Codechange: Remove TownLayoutByte type

pull/104/head
Charles Pigott 5 years ago committed by PeterN
parent 0e439aeab7
commit f20b75d712

@ -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);
}
}

@ -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.

@ -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;

@ -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));
}
/**

@ -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 {

Loading…
Cancel
Save