@Cody: Can you post a savegame so it can be reviewed?
dbkblk, xUPT limit crash; I've set it to 15 but it crashes even with higher values I think. Savegame and minidump attached here
https://www.dropbox.com/s/zh3owtkyj1zppyo/r971-real-rev-01 BC-6000.CivBeyondSwordSave?dl=0
https://www.dropbox.com/s/yxw5x94m8o3b260/MiniDump_970.dmp?dl=0
Make sure you set xUPT limit under BUG, hit "end of turn" for a dozen of times (maybe less) and bang, it will crash. It's definitely connected with xUPT as removing the limit allows the game to continue. Also from what I've seen debugging it, the problem is
here in CvTeam.cpp
Code:
bool CvTeam::isAtWar(TeamTypes eIndex) const
{
if ( eIndex == NO_TEAM )
{
return false;
}
FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");
[COLOR="Red"][B]return m_abAtWar[eIndex];[/B][/COLOR]
}
which in turn led me here
Code:
bool PUF_isEnemy(const CvUnit* pUnit, int iData1, int iData2)
{
FAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0");
FAssertMsg(iData2 != -1, "Invalid data argument, should be >= 0");
TeamTypes eOtherTeam = GET_PLAYER((PlayerTypes)iData1).getTeam();
TeamTypes eOurTeam = GET_PLAYER(pUnit->getCombatOwner(eOtherTeam, pUnit->plot())).getTeam();
if (pUnit->canCoexistWithEnemyUnit(eOtherTeam))
{
return false;
}
return (iData2 ? eOtherTeam != eOurTeam : [COLOR="red"][B]atWar[/B][/COLOR](eOtherTeam, eOurTeam));
}
and here
Code:
bool CvPlot::isVisibleEnemyUnit(PlayerTypes ePlayer) const
{
[B][COLOR="red"]return (plotCheck(PUF_isEnemy, ePlayer, 0, NO_PLAYER, NO_TEAM, PUF_isVisible, ePlayer) != NULL);[/COLOR][/B]
}
and finally here:
Code:
bool CvPlot::isAtMaxLandMilitaryUnitsPerTiles() const
{ // xUPT: check the number of land military units and compare it to the limit (dbkblk, 2015-02)
if (GC.getGameINLINE().getModderGameOption(MODDERGAMEOPTION_MAX_UNITS_PER_TILES) == 0){
// Option disabled
return false;
}
if (this->isCity()){
if (this->getNumMilitaryLandUnits(this->getOwner()) >= (GC.getGameINLINE().getModderGameOption(MODDERGAMEOPTION_MAX_UNITS_PER_TILES) * GC.getDefineINT("UNITS_PER_TILES_CITY_FACTOR", 3))){
return true;
}
}
else{
if (this->getNumMilitaryLandUnits(this->getOwner()) >= GC.getGameINLINE().getModderGameOption(MODDERGAMEOPTION_MAX_UNITS_PER_TILES)){
return true;
}
}
// If there is at least one enemy on the tile, consider it full.
[COLOR="red"][B]if (this->isVisibleEnemyUnit(this->getOwner())){
return true;[/B][/COLOR]
}
return false;
}
It probably has to do with barbarians as ePlayer in isVisibleEnemyUnit is -1
But I don't know how to fix it. Any idea?
Edit: I think I've fixed it but I'm not sure if it could have side effects; I've simply added
if (iData1 = -1)
{
return true;
}
in bool PUF_isEnemy. I have a doubt because at least I think I recall that Player -1 is Pitboss server in MP games. Anyway if you or Afforess have any advice, that would help.
Edit2: no, it doesn't work. Game doesn't crash but you can't peacefully occupy the same tile already occupied by another civ's unit. This leads me to think that the problem is that barbarians are somehow now considered a civ since some revisions now; I don't know when it started, but this also explains the bug when you declare war to barbarians and the fact that they're getting Great People and Golden Ages.
Edit3: well, I think I can solve the crash at least by simply adding a
if (eOtherTeam = BARBARIAN_TEAM)
{
return true;
}
in bool PUF_isEnemy. I'll check later if it works