Index: ps/trunk/binaries/data/mods/public/simulation/helpers/InitGame.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/helpers/InitGame.js +++ ps/trunk/binaries/data/mods/public/simulation/helpers/InitGame.js @@ -72,6 +72,9 @@ if (settings.WorldPopulationCap) Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).SetMaxWorldPopulation(settings.WorldPopulationCap); + // Update the grid with all entities created for the map init. + Engine.QueryInterface(SYSTEM_ENTITY, IID_Pathfinder).UpdateGrid(); + // Map or player data (handicap...) dependent initialisations of components (i.e. garrisoned units). Engine.BroadcastMessage(MT_InitGame, {}); Index: ps/trunk/source/simulation2/Simulation2.cpp =================================================================== --- ps/trunk/source/simulation2/Simulation2.cpp +++ ps/trunk/source/simulation2/Simulation2.cpp @@ -531,19 +531,16 @@ CComponentManager& componentManager = simContext.GetComponentManager(); + CmpPtr cmpPathfinder(simContext, SYSTEM_ENTITY); + if (cmpPathfinder) + cmpPathfinder->FetchAsyncResultsAndSendMessages(); + { PROFILE2("Sim - Update Start"); CMessageTurnStart msgTurnStart; componentManager.BroadcastMessage(msgTurnStart); } - CmpPtr cmpPathfinder(simContext, SYSTEM_ENTITY); - if (cmpPathfinder) - { - cmpPathfinder->FetchAsyncResultsAndSendMessages(); - cmpPathfinder->UpdateGrid(); - } - // Push AI commands onto the queue before we use them CmpPtr cmpAIManager(simContext, SYSTEM_ENTITY); if (cmpAIManager) @@ -594,7 +591,10 @@ // Process all remaining moves if (cmpPathfinder) + { + cmpPathfinder->UpdateGrid(); cmpPathfinder->StartProcessingMoves(false); + } } void CSimulation2Impl::Interpolate(float simFrameLength, float frameOffset, float realFrameLength) Index: ps/trunk/source/simulation2/components/CCmpPathfinder_Common.h =================================================================== --- ps/trunk/source/simulation2/components/CCmpPathfinder_Common.h +++ ps/trunk/source/simulation2/components/CCmpPathfinder_Common.h @@ -89,12 +89,10 @@ static void ClassInit(CComponentManager& componentManager) { componentManager.SubscribeToMessageType(MT_Deserialized); - componentManager.SubscribeToMessageType(MT_Update); componentManager.SubscribeToMessageType(MT_RenderSubmit); // for debug overlays componentManager.SubscribeToMessageType(MT_TerrainChanged); componentManager.SubscribeToMessageType(MT_WaterChanged); componentManager.SubscribeToMessageType(MT_ObstructionMapShapeChanged); - componentManager.SubscribeToMessageType(MT_TurnStart); } ~CCmpPathfinder(); Index: ps/trunk/source/simulation2/components/ICmpPathfinder.cpp =================================================================== --- ps/trunk/source/simulation2/components/ICmpPathfinder.cpp +++ ps/trunk/source/simulation2/components/ICmpPathfinder.cpp @@ -25,4 +25,5 @@ DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpPathfinder, SetDebugOverlay, bool) DEFINE_INTERFACE_METHOD_1("SetHierDebugOverlay", void, ICmpPathfinder, SetHierDebugOverlay, bool) DEFINE_INTERFACE_METHOD_CONST_1("GetPassabilityClass", pass_class_t, ICmpPathfinder, GetPassabilityClass, std::string) +DEFINE_INTERFACE_METHOD_0("UpdateGrid", void, ICmpPathfinder, UpdateGrid) END_INTERFACE_WRAPPER(Pathfinder)