mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Remove TownLayoutByte type
parent
0e439aeab7
commit
f20b75d712
|
@ -2110,7 +2110,7 @@ bool AfterLoadGame()
|
||||||
_settings_game.economy.town_layout = TL_BETTER_ROADS;
|
_settings_game.economy.town_layout = TL_BETTER_ROADS;
|
||||||
} else {
|
} else {
|
||||||
_settings_game.economy.allow_town_roads = true;
|
_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
|
/* Initialize layout of all towns. Older versions were using different
|
||||||
|
@ -2129,7 +2129,7 @@ bool AfterLoadGame()
|
||||||
case 5: layout = 1; break;
|
case 5: layout = 1; break;
|
||||||
case 0: layout = 2; 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 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 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
|
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
|
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)
|
bool allow_town_roads; ///< towns are allowed to build roads (always allowed when generating world / in SE)
|
||||||
TownFounding found_town; ///< town founding.
|
TownFounding found_town; ///< town founding.
|
||||||
|
|
14
src/town.h
14
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.
|
CargoTypes cargo_accepted_total; ///< NOSAVE: Bitmap of all cargoes accepted by houses in this town.
|
||||||
StationList stations_near; ///< NOSAVE: List of nearby stations.
|
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 grow_counter; ///< counter to count when to grow, value is smaller than or equal to growth_rate
|
||||||
uint16 growth_rate; ///< town growth rate
|
uint16 growth_rate; ///< town growth rate
|
||||||
|
|
||||||
byte fund_buildings_months; ///< fund buildings program in action?
|
byte fund_buildings_months; ///< fund buildings program in action?
|
||||||
byte road_build_months; ///< fund road reconstruction 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
|
bool larger_town; ///< if this is a larger town and should grow more quickly
|
||||||
TownLayoutByte layout; ///< town specific road layout
|
TownLayout layout; ///< town specific road layout
|
||||||
|
|
||||||
std::list<PersistentStorage *> psa_list;
|
std::list<PersistentStorage *> psa_list;
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ void Town::InitializeLayout(TownLayout layout)
|
||||||
return;
|
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?
|
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** Town Layouts. It needs to be 8bits, because we save and load it as such */
|
||||||
* Town Layouts
|
enum TownLayout : byte {
|
||||||
*/
|
|
||||||
enum TownLayout {
|
|
||||||
TL_BEGIN = 0,
|
TL_BEGIN = 0,
|
||||||
TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads)
|
TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads)
|
||||||
TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 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
|
NUM_TLS, ///< Number of town layouts
|
||||||
};
|
};
|
||||||
template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS, 3> {};
|
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 */
|
/** Town founding setting values. It needs to be 8bits, because we save and load it as such */
|
||||||
enum TownFounding : byte {
|
enum TownFounding : byte {
|
||||||
|
|
Loading…
Reference in New Issue