Announcement

Collapse
No announcement yet.

[DEBUG] 623 Diplomacy Proposal Crash

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

  • [DEBUG] 623 Diplomacy Proposal Crash

    Code:
      0x005c8cb1  [?GetProposal@ProposalElement@DiplomacyRecord@@QBEPBVDiplomacyProposalRecord@@XZ + 0xa]
      0x0085e4ea  [?GetNewProposalPriority@Diplomat@@QBEHHW4PROPOSAL_TYPE@@@Z + 0x38]
      0x0084a095  [?GEVHookCallback@BegForGold_NewProposalEvent@@EAE?AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVGameEventArgList@@@Z + 0x1dc]
      0x005c1002  [?Activate@GameEventHook@@QBE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@HAAH@Z + 0x8e]
      0x005c1c10  [?ActivateHook@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgList@@HAAH@Z + 0x40]
      0x005bf9b2  [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x2d]
      0x005c1a84  [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x2f]
      0x005c1a2b  [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x7b]
      0x005c19a0  [?ArglistAddEvent@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVENT@@PAVGameEventArgList@@@Z + 0x13d]
      0x005c1855  [?AddEvent@GameEventManager@@QAA?AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVENT@@ZZ + 0xe5]
      0x0043e27b  [?dh_endTurn@@YAXPAVDQAction@@PAVSequence@@W4DHEXECUTE@@@Z + 0x35]
      0x00438122  [?HandleNextAction@Director@@QAEXXZ + 0xfb]
      0x0041907d  [?Process@UnitActor@@UAEXXZ + 0x1e5]
      0x00438d56  [?ProcessActiveUnits@Director@@QAEIXZ + 0x80]
      0x00437fca  [?Process@Director@@QAEXXZ + 0x2d]
      0x0040eb9f  [?ProcessUI@CivApp@@QAEHIAAI@Z + 0x22c]
      0x0040eec0  [?Process@CivApp@@QAEHXZ + 0xa7]
      0x00407dff  [?CivMain@@YGHPAUHINSTANCE__@@0PADH@Z + 0x3b6]
      0x00407876  [WinMain@16 + 0x74]
    The crash appears to be from this code:
    Code:
    sint32 Diplomat::GetNewProposalPriority(const PLAYER_INDEX foreignerId, 
    							  const PROPOSAL_TYPE proposalType ) const
    {
    	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
    	
    	const DiplomacyRecord::ProposalElement * elem =
    		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
    
    	
    	const DiplomacyProposalRecord * rec = elem->GetProposal();
    	if (InvalidNewProposal(foreignerId, rec))
    		return -1;
    
    	sint32 priority = -1;
    	(void) elem->GetSendPriority(priority);
    	return priority;
    }
    I tried reverting it to rev610, i tied some editing but I'm still getting a crash

    it seems to address this line in diplomacyrecord.cpp
    Code:
    const DiplomacyProposalRecord *DiplomacyRecord::ProposalElement::GetProposal() const
    {
        return g_theDiplomacyProposalDB->Get(m_Proposal);
    }
    npt sure what that causes it there.

    Fromafar said this:
    quote:
    Originally posted by E
    I thought restoring this line

    code:--------------------------------------------------------------------------------
    Assert(foreignerId < m_diplomacy.size() );
    --------------------------------------------------------------------------------

    to

    code:--------------------------------------------------------------------------------
    sint32 Diplomat::GetNewProposalPriority(const PLAYER_INDEX foreignerId, const PROPOSAL_TYPE proposalType ) const
    --------------------------------------------------------------------------------

    would fix the new CTD



    Adding or removing Assert statements will do nothing to prevent CTDs in the final version. Those are active only in the debug version and report expected unexpected situations. In this case, the Assert is quite useless - even in the debug version. The foreigner Id is used as index in the line before the Assert, so when using a wrong index, it could have crashed before reaching the Assert.

    Because the reported crash is attributed to the GetProposal() call, you have already passed the Assert statements. Are you running the debug version? Set a breakpoint (or run until you get the automatic breakpoint when the crash occurs) at the line


    Code:
    const DiplomacyProposalRecord * rec = elem->GetProposal();
    and examine the value of elem. It could be NULL, which would definitely cause a CTD.

    I tried reverting etc. just kind of loat now.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com
Working...
X