diff src/station_cmd.cpp @ 5836:0b68d5a508a2 draft

(svn r8402) -Codechange: Move RoadStop-specific enums to the RoadStop class, and changed a one-member enum into a static const. Simplify their naming and add some doxygen-comments to RoadStop
author celestar <celestar@openttd.org>
date Thu, 25 Jan 2007 10:06:58 +0000
parents f9e0c80cf037
children e18480817d2c
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -81,18 +81,18 @@
 extern void UpdateAirplanesOnNewStation(Station *st);
 
 
-RoadStop* GetPrimaryRoadStop(const Station* st, RoadStopType type)
+RoadStop* GetPrimaryRoadStop(const Station* st, RoadStop::Type type)
 {
 	switch (type) {
-		case RS_BUS:   return st->bus_stops;
-		case RS_TRUCK: return st->truck_stops;
+		case RoadStop::BUS:   return st->bus_stops;
+		case RoadStop::TRUCK: return st->truck_stops;
 		default: NOT_REACHED();
 	}
 
 	return NULL;
 }
 
-RoadStop* GetRoadStopByTile(TileIndex tile, RoadStopType type)
+RoadStop* GetRoadStopByTile(TileIndex tile, RoadStop::Type type)
 {
 	const Station* st = GetStationByTile(tile);
 	RoadStop* rs;
@@ -104,7 +104,7 @@
 	return rs;
 }
 
-uint GetNumRoadStopsInStation(const Station* st, RoadStopType type)
+uint GetNumRoadStopsInStation(const Station* st, RoadStop::Type type)
 {
 	uint num = 0;
 	const RoadStop *rs;
@@ -1299,7 +1299,7 @@
  * then point into the global roadstop array. *prev (in CmdBuildRoadStop)
  * is the pointer tino the global roadstop array which has *currstop in
  * its ->next element.
- * @param[in] truck_station Determines whether a stop is RS_BUS or RS_TRUCK
+ * @param[in] truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
  * @param[in] station The station to do the whole procedure for
  * @param[out] currstop See the detailed function description
  * @param prev See the detailed function description
@@ -1369,7 +1369,7 @@
 	std::auto_ptr<RoadStop> rs_auto_delete(road_stop);
 
 	if (st != NULL &&
-			GetNumRoadStopsInStation(st, RS_BUS) + GetNumRoadStopsInStation(st, RS_TRUCK) >= ROAD_STOP_LIMIT) {
+			GetNumRoadStopsInStation(st, RoadStop::BUS) + GetNumRoadStopsInStation(st, RoadStop::TRUCK) >= ROAD_STOP_LIMIT) {
 		return_cmd_error(type ? STR_3008B_TOO_MANY_TRUCK_STOPS : STR_3008A_TOO_MANY_BUS_STOPS);
 	}
 
@@ -1418,7 +1418,7 @@
 
 		st->rect.BeforeAddTile(tile, StationRect::ADD_TRY);
 
-		MakeRoadStop(tile, st->owner, st->index, type ? RS_TRUCK : RS_BUS, (DiagDirection)p1);
+		MakeRoadStop(tile, st->owner, st->index, type ? RoadStop::TRUCK : RoadStop::BUS, (DiagDirection)p1);
 
 		UpdateStationVirtCoordDirty(st);
 		UpdateStationAcceptance(st, false);
@@ -1444,10 +1444,10 @@
 
 	if (is_truck) { // truck stop
 		primary_stop = &st->truck_stops;
-		cur_stop = GetRoadStopByTile(tile, RS_TRUCK);
+		cur_stop = GetRoadStopByTile(tile, RoadStop::TRUCK);
 	} else {
 		primary_stop = &st->bus_stops;
-		cur_stop = GetRoadStopByTile(tile, RS_BUS);
+		cur_stop = GetRoadStopByTile(tile, RoadStop::BUS);
 	}
 
 	assert(cur_stop != NULL);