* Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "Config/Config.h"
|
#include "Config/Config.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
#include "scripts/creature/mob_event_ai.h"
|
#include "scripts/creature/mob_event_ai.h"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Platform/CompilerDefs.h"
|
#include "Platform/CompilerDefs.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
class Creature;
|
class Creature;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "Database/DBCEnums.h"
|
#include "DBCEnums.h"
|
||||||
#include "GameEventMgr.h"
|
#include "GameEventMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Guild.h"
|
#include "Guild.h"
|
||||||
@@ -197,10 +197,8 @@ void AchievementMgr::SaveToDB()
|
|||||||
|
|
||||||
if(need_execute)
|
if(need_execute)
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction ();
|
|
||||||
CharacterDatabase.Execute( ssdel.str().c_str() );
|
CharacterDatabase.Execute( ssdel.str().c_str() );
|
||||||
CharacterDatabase.Execute( ssins.str().c_str() );
|
CharacterDatabase.Execute( ssins.str().c_str() );
|
||||||
CharacterDatabase.CommitTransaction ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,12 +256,10 @@ void AchievementMgr::SaveToDB()
|
|||||||
|
|
||||||
if(need_execute_del || need_execute_ins)
|
if(need_execute_del || need_execute_ins)
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction ();
|
|
||||||
if(need_execute_del)
|
if(need_execute_del)
|
||||||
CharacterDatabase.Execute( ssdel.str().c_str() );
|
CharacterDatabase.Execute( ssdel.str().c_str() );
|
||||||
if(need_execute_ins)
|
if(need_execute_ins)
|
||||||
CharacterDatabase.Execute( ssins.str().c_str() );
|
CharacterDatabase.Execute( ssins.str().c_str() );
|
||||||
CharacterDatabase.CommitTransaction ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Policies/Singleton.h"
|
#include "Policies/Singleton.h"
|
||||||
#include "Database/DBCEnums.h"
|
|
||||||
#include "Database/DBCStores.h"
|
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
|
#include "DBCEnums.h"
|
||||||
|
#include "DBCStores.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "Database/DBCStores.h"
|
|
||||||
#include "Database/SQLStorage.h"
|
#include "Database/SQLStorage.h"
|
||||||
|
#include "DBCStores.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
|
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
|
|||||||
@@ -19,12 +19,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
//#include "DataStore.h"
|
|
||||||
#include "Policies/SingletonImp.h"
|
#include "Policies/SingletonImp.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
|
|
||||||
#include "DBCfmt.cpp"
|
#include "DBCfmt.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@@ -162,7 +161,7 @@ template<class T>
|
|||||||
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
|
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
|
||||||
{
|
{
|
||||||
// compatibility format and C++ structure sizes
|
// compatibility format and C++ structure sizes
|
||||||
assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
||||||
|
|
||||||
std::string dbc_filename = dbc_path + filename;
|
std::string dbc_filename = dbc_path + filename;
|
||||||
if(storage.Load(dbc_filename.c_str()))
|
if(storage.Load(dbc_filename.c_str()))
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -18,12 +16,11 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DBCSTORES_H
|
#ifndef MANGOS_DBCSTORES_H
|
||||||
#define DBCSTORES_H
|
#define MANGOS_DBCSTORES_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
//#include "DataStore.h"
|
#include "Database/DBCStore.h"
|
||||||
#include "dbcfile.h"
|
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -61,77 +58,6 @@ uint32 GetTalentInspectBitPosInTab(uint32 talentId);
|
|||||||
uint32 GetTalentTabInspectBitSize(uint32 talentTabId);
|
uint32 GetTalentTabInspectBitSize(uint32 talentTabId);
|
||||||
uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls);
|
uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls);
|
||||||
|
|
||||||
template<class T>
|
|
||||||
class DBCStorage
|
|
||||||
{
|
|
||||||
typedef std::list<char*> StringPoolList;
|
|
||||||
public:
|
|
||||||
explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { }
|
|
||||||
~DBCStorage() { Clear(); }
|
|
||||||
|
|
||||||
T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; }
|
|
||||||
uint32 GetNumRows() const { return nCount; }
|
|
||||||
char const* GetFormat() const { return fmt; }
|
|
||||||
uint32 GetFieldCount() const { return fieldCount; }
|
|
||||||
|
|
||||||
bool Load(char const* fn)
|
|
||||||
{
|
|
||||||
DBCFile dbc;
|
|
||||||
// Check if load was sucessful, only then continue
|
|
||||||
if(!dbc.Load(fn, fmt))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
fieldCount = dbc.GetCols();
|
|
||||||
m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable);
|
|
||||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
|
||||||
|
|
||||||
// error in dbc file at loading if NULL
|
|
||||||
return indexTable!=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LoadStringsFrom(char const* fn)
|
|
||||||
{
|
|
||||||
// DBC must be already loaded using Load
|
|
||||||
if(!indexTable)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
DBCFile dbc;
|
|
||||||
// Check if load was successful, only then continue
|
|
||||||
if(!dbc.Load(fn, fmt))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
if (!indexTable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
delete[] ((char*)indexTable);
|
|
||||||
indexTable = NULL;
|
|
||||||
delete[] ((char*)m_dataTable);
|
|
||||||
m_dataTable = NULL;
|
|
||||||
|
|
||||||
while(!m_stringPoolList.empty())
|
|
||||||
{
|
|
||||||
delete[] m_stringPoolList.front();
|
|
||||||
m_stringPoolList.pop_front();
|
|
||||||
}
|
|
||||||
nCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint32 nCount;
|
|
||||||
uint32 fieldCount;
|
|
||||||
char const* fmt;
|
|
||||||
T** indexTable;
|
|
||||||
T* m_dataTable;
|
|
||||||
StringPoolList m_stringPoolList;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern DBCStorage <AchievementEntry> sAchievementStore;
|
extern DBCStorage <AchievementEntry> sAchievementStore;
|
||||||
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
|
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
|
||||||
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
|
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
|
||||||
@@ -220,11 +146,10 @@ extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
|
|||||||
void LoadDBCStores(const std::string& dataPath);
|
void LoadDBCStores(const std::string& dataPath);
|
||||||
|
|
||||||
// script support functions
|
// script support functions
|
||||||
TRINITY_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
|
TRINITY_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
|
||||||
TRINITY_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore();
|
TRINITY_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore();
|
||||||
TRINITY_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
|
TRINITY_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
|
||||||
TRINITY_DLL_SPEC DBCStorage <FactionEntry> const* GetFactionStore();
|
TRINITY_DLL_SPEC DBCStorage <FactionEntry> const* GetFactionStore();
|
||||||
TRINITY_DLL_SPEC DBCStorage <ItemEntry> const* GetItemDisplayStore();
|
TRINITY_DLL_SPEC DBCStorage <ItemEntry> const* GetItemDisplayStore();
|
||||||
TRINITY_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore();
|
TRINITY_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DBCSTRUCTURE_H
|
#ifndef MANGOS_DBCSTRUCTURE_H
|
||||||
#define DBCSTRUCTURE_H
|
#define MANGOS_DBCSTRUCTURE_H
|
||||||
|
|
||||||
#include "DBCEnums.h"
|
#include "DBCEnums.h"
|
||||||
#include "Platform/Define.h"
|
#include "Platform/Define.h"
|
||||||
@@ -18,6 +18,9 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef MANGOS_DBCSFRM_H
|
||||||
|
#define MANGOS_DBCSFRM_H
|
||||||
|
|
||||||
const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi";
|
const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi";
|
||||||
const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix";
|
const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix";
|
||||||
const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx";
|
const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx";
|
||||||
@@ -99,3 +102,5 @@ const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiii
|
|||||||
const char WorldMapAreaEntryfmt[]="xinxffffix";
|
const char WorldMapAreaEntryfmt[]="xinxffffix";
|
||||||
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
|
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
|
||||||
const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
|
const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "HostilRefManager.h"
|
#include "HostilRefManager.h"
|
||||||
#include "ThreatManager.h"
|
#include "ThreatManager.h"
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|
||||||
HostilRefManager::~HostilRefManager()
|
HostilRefManager::~HostilRefManager()
|
||||||
|
|||||||
+1
-1
@@ -29,8 +29,8 @@
|
|||||||
#include "UpdateMask.h"
|
#include "UpdateMask.h"
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "Database/DBCStores.h"
|
|
||||||
#include "AuctionHouseBot.h"
|
#include "AuctionHouseBot.h"
|
||||||
|
#include "DBCStores.h"
|
||||||
|
|
||||||
void MailItem::deleteItem( bool inDB )
|
void MailItem::deleteItem( bool inDB )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -380,6 +380,11 @@ libmangosgame_a_SOURCES = \
|
|||||||
CreatureAISelector.h \
|
CreatureAISelector.h \
|
||||||
Creature.cpp \
|
Creature.cpp \
|
||||||
Creature.h \
|
Creature.h \
|
||||||
|
DBCEnums.h \
|
||||||
|
DBCfmt.h \
|
||||||
|
DBCStores.cpp \
|
||||||
|
DBCStores.h \
|
||||||
|
DBCStructure.h \
|
||||||
debugcmds.cpp \
|
debugcmds.cpp \
|
||||||
DestinationHolder.cpp \
|
DestinationHolder.cpp \
|
||||||
DestinationHolder.h \
|
DestinationHolder.h \
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
#include "zthread/Lockable.h"
|
#include "zthread/Lockable.h"
|
||||||
#include "zthread/Mutex.h"
|
#include "zthread/Mutex.h"
|
||||||
#include "zthread/FairReadWriteLock.h"
|
#include "zthread/FairReadWriteLock.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "GridDefines.h"
|
#include "GridDefines.h"
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "OutdoorPvP.h"
|
#include "OutdoorPvP.h"
|
||||||
|
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
|
|
||||||
const uint32 EP_AllianceBuffs[4] = {11413, 11414, 11415, 1386};
|
const uint32 EP_AllianceBuffs[4] = {11413, 11414, 11415, 1386};
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -210,8 +210,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
owner->SetPet(this, true);
|
owner->SetPet(this, true);
|
||||||
AIM_Initialize();
|
|
||||||
map->Add((Creature*)this);
|
|
||||||
|
|
||||||
InitStatsForLevel(petlevel);
|
InitStatsForLevel(petlevel);
|
||||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
|
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
|
||||||
@@ -314,6 +312,9 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||||||
|
|
||||||
sLog.outDebug("New Pet has guid %u", GetGUIDLow());
|
sLog.outDebug("New Pet has guid %u", GetGUIDLow());
|
||||||
|
|
||||||
|
AIM_Initialize();
|
||||||
|
map->Add((Creature*)this);
|
||||||
|
|
||||||
if(owner->GetTypeId() == TYPEID_PLAYER)
|
if(owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
((Player*)owner)->PetSpellInitialize();
|
((Player*)owner)->PetSpellInitialize();
|
||||||
@@ -1362,8 +1363,8 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||||||
WorldPacket data(SMSG_PET_LEARNED_SPELL, 2);
|
WorldPacket data(SMSG_PET_LEARNED_SPELL, 2);
|
||||||
data << uint16(spell_id);
|
data << uint16(spell_id);
|
||||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||||
|
((Player*)owner)->PetSpellInitialize();
|
||||||
}
|
}
|
||||||
((Player*)owner)->PetSpellInitialize();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1603,7 +1604,8 @@ bool Pet::resetTalents(bool no_cost)
|
|||||||
m_resetTalentsCost = cost;
|
m_resetTalentsCost = cost;
|
||||||
m_resetTalentsTime = time(NULL);
|
m_resetTalentsTime = time(NULL);
|
||||||
}
|
}
|
||||||
player->PetSpellInitialize();
|
if(!m_loading)
|
||||||
|
player->PetSpellInitialize();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "Spell.h"
|
#include "Spell.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ReputationMgr.h"
|
#include "ReputationMgr.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
@@ -444,7 +444,6 @@ void ReputationMgr::LoadFromDB(QueryResult *result)
|
|||||||
|
|
||||||
void ReputationMgr::SaveToDB()
|
void ReputationMgr::SaveToDB()
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
|
||||||
for(FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
for(FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.Changed)
|
if (itr->second.Changed)
|
||||||
@@ -454,7 +453,6 @@ void ReputationMgr::SaveToDB()
|
|||||||
itr->second.Changed = false;
|
itr->second.Changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CharacterDatabase.CommitTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
|
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
enum FactionFlags
|
enum FactionFlags
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "SpellAuraDefines.h"
|
#include "SpellAuraDefines.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Spell.h"
|
#include "Spell.h"
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
// For more high level function for sSpellStore data
|
// For more high level function for sSpellStore data
|
||||||
|
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "Database/SQLStorage.h"
|
#include "Database/SQLStorage.h"
|
||||||
|
|
||||||
#include "Utilities/UnorderedMap.h"
|
#include "Utilities/UnorderedMap.h"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "TotemAI.h"
|
#include "TotemAI.h"
|
||||||
#include "Totem.h"
|
#include "Totem.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "Path.h"
|
#include "Path.h"
|
||||||
|
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
|
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|||||||
+1
-1
@@ -8273,7 +8273,7 @@ Pet* Unit::GetPet() const
|
|||||||
return pet;
|
return pet;
|
||||||
|
|
||||||
sLog.outError("Unit::GetPet: Pet %u not exist.",GUID_LOPART(pet_guid));
|
sLog.outError("Unit::GetPet: Pet %u not exist.",GUID_LOPART(pet_guid));
|
||||||
const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_SUMMON, 0);
|
//const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_SUMMON, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@
|
|||||||
#include "FollowerRefManager.h"
|
#include "FollowerRefManager.h"
|
||||||
#include "Utilities/EventProcessor.h"
|
#include "Utilities/EventProcessor.h"
|
||||||
#include "MotionMaster.h"
|
#include "MotionMaster.h"
|
||||||
#include "Database/DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#define WORLD_TRIGGER 12999
|
#define WORLD_TRIGGER 12999
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Database/DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "LootMgr.h"
|
#include "LootMgr.h"
|
||||||
#include "ItemEnchantmentMgr.h"
|
#include "ItemEnchantmentMgr.h"
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -18,8 +16,8 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DBCFILE_H
|
#ifndef DBC_FILE_LOADER_H
|
||||||
#define DBCFILE_H
|
#define DBC_FILE_LOADER_H
|
||||||
#include "Platform/Define.h"
|
#include "Platform/Define.h"
|
||||||
#include "Utilities/ByteConverter.h"
|
#include "Utilities/ByteConverter.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -37,11 +35,11 @@ enum
|
|||||||
FT_LOGIC='l' //Logical (boolean)
|
FT_LOGIC='l' //Logical (boolean)
|
||||||
};
|
};
|
||||||
|
|
||||||
class DBCFile
|
class DBCFileLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DBCFile();
|
DBCFileLoader();
|
||||||
~DBCFile();
|
~DBCFileLoader();
|
||||||
|
|
||||||
bool Load(const char *filename, const char *fmt);
|
bool Load(const char *filename, const char *fmt);
|
||||||
|
|
||||||
@@ -77,11 +75,11 @@ class DBCFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Record(DBCFile &file_, unsigned char *offset_): offset(offset_), file(file_) {}
|
Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) {}
|
||||||
unsigned char *offset;
|
unsigned char *offset;
|
||||||
DBCFile &file;
|
DBCFileLoader &file;
|
||||||
|
|
||||||
friend class DBCFile;
|
friend class DBCFileLoader;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,4 +105,3 @@ class DBCFile
|
|||||||
unsigned char *stringTable;
|
unsigned char *stringTable;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DBCSTORE_H
|
||||||
|
#define DBCSTORE_H
|
||||||
|
|
||||||
|
#include "DBCFileLoader.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class DBCStorage
|
||||||
|
{
|
||||||
|
typedef std::list<char*> StringPoolList;
|
||||||
|
public:
|
||||||
|
explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { }
|
||||||
|
~DBCStorage() { Clear(); }
|
||||||
|
|
||||||
|
T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; }
|
||||||
|
uint32 GetNumRows() const { return nCount; }
|
||||||
|
char const* GetFormat() const { return fmt; }
|
||||||
|
uint32 GetFieldCount() const { return fieldCount; }
|
||||||
|
|
||||||
|
bool Load(char const* fn)
|
||||||
|
{
|
||||||
|
DBCFileLoader dbc;
|
||||||
|
// Check if load was sucessful, only then continue
|
||||||
|
if(!dbc.Load(fn, fmt))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fieldCount = dbc.GetCols();
|
||||||
|
m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable);
|
||||||
|
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||||
|
|
||||||
|
// error in dbc file at loading if NULL
|
||||||
|
return indexTable!=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoadStringsFrom(char const* fn)
|
||||||
|
{
|
||||||
|
// DBC must be already loaded using Load
|
||||||
|
if(!indexTable)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
DBCFileLoader dbc;
|
||||||
|
// Check if load was successful, only then continue
|
||||||
|
if(!dbc.Load(fn, fmt))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
if (!indexTable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete[] ((char*)indexTable);
|
||||||
|
indexTable = NULL;
|
||||||
|
delete[] ((char*)m_dataTable);
|
||||||
|
m_dataTable = NULL;
|
||||||
|
|
||||||
|
while(!m_stringPoolList.empty())
|
||||||
|
{
|
||||||
|
delete[] m_stringPoolList.front();
|
||||||
|
m_stringPoolList.pop_front();
|
||||||
|
}
|
||||||
|
nCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 nCount;
|
||||||
|
uint32 fieldCount;
|
||||||
|
char const* fmt;
|
||||||
|
T** indexTable;
|
||||||
|
T* m_dataTable;
|
||||||
|
StringPoolList m_stringPoolList;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
|
|
||||||
#include "Database/DBCStores.h"
|
|
||||||
#include "Database/Field.h"
|
#include "Database/Field.h"
|
||||||
#include "Database/QueryResult.h"
|
#include "Database/QueryResult.h"
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ AM_CPPFLAGS = $(TRINI_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir) -I$(src
|
|||||||
noinst_LIBRARIES = libmangosdatabase.a
|
noinst_LIBRARIES = libmangosdatabase.a
|
||||||
|
|
||||||
libmangosdatabase_a_SOURCES = \
|
libmangosdatabase_a_SOURCES = \
|
||||||
DBCStores.cpp \
|
DBCFileLoader.cpp \
|
||||||
DBCStores.h \
|
DBCFileLoader.h \
|
||||||
DBCStructure.h \
|
DBCStore.h \
|
||||||
DBCfmt.cpp \
|
|
||||||
Database.cpp \
|
Database.cpp \
|
||||||
Database.h \
|
Database.h \
|
||||||
DatabaseEnv.h \
|
DatabaseEnv.h \
|
||||||
@@ -61,6 +60,4 @@ libmangosdatabase_a_SOURCES = \
|
|||||||
SqlDelayThread.cpp \
|
SqlDelayThread.cpp \
|
||||||
SqlDelayThread.h \
|
SqlDelayThread.h \
|
||||||
SqlOperations.cpp \
|
SqlOperations.cpp \
|
||||||
SqlOperations.h \
|
SqlOperations.h
|
||||||
dbcfile.cpp \
|
|
||||||
dbcfile.h
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "dbcfile.h"
|
#include "DBCFileLoader.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<class S, class D>
|
template<class S, class D>
|
||||||
|
|||||||
@@ -1,261 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "dbcfile.h"
|
|
||||||
|
|
||||||
DBCFile::DBCFile()
|
|
||||||
{
|
|
||||||
data = NULL;
|
|
||||||
fieldsOffset = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DBCFile::Load(const char *filename, const char *fmt)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32 header;
|
|
||||||
if(data)
|
|
||||||
{
|
|
||||||
delete [] data;
|
|
||||||
data=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE * f=fopen(filename,"rb");
|
|
||||||
if(!f)return false;
|
|
||||||
|
|
||||||
if(fread(&header,4,1,f)!=1) // Number of records
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EndianConvert(header);
|
|
||||||
if(header!=0x43424457)
|
|
||||||
return false; //'WDBC'
|
|
||||||
|
|
||||||
if(fread(&recordCount,4,1,f)!=1) // Number of records
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EndianConvert(recordCount);
|
|
||||||
|
|
||||||
if(fread(&fieldCount,4,1,f)!=1) // Number of fields
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EndianConvert(fieldCount);
|
|
||||||
|
|
||||||
if(fread(&recordSize,4,1,f)!=1) // Size of a record
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EndianConvert(recordSize);
|
|
||||||
|
|
||||||
if(fread(&stringSize,4,1,f)!=1) // String size
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EndianConvert(stringSize);
|
|
||||||
|
|
||||||
fieldsOffset = new uint32[fieldCount];
|
|
||||||
fieldsOffset[0] = 0;
|
|
||||||
for(uint32 i = 1; i < fieldCount; i++)
|
|
||||||
{
|
|
||||||
fieldsOffset[i] = fieldsOffset[i - 1];
|
|
||||||
if (fmt[i - 1] == 'b' || fmt[i - 1] == 'X') // byte fields
|
|
||||||
fieldsOffset[i] += 1;
|
|
||||||
else // 4 byte fields (int32/float/strings)
|
|
||||||
fieldsOffset[i] += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = new unsigned char[recordSize*recordCount+stringSize];
|
|
||||||
stringTable = data + recordSize*recordCount;
|
|
||||||
|
|
||||||
if(fread(data,recordSize*recordCount+stringSize,1,f)!=1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBCFile::~DBCFile()
|
|
||||||
{
|
|
||||||
if(data)
|
|
||||||
delete [] data;
|
|
||||||
if(fieldsOffset)
|
|
||||||
delete [] fieldsOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBCFile::Record DBCFile::getRecord(size_t id)
|
|
||||||
{
|
|
||||||
assert(data);
|
|
||||||
return Record(*this, data + id*recordSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 DBCFile::GetFormatRecordSize(const char * format,int32* index_pos)
|
|
||||||
{
|
|
||||||
uint32 recordsize = 0;
|
|
||||||
int32 i = -1;
|
|
||||||
for(uint32 x=0; format[x];++x)
|
|
||||||
switch(format[x])
|
|
||||||
{
|
|
||||||
case FT_FLOAT:
|
|
||||||
case FT_INT:
|
|
||||||
recordsize+=4;
|
|
||||||
break;
|
|
||||||
case FT_STRING:
|
|
||||||
recordsize+=sizeof(char*);
|
|
||||||
break;
|
|
||||||
case FT_SORT:
|
|
||||||
i=x;
|
|
||||||
break;
|
|
||||||
case FT_IND:
|
|
||||||
i=x;
|
|
||||||
recordsize+=4;
|
|
||||||
break;
|
|
||||||
case FT_BYTE:
|
|
||||||
recordsize += 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(index_pos)
|
|
||||||
*index_pos = i;
|
|
||||||
|
|
||||||
return recordsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* DBCFile::AutoProduceData(const char* format, uint32& records, char**& indexTable)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
format STRING, NA, FLOAT,NA,INT <=>
|
|
||||||
struct{
|
|
||||||
char* field0,
|
|
||||||
float field1,
|
|
||||||
int field2
|
|
||||||
}entry;
|
|
||||||
|
|
||||||
this func will generate entry[rows] data;
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef char * ptr;
|
|
||||||
if(strlen(format)!=fieldCount)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
//get struct size and index pos
|
|
||||||
int32 i;
|
|
||||||
uint32 recordsize=GetFormatRecordSize(format,&i);
|
|
||||||
|
|
||||||
if(i>=0)
|
|
||||||
{
|
|
||||||
uint32 maxi=0;
|
|
||||||
//find max index
|
|
||||||
for(uint32 y=0;y<recordCount;y++)
|
|
||||||
{
|
|
||||||
uint32 ind=getRecord(y).getUInt (i);
|
|
||||||
if(ind>maxi)maxi=ind;
|
|
||||||
}
|
|
||||||
|
|
||||||
++maxi;
|
|
||||||
records=maxi;
|
|
||||||
indexTable=new ptr[maxi];
|
|
||||||
memset(indexTable,0,maxi*sizeof(ptr));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
records = recordCount;
|
|
||||||
indexTable = new ptr[recordCount];
|
|
||||||
}
|
|
||||||
|
|
||||||
char* dataTable= new char[recordCount*recordsize];
|
|
||||||
|
|
||||||
uint32 offset=0;
|
|
||||||
|
|
||||||
for(uint32 y =0;y<recordCount;y++)
|
|
||||||
{
|
|
||||||
if(i>=0)
|
|
||||||
{
|
|
||||||
indexTable[getRecord(y).getUInt(i)]=&dataTable[offset];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
indexTable[y]=&dataTable[offset];
|
|
||||||
|
|
||||||
for(uint32 x=0;x<fieldCount;x++)
|
|
||||||
{
|
|
||||||
switch(format[x])
|
|
||||||
{
|
|
||||||
case FT_FLOAT:
|
|
||||||
*((float*)(&dataTable[offset]))=getRecord(y).getFloat(x);
|
|
||||||
offset+=4;
|
|
||||||
break;
|
|
||||||
case FT_IND:
|
|
||||||
case FT_INT:
|
|
||||||
*((uint32*)(&dataTable[offset]))=getRecord(y).getUInt(x);
|
|
||||||
offset+=4;
|
|
||||||
break;
|
|
||||||
case FT_BYTE:
|
|
||||||
*((uint8*)(&dataTable[offset]))=getRecord(y).getUInt8(x);
|
|
||||||
offset+=1;
|
|
||||||
break;
|
|
||||||
case FT_STRING:
|
|
||||||
*((char**)(&dataTable[offset]))=NULL; // will be replaces non-empty or "" strings in AutoProduceStrings
|
|
||||||
offset+=sizeof(char*);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dataTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* DBCFile::AutoProduceStrings(const char* format, char* dataTable)
|
|
||||||
{
|
|
||||||
if(strlen(format)!=fieldCount)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
char* stringPool= new char[stringSize];
|
|
||||||
memcpy(stringPool,stringTable,stringSize);
|
|
||||||
|
|
||||||
uint32 offset=0;
|
|
||||||
|
|
||||||
for(uint32 y =0;y<recordCount;y++)
|
|
||||||
{
|
|
||||||
for(uint32 x=0;x<fieldCount;x++)
|
|
||||||
switch(format[x])
|
|
||||||
{
|
|
||||||
case FT_FLOAT:
|
|
||||||
case FT_IND:
|
|
||||||
case FT_INT:
|
|
||||||
offset+=4;
|
|
||||||
break;
|
|
||||||
case FT_BYTE:
|
|
||||||
offset+=1;
|
|
||||||
break;
|
|
||||||
case FT_STRING:
|
|
||||||
// fill only not filled entries
|
|
||||||
char** slot = (char**)(&dataTable[offset]);
|
|
||||||
if(!*slot || !**slot)
|
|
||||||
{
|
|
||||||
const char * st = getRecord(y).getString(x);
|
|
||||||
*slot=stringPool+(st-(const char*)stringTable);
|
|
||||||
}
|
|
||||||
offset+=sizeof(char*);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringPool;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -897,6 +897,21 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Server">
|
Name="Server">
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCEnums.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCfmt.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStructure.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\game\GlobalEvents.cpp">
|
RelativePath="..\..\src\game\GlobalEvents.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
+3
-24
@@ -195,34 +195,13 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="DataStores">
|
Name="DataStores">
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp">
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.h">
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp">
|
RelativePath="..\..\src\shared\Database\DBCStore.h">
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStructure.h">
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|||||||
@@ -1331,6 +1331,26 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Server"
|
Name="Server"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCEnums.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCfmt.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStructure.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
||||||
>
|
>
|
||||||
|
|||||||
+3
-47
@@ -440,59 +440,15 @@
|
|||||||
Name="DataStores"
|
Name="DataStores"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp"
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.h"
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp"
|
RelativePath="..\..\src\shared\Database\DBCStore.h"
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStructure.h"
|
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|||||||
@@ -1330,6 +1330,26 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Server"
|
Name="Server"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCEnums.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCfmt.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStores.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\game\DBCStructure.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
||||||
>
|
>
|
||||||
|
|||||||
+3
-47
@@ -447,59 +447,15 @@
|
|||||||
Name="DataStores"
|
Name="DataStores"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp"
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\dbcfile.h"
|
RelativePath="..\..\src\shared\Database\DBCFileLoader.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp"
|
RelativePath="..\..\src\shared\Database\DBCStore.h"
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStores.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\shared\Database\DBCStructure.h"
|
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|||||||
Reference in New Issue
Block a user