OK, here is the final version:
In bolt the changes. The first change is a change that replaces a TRUE by a FALSE, and restores the original code at that place.
The consequence of this non-original code was that all the units with the flag HasPopAndCanBuild can't settle a city even if they meet all the other criteria. unfortunatly all and only all settle units have this flag. The consequence is that no settler was able to settle.
The other change is a chnge to make the code compile, in this function there is no pointer on a Cell object defined with the name cell. To get such a pointer you can use g_theWorld->GetCell(pos) if pos is a valid MapPint object.
Since I was modifying this file anyway I corrected the comments a little bit.
In unit.cdb I replaced
Int UnitUpkeep by
Bit(Int) GoldHunger
The name GoldHunger makes it coherent with the other hunger flags, ShieldHunger and FoodHunger, and the Bit makes it optional so that you don't have to add it, to unit.txt so that CTP2 doesn't complain about it if it is missing.
-Martin
Code:
BOOL UDUnitTypeCanSettle(sint32 unit_type, const MapPoint &pos) { #if defined(ACTIVISION_ORIGINAL) sint32 searching = TRUE; const UnitRecord *rec = g_theUnitDB->Get(unit_type); sint32 t = rec->GetSettleCityTypeIndex(); if (t < 0) { return FALSE; } if (g_theUnitDB->Get(t)->GetHasPopAndCanBuild() == FALSE) { return FALSE; } if (g_theWorld->HasCity(pos)) return FALSE; if (rec->GetSettleLand() && g_theWorld->IsLand(pos)) searching = FALSE; else if (rec->GetSettleMountain() && g_theWorld->IsMountain(pos)) searching = FALSE; else if (rec->GetSettleWater() && g_theWorld->IsWater(pos)) searching = FALSE; else if (rec->GetSettleSpace() && g_theWorld->IsSpace(pos)) searching = FALSE; if (searching) return FALSE; return TRUE; #else sint32 i; const UnitRecord *rec = g_theUnitDB->Get(unit_type); sint32 t = rec->GetSettleCityTypeIndex(); if (t < 0) { return FALSE; } if (g_theUnitDB->Get(t)->GetHasPopAndCanBuild() == [b]FALSE[/b]) { return FALSE; } if (g_theWorld->HasCity(pos)) return FALSE; for(i = 0; i < rec->GetNumCanSettleOn(); i++) { if(rec->GetCanSettleOnIndex(i) == [b]g_theWorld->GetCell(pos)->GetTerrain()[/b]) { return TRUE; } } if (rec->GetSettleLand() && g_theWorld->IsLand(pos)) return TRUE; else if (rec->GetSettleMountain() && g_theWorld->IsMountain(pos)) return TRUE; else if (rec->GetSettleWater() && g_theWorld->IsWater(pos)) return TRUE; else if (rec->GetSettleSpace() && g_theWorld->IsSpace(pos)) return TRUE; return FALSE; #endif }
The consequence of this non-original code was that all the units with the flag HasPopAndCanBuild can't settle a city even if they meet all the other criteria. unfortunatly all and only all settle units have this flag. The consequence is that no settler was able to settle.
The other change is a chnge to make the code compile, in this function there is no pointer on a Cell object defined with the name cell. To get such a pointer you can use g_theWorld->GetCell(pos) if pos is a valid MapPint object.
Since I was modifying this file anyway I corrected the comments a little bit.
In unit.cdb I replaced
Int UnitUpkeep by
Bit(Int) GoldHunger
The name GoldHunger makes it coherent with the other hunger flags, ShieldHunger and FoodHunger, and the Bit makes it optional so that you don't have to add it, to unit.txt so that CTP2 doesn't complain about it if it is missing.
-Martin
Comment