diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 0c43545cd..6cc0ab14a 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1553,7 +1553,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI } // used to create the BG templates -uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) +uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) { // Create the BG BattleGround *bg = NULL; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 737862507..2c058d649 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -206,7 +206,7 @@ class BattleGroundMgr BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated); - uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); + uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; }; void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); } diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index 257a6e6d1..dc8f64486 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -407,5 +407,6 @@ enum SpellEffectIndex }; #define MAX_EFFECT_INDEX 3 +#define MAX_REAGENTS 8 #endif diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 23f2cce7d..8f0fd71fa 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -199,18 +199,23 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale return false; } -static uint32 ReadDBCBuild(const std::string& dbc_path, char const* localeName = NULL) +static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const* localeNameStr = NULL) { std::string text; - if (!localeName) + if (!localeNameStr) { - for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr) + for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr) + { if (ReadDBCBuildFileText(dbc_path,itr->name,text)) + { + localeNameStr = itr; break; + } + } } else - ReadDBCBuildFileText(dbc_path,localeName,text); + ReadDBCBuildFileText(dbc_path,localeNameStr->name,text); if (text.empty()) return 0; @@ -240,7 +245,9 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& f struct LocalData { - explicit LocalData(uint32 build) : main_build(build), availableDbcLocales(0xFFFFFFFF),checkedDbcLocaleBuilds(0) {} + LocalData(uint32 build) + : main_build(build), availableDbcLocales(0xFFFFFFFF),checkedDbcLocaleBuilds(0) {} + uint32 main_build; // bitmasks for index of fullLocaleNameList @@ -263,13 +270,16 @@ inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errl if (!(localeData.availableDbcLocales & (1 << i))) continue; - std::string dbc_dir_loc = dbc_path + fullLocaleNameList[i].name + "/"; + LocaleNameStr const* localStr = &fullLocaleNameList[i]; + + std::string dbc_dir_loc = dbc_path + localStr->name + "/"; if (!(localeData.checkedDbcLocaleBuilds & (1 << i))) { localeData.checkedDbcLocaleBuilds |= (1<name + "/" + filename; char buf[200]; - snprintf(buf,200," (exist, but DBC locale subdir %s have DBCs for build %u instead expected build %u, it and other DBC from subdir skipped)",fullLocaleNameList[i].name,build_loc,localeData.main_build); + snprintf(buf,200," (exist, but DBC locale subdir %s have DBCs for build %u instead expected build %u, it and other DBC from subdir skipped)",localStr->name,build_loc,localeData.main_build); errlist.push_back(dbc_filename_loc + buf); } @@ -287,7 +297,7 @@ inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errl } } - std::string dbc_filename_loc = dbc_path + fullLocaleNameList[i].name + "/" + filename; + std::string dbc_filename_loc = dbc_path + localStr->name + "/" + filename; if(!storage.LoadStringsFrom(dbc_filename_loc.c_str())) localeData.availableDbcLocales &= ~(1<second; } -char* GetPetName(uint32 petfamily, uint32 dbclang) +char const* GetPetName(uint32 petfamily, uint32 dbclang) { if(!petfamily) return NULL; diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 30cd74db7..505123617 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -31,7 +31,7 @@ std::string AcceptableClientBuildsListStr(); typedef std::list SimpleFactionsList; SimpleFactionsList const* GetFactionTeamList(uint32 faction); -char* GetPetName(uint32 petfamily, uint32 dbclang); +char const* GetPetName(uint32 petfamily, uint32 dbclang); uint32 GetTalentSpellCost(uint32 spellId); uint32 GetTalentSpellCost(TalentSpellPos const* pos); TalentSpellPos const* GetTalentSpellPos(uint32 spellId); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index d4cb2cd0f..4f098eebd 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1411,8 +1411,8 @@ struct SpellEntry //uint32 modalNextSpell; // 48 m_modalNextSpell not used uint32 StackAmount; // 49 m_cumulativeAura uint32 Totem[2]; // 50-51 m_totem - int32 Reagent[8]; // 52-59 m_reagent - uint32 ReagentCount[8]; // 60-67 m_reagentCount + int32 Reagent[MAX_REAGENTS]; // 52-59 m_reagent + uint32 ReagentCount[MAX_REAGENTS]; // 60-67 m_reagentCount int32 EquippedItemClass; // 68 m_equippedItemClass (value) int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask) int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 7b3896124..81f0ced40 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6196,7 +6196,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) if(list0.empty() || list1.empty()) { CreatureInfo const *cinfo = GetCreatureTemplate(entry); - char* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale()); + char const* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale()); if(!petname) petname = cinfo->Name; return std::string(petname); diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 09cfffdae..2a0d6417a 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1320,7 +1320,7 @@ enum Opcodes UMSG_UNKNOWN_1283 = 0x503, // not found UMSG_UNKNOWN_1284 = 0x504, // not found UMSG_UNKNOWN_1285 = 0x505, // not found - SMSG_UNKNOWN_1286 = 0x506, // ERR_CORPSE_IS_NOT_IN_INSTANCE = 0x1A8, + SMSG_CORPSE_IS_NOT_IN_INSTANCE = 0x506, // ERR_CORPSE_IS_NOT_IN_INSTANCE = 0x1A8, UMSG_UNKNOWN_1287 = 0x507, // not found CMSG_SET_ALLOW_LOW_LEVEL_RAID1 = 0x508, // lua: SetAllowLowLevelRaid CMSG_SET_ALLOW_LOW_LEVEL_RAID2 = 0x509, // lua: SetAllowLowLevelRaid diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ad13aae23..3358f9360 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2622,7 +2622,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(index, 0); SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS,0); - for (int i = 0; i < 7; ++i) + for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) { SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0); SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, 0); @@ -2654,7 +2654,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE,0.0f); // Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset - for (uint8 i = 0; i < 7; ++i) + for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i) SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1+i, 0.0f); SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f); @@ -2691,7 +2691,7 @@ void Player::InitStatsForLevel(bool reapplyMods) // save new stats for (int i = POWER_MANA; i < MAX_POWERS; ++i) - SetMaxPower(Powers(i), uint32(GetCreatePowers(Powers(i)))); + SetMaxPower(Powers(i), GetCreatePowers(Powers(i))); SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later @@ -14922,7 +14922,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32()); SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8()); - InitDisplayIds(); // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory) @@ -15216,7 +15215,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 ); - // cleanup aura list explicitly before skill load wher some spells can be applied + // cleanup aura list explicitly before skill load where some spells can be applied RemoveAllAuras(); // make sure the unit is considered out of combat for proper loading @@ -17436,7 +17435,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if(spellInfo) { - for(uint32 i = 0; i < 7; ++i) + for(uint32 i = 0; i < MAX_REAGENTS; ++i) { if(spellInfo->Reagent[i] > 0) { diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c9c334372..82ee63a3e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3958,7 +3958,7 @@ void Spell::TakeReagents() if (p_caster->CanNoReagentCast(m_spellInfo) ) return; - for(uint32 x = 0; x < 8; ++x) + for(uint32 x = 0; x < MAX_REAGENTS; ++x) { if(m_spellInfo->Reagent[x] <= 0) continue; @@ -5643,7 +5643,7 @@ SpellCastResult Spell::CheckItems() { if (!p_caster->CanNoReagentCast(m_spellInfo)) { - for(uint32 i = 0; i < 8; ++i) + for(uint32 i = 0; i < MAX_REAGENTS; ++i) { if(m_spellInfo->Reagent[i] <= 0) continue; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index b3deeb43c..a0d727b3c 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2709,7 +2709,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) if(need_check_reagents) { - for(int j = 0; j < 8; ++j) + for(int j = 0; j < MAX_REAGENTS; ++j) { if(spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype( spellInfo->Reagent[j] )) { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 937885db7..3b3689239 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12160,14 +12160,14 @@ uint32 Unit::GetCreatePowers( Powers power ) const // POWER_FOCUS and POWER_HAPPINESS only have hunter pet switch(power) { - case POWER_MANA: return GetCreateMana(); - case POWER_RAGE: return 1000; - case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100); - case POWER_ENERGY: return 100; - case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000); + case POWER_HEALTH: return 0; + case POWER_MANA: return GetCreateMana(); + case POWER_RAGE: return 1000; + case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100); + case POWER_ENERGY: return 100; + case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000); case POWER_RUNIC_POWER: return 1000; - case POWER_RUNE: return 0; - case POWER_HEALTH: return 0; + case POWER_RUNE: return 0; } return 0; diff --git a/src/game/Unit.h b/src/game/Unit.h index 31dbbfe7e..bd0593b63 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -576,11 +576,12 @@ enum UnitFlags // Value masks for UNIT_FIELD_FLAGS_2 enum UnitFlags2 { - UNIT_FLAG2_FEIGN_DEATH = 0x00000001, - UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip) - UNIT_FLAG2_COMPREHEND_LANG = 0x00000008, - UNIT_FLAG2_FORCE_MOVE = 0x00000040, - UNIT_FLAG2_REGENERATE_POWER = 0x00000800 + UNIT_FLAG2_FEIGN_DEATH = 0x00000001, + UNIT_FLAG2_UNK1 = 0x00000002, // Hides unit model (show only player equip) + UNIT_FLAG2_COMPREHEND_LANG = 0x00000008, + UNIT_FLAG2_FORCE_MOVE = 0x00000040, + UNIT_FLAG2_DISARM = 0x00000400, // disarm or something + UNIT_FLAG2_REGENERATE_POWER = 0x00000800, }; /// Non Player Character flags diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index 92270676f..0563cdea3 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -31,7 +31,7 @@ char const* localeNames[MAX_LOCALE] = { }; // used for search by name or iterate all names -LocaleNameStr fullLocaleNameList[] = +LocaleNameStr const fullLocaleNameList[] = { { "enUS", LOCALE_enUS }, { "enGB", LOCALE_enUS }, @@ -48,7 +48,7 @@ LocaleNameStr fullLocaleNameList[] = LocaleConstant GetLocaleByName(const std::string& name) { - for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr) + for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr) if (name==itr->name) return itr->locale; diff --git a/src/shared/Common.h b/src/shared/Common.h index d7d21430e..eb1044747 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -220,7 +220,7 @@ struct LocaleNameStr }; // used for iterate all names including alternative -extern LocaleNameStr fullLocaleNameList[]; +extern LocaleNameStr const fullLocaleNameList[]; //operator new[] based version of strdup() function! Release memory by using operator delete[] ! inline char * mangos_strdup(const char * source) diff --git a/src/shared/Database/DBCFileLoader.cpp b/src/shared/Database/DBCFileLoader.cpp index 613a87e25..c5ac9dc7e 100644 --- a/src/shared/Database/DBCFileLoader.cpp +++ b/src/shared/Database/DBCFileLoader.cpp @@ -242,6 +242,7 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable) offset+=1; break; case FT_STRING: + { // fill only not filled entries char** slot = (char**)(&dataTable[offset]); if(!*slot || !**slot) @@ -251,6 +252,13 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable) } offset+=sizeof(char*); break; + } + case FT_NA: + case FT_NA_BYTE: + case FT_SORT: + break; + default: + assert(false && "unknown format character"); } } diff --git a/src/shared/Database/DBCStore.h b/src/shared/Database/DBCStore.h index a5f99a13c..17a64aa95 100644 --- a/src/shared/Database/DBCStore.h +++ b/src/shared/Database/DBCStore.h @@ -42,7 +42,11 @@ class DBCStorage return false; fieldCount = dbc.GetCols(); + + // load raw non-string data m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable); + + // load strings from dbc data m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable)); // error in dbc file at loading if NULL @@ -60,6 +64,7 @@ class DBCStorage if(!dbc.Load(fn, fmt)) return false; + // load strings from another locale dbc data m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable)); return true; @@ -93,4 +98,5 @@ class DBCStorage T* m_dataTable; StringPoolList m_stringPoolList; }; + #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 67d06f03d..fe2c28bcb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9860" + #define REVISION_NR "9861" #endif // __REVISION_NR_H__