Single Player bugs and crashes v39 plus (SVN) - After the 20th of July 2019

i hope so because i keep getting this now??

Both religions & corporations indexes are already getting remapped then loading saves look at the RemappedClassType enum and it's usages.
if changes to the assets cause the indexes to be changed since the last time a game was saved all indexes will be changed to the new index unless something no longer exists then it becomes -1.
But removing assets is always a problem then the removed assets are already present in a game and some code might simply not be written to handle such removals.
As he says, removing assets in an ongoing game is always a problem. I'm not trying to find a solution to this anymore because it's beyond my ability.
 
I'am still getting that std::length_error almost everytime I start a new game.
Code:
Exception thrown at 0x7452B0B2 in Civ4BeyondSword.exe: Microsoft C++ exception: std::length_error at memory location 0x0019F990.
That has to be caused by the xml loading changes or the PPIO merge because it already happened before the memory allocator change.
We never had that error before the recent set of xml loading changes and I didn't use PPIO much so I don't know if that might have caused such problems.
Did you mean it crashes while generating a new map or entering a scenario for a new game, or while starting the application? If you mean generating a new map, which map script were you using or which scenario?
 
I can't abandon Cannibalism Woldview. My judge (or great specialist) can remove slavery, but not cannibalism.
And look like cannibalism isn't working at all, because I can't eat captives...
Cannibalism and Human Sacrifices are not working. I thought we were merging Slavery and Cannibalism into core which would have fixed Cannibalism but we did not get to it by the looks of things. It turns out that Actions on units are not modular. Or more precisely are modular once but not twice and three times. This may also be why the judge can't end Cannibalism, although different units can remove different world views.
 
These three variables are uninitiated in CvPlayer.
Code:
    int m_iExtraCityDefense;
    int m_iDistantUnitSupportCostModifier;
    int m_iReligionSpreadRate;

I won't put these changes in the svn because it takes to long to compile the FinalRelease dll using my laptop it would be nice if another modder could take care of these.
They are initialized to zero, in CvPlayer::init() not in CvPlayer::reset(), but they still set to zero that I can confirm.

However, I find that m_orbitalInfrastructureCount is not init to zero and there may be others
that one doesn't need to init
 
Last edited:
Did you mean it crashes while generating a new map or entering a scenario for a new game, or while starting the application? If you mean generating a new map, which map script were you using or which scenario?
It happens then i start a new game using a random map but i can't remember which map script or scripts i used.

I check that later.
 
They are initialized to zero, in CvPlayer::init() not in CvPlayer::reset(), but they still set to zero that I can confirm.
Are you sure i didn't see them in CvPlayer::init?

While debugging using the debug dll earlier i noticed that these are not beeing set to 0 in a running game.
 
Last edited:
Are you sure i didn't see them in CvPlayer::init?

While debugging using the debug dll earlier i noticed that these are not beeing set to 0 in a running game.
There, this is their init code.
Code:
    setReligionSpreadRate(0);
    setDistantUnitSupportCostModifier(0);
    setExtraCityDefense(0);
When I tested this, I put a breakpoint on CvPlayer::getBuildingClassCountPlusMaking, opened up an initial autosave, and saw those three values (read from the save) were zero, for all players that ran through that breakpoint.
(bad breakpoint choice, it is called for every BuildingClass by CvGame::calculateSyncChecksum)

It may be different when examined by another method I think, because these lines are not in CvPlayer::reset

Edit: Now I put a conditional breakpoint in CvPlayer:: processBuilding to catch if any player has nonzero values of the three variables, and let it auto play, and the breakpoint isn't hit after one turn.
 
Last edited:
There, this is their init code.
Code:
    setReligionSpreadRate(0);
    setDistantUnitSupportCostModifier(0);
    setExtraCityDefense(0);
When I tested this, I put a breakpoint on CvPlayer::getBuildingClassCountPlusMaking(), opened up an initial autosave, and saw those three values (read from the save) were zero, for all players that ran through that breakpoint.

(bad breakpoint choice, it is called for every BuildingClass)

