summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-10-25 14:19:09 +0000
committerfrosch <frosch@openttd.org>2008-10-25 14:19:09 +0000
commit11ef57d81ea1a9c94002ef9013cebb0990b337e7 (patch)
tree44e1a84104135e19cf4584f675c763494f9860a5 /src/station.cpp
parenta14ad77a36c836fd3f6940eadeb8161e7ad02f92 (diff)
downloadopenttd-11ef57d81ea1a9c94002ef9013cebb0990b337e7.tar.xz
(svn r14529) -Codechange: Turn FindCatchmentRadius() into Station::GetCatchmentRadius().
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/station.cpp b/src/station.cpp
index 128dbe9b7..1c3570d52 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -246,6 +246,28 @@ bool Station::IsBuoy() const
return (had_vehicle_of_type & HVOT_BUOY) != 0;
}
+/** Determines the catchment radius of the station
+ * @return The radius
+ */
+uint Station::GetCatchmentRadius() const
+{
+ uint ret = CA_NONE;
+
+ if (_settings_game.station.modified_catchment) {
+ if (this->bus_stops != NULL) ret = max<uint>(ret, CA_BUS);
+ if (this->truck_stops != NULL) ret = max<uint>(ret, CA_TRUCK);
+ if (this->train_tile != 0) ret = max<uint>(ret, CA_TRAIN);
+ if (this->dock_tile != 0) ret = max<uint>(ret, CA_DOCK);
+ if (this->airport_tile != 0) ret = max<uint>(ret, this->Airport()->catchment);
+ } else {
+ if (this->bus_stops != NULL || this->truck_stops != NULL || this->train_tile != 0 || this->dock_tile != 0 || this->airport_tile != 0) {
+ ret = CA_UNMODIFIED;
+ }
+ }
+
+ return ret;
+}
+
/************************************************************************/
/* StationRect implementation */