# HG changeset patch # User belugas # Date 1193853701 0 # Node ID 017d4289aca3e577c397d8470b03cabb4095d145 # Parent 5462f200e4750730618e4acff7031ef693b2f429 (svn r11363) -Codechange: Remove some magical numbers diff -r 5462f200e475 -r 017d4289aca3 src/station_cmd.cpp --- a/src/station_cmd.cpp Tue Oct 30 20:31:35 2007 +0000 +++ b/src/station_cmd.cpp Wed Oct 31 18:01:41 2007 +0000 @@ -226,6 +226,16 @@ #define M(x) ((x) - STR_SV_STNAME) +enum StationNaming = { + STATIONNAMING_RAIL = 0, + STATIONNAMING_ROAD = 0, + STATIONNAMING_AIRPORT, + STATIONNAMING_OILRIG, + STATIONNAMING_DOCK, + STATIONNAMING_BUOY, + STATIONNAMING_HELIPORT, +} + static bool GenerateStationName(Station *st, TileIndex tile, int flag) { static const uint32 _gen_station_name_bits[] = { @@ -962,7 +972,7 @@ st_auto_delete = st; st->town = ClosestTownFromTile(tile_org, (uint)-1); - if (!GenerateStationName(st, tile_org, 0)) return CMD_ERROR; + if (!GenerateStationName(st, tile_org, STATIONNAMING_RAIL)) return CMD_ERROR; if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { SETBIT(st->town->have_ratings, _current_player); @@ -1387,7 +1397,7 @@ Town *t = st->town = ClosestTownFromTile(tile, (uint)-1); - if (!GenerateStationName(st, tile, 0)) return CMD_ERROR; + if (!GenerateStationName(st, tile, STATIONNAMING_ROAD)) return CMD_ERROR; if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { SETBIT(t->have_ratings, _current_player); @@ -1695,7 +1705,7 @@ /* If only helicopters may use the airport generate a helicopter related (5) * station name, otherwise generate a normal airport name (1) */ - if (!GenerateStationName(st, tile, !(afc->flags & AirportFTAClass::AIRPLANES) ? 5 : 1)) { + if (!GenerateStationName(st, tile, !(afc->flags & AirportFTAClass::AIRPLANES) ? STATIONNAMING_HELIPORT : STATIONNAMING_AIRPORT)) { return CMD_ERROR; } } @@ -1810,7 +1820,7 @@ st->town = ClosestTownFromTile(tile, (uint)-1); st->sign.width_1 = 0; - if (!GenerateStationName(st, tile, 4)) return CMD_ERROR; + if (!GenerateStationName(st, tile, STATIONNAMING_BUOY)) return CMD_ERROR; if (flags & DC_EXEC) { st->dock_tile = tile; @@ -1980,7 +1990,7 @@ st->sign.width_1 = 0; - if (!GenerateStationName(st, tile, 3)) return CMD_ERROR; + if (!GenerateStationName(st, tile, STATIONNAMING_DOCK)) return CMD_ERROR; } if (flags & DC_EXEC) { @@ -2749,7 +2759,7 @@ DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile); return; } - if (!GenerateStationName(st, tile, 2)) { + if (!GenerateStationName(st, tile, STATIONNAMING_OILRIG)) { DEBUG(misc, 0, "Can't allocate station-name for oilrig at 0x%X, reverting to oilrig only", tile); return; }