Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/Simulation2.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2018 Wildfire Games. | ||||
Stan: Bump year.
@Itms: D404 seem to work as expected :) | |||||
Not Done Inline ActionsYear :) Stan: Year :) | |||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 525 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(); | |||||
Done Inline ActionsPut before the grid update because we need to make sure the state isn't changed from last turn. wraitii: Put before the grid update because we need to make sure the state isn't changed from last turn. | |||||
Not Done Inline ActionsMaybe it deserves a comment ? Stan: Maybe it deserves a comment ? | |||||
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(); | { | ||||
Not Done Inline Actions(This is a requirement, so it should be checked in the requirements phase of development, i.e. before the design or implementation stage). elexis: (This is a requirement, so it should be checked in the requirements phase of development, i.e. | |||||
Done Inline ActionsThis comment is outdated since below I call "FetchAsyncResultsAndSendMessages", which actually waits for all paths to be computed, so we aren't running this "during update". It could probably be run during update but I haven't checked and it'd be trickier. wraitii: This comment is outdated since below I call "FetchAsyncResultsAndSendMessages", which actually… | |||||
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); | ||||
} | } | ||||
Not Done Inline ActionsNuke Stan: Nuke | |||||
Not Done Inline ActionsStill accurate. Stan: Still accurate. | |||||
{ | { | ||||
CMessageUpdate_MotionFormation msgUpdate(turnLengthFixed); | CMessageUpdate_MotionFormation msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
// Process move commands for formations (group proxy) | |||||
if (cmpPathfinder) | |||||
cmpPathfinder->ProcessSameTurnMoves(); | |||||
{ | { | ||||
PROFILE2("Sim - Motion Unit"); | PROFILE2("Sim - Motion Unit"); | ||||
CMessageUpdate_MotionUnit msgUpdate(turnLengthFixed); | CMessageUpdate_MotionUnit msgUpdate(turnLengthFixed); | ||||
componentManager.BroadcastMessage(msgUpdate); | componentManager.BroadcastMessage(msgUpdate); | ||||
} | } | ||||
{ | { | ||||
Not Done Inline ActionsNuke. Stan: Nuke. | |||||
Not Done Inline ActionsHaving blank lines here actually makes sense. If 574 can be blank then why wouldn't there be other blank lines? Kuba386: Having blank lines here actually makes sense. If 574 can be blank then why wouldn't there be… | |||||
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 | |||||
Done Inline ActionsComment should be changed to something like "Start processing moves in the background". wraitii: Comment should be changed to something like "Start processing moves in the background". | |||||
if (cmpPathfinder) | |||||
cmpPathfinder->StartProcessingMoves(); | |||||
} | } | ||||
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
Bump year.
@Itms: D404 seem to work as expected :)