bool CvCity::canTrain(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost, bool bIgnoreUpgrades) const
{
if (eUnit == NO_UNIT)
{
return false;
}
if (GC.getUnitInfo(eUnit).getMinLevel() > 0)
{
return false;
}
if (isSettlement())
{
return false;
}
return canUpgrade(eUnit, bContinue, bTestVisible, bIgnoreCost, bIgnoreUpgrades);
}
bool CvCity::canUpgrade(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost, bool bIgnoreUpgrades) const
//FfH: End Modify
{
if (eUnit == NO_UNIT)
{
return false;
}
if(GC.getUSE_CAN_TRAIN_CALLBACK())
{
CyCity* pyCity = new CyCity((CvCity*)this);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
argsList.add(eUnit);
argsList.add(bContinue);
argsList.add(bTestVisible);
argsList.add(bIgnoreCost);
argsList.add(bIgnoreUpgrades);
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "canTrain", argsList.makeFunctionArgs(), &lResult);
delete pyCity; // python fxn must not hold on to this pointer
if (lResult == 1)
{
return true;
}
}
if (!(GET_PLAYER(getOwnerINLINE()).canTrain(eUnit, bContinue, bTestVisible, bIgnoreCost)))
{
return false;
}
EDIT: I think I see it... since there isn't a bIgnoreUpgrades it isn't calling the function listed first there. It is actually calling a function over in CvPlayer.cpp... I guess the GET_PLAYER should have tipped me off on that one.
What code would I have to add to the buildinginfo file for a building that adds food to a desert tile? Production to a peak tile?
Bonus to as in +3
and for the second question
Lets say I want the civilisation to get an additional bonus to production, food, comerce from a mine, farm or other imrovement.
If someone were to add tags for peaks (like the tags for hills) I would greatly appreciate it. Peaks really are a hassle.
Completely unrelated, but how would I limit a unit to moving only on tundra and snow? I I have it so that my Ice II summon (Frost Giant) isn't supposed to enter other terrains and it mostly working, but they can still enter any tile with a feature. I can make all the features impassibel for them too, but that seems too limiting. I don't want them in Jungles or Flood Plains or Scrubs, of course, but forests seem to be a problem. It seems like too much to block them from traveling in forests on ice or tundra terrain, but I don't see another way to stop them from traveling in the temperate or tropical lands otherwise.