Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/Simulation2.cpp
Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Lines | CComponentManager& componentManager = simContext.GetComponentManager(); | ||||
PROFILE2("Sim - Update Start"); | PROFILE2("Sim - Update Start"); | ||||
CMessageTurnStart msgTurnStart; | CMessageTurnStart msgTurnStart; | ||||
componentManager.BroadcastMessage(msgTurnStart); | componentManager.BroadcastMessage(msgTurnStart); | ||||
} | } | ||||
CmpPtr<ICmpPathfinder> cmpPathfinder(simContext, SYSTEM_ENTITY); | CmpPtr<ICmpPathfinder> cmpPathfinder(simContext, SYSTEM_ENTITY); | ||||
if (cmpPathfinder) | if (cmpPathfinder) | ||||
{ | { | ||||
cmpPathfinder->FetchAsyncResultsAndSendMessages(); | |||||
cmpPathfinder->UpdateGrid(); | cmpPathfinder->UpdateGrid(); | ||||
cmpPathfinder->FinishAsyncRequests(); | |||||
} | } | ||||
// Push AI commands onto the queue before we use them | // Push AI commands onto the queue before we use them | ||||
CmpPtr<ICmpAIManager> cmpAIManager(simContext, SYSTEM_ENTITY); | CmpPtr<ICmpAIManager> cmpAIManager(simContext, SYSTEM_ENTITY); | ||||
if (cmpAIManager) | if (cmpAIManager) | ||||
cmpAIManager->PushCommands(); | cmpAIManager->PushCommands(); | ||||
CmpPtr<ICmpCommandQueue> cmpCommandQueue(simContext, SYSTEM_ENTITY); | CmpPtr<ICmpCommandQueue> cmpCommandQueue(simContext, SYSTEM_ENTITY); | ||||
if (cmpCommandQueue) | if (cmpCommandQueue) | ||||
cmpCommandQueue->FlushTurn(commands); | cmpCommandQueue->FlushTurn(commands); | ||||
// Process newly generated move commands so the UI feels snappy | // Process newly generated move commands so the UI feels snappy | ||||
if (cmpPathfinder) | if (cmpPathfinder) | ||||
cmpPathfinder->ProcessSameTurnMoves(); | { | ||||
cmpPathfinder->StartProcessingMoves(true); | |||||
cmpPathfinder->FetchAsyncResultsAndSendMessages(); | |||||
} | |||||
// Send all the update phases | // Send all the update phases | ||||
{ | { | ||||
PROFILE2("Sim - Update"); | PROFILE2("Sim - Update"); | ||||
CMessageUpdate msgUpdate(turnLengthFixed); | CMessageUpdate msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
{ | { | ||||
CMessageUpdate_MotionFormation msgUpdate(turnLengthFixed); | CMessageUpdate_MotionFormation msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
// Process move commands for formations (group proxy) | // Process move commands for formations (group proxy) | ||||
if (cmpPathfinder) | if (cmpPathfinder) | ||||
cmpPathfinder->ProcessSameTurnMoves(); | { | ||||
cmpPathfinder->StartProcessingMoves(true); | |||||
cmpPathfinder->FetchAsyncResultsAndSendMessages(); | |||||
} | |||||
{ | { | ||||
PROFILE2("Sim - Motion Unit"); | PROFILE2("Sim - Motion Unit"); | ||||
CMessageUpdate_MotionUnit msgUpdate(turnLengthFixed); | CMessageUpdate_MotionUnit msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
{ | { | ||||
PROFILE2("Sim - Update Final"); | PROFILE2("Sim - Update Final"); | ||||
CMessageUpdate_Final msgUpdate(turnLengthFixed); | CMessageUpdate_Final msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
// Process moves resulting from group proxy movement (unit needs to catch up or realign) and any others | |||||
if (cmpPathfinder) | |||||
cmpPathfinder->ProcessSameTurnMoves(); | |||||
// Clean up any entities destroyed during the simulation update | // Clean up any entities destroyed during the simulation update | ||||
componentManager.FlushDestroyedComponents(); | componentManager.FlushDestroyedComponents(); | ||||
// Process all remaining moves | |||||
if (cmpPathfinder) | |||||
cmpPathfinder->StartProcessingMoves(); | |||||
Stan: Should't a boolean be passed ? | |||||
Not Done Inline ActionsYes, shouldn't it be false? Kuba386: Yes, shouldn't it be false? | |||||
Done Inline ActionsI'm not sure what Stan meant by that or you you mean by that? wraitii: I'm not sure what Stan meant by that or you you mean by that? | |||||
Not Done Inline ActionsI mean shouldn't we change: StartProcessingMoves(); -> StartProcessingMoves(false); or void StartProcessingMoves(bool useMax) { .... } -> void StartProcessingMoves(bool useMax = false) { .... } ? Kuba386: I mean shouldn't we change:
StartProcessingMoves(); -> StartProcessingMoves(false);
or… | |||||
Done Inline Actions= false is defined in ICmpPathfinder.h wraitii: ` = false` is defined in ICmpPathfinder.h | |||||
Not Done Inline ActionsWhy not pass it explicitly, so that the reader of the cpp file is indicated that there is an option to be considered here? What was the purpose of that max from the cited commit, and why does this purpose not apply anymore for threads? elexis: Why not pass it explicitly, so that the reader of the `cpp` file is indicated that there is an… | |||||
Done Inline ActionsThis last call should compute all moves, since it's the last call before the next turn. So obviously it can't use the limit. It already wasn't using the limit before, nothing's changed. Nothing against explicitly passing the argument, don't care. wraitii: This last call should compute all moves, since it's the last call before the next turn. So… | |||||
} | } | ||||
void CSimulation2Impl::Interpolate(float simFrameLength, float frameOffset, float realFrameLength) | void CSimulation2Impl::Interpolate(float simFrameLength, float frameOffset, float realFrameLength) | ||||
{ | { | ||||
PROFILE3("sim interpolate"); | PROFILE3("sim interpolate"); | ||||
m_LastFrameOffset = frameOffset; | m_LastFrameOffset = frameOffset; | ||||
▲ Show 20 Lines • Show All 390 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Should't a boolean be passed ?