Announcement

Collapse
No announcement yet.

[debug] 627 GetTerrainType@Cell crash

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

  • [debug] 627 GetTerrainType@Cell crash

    Code:
      0x0045ce5a  [?GetTerrainType@Cell@@QBEHXZ + 0xa]
      0x004f90ec  [?terrainutil_GetTerrainEffect@@YAPBVEffect@TerrainImprovementRecord@@PBV2@ABVMapPoint@@@Z + 0x19]
      0x004f9361  [?terrainutil_GetProductionCost@@YAHHABVMapPoint@@H@Z + 0xbe]
      0x004cc1a2  [?ComputeTowerPositions@GaiaController@@QAEXXZ + 0x2af]
      0x004cc2a9  [?BuildProcessingTowers@GaiaController@@QAEXXZ + 0x35]
      0x0089aeca  [?BeginTurn@CtpAi@@SAXH@Z + 0x224]
      0x005390f6  [?GEVHookCallback@BeginTurnEvent@@EAE?AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVGameEventArgList@@@Z + 0x8d]
      0x005c1e82  [?Activate@GameEventHook@@QBE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@HAAH@Z + 0x8e]
      0x005c2ae0  [?ActivateHook@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgList@@HAAH@Z + 0x40]
      0x005c07f2  [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x2d]
      0x005c2954  [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x2f]
      0x005c28fb  [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x7b]
      0x005c2870  [?ArglistAddEvent@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVENT@@PAVGameEventArgList@@@Z + 0x13d]
      0x005c2725  [?AddEvent@GameEventManager@@QAA?AW4GAME_EVENT_ERR@@W4GAME_EVENT_INSERT@@W4GAME_EVENT@@ZZ + 0xe5]
      0x0043e076  [?dh_endTurn@@YAXPAVDQAction@@PAVSequence@@W4DHEXECUTE@@@Z + 0x35]
      0x00437ef2  [?HandleNextAction@Director@@QAEXXZ + 0xfb]
      0x00437d92  [?Process@Director@@QAEXXZ + 0x25]
      0x0040ebbf  [?ProcessUI@CivApp@@QAEHIAAI@Z + 0x22c]
      0x0040eee0  [?Process@CivApp@@QAEHXZ + 0xa7]
    well I think its trying to call this in cell.h
    Code:
    TERRAIN_TYPES GetTerrainType() const { return TERRAIN_TYPES(m_terrain_type); }
    via
    Code:
    const TerrainImprovementRecord::Effect *terrainutil_GetTerrainEffect(const TerrainImprovementRecord *rec,
    																	 const MapPoint &pos)
    {
    	return terrainutil_GetTerrainEffect(rec, (sint32)g_theWorld->GetCell(pos)->GetTerrainType());
    }

    So whats the problem? it works when I start new games?

    I do see governor call it this way:
    Code:
    const TERRAIN_TYPES terrain_type = g_theWorld->GetTerrainType(pos);
    is there a reason for the difference or should one be changed to the other?

    EDIT: well I did try to match it the governor's way, still get a the "long turn" and then game not responding.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    I suspect this crash is caused by
    Code:
    g_theWorld->GetCell(pos)
    evaluating to NULL, or some other invalid pointer.

    Comment


    • #3
      I see that these files call terrain type different one uses a uint32 shouldn't an unseen cell call the same a cell?

      Code:
      world\Cell.h(210):	TERRAIN_TYPES GetTerrainType() const { return TERRAIN_TYPES(m_terrain_type); }
      
      world\UnseenCell.h(183):	uint32 GetTerrainType() { return m_terrain_type; }
      
      world\World.h(404):    TERRAIN_TYPES GetTerrainType(const MapPoint &pos) const;
      Formerly known as "E" on Apolyton

      See me at Civfanatics.com

      Comment


      • #4
        Can you find the definition of TERRAIN_TYPES?

        Comment


        • #5
          Re: [debug] 627 GetTerrainType@Cell crash

          Originally posted by E
          Code:
            0x0045ce5a  [?GetTerrainType@Cell@@QBEHXZ + 0xa]
            0x004f90ec  [?terrainutil_GetTerrainEffect@@YAPBVEffect@TerrainImprovementRecord@@PBV2@ABVMapPoint@@@Z + 0x19]
            0x004f9361  [?terrainutil_GetProductionCost@@YAHHABVMapPoint@@H@Z + 0xbe]
            0x004cc1a2  [?ComputeTowerPositions@GaiaController@@QAEXXZ + 0x2af]
          So whats the problem?
          Focus your attention on the GetCell call. John is probably right. What is the value of pos when you call it?
          Don't worry too much about the conversion between uint32 and TERRAIN_TYPES values. That is irrelevant when the Cell is invalid.

          it works when I start new games?
          Probably. At least for a while. You won't be able to build the Gaia controller at the start of a new game.

          Comment

          Working...
          X