Changeset 27698
- Timestamp:
- Jun 14, 2023, 9:32:22 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/simulation2/components/CCmpAIManager.cpp
r27323 r27698 522 522 } 523 523 524 void UpdateGameState( const Script::StructuredClone&gameState)524 void UpdateGameState( gameState) 525 525 { 526 526 ENSURE(m_CommandsComputed); 527 m_GameState = gameState; 527 m_GameState.reset(); 528 m_GameState.init(ScriptRequest(m_ScriptInterface).cx, gameState); 528 529 } 529 530 … … 798 799 // Deserialize the game state, to pass to the AI's HandleMessage 799 800 ScriptRequest rq(m_ScriptInterface); 800 JS::RootedValue state(rq.cx);801 801 { 802 802 PROFILE3("AI compute read state"); 803 Script::ReadStructuredClone(rq, m_GameState, &state); 804 Script::SetProperty(rq, state, "passabilityMap", m_PassabilityMapVal, true); 805 Script::SetProperty(rq, state, "territoryMap", m_TerritoryMapVal, true); 803 Script::SetProperty(rq, m_GameState, "passabilityMap", m_PassabilityMapVal, true); 804 Script::SetProperty(rq, m_GameState, "territoryMap", m_TerritoryMapVal, true); 806 805 } 807 806 … … 816 815 { 817 816 PROFILE3("AI run shared component"); 818 ScriptFunction::CallVoid(rq, m_SharedAIObj, "onUpdate", state);817 ScriptFunction::CallVoid(rq, m_SharedAIObj, "onUpdate", tate); 819 818 } 820 819 … … 826 825 827 826 if (m_HasSharedComponent && m_Players[i]->m_UseSharedComponent) 828 m_Players[i]->Run( state, m_Players[i]->m_Player, m_SharedAIObj);827 m_Players[i]->Run(tate, m_Players[i]->m_Player, m_SharedAIObj); 829 828 else 830 m_Players[i]->Run( state, m_Players[i]->m_Player);829 m_Players[i]->Run(tate, m_Players[i]->m_Player); 831 830 } 832 831 } … … 848 847 std::set<std::wstring> m_LoadedModules; 849 848 850 Script::StructuredClone m_GameState;849 e m_GameState; 851 850 Grid<NavcellData> m_PassabilityMap; 852 851 JS::PersistentRootedValue m_PassabilityMapVal; … … 1004 1003 1005 1004 // Update the game state 1006 m_Worker.UpdateGameState( Script::WriteStructuredClone(rq, state));1005 m_Worker.UpdateGameState(); 1007 1006 1008 1007 // Update the pathfinding data
Note:
See TracChangeset
for help on using the changeset viewer.