Announcement

Collapse
No announcement yet.

[DEBUG] Maq's CanThisCargoUnloadAt crash

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

  • [DEBUG] Maq's CanThisCargoUnloadAt crash

    Originally posted by Maquiladora
    I tried carrying on my current game with 714, but i got a similar error as i reported above. Happens on an AI turn.

    Code:
      0x0053c5c2  [?CanThisCargoUnloadAt@UnitData@@QBE_NABVUnit@@ABVMapPoint@@1AB_N@Z + 0x5c]
      0x0053c54f  [?CanAtLeastOneCargoUnloadAt@UnitData@@QBE_NABVMapPoint@@0AB_N@Z + 0x60]
      0x00536d4f  [?CanAtLeastOneCargoUnloadAt@Unit@@QBE_NABVMapPoint@@0AB_N@Z + 0x22]
      0x004a862e  [?CanAtLeastOneCargoUnloadAt@ArmyData@@QBE_NABVMapPoint@@0AB_N@Z + 0x47]
      0x004943c2  [?CanAtLeastOneCargoUnloadAt@Army@@QBE_NABVMapPoint@@0_N@Z + 0x22]
      0x00730440  [?TransportPathCallback@RobotAstar2@@AAEHABHABVMapPoint@@10AAMAAW4ASTAR_ENTRY_TYPE@@@Z + 0xdb]
      0x0073095b  [?EntryCost@RobotAstar2@@EAEHABVMapPoint@@0AAMAAHAAW4ASTAR_ENTRY_TYPE@@@Z + 0x69]
      0x0073210c  [?InitPoint@UnitAstar@@UAEHPAVAstarPoint@@0ABVMapPoint@@M1@Z + 0x126]
      0x0072cedd  [?FindPath@Astar@@QAE_NABVMapPoint@@0AAVPath@@AAMHHAAH@Z + 0x5fc]
      0x00733e02  [?FindPath@UnitAstar@@QAEHVArmy@@HIIABVMapPoint@@H1AAVPath@@AAH2AAMHHHH3ABHHH@Z + 0x4ca]
      0x00730852  [?FindPath@RobotAstar2@@QAE_NABW4PathType@1@ABVArmy@@ABIABVMapPoint@@3AB_NABHABMAAVPath@@AAM@Z + 0x1fc]
      0x009c2a11  [?FindPathToBoard@CTPAgent@@QAE_NABIABVMapPoint@@AB_NAAVPath@@@Z + 0xea]
      0x009bb8ed  [?GotoTransportTaskSolution@CTPGoal@@IAE_NPAVCTPAgent@@0ABW4SUB_TASK_TYPE@@@Z + 0x4a9]
      0x009be132  [?LoadTransport@CTPGoal@@IAE_NPAVCTPAgent@@0@Z + 0xb6]
      0x009bde3b  [?TryTransport@CTPGoal@@IAE_NPAVCTPAgent@@ABVMapPoint@@@Z + 0xbf]
      0x009bc875  [?GotoGoalTaskSolution@CTPGoal@@IAE_NPAVCTPAgent@@ABVMapPoint@@ABW4SUB_TASK_TYPE@@@Z + 0xa7b]
      0x009b9195  [?Execute_Task@CTPGoal@@UAE?AW4GOAL_RESULT@@XZ + 0x33b]
      0x009a4776  [?Execute_Task@Plan@@QAE?AW4GOAL_RESULT@@XZ + 0x23]
      0x009a949f  [?Match_Resources@Scheduler@@QAEX_N@Z + 0xe7]
      0x009e4941  [?GEVHookCallback@CtpAi_ProcessMatchesEvent@@EAE?AW4GAME_EVENT_HOOK_DISPOSITION@@W4GAME_EVENT@@PAVGameEventArgList@@@Z + 0x99]
      0x0061cec1  [?Activate@GameEventHook@@QBE?AW4GAME_EVENT_ERR@@PAVGameEventArgList@@HAAH@Z + 0x9b]
      0x0061dc4e  [?ActivateHook@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@W4GAME_EVENT@@PAVGameEventArgList@@HAAH@Z + 0x40]
      0x0061b1fb  [?Process@GameEvent@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x2d]
      0x0061da23  [?ProcessHead@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0x4b]
      0x0061d9ae  [?Process@GameEventManager@@QAE?AW4GAME_EVENT_ERR@@XZ + 0xa0]
      0x0040f6a2  [?Process@CivApp@@QAEHXZ + 0x101]
      0x0040889e  [?CivMain@@YGHPAUHINSTANCE__@@0PADH@Z + 0x3ea]
      0x004082db  [WinMain@16 + 0x72]
      0x009f4e7c  [WinMainCRTStartup + 0x134]

    well I cant figure it out. I didn't touch this code and I don't see what the difference is between 700 and 714.

    I tried a debug version and the first, before start up I got:

    Code:
    Assertion failed: setnewh.cpp line 52  new_p == 0
    then loading his save game I got another assertion failure
    Code:
    diplomat.cpp Line 870
    then at end turn,, where it crashed in a normal build i get a crah and the debug points me to spritefile::ReadData (like my tile crash)

    so something is odd

    here's the link to his saved game


    and another one same crash
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    i have confirmed this crash in separategames numerous times. any idea where it came from?
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #3
      ok trying to rever the problem i went through ctp2ai and unitdata and there was no issues but armydata may be the problem because iget these compile errors and they are related to water

      Code:
      ...ctp2_code\gs\gameobj\ArmyData.cpp(843) : error C2556: 'short __thiscall ArmyData::CountMovementTypeSea(void) const' : overloaded function differs only by return type from 'unsigned int 
      __thiscall ArmyData::CountMovementTypeSea(void) const'
              ...ctp2_code\gs\gameobj\ArmyData.h(161) : see declaration of 'CountMovementTypeSea'
      ...ctp2_code\gs\gameobj\ArmyData.cpp(843) : error C2371: 'CountMovementTypeSea' : redefinition; different basic types
              ...ctp2_code\gs\gameobj\ArmyData.h(161) : see declaration of 'CountMovementTypeSea'
      ...ctp2_code\gs\gameobj\ArmyData.cpp(1705) : error C2264: 'CountMovementTypeSea' : error in function definition or declaration; function not called
      ...ctp2_code\gs\gameobj\ArmyData.cpp(7088) : error C2248: 'm_array' : cannot access protected member declared in class 'CellUnitList'
              ..\gs\world\cellunitlist.h(197) : see declaration of 'm_array'
      Formerly known as "E" on Apolyton

      See me at Civfanatics.com

      Comment


      • #4
        Re: [DEBUG] Maq's CanThisCargoUnloadAt crash

        Originally posted by E
        I tried a debug version and the first, before start up I got:

        Code:
        Assertion failed: setnewh.cpp line 52  new_p == 0
        I get this two, you shouldn't find this file on your computer and the assert isn't recorded in the log files.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #5
          It looks like my standardisation attempts are not appreciated by MSVC6.

          Regarding the CanThisCargoUnloadAt crash: the original code had something like
          Code:
          sint32 Num() const { if  (!this) return 0 else return m_nElements; }
          in CellUnitList.h. This is not good: executing a method call on a NULL pointer is undefined behaviour (meaning the compiler can do anything it wants) according to the standard. MS has apparently decided to not crash until you actually try to access members or derefence the pointer in some other way, but expecting NULL->Num() to be 0 is not portable. Changing it to
          Code:
          sint32 Num() const { return m_nElements; }
          uncovers some invalid calls, such as the dest_army->Num() in UnitData::CanThisCargoUnloadAt (where the_dest_army may be NULL), but that is just a matter of further code improvement.

          The other issue looks like the set_new_handler is causing problems. I introduced it to make a failing new throw a std::bad_alloc exception (MSVC has it returning NULL by default). If it doesn't work for MSVC6, feel free to remove it.

          And E, it is unwise to revert only part of my changes. Reverting ArmyData.cpp (containing a modified method signature) without reverting the declaration in ArmyData.h . No compiler is going to like that.

          For the "loading save game" crash, you may have to check the revision that was used to save the game. I did restore the format in revision 710, so there may be a problem when you try to load a game that was saved before revision 710.

          Comment


          • #6
            the change compiled and i tested it on maq's save game and it worked. so i think this action is closed.
            Formerly known as "E" on Apolyton

            See me at Civfanatics.com

            Comment

            Working...
            X