station.h
changeset 1217 ab9f02a224ab
parent 1093 e8d26c7dc42f
child 1247 01711347f9ac
--- a/station.h	Sat Jan 29 18:22:07 2005 +0000
+++ b/station.h	Sat Jan 29 19:41:44 2005 +0000
@@ -14,10 +14,32 @@
 	byte last_age;
 } GoodsEntry;
 
+typedef enum RoadStopType {
+	RS_BUS,
+	RS_TRUCK
+} RoadStopType;
+
+enum { NUM_ROAD_STOPS = 250 };
+enum { ROAD_STOP_LIMIT = 8 };
+enum { NUM_SLOTS = 2 };
+enum { INVALID_SLOT = 0xFFFF };
+
+typedef struct RoadStop {
+	TileIndex xy;
+	bool used;
+	byte status;
+	uint32 index;
+	uint16 slot[NUM_SLOTS];
+	uint16 station;		//XXX should be StationIndex
+	uint8 type;
+	struct RoadStop *next;
+	struct RoadStop *prev;
+} RoadStop;
+
 struct Station {
 	TileIndex xy;
-	TileIndex bus_tile;
-	TileIndex lorry_tile;
+	RoadStop *bus_stops;
+	RoadStop *truck_stops;
 	TileIndex train_tile;
 	TileIndex airport_tile;
 	TileIndex dock_tile;
@@ -36,9 +58,6 @@
 	byte owner;
 	byte facilities;
 	byte airport_type;
-	byte truck_stop_status;
-	byte bus_stop_status;
-	byte blocked_months_obsolete;
 
 	// trainstation width/height
 	byte trainst_w, trainst_h;
@@ -53,6 +72,14 @@
 
 	VehicleID last_vehicle;
 	GoodsEntry goods[NUM_CARGO];
+
+	/* Stuff that is no longer used, but needed for conversion */
+	TileIndex bus_tile_obsolete;
+	TileIndex lorry_tile_obsolete;
+
+	byte truck_stop_status_obsolete;
+	byte bus_stop_status_obsolete;
+	byte blocked_months_obsolete;
 };
 
 enum {
@@ -68,7 +95,7 @@
 	HVOT_TRAIN = 1<<1,
 	HVOT_BUS = 1 << 2,
 	HVOT_TRUCK = 1 << 3,
-	HVOT_AIRCRAFT = 1<<4,
+	HVOT_AIRCRAFT = 1 << 4,
 	HVOT_SHIP = 1 << 5,
 	HVOT_BUOY = 1 << 6
 };
@@ -93,7 +120,9 @@
 void ShowStationViewWindow(int station);
 void UpdateAllStationVirtCoord(void);
 
+VARDEF RoadStop _roadstops[NUM_ROAD_STOPS * 2];
 VARDEF Station _stations[250];
+VARDEF uint _roadstops_size;
 VARDEF uint _stations_size;
 
 VARDEF SortStruct *_station_sort;
@@ -189,4 +218,10 @@
 uint32 GetCustomStationRelocation(struct StationSpec *spec, struct Station *stat, byte ctype);
 int GetCustomStationsCount(enum StationClass sclass);
 
+RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type);
+inline int GetRoadStopType(TileIndex tile);
+uint GetNumRoadStops(const Station *st, RoadStopType type);
+RoadStop * GetPrimaryRoadStop(const Station *st, RoadStopType type);
+RoadStop * GetFirstFreeRoadStop( void );
+
 #endif /* STATION_H */