xienwolf
Deity
Yes, Max is correct.
Section in Cyan says that there will be an instant placement of any Spawn Unittype on Unique Features.
Was looking for where precisely the whole Advanced Start setup is defined so I could see why/how they block the spawning of units for it (I assume they actually go through and despawn any pre-generated units, but that would require reseting the World Unit Counter as well), and I stumbled on the Map Regeneration code section. Could be rather easy to clean that up so that regenerated maps actually work just like normally generated ones.
EDIT: still not finding Advanced Start's method. No mention of it at all in Map Generation section of the SDK. So for now I'll assume that it creates a WorldBuilder Save setup of the randomly generated map, runs city placement like as if you are using WorldBuilder, then re-saves whatever work you did and loads it like a scenario. In that case, you would skip the normal Map Generation functions I think (no random placement of anything), and thus miss this line of code. Any pre-made map should result in the same "issue".
Code:
void CvMapGenerator::addUniqueImprovements()
{
CvPlot* pPlot;
int iBestValue = 0;
int iValue = 0;
int iChance = GC.getDefineINT("IMPROVEMENT_UNIQUE_CHANCE") + GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getUniqueFeatureChance();
CvPlot* pBestPlot = NULL;
for (int iI = 0; iI < GC.getNumImprovementInfos(); iI++)
{
if (GC.getImprovementInfo((ImprovementTypes)iI).isUnique())
{
iBestValue = 0;
pBestPlot = NULL;
if (GC.getGameINLINE().getMapRandNum(100, "Unique Improvements") < iChance)
{
for (int iJ = 0; iJ < GC.getMapINLINE().numPlotsINLINE(); iJ++)
{
pPlot = GC.getMapINLINE().plotByIndexINLINE(iJ);
FAssert(pPlot != NULL);
if (pPlot->canHaveImprovement((ImprovementTypes)iI))
{
if (pPlot->getBonusType(NO_TEAM) == NO_BONUS)
{
iValue = GC.getGameINLINE().getMapRandNum(10000, "Unique Improvements");
if (iValue > iBestValue)
{
iBestValue = iValue;
pBestPlot = pPlot;
}
}
}
}
if (pBestPlot != NULL)
{
pBestPlot->setImprovementType((ImprovementTypes)iI);
[COLOR="Cyan"]if (GC.getImprovementInfo((ImprovementTypes)iI).getSpawnUnitType() != NO_UNIT)
{
if (!GC.getGameINLINE().isOption(GAMEOPTION_NO_BARBARIANS))
{
GET_PLAYER(BARBARIAN_PLAYER).initUnit(((UnitTypes)GC.getImprovementInfo((ImprovementTypes)iI).getSpawnUnitType()), pBestPlot->getX(), pBestPlot->getY());[/COLOR]
}
}
}
}
}
}
}
Section in Cyan says that there will be an instant placement of any Spawn Unittype on Unique Features.
Was looking for where precisely the whole Advanced Start setup is defined so I could see why/how they block the spawning of units for it (I assume they actually go through and despawn any pre-generated units, but that would require reseting the World Unit Counter as well), and I stumbled on the Map Regeneration code section. Could be rather easy to clean that up so that regenerated maps actually work just like normally generated ones.
EDIT: still not finding Advanced Start's method. No mention of it at all in Map Generation section of the SDK. So for now I'll assume that it creates a WorldBuilder Save setup of the randomly generated map, runs city placement like as if you are using WorldBuilder, then re-saves whatever work you did and loads it like a scenario. In that case, you would skip the normal Map Generation functions I think (no random placement of anything), and thus miss this line of code. Any pre-made map should result in the same "issue".