Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ObjectManager.cpp
Show All 23 Lines | |||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/Game.h" | #include "ps/Game.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/XML/Xeromyces.h" | #include "ps/XML/Xeromyces.h" | ||||
#include "simulation2/Simulation2.h" | #include "simulation2/Simulation2.h" | ||||
#include "simulation2/components/ICmpTerrain.h" | #include "simulation2/components/ICmpTerrain.h" | ||||
#include "simulation2/components/ICmpVisual.h" | #include "simulation2/components/ICmpVisual.h" | ||||
#include "simulation2/helpers/SparseFlatMap.h" | |||||
bool CObjectManager::ObjectKey::operator< (const CObjectManager::ObjectKey& a) const | bool CObjectManager::ObjectKey::operator< (const CObjectManager::ObjectKey& a) const | ||||
{ | { | ||||
if (ActorName < a.ActorName) | if (ActorName < a.ActorName) | ||||
return true; | return true; | ||||
else if (ActorName > a.ActorName) | else if (ActorName > a.ActorName) | ||||
return false; | return false; | ||||
else | else | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | for (std::map<CStrW, CObjectBase*>::iterator it = m_ObjectBases.begin(); it != m_ObjectBases.end(); ++it) | ||||
{ | { | ||||
it->second->Reload(); | it->second->Reload(); | ||||
// Slightly ugly hack: The graphics system doesn't preserve enough information to regenerate the | // Slightly ugly hack: The graphics system doesn't preserve enough information to regenerate the | ||||
// object with all correct variations, and we don't want to waste space storing it just for the | // object with all correct variations, and we don't want to waste space storing it just for the | ||||
// rare occurrence of hotloading, so we'll tell the component (which does preserve the information) | // rare occurrence of hotloading, so we'll tell the component (which does preserve the information) | ||||
// to do the reloading itself | // to do the reloading itself | ||||
const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | ||||
for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit) | for (const std::pair<entity_id_t, IComponent*>& entComp : cmps) | ||||
static_cast<ICmpVisual*>(eit->second)->Hotload(it->first); | static_cast<ICmpVisual*>(entComp.second)->Hotload(it->first); | ||||
elexis: `CSimulation2::InterfaceListUnordered::iterator` or `std::pair<whatever, thatis>`?
Can `cmps`… | |||||
} | } | ||||
} | } | ||||
return INFO::OK; | return INFO::OK; | ||||
} | } |
Wildfire Games · Phabricator
CSimulation2::InterfaceListUnordered::iterator or std::pair<whatever, thatis>?
Can cmps be inlined (I didn't check whether that function would be called everytime then)?