src/station_base.h
author rubidium
Mon, 31 Mar 2008 06:42:26 +0000
changeset 8787 41d9d5adbe87
parent 8785 871586967963
child 9003 7972fa66d9c9
permissions -rw-r--r--
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
8785
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     1
/* $Id$ */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     2
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     3
/** @file station_base.h Base classes/functions for stations. */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     4
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     5
#ifndef STATION_BASE_H
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     6
#define STATION_BASE_H
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     7
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     8
#include "station_type.h"
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
     9
#include "airport.h"
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    10
#include "oldpool.h"
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    11
#include "cargopacket.h"
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    12
#include "cargo_type.h"
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    13
#include "town_type.h"
8787
41d9d5adbe87 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents: 8785
diff changeset
    14
#include "strings_type.h"
41d9d5adbe87 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents: 8785
diff changeset
    15
#include "date_type.h"
41d9d5adbe87 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents: 8785
diff changeset
    16
#include "vehicle_type.h"
41d9d5adbe87 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents: 8785
diff changeset
    17
#include "player_type.h"
41d9d5adbe87 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents: 8785
diff changeset
    18
#include "core/geometry_type.hpp"
8785
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    19
#include <list>
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    20
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    21
DECLARE_OLD_POOL(Station, Station, 6, 1000)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    22
DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    23
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    24
static const byte INITIAL_STATION_RATING = 175;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    25
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    26
struct GoodsEntry {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    27
	enum AcceptancePickup {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    28
		ACCEPTANCE,
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    29
		PICKUP
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    30
	};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    31
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    32
	GoodsEntry() :
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    33
		acceptance_pickup(0),
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    34
		days_since_pickup(255),
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    35
		rating(INITIAL_STATION_RATING),
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    36
		last_speed(0),
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    37
		last_age(255)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    38
	{}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    39
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    40
	byte acceptance_pickup;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    41
	byte days_since_pickup;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    42
	byte rating;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    43
	byte last_speed;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    44
	byte last_age;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    45
	CargoList cargo; ///< The cargo packets of cargo waiting in this station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    46
};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    47
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    48
/** A Stop for a Road Vehicle */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    49
struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    50
	static const int  cDebugCtorLevel =  5;  ///< Debug level on which Contructor / Destructor messages are printed
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    51
	static const uint LIMIT           = 16;  ///< The maximum amount of roadstops that are allowed at a single station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    52
	static const uint MAX_BAY_COUNT   =  2;  ///< The maximum number of loading bays
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    53
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    54
	TileIndex        xy;                    ///< Position on the map
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    55
	byte             status;                ///< Current status of the Stop. Like which spot is taken. Access using *Bay and *Busy functions.
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    56
	byte             num_vehicles;          ///< Number of vehicles currently slotted to this stop
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    57
	struct RoadStop  *next;                 ///< Next stop of the given type at this station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    58
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    59
	RoadStop(TileIndex tile = 0);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    60
	virtual ~RoadStop();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    61
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    62
	/**
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    63
	 * Determines whether a road stop exists
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    64
	 * @return true if and only is the road stop exists
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    65
	 */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    66
	inline bool IsValid() const { return this->xy != 0; }
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    67
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    68
	/* For accessing status */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    69
	bool HasFreeBay() const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    70
	bool IsFreeBay(uint nr) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    71
	uint AllocateBay();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    72
	void AllocateDriveThroughBay(uint nr);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    73
	void FreeBay(uint nr);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    74
	bool IsEntranceBusy() const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    75
	void SetEntranceBusy(bool busy);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    76
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    77
	RoadStop *GetNextRoadStop(const Vehicle *v) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    78
};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    79
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    80
struct StationSpecList {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    81
	const StationSpec *spec;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    82
	uint32 grfid;      ///< GRF ID of this custom station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    83
	uint8  localidx;   ///< Station ID within GRF of station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    84
};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    85
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    86
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    87
struct StationRect : public Rect {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    88
	enum StationRectMode
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    89
	{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    90
		ADD_TEST = 0,
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    91
		ADD_TRY,
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    92
		ADD_FORCE
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    93
	};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    94
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    95
	StationRect();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    96
	void MakeEmpty();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    97
	bool PtInExtendedRect(int x, int y, int distance = 0) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    98
	bool IsEmpty() const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
    99
	bool BeforeAddTile(TileIndex tile, StationRectMode mode);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   100
	bool BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   101
	bool AfterRemoveTile(Station *st, TileIndex tile);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   102
	bool AfterRemoveRect(Station *st, TileIndex tile, int w, int h);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   103
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   104
	static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   105
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   106
	StationRect& operator = (Rect src);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   107
};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   108
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   109
struct Station : PoolItem<Station, StationID, &_Station_pool> {
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   110
public:
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   111
	RoadStop *GetPrimaryRoadStop(RoadStopType type) const
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   112
	{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   113
		return type == ROADSTOP_BUS ? bus_stops : truck_stops;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   114
	}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   115
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   116
	RoadStop *GetPrimaryRoadStop(const Vehicle *v) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   117
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   118
	const AirportFTAClass *Airport() const
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   119
	{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   120
		if (airport_tile == 0) return GetAirport(AT_DUMMY);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   121
		return GetAirport(airport_type);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   122
	}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   123
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   124
	TileIndex xy;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   125
	RoadStop *bus_stops;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   126
	RoadStop *truck_stops;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   127
	TileIndex train_tile;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   128
	TileIndex airport_tile;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   129
	TileIndex dock_tile;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   130
	Town *town;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   131
	StringID string_id;     ///< Default name (town area) of station
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   132
	char *name;             ///< Custom name
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   133
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   134
	ViewportSign sign;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   135
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   136
	uint16 had_vehicle_of_type;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   137
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   138
	byte time_since_load;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   139
	byte time_since_unload;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   140
	byte delete_ctr;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   141
	PlayerByte owner;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   142
	byte facilities;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   143
	byte airport_type;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   144
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   145
	/* trainstation width/height */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   146
	byte trainst_w, trainst_h;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   147
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   148
	/** List of custom stations (StationSpecs) allocated to the station */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   149
	uint8 num_specs;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   150
	StationSpecList *speclist;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   151
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   152
	Date build_date;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   153
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   154
	uint64 airport_flags;   ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   155
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   156
	byte last_vehicle_type;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   157
	std::list<Vehicle *> loading_vehicles;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   158
	GoodsEntry goods[NUM_CARGO];
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   159
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   160
	uint16 random_bits;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   161
	byte waiting_triggers;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   162
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   163
	StationRect rect; ///< Station spread out rectangle (not saved) maintained by StationRect_xxx() functions
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   164
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   165
	static const int cDebugCtorLevel = 5;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   166
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   167
	Station(TileIndex tile = 0);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   168
	virtual ~Station();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   169
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   170
	void AddFacility(byte new_facility_bit, TileIndex facil_xy);
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   171
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   172
	/**
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   173
	 * Mark the sign of a station dirty for repaint.
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   174
	 *
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   175
	 * @ingroup dirty
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   176
	 */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   177
	void MarkDirty() const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   178
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   179
	/**
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   180
	 * Marks the tiles of the station as dirty.
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   181
	 *
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   182
	 * @ingroup dirty
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   183
	 */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   184
	void MarkTilesDirty(bool cargo_change) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   185
	bool TileBelongsToRailStation(TileIndex tile) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   186
	uint GetPlatformLength(TileIndex tile, DiagDirection dir) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   187
	uint GetPlatformLength(TileIndex tile) const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   188
	bool IsBuoy() const;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   189
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   190
	/**
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   191
	 * Determines whether a station exists
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   192
	 * @return true if and only is the station exists
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   193
	 */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   194
	inline bool IsValid() const { return this->xy != 0; }
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   195
};
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   196
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   197
static inline StationID GetMaxStationIndex()
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   198
{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   199
	/* TODO - This isn't the real content of the function, but
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   200
	 *  with the new pool-system this will be replaced with one that
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   201
	 *  _really_ returns the highest index. Now it just returns
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   202
	 *  the next safe value we are sure about everything is below.
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   203
	 */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   204
	return GetStationPoolSize() - 1;
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   205
}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   206
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   207
static inline uint GetNumStations()
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   208
{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   209
	return GetStationPoolSize();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   210
}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   211
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   212
static inline bool IsValidStationID(StationID index)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   213
{
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   214
	return index < GetStationPoolSize() && GetStation(index)->IsValid();
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   215
}
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   216
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   217
#define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) if (st->IsValid())
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   218
#define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   219
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   220
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   221
/* Stuff for ROADSTOPS */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   222
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   223
#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (rs->IsValid())
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   224
#define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   225
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   226
/* End of stuff for ROADSTOPS */
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   227
871586967963 (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
diff changeset
   228
#endif /* STATION_BASE_H */