mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-17 01:12:39 +01:00
Codechange: Use enum class for water-related enums. (#14804)
This commit is contained in:
@@ -116,9 +116,9 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
|
||||
for (TileIndex t : ta) {
|
||||
if (IsWaterTile(t)) ClearNeighbourNonFloodingStates(t);
|
||||
if (HasTileWaterGround(t)) InvalidateWaterRegion(t);
|
||||
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
|
||||
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WaterClass::Invalid);
|
||||
/* Update company infrastructure counts for objects build on canals owned by nobody. */
|
||||
if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(t, OWNER_NONE) || IsTileOwner(t, OWNER_WATER))) {
|
||||
if (wc == WaterClass::Canal && owner != OWNER_NONE && (IsTileOwner(t, OWNER_NONE) || IsTileOwner(t, OWNER_WATER))) {
|
||||
Company::Get(owner)->infrastructure.water++;
|
||||
DirtyCompanyInfrastructureWindows(owner);
|
||||
}
|
||||
@@ -769,7 +769,7 @@ static bool TryBuildLightHouse()
|
||||
}
|
||||
|
||||
/* Only build lighthouses at tiles where the border is sea. */
|
||||
if (!IsTileType(tile, MP_WATER) || GetWaterClass(tile) != WATER_CLASS_SEA) return false;
|
||||
if (!IsTileType(tile, MP_WATER) || GetWaterClass(tile) != WaterClass::Sea) return false;
|
||||
|
||||
for (int j = 0; j < 19; j++) {
|
||||
int h;
|
||||
@@ -873,7 +873,7 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
||||
ObjectType type = GetObjectType(tile);
|
||||
if ((type == OBJECT_OWNED_LAND || type >= NEW_OBJECT_OFFSET) && new_owner != INVALID_OWNER) {
|
||||
SetTileOwner(tile, new_owner);
|
||||
if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
|
||||
if (GetWaterClass(tile) == WaterClass::Canal) {
|
||||
Company::Get(old_owner)->infrastructure.water--;
|
||||
Company::Get(new_owner)->infrastructure.water++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user