summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-02-15 23:57:03 +0000
committerglx <glx@openttd.org>2008-02-15 23:57:03 +0000
commit3e70ee6ed7ea7bfb7b08ee70206a30651aec956b (patch)
tree846aa4f1b2b7c56288258e3f5e20efa172fe99a1
parenta5f99154b755c85dabe8e2a8cc352b7d1a0fbb6c (diff)
downloadopenttd-3e70ee6ed7ea7bfb7b08ee70206a30651aec956b.tar.xz
(svn r12154) -Codechange: removed a magic number
-rw-r--r--src/ai/default/default.cpp4
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/station.h2
-rw-r--r--src/station_cmd.cpp4
7 files changed, 10 insertions, 8 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 077e2a849..949f29702 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -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);
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 86f288610..e0b5bb7db 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -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);
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 39f40a3a2..d4e883674 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -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);
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index d741fe2fb..8bfc5717c 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -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);
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index b7313b449..af1aff229 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -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);
diff --git a/src/station.h b/src/station.h
index 0d34a9713..b8557378b 100644
--- a/src/station.h
+++ b/src/station.h
@@ -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.
};
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 47c41087d..77e3ad8f3 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -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))