refactor(Core/Game): restyle game lib with astyle (#3466)

This commit is contained in:
Kargatum
2020-10-12 15:08:15 +07:00
committed by GitHub
parent e99b526e17
commit a2b26272d2
338 changed files with 52196 additions and 50944 deletions

View File

@@ -345,13 +345,13 @@ void LoadDBCStores(const std::string& dataPath)
LOAD_DBC(sVehicleSeatStore, "VehicleSeat.dbc", "vehicleseat_dbc");
LOAD_DBC(sWMOAreaTableStore, "WMOAreaTable.dbc", "wmoareatable_dbc");
LOAD_DBC(sWorldMapAreaStore, "WorldMapArea.dbc", "worldmaparea_dbc");
LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
#undef LOAD_DBC
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
for (FactionEntry const* faction : sFactionStore)
{
if (faction->team)
@@ -360,7 +360,7 @@ void LoadDBCStores(const std::string& dataPath)
flist.push_back(faction->ID);
}
}
for (GameObjectDisplayInfoEntry const* info : sGameObjectDisplayInfoStore)
{
if (info->maxX < info->minX)
@@ -372,7 +372,7 @@ void LoadDBCStores(const std::string& dataPath)
if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
// fill data
for (MapDifficultyEntry const* entry : sMapDifficultyStore)
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
@@ -380,7 +380,7 @@ void LoadDBCStores(const std::string& dataPath)
for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
for (auto i : sSpellStore)
if (i->Category)
sSpellsByCategoryStore[i->Category].insert(i->Id);
@@ -459,12 +459,12 @@ void LoadDBCStores(const std::string& dataPath)
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
}
}
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
// Calculate path nodes count
uint32 pathCount = sTaxiPathStore.GetNumRows();
@@ -499,7 +499,7 @@ void LoadDBCStores(const std::string& dataPath)
memset(sHordeTaxiNodesMask, 0, sizeof(sHordeTaxiNodesMask));
memset(sAllianceTaxiNodesMask, 0, sizeof(sAllianceTaxiNodesMask));
memset(sDeathKnightTaxiNodesMask, 0, sizeof(sDeathKnightTaxiNodesMask));
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
@@ -526,7 +526,7 @@ void LoadDBCStores(const std::string& dataPath)
// valid taxi network node
uint8 field = (uint8)((i - 1) / 32);
uint32 submask = 1<<((i-1)%32);
uint32 submask = 1 << ((i - 1) % 32);
sTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
@@ -550,7 +550,7 @@ void LoadDBCStores(const std::string& dataPath)
for (TransportAnimationEntry const* anim : sTransportAnimationStore)
sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
for (TransportRotationEntry const* rot : sTransportRotationStore)
sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);
@@ -575,11 +575,11 @@ void LoadDBCStores(const std::string& dataPath)
// Check loaded DBC files proper version
if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
sLog->outError("You have _outdated_ DBC data. Please extract correct versions from current using client.");
exit(1);
@@ -622,7 +622,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
uint32 GetTalentSpellCost(uint32 spellId)
{
if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
return pos->rank + 1;
return 0;
}
@@ -659,9 +659,12 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
switch (mapEntry->Expansion())
{
default: return CONTENT_1_60;
case 1: return CONTENT_61_70;
case 2: return CONTENT_71_80;
default:
return CONTENT_1_60;
case 1:
return CONTENT_61_70;
case 2:
return CONTENT_71_80;
}
}
@@ -674,8 +677,8 @@ void Zone2MapCoordinates(float& x, float& y, uint32 zone)
return;
std::swap(x, y); // at client map coords swapped
x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1;
y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down
x = x * ((maEntry->x2 - maEntry->x1) / 100) + maEntry->x1;
y = y * ((maEntry->y2 - maEntry->y1) / 100) + maEntry->y1; // client y coord from top to down
}
void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
@@ -686,8 +689,8 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
if (!maEntry)
return;
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down
x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100);
y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down
std::swap(x, y); // client have map coords swapped
}
@@ -697,7 +700,7 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
return itr != sMapDifficultyMap.end() ? &itr->second : nullptr;
}
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty& difficulty)
{
uint32 tmpDiff = difficulty;
@@ -760,7 +763,7 @@ uint32 const* GetTalentTabPages(uint8 cls)
}
bool IsSharedDifficultyMap(uint32 mapid)
{
{
return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
}

View File

@@ -31,12 +31,12 @@ enum ContentLevels
};
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
void Zone2MapCoordinates(float &x, float &y, uint32 zone);
void Map2ZoneCoordinates(float &x, float &y, uint32 zone);
void Zone2MapCoordinates(float& x, float& y, uint32 zone);
void Map2ZoneCoordinates(float& x, float& y, uint32 zone);
typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty& difficulty);
bool IsSharedDifficultyMap(uint32 mapid);