It may be different when examined by another method I think, because these lines are not in CvPlayer::reset

But that only happens in one init function but not in the other one if i remember correctly.

If that specific init function has not been called these variables are uninitiated and that is what i saw in the debugger. Maybe it makes a difference if you load a save or start a new game? But they have to be set to 0 in Reset otherwise they might be uninitiated once they are used in the code for the first time.
 
  • Like
Reactions: Anq
But that only happens in one init function but not in the other one if i remember correctly.

If that specific init function has not been called these variables are uninitiated and that is what i saw in the debugger. Maybe it makes a difference if you load a save or start a new game? But they have to be set to 0 in Reset otherwise they might be uninitiated once they are used in the code for the first time.
I can confirm that when starting a new game, m_iReligionSpreadRate is not set to zero, because the assert in setReligionSpreadRate catches a garbage value (-623191334 from getReligionSpreadRate)
So are the two other variables. They need to be init to zero in CvPlayer::reset
 
I can confirm that when starting a new game, m_iReligionSpreadRate is not set to zero, because the assert in setReligionSpreadRate catches a garbage value (-623191334 from getReligionSpreadRate)
So are the two other variables. They need to be init to zero in CvPlayer::reset
-623191334 in hex is 0xDADADADA, i.e. the value I set newly allocated memory to in the debug allocator. Whenever you see it you know it was never initialized, rather than corrupted some time after initialization.
 
It happens then i start a new game using a random map but i can't remember which map script or scripts i used.

I check that later.
No matter which mapscript I use, it throws std::length_error for me too, if I start with debugger attached. If I start without debugger, the game can finish setting the stage to play.
 
No matter which mapscript I use, it throws std::length_error for me too, if I start with debugger attached. If I start without debugger, the game can finish setting the stage to play.
It is throwing the exception in both cases, just the debugger breaks into it but without ignores it. I had this problem before, but fixing the uninitialized arrays in 10955 appeared to fix it for me.
 
Updated to 10975 this morning and tried starting a new game a few times but crashed when the map began to initialize. Looks like others have had the same problem before.
 
v. 10975.
I still have the same bug with World Wonder buildings: they are not displayed as available for building when I'm in city view.
For example, I have all prerequisites met to build Neanderthal Culture. But it is not displayed in available buildings within city. It is not even listed in "not yet available" buildings.
But at the same time I have Neanderthal Culture listed in the popup list of "Choose what to build next..." And I can queue Neanderthal Culture from there.

Here is save game file.
 
No matter which mapscript I use, it throws std::length_error for me too, if I start with debugger attached. If I start without debugger, the game can finish setting the stage to play.

That screenshot i posted then i reported that issue the first time was from a minidump. I was using the Release dll without debugger attached.
 
There is definitely something with the xml load sequence because the length_error is thrown after LoadPostMenuGlobals exits.

Update: after CvGame::init sequence and after GC.getNumPlayableCivilizationInfos is called by the exe
 
Last edited:
Caught it. The playable civilization count in CvGlobals is uninitialized.
Spoiler :
upload_2019-8-14_22-16-28.png
 
Last edited:
@KaTiON_PT @Toffer90 Era concept page is horribly broken - most of era entries are missing pictures (could be fault of partial FPK update) and texts.
I can't fix those (and commit fix), as my router is almost dead - internet is very slow and spotty.

Edit: somehow something went horribly wrong with FPKs.....
Crashes are most likely result of failed FPK update, hopefully I will be able to update them one by one.....
Sadly I can't update FPKs, which means I'm out of modding for a while.
 
Last edited:
Updated to SVN 10977 and cleared cache. Started custom scenario (GEM) and got some python errors on start:

Traceback (most recent call last):
File "BugEventManager", line 308, in _handleDefaultEvent
File "NaturalWonder_EM", line 16, in onPlotRevealed
File "NaturalWonders", line 196, in checkReveal
File "CvUtil", line 276, in sendMessage
RuntimeError: unidentifiable C++ exception
 
Back
Top Bottom