originally from:
Grrr I got this crash and seems related to net play although i was playing single player. And I did notice the player lag bureaubert talked about. I was playing my civ3mod but it seems similar to the Fugi crash with 577 he posted here.
a reload of the save game at turn 42 crashed again but not with the net line:
###########################
Here's the code I think in question (located in ai\strategy\scheduler\plan.cpp) :
the file was done way back in october 2005 so it might have popped up before. But it looks like it could be a problem with the AI not being able to assign goals since I think this is what clavitix was talking abou there:
Grrr I got this crash and seems related to net play although i was playing single player. And I did notice the player lag bureaubert talked about. I was playing my civ3mod but it seems similar to the Fugi crash with 577 he posted here.
Code:
0x0076b1e8 [?begin@?$list@PAVGame@NETFunc@@V?$allocator@PAVGame@NETFunc@@@std@@@std@@QAE?AViterator@12@XZ + 0x18] 0x00884783 [?Rollback_All_Agents@Plan@@QAEJXZ + 0x42] 0x00887b96 [? Rollback_Matches_For_Goal@Scheduler@@IAEJABQAVGoal @@@Z + 0xe4] 0x00886732 [?Match_Resources@Scheduler@@QAEX_N@Z + 0x2c3] 0x008ac246 [?GEVHookCallback@CtpAi_ProcessMatchesEvent@@EAE? AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVG ameEventArgList@@@Z + 0xa3] 0x005c2fc6 [?Activate@GameEventHook@@QAE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@JAAJ@Z + 0x8e] 0x005c3c5a [?ActivateHook@GameEventManager@@QAE? AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgLi st@@JAAJ@Z + 0x3a] 0x005c18c4 [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@AAH@Z + 0x2f] 0x005c3ab8 [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x33] 0x005c3a5b [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x7b] 0x0040f076 [?Process@CivApp@@QAEJXZ + 0x103] 0x00407e01 [?CivMain@@YGHPAUHINSTANCE__@@0PADH@Z + 0x3b6] 0x00407878 [WinMain@16 + 0x74] 0x008bb8dc [WinMainCRTStartup + 0x134] 0x7c816d4f [__onexitbegin + 0x7bc5b917]
a reload of the save game at turn 42 crashed again but not with the net line:
Code:
0x008847d6 [?Rollback_All_Agents@Plan@@QAEJXZ + 0x95] 0x0088794f [? Remove_Matches_For_Goal@Scheduler@@IAEXABQAVGoal@@ @Z + 0x7a] 0x008867fc [?Remove_Goal@Scheduler@@QAE?AViterator@?$list@U?$pair@JPAVGoal@@@std@@V?$allocator@U?$pair@JPAVGoal@@@std@@@2@@std@@ABV234@@Z + 0x43] 0x00886eb9 [?Prioritize_Goals@Scheduler@@QAE_NXZ + 0x313] 0x008862cc [?Process_Goal_Changes@Scheduler@@QAE?AW4TIME_SLICE_STATE@1@XZ + 0x53] 0x008ac132 [?GEVHookCallback@CtpAi_BeginSchedulerEvent@@EAE? AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVG ameEventArgList@@@Z + 0x8a] 0x005c2fc6 [?Activate@GameEventHook@@QAE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@JAAJ@Z + 0x8e] 0x005c3c5a [?ActivateHook@GameEventManager@@QAE? AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgLi st@@JAAJ@Z + 0x3a] 0x005c18c4 [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@AAH@Z + 0x2f] 0x005c3ab8 [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x33] 0x005c3a5b [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x7b] 0x0040f076 [?Process@CivApp@@QAEJXZ + 0x103] 0x00407e01 [?CivMain@@YGHPAUHINSTANCE__@@0PADH@Z + 0x3b6] 0x00407878 [WinMain@16 + 0x74] 0x008bb8dc [WinMainCRTStartup + 0x134] 0x7c816d4f [__onexitbegin + 0x7bc5b917]
Here's the code I think in question (located in ai\strategy\scheduler\plan.cpp) :
Code:
sint32 Plan::Rollback_All_Agents() { sint32 rollback_agents = 0; Assert(m_the_goal && m_the_squad); if (m_the_goal && m_the_squad) { CTPGoal_ptr ctpgoal_ptr = static_cast(m_the_goal); for ( Agent_Match_List::iterator match_iter = m_matches.begin(); match_iter != m_matches.end(); ++match_iter ) { if (match_iter->committed) { CTPAgent_ptr agent_ptr = (CTPAgent_ptr) *(match_iter->squad_index); ctpgoal_ptr->Rollback_Agent(match_iter->goal_index); match_iter->committed = false; match_iter->value = Goal::BAD_UTILITY; agent_ptr->Set_Is_Used(false); ++rollback_agents; } else { Assert(ctpgoal_ptr->Get_Agent_List().end() == match_iter->goal_index); } } } return rollback_agents; }
Code:
// Modifications from the original Activision code: // // - Changed the > and < operator (to change the Sort method see Sort_Matches) - Calvitix // instead of only looking for the matching value, the new operator first // compare the Goal Raw-priority. If it is equal, then compare matching // value. It has the advantage to give the possibility for high priority // goal that demands many units to be considered. // For example : 3 units available, // 3 Goals : // GOAL1 priority 50000, demands 2 units to be satisfied // GOAL2 priority 40000, demands 1 unit to be satisfied // GOAL3 priority 30000, demands 1 unit to be satisfied // // the matches are : // // GOAL1 <-> UNIT1 52000 // GOAL1 <-> UNIT2 49000 // GOAL1 <-> UNIT3 47000 // GOAL2 <-> UNIT1 54000 // GOAL2 <-> UNIT2 53000 // GOAL2 <-> UNIT3 52000 // GOAL3 <-> UNIT1 52000 // GOAL3 <-> UNIT2 53000 // GOAL3 <-> UNIT3 55000 // // Original Sort_matches and agent committing : // // GOAL3 -> UNIT3 --> OK // GOAL2 -> UNIT1 --> OK // GOAL1 -> FAILED to Satisfy, and it has the greatest priority !!!! // // // with new sort_matches (implied with thos operator changes) // // GOAL1 -> UNIT1 // -> UNIT2 --> OK // GOAL2 -> UNIT3 --> OK // GOAL3 -> FAILED to Satisfy // // - Added an method that determines if the matches can be reevaluated) // (ie the agent can be rollbacked and eventually be used for another goal) // depending on NoRollback flag. // - Prevented crashes, and cleaned up the code somewhat. // - Deferred some derefences until used (hopefully preventing crashes).