Changeset View
Standalone View
source/graphics/ObjectManager.cpp
Context not available. | |||||
#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/system/ComponentDataHolder.h" | |||||
bool CObjectManager::ObjectKey::operator< (const CObjectManager::ObjectKey& a) const | bool CObjectManager::ObjectKey::operator< (const CObjectManager::ObjectKey& a) const | ||||
{ | { | ||||
Context not available. | |||||
changed = true; | changed = true; | ||||
} | } | ||||
const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | SComponentDataGenerator* cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | ||||
Stan: Should it be const? The name of the function implies it returns a list of entities, but it's… | |||||
Done Inline ActionsI think const is correct as no object member data is being modified. I agree about misleading function name. Mercury: I think const is correct as no object member data is being modified.
I agree about misleading… | |||||
Done Inline ActionsUsage is also not consistent among places. Stan: Usage is also not consistent among places. | |||||
Done Inline ActionsMy bad, actually const doesn't work here, generator needs to modify it's buffer pointer. By 'consistent' do you mean the variable name? I changed them all to gen. Mercury: My bad, actually const doesn't work here, generator needs to modify it's buffer pointer. By… | |||||
Done Inline ActionsI see ents, cmp and gen Stan: I see `ents`, `cmp` and `gen` | |||||
// Reload actors that use a changed object | // Reload actors that use a changed object | ||||
for (std::pair<const CStrW, Hotloadable<CActorDef>>& actor : m_ActorDefs) | for (std::pair<const CStrW, Hotloadable<CActorDef>>& actor : m_ActorDefs) | ||||
Context not available. | |||||
// 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 | ||||
for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit) | while(IComponent* cmp = cmps->Next()) | ||||
Done Inline ActionsI think we have ICmpPtr Same question for all the occurrences of this. Stan: I think we have ICmpPtr
Same question for all the occurrences of this. | |||||
Done Inline ActionsCan we use the CCmpManager function for those too? Stan: Can we use the CCmpManager function for those too? | |||||
Done Inline ActionsI can't find any use of ICmpPtr. Mercury: I can't find any use of ICmpPtr. | |||||
Done Inline ActionsMy Bad. CmpPtr<ICmpVisual> Stan: My Bad. CmpPtr<ICmpVisual> | |||||
Done Inline ActionsThe CmpPtr template takes an entity as argument and gets the component through query interface so it isn't appropriate for iteration. Another constructor overload could wrap the static_cast but that seems like obfuscation to me. Mercury: The CmpPtr template takes an entity as argument and gets the component through query interface… | |||||
Done Inline ActionsNo, CComponentManager::BroadcastMessagesToInterface calls the HandleMessage method but these call Hotload. Mercury: No, CComponentManager::BroadcastMessagesToInterface calls the HandleMessage method but these… | |||||
Done Inline ActionsMight make sense to make a hotload function then? Could be out of scope. Stan: Might make sense to make a hotload function then? Could be out of scope. | |||||
Done Inline ActionsWe would need two versions ( with and without argument ) and pass through functions in simulation2, doesn't seem worth it to me for only 3 instances. Mercury: We would need two versions ( with and without argument ) and pass through functions in… | |||||
static_cast<ICmpVisual*>(eit->second)->Hotload(actor.first); | static_cast<ICmpVisual*>(cmp)->Hotload(actor.first); | ||||
cmps->Reset(); | |||||
} | } | ||||
} | } | ||||
Context not available. | |||||
m_QualityLevel = quality > 255 ? 255 : quality < 0 ? 0 : quality; | m_QualityLevel = quality > 255 ? 255 : quality < 0 ? 0 : quality; | ||||
// No need to reload entries or actors, but we do need to reload all units. | // No need to reload entries or actors, but we do need to reload all units. | ||||
const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | SComponentDataGenerator* cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | ||||
for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit) | while(IComponent* cmp = cmps->Next()) | ||||
static_cast<ICmpVisual*>(eit->second)->Hotload(); | static_cast<ICmpVisual*>(cmp)->Hotload(); | ||||
// Trigger an interpolate call - needed because the game is generally paused & models disappear otherwise. | // Trigger an interpolate call - needed because the game is generally paused & models disappear otherwise. | ||||
m_Simulation.Interpolate(0.f, 0.f, 0.f); | m_Simulation.Interpolate(0.f, 0.f, 0.f); | ||||
Context not available. | |||||
actor.second.outdated = true; | actor.second.outdated = true; | ||||
// Reload visual actor components. | // Reload visual actor components. | ||||
const CSimulation2::InterfaceListUnordered& cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | SComponentDataGenerator* cmps = m_Simulation.GetEntitiesWithInterfaceUnordered(IID_Visual); | ||||
for (CSimulation2::InterfaceListUnordered::const_iterator eit = cmps.begin(); eit != cmps.end(); ++eit) | while(IComponent* cmp = cmps->Next()) | ||||
static_cast<ICmpVisual*>(eit->second)->Hotload(); | static_cast<ICmpVisual*>(cmp)->Hotload(); | ||||
// Trigger an interpolate call - needed because the game is generally paused & models disappear otherwise. | // Trigger an interpolate call - needed because the game is generally paused & models disappear otherwise. | ||||
m_Simulation.Interpolate(0.f, 0.f, 0.f); | m_Simulation.Interpolate(0.f, 0.f, 0.f); | ||||
Context not available. |
Should it be const? The name of the function implies it returns a list of entities, but it's actually a list of components ?
Same question for three below.