Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpTerritoryManager.cpp
Show First 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | void CCmpTerritoryManager::CalculateTerritories() | ||||
// Reset territory counts for all players | // Reset territory counts for all players | ||||
CmpPtr<ICmpPlayerManager> cmpPlayerManager(GetSystemEntity()); | CmpPtr<ICmpPlayerManager> cmpPlayerManager(GetSystemEntity()); | ||||
if (cmpPlayerManager && (size_t)cmpPlayerManager->GetNumPlayers() != m_TerritoryCellCounts.size()) | if (cmpPlayerManager && (size_t)cmpPlayerManager->GetNumPlayers() != m_TerritoryCellCounts.size()) | ||||
m_TerritoryCellCounts.resize(cmpPlayerManager->GetNumPlayers()); | m_TerritoryCellCounts.resize(cmpPlayerManager->GetNumPlayers()); | ||||
for (u16& count : m_TerritoryCellCounts) | for (u16& count : m_TerritoryCellCounts) | ||||
count = 0; | count = 0; | ||||
// Find all territory influence entities | // Find all territory influence entities | ||||
CComponentManager::InterfaceList influences = GetSimContext().GetComponentManager().GetEntitiesWithInterface(IID_TerritoryInfluence); | CComponentManager::InterfaceList influences = GetSimContext().GetComponentManager().GetComponentsByInterface(IID_TerritoryInfluence); | ||||
// Split influence entities into per-player lists, ignoring any with invalid properties | // Split influence entities into per-player lists, ignoring any with invalid properties | ||||
std::map<player_id_t, std::vector<entity_id_t> > influenceEntities; | std::map<player_id_t, std::vector<entity_id_t> > influenceEntities; | ||||
for (const CComponentManager::InterfacePair& pair : influences) | for (const CComponentManager::InterfacePair& pair : influences) | ||||
{ | { | ||||
entity_id_t ent = pair.first; | entity_id_t ent = pair.first; | ||||
CmpPtr<ICmpOwnership> cmpOwnership(GetSimContext(), ent); | CmpPtr<ICmpOwnership> cmpOwnership(GetSimContext(), ent); | ||||
▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator