aboutsummaryrefslogtreecommitdiff
path: root/src/game/DBCStores.cpp
diff options
context:
space:
mode:
authorSpp <none@none>2010-04-07 19:14:10 +0200
committerSpp <none@none>2010-04-07 19:14:10 +0200
commitd19e12708001fbef2308be0e8cb5375a2ac7af48 (patch)
tree09fc8f67a6197802e0512950f0b0a3438a9834e8 /src/game/DBCStores.cpp
parent2e127f7a30706dc1d40c65de22ff02851732da24 (diff)
Code style (game + scripts only):
"if(" --> "if (" --HG-- branch : trunk
Diffstat (limited to 'src/game/DBCStores.cpp')
-rw-r--r--src/game/DBCStores.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp
index a574efc3e1b..f6a7671b1b0 100644
--- a/src/game/DBCStores.cpp
+++ b/src/game/DBCStores.cpp
@@ -183,16 +183,16 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
if (custom_entries)
sql = new SqlDbc(&filename,custom_entries, idname,storage.GetFormat());
- if(storage.Load(dbc_filename.c_str(), sql))
+ if (storage.Load(dbc_filename.c_str(), sql))
{
bar.step();
for (uint8 i = 0; i < MAX_LOCALE; ++i)
{
- if(!(availableDbcLocales & (1 << i)))
+ if (!(availableDbcLocales & (1 << i)))
continue;
std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename;
- if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
+ if (!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
}
@@ -200,7 +200,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
{
// sort problematic dbc to (1) non compatible and (2) non-existed
FILE * f=fopen(dbc_filename.c_str(),"rb");
- if(f)
+ if (f)
{
char buf[100];
snprintf(buf,100," (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
@@ -230,13 +230,13 @@ void LoadDBCStores(const std::string& dataPath)
// must be after sAreaStore loading
for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0
{
- if(AreaTableEntry const* area = sAreaStore.LookupEntry(i))
+ if (AreaTableEntry const* area = sAreaStore.LookupEntry(i))
{
// fill AreaId->DBC records
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag));
// fill MapId->DBC records ( skip sub zones and continents )
- if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
+ if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag));
}
}
@@ -280,13 +280,13 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore, dbcPath,"GameObjectDisplayInfo.dbc");
for (uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i)
{
- if(GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
+ if (GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
{
- if(info->maxX < info->minX)
+ if (info->maxX < info->minX)
std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
- if(info->maxY < info->minY)
+ if (info->maxY < info->minY)
std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
- if(info->maxZ < info->minZ)
+ if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
}
@@ -325,7 +325,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc");
// fill data
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
- if(MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
+ if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers);
sMapDifficultyStore.Clear();
@@ -349,7 +349,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spell = sSpellStore.LookupEntry(i);
- if(spell && spell->Category)
+ if (spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
}
@@ -357,25 +357,25 @@ void LoadDBCStores(const std::string& dataPath)
{
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
- if(!skillLine)
+ if (!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
- if(spellInfo && IsPassiveSpell(spellInfo->Id))
+ if (spellInfo && IsPassiveSpell(spellInfo->Id))
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
- if(!cFamily)
+ if (!cFamily)
continue;
- if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
+ if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
- if(spellInfo->spellLevel)
+ if (spellInfo->spellLevel)
continue;
- if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
+ if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
@@ -402,7 +402,7 @@ void LoadDBCStores(const std::string& dataPath)
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
- if(talentInfo->RankID[j])
+ if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
@@ -414,7 +414,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
- if(!talentTabInfo)
+ if (!talentTabInfo)
continue;
// prevent memory corruption; otherwise cls will become 12 below
@@ -433,7 +433,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc");
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
- if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
+ if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
@@ -443,7 +443,7 @@ void LoadDBCStores(const std::string& dataPath)
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
- if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
+ if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
@@ -454,7 +454,7 @@ void LoadDBCStores(const std::string& dataPath)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
- if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
+ if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
@@ -463,9 +463,9 @@ void LoadDBCStores(const std::string& dataPath)
{
std::set<uint32> spellPaths;
for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
- if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
+ if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for (int j=0; j < 3; ++j)
- if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
+ if (sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask));
@@ -473,24 +473,24 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
- if(!node)
+ if (!node)
continue;
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
- if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
+ if (src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
{
bool ok = false;
for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
{
// not spell path
- if(spellPaths.find(dest_i->second.ID)==spellPaths.end())
+ if (spellPaths.find(dest_i->second.ID)==spellPaths.end())
{
ok = true;
break;
}
}
- if(!ok)
+ if (!ok)
continue;
}
@@ -518,12 +518,12 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
// error checks
- if(bad_dbc_files.size() >= DBCFilesCount )
+ if (bad_dbc_files.size() >= DBCFilesCount )
{
sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
exit(1);
}
- else if(!bad_dbc_files.empty() )
+ else if (!bad_dbc_files.empty() )
{
std::string str;
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
@@ -534,7 +534,7 @@ void LoadDBCStores(const std::string& dataPath)
}
// Check loaded DBC files proper version
- if( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
+ if ( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
!sMapStore.LookupEntry(718) || // last map added in 3.3.2
!sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.2
!sItemExtendedCostStore.LookupEntry(2982) || // last item extended cost added in 3.3.2
@@ -553,14 +553,14 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
{
for (FactionTeamMap::const_iterator itr = sFactionTeamMap.begin(); itr != sFactionTeamMap.end(); ++itr)
{
- if(itr->first == faction)
+ if (itr->first == faction)
{
isTeamMember = false;
return &itr->second;
}
for (SimpleFactionsList::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
{
- if((*itr2) == faction)
+ if ((*itr2) == faction)
{
isTeamMember = true;
return &itr->second;
@@ -572,10 +572,10 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
char* GetPetName(uint32 petfamily, uint32 dbclang)
{
- if(!petfamily)
+ if (!petfamily)
return NULL;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
- if(!pet_family)
+ if (!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
}
@@ -583,7 +583,7 @@ char* GetPetName(uint32 petfamily, uint32 dbclang)
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
- if(itr==sTalentSpellPosMap.end())
+ if (itr==sTalentSpellPosMap.end())
return NULL;
return &itr->second;
@@ -591,7 +591,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
uint32 GetTalentSpellCost(uint32 spellId)
{
- if(TalentSpellPos const* pos = GetTalentSpellPos(spellId))
+ if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
return 0;
@@ -600,7 +600,7 @@ uint32 GetTalentSpellCost(uint32 spellId)
int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
- if(i == sAreaFlagByAreaID.end())
+ if (i == sAreaFlagByAreaID.end())
return -1;
return i->second;
@@ -609,7 +609,7 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
- if(areaflag < 0)
+ if (areaflag < 0)
return NULL;
return sAreaStore.LookupEntry(areaflag);
@@ -617,10 +617,10 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id)
{
- if(area_flag)
+ if (area_flag)
return sAreaStore.LookupEntry(area_flag);
- if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
+ if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
return GetAreaEntryByAreaID(mapEntry->linked_zone);
return NULL;
@@ -629,7 +629,7 @@ AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_i
uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
- if(i == sAreaFlagByMapID.end())
+ if (i == sAreaFlagByMapID.end())
return 0;
else
return i->second;
@@ -637,10 +637,10 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
- if(mapid != 530 && mapid != 571) // speed for most cases
+ if (mapid != 530 && mapid != 571) // speed for most cases
return mapid;
- if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
+ if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
return mapid;
@@ -649,11 +649,11 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid,zoneId);
- if(mapid < 2)
+ if (mapid < 2)
return CONTENT_1_60;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
- if(!mapEntry)
+ if (!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
@@ -670,7 +670,7 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
- if(ch && ch->ChannelID == channel_id)
+ if (ch && ch->ChannelID == channel_id)
return ch;
}
return NULL;
@@ -678,19 +678,19 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
- if(requiredTotemCategoryId==0)
+ if (requiredTotemCategoryId==0)
return true;
- if(itemTotemCategoryId==0)
+ if (itemTotemCategoryId==0)
return false;
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
- if(!itemEntry)
+ if (!itemEntry)
return false;
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
- if(!reqEntry)
+ if (!reqEntry)
return false;
- if(itemEntry->categoryType!=reqEntry->categoryType)
+ if (itemEntry->categoryType!=reqEntry->categoryType)
return false;
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
@@ -701,7 +701,7 @@ void Zone2MapCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
- if(!maEntry)
+ if (!maEntry)
return;
std::swap(x,y); // at client map coords swapped
@@ -714,7 +714,7 @@ void Map2ZoneCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
- if(!maEntry)
+ if (!maEntry)
return;
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);