Founding a pantheon without a single city crashes the game

Zacchon

Chieftain
Joined
May 11, 2015
Messages
1
Location
Helsinki, Finland
The game asked me to found a pantheon but crashed after doing so, most likely because I had no cities.

Doesn't seem like a very common problem, just because people tend to found cities pretty early. I walked into ruins on turn 41 and got 30 faith so that's how it happened.

But for the sake of zero-city-challenge this is quite an annoying issue. Easy to avoid by the "new random seed" option, though.
 
Found the cause of the crash. For any future DLL modders, the problem is in CvReligionClasses.cpp, in the function CvGameReligions::FoundPantheon(). The problematic line is this one:
Code:
args->Push(GET_PLAYER(ePlayer).getCapitalCity()->GetID());
If GET_PLAYER(ePlayer).getCapitalCity() is NULL, the game crashes with a null pointer dereference. To fix it, GET_PLAYER(ePlayer).getCapitalCity() can be stored in a CvCity pointer, and if it's NULL, the script engine check is skipped.
 
Back
Top Bottom