I did it ... via SLIC:
Code:
int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnitType) {
city_t tmpCity;
int_t tmpUnitType;
location_t tmpCityLoc;
location_t tmpWaterLoc;
int_t tmpPlayer;
int_t i;
int_t tmpIsOcean;
tmpCity = theCity;
tmpUnitType = theUnitType;
tmpCityLoc = tmpCity.location;
tmpPlayer = tmpCity.owner;
tmpIsOcean = 0;
if(CityIsValid(tmpCity)) {
// make sure the AI doesn't build a navy at the lake
if(!IsHumanPlayer(tmpPlayer)) {
if(UnitDB(tmpUnitType).WoodenShip
|| UnitDB(tmpUnitType).IsSubmarine
|| UnitDB(tmpUnitType).ActiveDefenseOnlyWhenCarryingEnablers
||(!UnitDB(tmpUnitType).CanEntrench
&& !UnitDB(tmpUnitType).NoFuelThenCrash
&& !UnitDB(tmpUnitType).CanBeExpelled
&& !UnitDB(tmpUnitType).CanBeSued)
&& !UnitDB(tmpUnitType).IsSubmarine) {
for(i = 0; i <= 7 ; i = i + 1) {
if(GetNeighbor(tmpCityLoc, i, tmpWaterLoc)) {
if(IsWater(tmpWaterLoc)) {
if(GetContinentSize(tmpWaterLoc) >= (GetMapWidth() / 2)) {
tmpIsOcean = 1;
}
}
}
}
if(tmpIsOcean == 0) {
return 0;
}
}
}
}
return 1;
}
Another obsolete workaround ...
Bookmarks