Afforess
The White Wizard
First off, I know The J has a python modcomp that "obsoletes" corporations, but I have a (unnatural) aversion to python, and it technically doesn't "obsolete" corporations the way I would in the SDK.
I added an obsolete tag to CvCorporationInfo, and some code to CvTeam in ProcessTechs(), but all it seems to do is lock up my game when I research the obsoletion tech, so I'm sure I mucked it up.
Here's the code from ProcessTechs, red code is added by me, regular text is default Firaxis code:
I'm sure there is more code than this I have to change, but I don't see why this as it is causes a lock-up. (It doesn't CTD, just locks the game up, as if in an infinite loop)
I added an obsolete tag to CvCorporationInfo, and some code to CvTeam in ProcessTechs(), but all it seems to do is lock up my game when I research the obsoletion tech, so I'm sure I mucked it up.
Here's the code from ProcessTechs, red code is added by me, regular text is default Firaxis code:
Code:
for (iI = 0; iI < GC.getNumCorporationInfos(); ++iI)
{
if (GC.getCorporationInfo((CorporationTypes)iI).getTechPrereq() == eIndex)
{
if (!(GC.getGameINLINE().isCorporationFounded((CorporationTypes)iI)))
{
iBestValue = MAX_INT;
eBestPlayer = NO_PLAYER;
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
if (GET_PLAYER((PlayerTypes)iJ).getTeam() == getID())
{
iValue = 10;
iValue += GC.getGameINLINE().getSorenRandNum(10, "Found Corporation (Player)");
if (GET_PLAYER((PlayerTypes)iJ).getCurrentResearch() != eIndex)
{
iValue *= 10;
}
if (iValue < iBestValue)
{
iBestValue = iValue;
eBestPlayer = ((PlayerTypes)iJ);
}
}
}
}
if (eBestPlayer != NO_PLAYER)
{
GET_PLAYER(eBestPlayer).foundCorporation((CorporationTypes)iI);
bFirstBonus = true;
}
}
}
[COLOR=Blue] else if (GC.getCorporationInfo((CorporationTypes)iI).getObsoleteTech() == eIndex)
{
bool bObsolete = false;
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
if (GET_PLAYER((PlayerTypes)iJ).getTeam() == getID())
{
if (GET_PLAYER((PlayerTypes)iJ).hasHeadquarters((CorporationTypes)iI))
{
CvCity* pHeadquarters = GC.getGameINLINE().getHeadquarters((CorporationTypes)iI);
if (NULL != pHeadquarters)
{
bObsolete = true;
}
}
}
}
}
if (bObsolete)
{
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
int iLoop;
CvCity* pLoopCity;
for (pLoopCity = GET_PLAYER((PlayerTypes)iJ).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iJ).nextCity(&iLoop))
{
pLoopCity->setHasCorporation((CorporationTypes)iI, false, false, false);
pLoopCity->updateCorporation();
pLoopCity->setInfoDirty(true);
}
}
}
}
}
}
}
}
}[/COLOR]
I'm sure there is more code than this I have to change, but I don't see why this as it is causes a lock-up. (It doesn't CTD, just locks the game up, as if in an infinite loop)