Cybah
Emperor
- Joined
- Jun 22, 2007
- Messages
- 1,481
Grrrr! Sometimes this game really annoys me.
One leadertrait in my mod gives a chance of X% that you get a unique building instead of the common building.
When this happens, for some reason the "BuildingClassNeededs" function won't work correctly anymore.
Example:
I have constructed a forge and this forge get switched for a malinese forge by
For some reason, I won't be able to construct the Colossus in that city (it says it requires a forge).
I don't have any idea to fix this problem. Need help.
Edit... should have something to do with this found in CvCity.cpp:
One leadertrait in my mod gives a chance of X% that you get a unique building instead of the common building.
When this happens, for some reason the "BuildingClassNeededs" function won't work correctly anymore.
Example:
I have constructed a forge and this forge get switched for a malinese forge by
PHP:
pCity.setNumRealBuilding(iBuildingType,0)
pCity.setNumRealBuilding(l_UniqueBuildings[chance],1)
For some reason, I won't be able to construct the Colossus in that city (it says it requires a forge).
I don't have any idea to fix this problem. Need help.
Edit... should have something to do with this found in CvCity.cpp:
PHP:
bool CvCity::canConstruct(BuildingTypes eBuilding, bool bContinue, bool bTestVisible, bool bIgnoreCost) const
{
...
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).isBuildingClassNeededInCity(iI))
{
ePrereqBuilding = ((BuildingTypes)(GC.getCivilizationInfo(getCivilizationType()).getCivilizationBuildings(iI)));
if (ePrereqBuilding != NO_BUILDING)
{
if (0 == getNumBuilding(ePrereqBuilding) /* && (bContinue || (getFirstBuildingOrder(ePrereqBuilding) == -1))*/)
{
return false;
}
}
}
}