Announcement

Collapse
No announcement yet.

DEBUG: Governor Readiness crash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DEBUG: Governor Readiness crash

    Code:
      0x0088836a  [?GetCost@MilitaryReadiness@@QBENXZ + 0xa]
      0x004e671f  [?GetReadinessCost@Player@@QBEJXZ + 0x15]
      0x0089d381  [?ComputeBestMilitaryReadiness@Governor@@QBEJXZ + 0xa8]
      0x008a27ec  [?BeginTurn@CtpAi@@SAXJ@Z + 0x29f]
      0x00538d99  [?GEVHookCallback@BeginTurnEvent@@EAE? AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVG
    ameEventArgList@@@Z + 0x90]
      0x005be51f  [?Run@GameEventHook@@AAE?AW4GAME_EVENT_ERR@@AAViterator@?$list@UNode@GameEventHook@@V? $allocator@UNode@GameEventHook@@@std@@@std@@PAVGam
    eEventArgList@@AAJ@Z + 0x63]
      0x005be4b6  [?Activate@GameEventHook@@QAE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@JAAJ@Z + 0x7e]
      0x005bf0da  [?ActivateHook@GameEventManager@@QAE? AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgLi
    st@@JAAJ@Z + 0x3a]
      0x005bcdd4  [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@AAH@Z + 0x2f]
      0x005bef38  [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x33]
      0x005beedb  [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x7b]
      0x005bee50  [?ArglistAddEvent@GameEventManager@@QAE? AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVE
    NT@@PAVGameEventArgList@@@Z + 0x13d]
      0x005bed05  [?AddEvent@GameEventManager@@QAA? AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVE
    NT@@ZZ + 0xe5]
      0x0043e542  [? dh_endTurn@@YAXPAVDQAction@@PAVSequence@@W4DHEXECU
    TE@@@Z + 0x3c]
      0x0043839b  [?HandleNextAction@Director@@QAEXXZ + 0xfb]
      0x0043823b  [?Process@Director@@QAEXXZ + 0x25]
      0x0040ece6  [?ProcessUI@CivApp@@QAEJKAAK@Z + 0x22c]
      0x0040f005  [?Process@CivApp@@QAEJXZ + 0xa7]
      0x00407dd0  [?CivMain@@YGHPAUHINSTANCE__@@0PADH@Z + 0x3b6]
      0x00407847  [WinMain@16 + 0x74]
      0x008b10ec  [WinMainCRTStartup + 0x134]
      0x7c816d4f  [__onexitbegin + 0x7bc66e37]
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    Well the get cost is only in readiness.h

    And this crash is infrequent but I think my code I added here (which should be an option as well)

    Code:
    void MilitaryReadiness::KillUnitsOverBudget(sint32 gov, DynamicArray &m_all_armies, sint32 mil_total)
    
    // notgoing to do a gold one because it will cost economy not units, tougher for human and AI
    
    {
        if (sint32(m_cost) <= mil_total) 
            return; 
    
    //EMOD  AI can run deficit? but cant build production?
        if (g_player[m_owner]->GetPlayerType() == PLAYER_TYPE_ROBOT) {
            return; 
        } else { 
    //EMOD
        sint32 n_units = 0, n_prof_units;
        sint32 i, j, n, m;
    
    
        n = m_all_armies.Num(); 
    
        if (n < 1) { 
            return; 
        } 
    
        for (i=0; i all_units[j].cost) { 
                    tmpu = all_units[i].u; 
                    tmpc = all_units[i].cost; 
    
                    all_units[i].u = all_units[j].u; 
                    all_units[i].cost = all_units[j].cost; 
    
                    all_units[j].u = tmpu; 
                    all_units[j].cost = tmpc; 
                }
            } 
        } 
    
    
        m_ignore_unsupport = TRUE; 
        for (i = n_units-1; 0 <= i; i--) { 
            if (sint32(m_cost) <= mil_total) 
                break; 
    
            m_cost -= all_units[i].cost; 
    
            if (0 != m_owner) { 
                if (g_slicEngine->GetSegment("120NoSupport")->TestLastShown(m_owner, 1)) {
                    SlicObject *so = new SlicObject("120NoSupport") ;
                    so->AddRecipient(m_owner) ;
                    g_slicEngine->Execute(so) ;
                }
    
                all_units[i].u.Kill(CAUSE_REMOVE_ARMY_NO_MAT_SUPPORT, -1);
            }
        }
    
    	
    	
    	if(sint32(m_cost) > mil_total) {
    		for (i=0; i<(n_prof_units-1); i++) { 
    			for (j=i+1; jGetSegment("120NoSupport")->TestLastShown(m_owner, 1)) {
                    SlicObject *so = new SlicObject("120NoSupport") ;
                    so->AddRecipient(m_owner) ;
                    g_slicEngine->Execute(so) ;
                }
    
    			prof_units[i].u.Kill(CAUSE_REMOVE_ARMY_NO_MAT_SUPPORT, -1); 
    		}
    	}
        m_ignore_unsupport = FALSE; 
    
        delete [] all_units; 
    	delete [] prof_units;
     } //EMOD
    }
    I'll out comment it fort he next build but ther is the question of when the option is in if it will still crash.

    however, this crash even in my tests happens infrequently, even when the AI has been running a shields deficit for many turns. So either it depends often the governor calculates or it might really be in the governor.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment

    Working...
    X