-- checks if city is between River and Sea and adds this condition (normally it would be treated like city with Lake)
-- Sea and Lake = FreshWater == true, Water>=1 == true true
-- Lake and River = FreshWater == true, Water>=1 == true true
-- Sea and River = FreshWater == true, Water>=1 == true true? (should be false)
-- Sea = FreshWater == false, Water>=1 == true false
-- Lake = FreshWater == true, Water>=1 == true true
-- River = FreshWater == true, Water>=1 == false false
function IsLakeWithOcean(ePlayer, eCity, eBuilding)
if not tValidIsNearLake[eBuilding] then return true end
if bReachedMaxEra then return false end
local pPlayer = Players[ePlayer]
if not pPlayer:IsAlive() then return false end
local pCity = pPlayer:GetCityByID(eCity)
local iCityX = pCity:GetX()
local iCityY = pCity:GetY()
if pCity:IsCoastal(1) then -- city is adjacent to at least one water tile
for dir = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1 do
if Map.PlotDirection(iCityX, iCityY, dir):IsLake() then
return true
end
end
end
return false
end
GameEvents.CityCanConstruct.Add(IsLakeWithOcean)