Not an emergency but I've been troubleshooting some odd CtD's on 0.40. I dont know if they existed in 0.34 or not.
The first was the CtD when map trading. I made the following change to CvDeal::StartTrade to keep the crashes from happening:
I hit upon this solution when I noticed that the CtD never happened if I went into the worldbuilder and exited (took me forever to track that one down). I went through everything going into and out of the worldbuilder did and finally came up with the GC.getMapINLINE().updateVisibility() as what kept the crash from happening.
Doesn't make much sense to me, and I have no idea what would have changed. But at the time I just left it in and went on.
Then today Im checking out another CtD when a unit moves (a ship with the sentry promotion). Again going into worldbuilder keeps the crash from happening. So I insert the following in CvPlot::changeVisibilityCount:
This jusr updates the visibility for that effected plot (changeVisibilityCount happens on all plots around a moving unit). The Map version of the function I pointed to above just runs this exact function on every plot on the map. This is what updateVisibility does:
It doesnt make any sense to me, and I wonder if their are more issues it is causing. So I thought I would see if you guys have any ideas. Let me know if you guys can think of anything.
The first was the CtD when map trading. I made the following change to CvDeal::StartTrade to keep the crashes from happening:
Code:
case TRADE_MAPS:
//FfH: Added by Kael 12/21/2008 (prevents a CtD when map trading)
GC.getMapINLINE().updateVisibility();
//FfH: End Add
for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
{
pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
if (pLoopPlot->isRevealed(GET_PLAYER(eFromPlayer).getTeam(), false))
{
pLoopPlot->setRevealed(GET_PLAYER(eToPlayer).getTeam(), true, false, GET_PLAYER(eFromPlayer).getTeam(), false);
}
}
for (iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
if (GET_PLAYER((PlayerTypes)iI).getTeam() == GET_PLAYER(eToPlayer).getTeam())
{
GET_PLAYER((PlayerTypes)iI).updatePlotGroups();
}
}
}
break;
I hit upon this solution when I noticed that the CtD never happened if I went into the worldbuilder and exited (took me forever to track that one down). I went through everything going into and out of the worldbuilder did and finally came up with the GC.getMapINLINE().updateVisibility() as what kept the crash from happening.
Doesn't make much sense to me, and I have no idea what would have changed. But at the time I just left it in and went on.
Then today Im checking out another CtD when a unit moves (a ship with the sentry promotion). Again going into worldbuilder keeps the crash from happening. So I insert the following in CvPlot::changeVisibilityCount:
Code:
updateVisibility();
This jusr updates the visibility for that effected plot (changeVisibilityCount happens on all plots around a moving unit). The Map version of the function I pointed to above just runs this exact function on every plot on the map. This is what updateVisibility does:
Code:
void CvPlot::updateVisibility()
{
PROFILE("CvPlot::updateVisibility");
if (!GC.IsGraphicsInitialized())
{
return;
}
setLayoutDirty(true);
updateSymbolVisibility();
updateFeatureSymbolVisibility();
updateRouteSymbol();
CvCity* pCity = getPlotCity();
if (pCity != NULL)
{
pCity->updateVisibility();
}
}
It doesnt make any sense to me, and I wonder if their are more issues it is causing. So I thought I would see if you guys have any ideas. Let me know if you guys can think of anything.