(svn r19478) -Codechange: Resolve TS_ prefix clash between TileSource and TownSize enums.

This commit is contained in:
alberth 2010-03-20 10:55:08 +00:00
parent f439b5767a
commit e89f154c0d
3 changed files with 11 additions and 11 deletions

View File

@ -1445,7 +1445,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
t->larger_town = city;
int x = (int)size * 16 + 3;
if (size == TS_RANDOM) x = (Random() & 0xF) + 8;
if (size == TSZ_RANDOM) x = (Random() & 0xF) + 8;
/* Don't create huge cities when founding town in-game */
if (city && (!manual || _game_mode == GM_EDITOR)) x *= _settings_game.economy.initial_city_size;
@ -1525,13 +1525,13 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
bool random = HasBit(p1, 6);
uint32 townnameparts = p2;
if (size > TS_RANDOM) return CMD_ERROR;
if (size > TSZ_RANDOM) return CMD_ERROR;
if (layout > TL_RANDOM) return CMD_ERROR;
/* Some things are allowed only in the scenario editor */
if (_game_mode != GM_EDITOR) {
if (_settings_game.economy.found_town == TF_FORBIDDEN) return CMD_ERROR;
if (size == TS_LARGE) return CMD_ERROR;
if (size == TSZ_LARGE) return CMD_ERROR;
if (random) return CMD_ERROR;
if (_settings_game.economy.found_town != TF_CUSTOM_LAYOUT && layout != _settings_game.economy.town_layout) {
return CMD_ERROR;
@ -1555,7 +1555,7 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if (ret.Failed()) return ret;
}
static const byte price_mult[][TS_RANDOM + 1] = {{ 15, 25, 40, 25 }, { 20, 35, 55, 35 }};
static const byte price_mult[][TSZ_RANDOM + 1] = {{ 15, 25, 40, 25 }, { 20, 35, 55, 35 }};
/* multidimensional arrays have to have defined length of non-first dimension */
assert_compile(lengthof(price_mult[0]) == 4);
@ -1782,7 +1782,7 @@ bool GenerateTowns(TownLayout layout)
/* Get a unique name for the town. */
if (!GenerateTownName(&townnameparts)) continue;
/* try 20 times to create a random-sized town for the first loop. */
if (CreateRandomTown(20, townnameparts, TS_RANDOM, city, layout) != NULL) num++; // If creation was successful, raise a flag.
if (CreateRandomTown(20, townnameparts, TSZ_RANDOM, city, layout) != NULL) num++; // If creation was successful, raise a flag.
} while (--n);
if (num != 0) return true;
@ -1790,7 +1790,7 @@ bool GenerateTowns(TownLayout layout)
/* If num is still zero at this point, it means that not a single town has been created.
* So give it a last try, but now more aggressive */
if (GenerateTownName(&townnameparts) &&
CreateRandomTown(10000, townnameparts, TS_RANDOM, _settings_game.economy.larger_towns != 0, layout) != NULL) {
CreateRandomTown(10000, townnameparts, TSZ_RANDOM, _settings_game.economy.larger_towns != 0, layout) != NULL) {
return true;
}

View File

@ -1053,7 +1053,7 @@ private:
public:
FoundTownWindow(const WindowDesc *desc, WindowNumber window_number) :
QueryStringBaseWindow(MAX_LENGTH_TOWN_NAME_BYTES),
town_size(TS_MEDIUM),
town_size(TSZ_MEDIUM),
town_layout(_settings_game.economy.town_layout),
params(_settings_game.game_creation.town_name)
{

View File

@ -19,10 +19,10 @@ struct Town;
/** Supported initial town sizes */
enum TownSize {
TS_SMALL, ///< small town
TS_MEDIUM, ///< medium town
TS_LARGE, ///< large town
TS_RANDOM, ///< random size, bigger than small, smaller than large
TSZ_SMALL, ///< Small town.
TSZ_MEDIUM, ///< Medium town.
TSZ_LARGE, ///< Large town.
TSZ_RANDOM, ///< Random size, bigger than small, smaller than large.
};
enum {