(svn r12154) -Codechange: removed a magic number

This commit is contained in:
glx 2008-02-15 23:57:03 +00:00
parent a5f99154b7
commit 3e70ee6ed7
7 changed files with 10 additions and 8 deletions

View File

@ -1604,7 +1604,7 @@ static void AiStateWantNewRoute(Player *p)
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
{
uint rad = (_patches.modified_catchment) ? CA_TRAIN : 4;
uint rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
for (; p->mode != 4; p++) {
AcceptedCargo values;
@ -3409,7 +3409,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
const AirportFTAClass* airport = GetAirport(p->attr);
uint w = airport->size_x;
uint h = airport->size_y;
uint rad = _patches.modified_catchment ? airport->catchment : 4;
uint rad = _patches.modified_catchment ? airport->catchment : CA_UNMODIFIED;
if (cargo & 0x80) {
GetProductionAroundTiles(values, tile2, w, h, rad);

View File

@ -179,7 +179,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
airport = GetAirport(_selected_airport_type);
SetTileSelectSize(airport->size_x, airport->size_y);
int rad = _patches.modified_catchment ? airport->catchment : 4;
int rad = _patches.modified_catchment ? airport->catchment : CA_UNMODIFIED;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);

View File

@ -243,7 +243,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_CREATE: w->LowerWidget(_station_show_coverage + 3); break;
case WE_PAINT: {
int rad = (_patches.modified_catchment) ? CA_DOCK : 4;
int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
if (WP(w, def_d).close) return;
DrawWindowWidgets(w);

View File

@ -818,7 +818,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
SetTileSelectSize(x, y);
}
int rad = (_patches.modified_catchment) ? CA_TRAIN : 4;
int rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
if (_station_show_coverage)
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);

View File

@ -809,7 +809,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
if (_station_show_coverage) {
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : 4;
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
} else {
SetTileSelectSize(1, 1);

View File

@ -239,6 +239,8 @@ enum CatchmentArea {
CA_TRAIN = 4,
CA_DOCK = 5,
CA_UNMODIFIED = 4, ///< Used when _patches.modified_catchment is false
MAX_CATCHMENT = 10, ///< Airports have a catchment up to this number.
};

View File

@ -599,7 +599,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
TileXY(rect.min_x, rect.min_y),
rect.max_x - rect.min_x + 1,
rect.max_y - rect.min_y + 1,
_patches.modified_catchment ? FindCatchmentRadius(st) : 4
_patches.modified_catchment ? FindCatchmentRadius(st) : CA_UNMODIFIED
);
} else {
memset(accepts, 0, sizeof(accepts));
@ -2712,7 +2712,7 @@ StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
h_prod = 0;
w += 8;
h += 8;
max_rad = 4;
max_rad = CA_UNMODIFIED;
}
BEGIN_TILE_LOOP(cur_tile, w, h, tile - TileDiffXY(max_rad, max_rad))