summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/saveload/afterload.cpp4
-rw-r--r--src/settings_type.h2
-rw-r--r--src/town.h14
-rw-r--r--src/town_cmd.cpp2
-rw-r--r--src/town_type.h8
5 files changed, 13 insertions, 17 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index b5095c521..5e7521d26 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2110,7 +2110,7 @@ bool AfterLoadGame()
_settings_game.economy.town_layout = TL_BETTER_ROADS;
} else {
_settings_game.economy.allow_town_roads = true;
- _settings_game.economy.town_layout = _settings_game.economy.town_layout - 1;
+ _settings_game.economy.town_layout = static_cast<TownLayout>(_settings_game.economy.town_layout - 1);
}
/* Initialize layout of all towns. Older versions were using different
@@ -2129,7 +2129,7 @@ bool AfterLoadGame()
case 5: layout = 1; break;
case 0: layout = 2; break;
}
- t->layout = layout - 1;
+ t->layout = static_cast<TownLayout>(layout - 1);
}
}
diff --git a/src/settings_type.h b/src/settings_type.h
index 054f2a7be..83d909130 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -482,7 +482,7 @@ struct EconomySettings {
uint8 town_growth_rate; ///< town growth rate
uint8 larger_towns; ///< the number of cities to build. These start off larger and grow twice as fast
uint8 initial_city_size; ///< multiplier for the initial size of the cities compared to towns
- TownLayoutByte town_layout; ///< select town layout, @see TownLayout
+ TownLayout town_layout; ///< select town layout, @see TownLayout
TownCargoGenMode town_cargogen_mode; ///< algorithm for generating cargo from houses, @see TownCargoGenMode
bool allow_town_roads; ///< towns are allowed to build roads (always allowed when generating world / in SE)
TownFounding found_town; ///< town founding.
diff --git a/src/town.h b/src/town.h
index 3d7d00b75..310b4c439 100644
--- a/src/town.h
+++ b/src/town.h
@@ -90,16 +90,16 @@ struct Town : TownPool::PoolItem<&_town_pool> {
CargoTypes cargo_accepted_total; ///< NOSAVE: Bitmap of all cargoes accepted by houses in this town.
StationList stations_near; ///< NOSAVE: List of nearby stations.
- uint16 time_until_rebuild; ///< time until we rebuild a house
+ uint16 time_until_rebuild; ///< time until we rebuild a house
- uint16 grow_counter; ///< counter to count when to grow, value is smaller than or equal to growth_rate
- uint16 growth_rate; ///< town growth rate
+ uint16 grow_counter; ///< counter to count when to grow, value is smaller than or equal to growth_rate
+ uint16 growth_rate; ///< town growth rate
- byte fund_buildings_months; ///< fund buildings program in action?
- byte road_build_months; ///< fund road reconstruction in action?
+ byte fund_buildings_months; ///< fund buildings program in action?
+ byte road_build_months; ///< fund road reconstruction in action?
- bool larger_town; ///< if this is a larger town and should grow more quickly
- TownLayoutByte layout; ///< town specific road layout
+ bool larger_town; ///< if this is a larger town and should grow more quickly
+ TownLayout layout; ///< town specific road layout
std::list<PersistentStorage *> psa_list;
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 367eba45f..ef87d82c5 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -177,7 +177,7 @@ void Town::InitializeLayout(TownLayout layout)
return;
}
- this->layout = TileHash(TileX(this->xy), TileY(this->xy)) % (NUM_TLS - 1);
+ this->layout = static_cast<TownLayout>(TileHash(TileX(this->xy), TileY(this->xy)) % (NUM_TLS - 1));
}
/**
diff --git a/src/town_type.h b/src/town_type.h
index 53df4a0e7..820408360 100644
--- a/src/town_type.h
+++ b/src/town_type.h
@@ -76,10 +76,8 @@ enum Ratings {
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
};
-/**
- * Town Layouts
- */
-enum TownLayout {
+/** Town Layouts. It needs to be 8bits, because we save and load it as such */
+enum TownLayout : byte {
TL_BEGIN = 0,
TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads)
TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads)
@@ -91,8 +89,6 @@ enum TownLayout {
NUM_TLS, ///< Number of town layouts
};
template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS, 3> {};
-/** It needs to be 8bits, because we save and load it as such */
-typedef SimpleTinyEnumT<TownLayout, byte> TownLayoutByte; // typedefing-enumification of TownLayout
/** Town founding setting values. It needs to be 8bits, because we save and load it as such */
enum TownFounding : byte {