author | peter1138 |
Sat, 12 Jan 2008 19:58:06 +0000 | |
changeset 8258 | 9fa31acb07bc |
parent 8237 | 6f925c9cf836 |
child 8573 | a0a5f36a982e |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
3 |
/** @file station.h */ |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
4 |
|
0 | 5 |
#ifndef STATION_H |
6 |
#define STATION_H |
|
7 |
||
6032 | 8 |
#include "airport.h" |
5216
8bd14ee39af2
(svn r7331) - Codechange: Rename all memory pool macro's and types to "old pool", so the new pool implementation can be committed alongside it.
matthijs
parents:
4981
diff
changeset
|
9 |
#include "oldpool.h" |
405
415546028e8d
(svn r602) -newgrf: Move DrawTileSeqStruct & co and struct SpriteGroup to sprite.h (pasky)
darkvater
parents:
403
diff
changeset
|
10 |
#include "sprite.h" |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8016
diff
changeset
|
11 |
#include "road_type.h" |
2963
f28ce0549513
(svn r3525) - Rename station_newgrf.[ch] to newgrf_station.[ch], and update project files.
peter1138
parents:
2817
diff
changeset
|
12 |
#include "newgrf_station.h" |
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
6953
diff
changeset
|
13 |
#include "cargopacket.h" |
8119
52b48108425a
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8109
diff
changeset
|
14 |
#include "cargo_type.h" |
8213
7bdd7593eb9b
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8121
diff
changeset
|
15 |
#include "town_type.h" |
8121
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8119
diff
changeset
|
16 |
#include "core/geometry_type.hpp" |
6500
f12678890222
(svn r9683) -Fix [FS#423]: improved loading does not use a huge amount of processing power anymore when having a lot of trains.
rubidium
parents:
6420
diff
changeset
|
17 |
#include <list> |
7891
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
18 |
#include <set> |
0 | 19 |
|
7377
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
20 |
struct Station; |
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
21 |
struct RoadStop; |
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
22 |
|
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
23 |
DECLARE_OLD_POOL(Station, Station, 6, 1000) |
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
24 |
DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000) |
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
25 |
|
6261
f294962efd0d
(svn r9070) -Fix [FS#404]: if bribe failed and you didn't pick up cargo yet, you wouldn't ever be able to do so for a given station
truelight
parents:
6248
diff
changeset
|
26 |
static const byte INITIAL_STATION_RATING = 175; |
5670
1e0f505996dc
(svn r8130) Provide struct GoodsEntry with a constructor
tron
parents:
5665
diff
changeset
|
27 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
28 |
struct GoodsEntry { |
7474
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
29 |
enum AcceptancePickup { |
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
30 |
ACCEPTANCE, |
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
31 |
PICKUP |
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
32 |
}; |
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
33 |
|
5670
1e0f505996dc
(svn r8130) Provide struct GoodsEntry with a constructor
tron
parents:
5665
diff
changeset
|
34 |
GoodsEntry() : |
7474
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
35 |
acceptance_pickup(0), |
7013
b9643e4f798b
(svn r10269) -Fix [FS#912]: station ratings were shown for all cargos instead of only the cargos that have been transported.
rubidium
parents:
7010
diff
changeset
|
36 |
days_since_pickup(255), |
6261
f294962efd0d
(svn r9070) -Fix [FS#404]: if bribe failed and you didn't pick up cargo yet, you wouldn't ever be able to do so for a given station
truelight
parents:
6248
diff
changeset
|
37 |
rating(INITIAL_STATION_RATING), |
5670
1e0f505996dc
(svn r8130) Provide struct GoodsEntry with a constructor
tron
parents:
5665
diff
changeset
|
38 |
last_speed(0), |
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
6953
diff
changeset
|
39 |
last_age(255) |
5670
1e0f505996dc
(svn r8130) Provide struct GoodsEntry with a constructor
tron
parents:
5665
diff
changeset
|
40 |
{} |
1e0f505996dc
(svn r8130) Provide struct GoodsEntry with a constructor
tron
parents:
5665
diff
changeset
|
41 |
|
7474
1daa825ba893
(svn r10981) -Fix [FS#1156] (r10970): stations gave ratings for accepted cargo too.
rubidium
parents:
7469
diff
changeset
|
42 |
byte acceptance_pickup; |
0 | 43 |
byte days_since_pickup; |
44 |
byte rating; |
|
45 |
byte last_speed; |
|
46 |
byte last_age; |
|
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
6953
diff
changeset
|
47 |
CargoList cargo; ///< The cargo packets of cargo waiting in this station |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
48 |
}; |
0 | 49 |
|
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
50 |
/** A Stop for a Road Vehicle */ |
7377
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
51 |
struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> { |
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
52 |
/** Types of RoadStops */ |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
53 |
enum Type { |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
54 |
BUS, ///< A standard stop for buses |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
55 |
TRUCK ///< A standard stop for trucks |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
56 |
}; |
5708
4c4c5ec2bed6
(svn r8185) -Codechange: Equipped Roadstops with new/delete operators and gave them proper constructors/destructors (Thanks to KUDr for a nice interactive C++ lesson)
celestar
parents:
5683
diff
changeset
|
57 |
|
7404
70543a7025e0
(svn r10777) -Fix: don't put the ctor debug on lvl3, it is more a lvl5 debug
truelight
parents:
7377
diff
changeset
|
58 |
static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed |
5837
e9c21cf7c7d9
(svn r8403) -Fix (r8402): Forgot to remove an enum
celestar
parents:
5836
diff
changeset
|
59 |
static const uint LIMIT = 16; ///< The maximum amount of roadstops that are allowed at a single station |
5990
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
60 |
static const uint MAX_BAY_COUNT = 2; ///< The maximum number of loading bays |
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
61 |
|
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
62 |
TileIndex xy; ///< Position on the map |
5990
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
63 |
byte status; ///< Current status of the Stop. Like which spot is taken. Access using *Bay and *Busy functions. |
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
64 |
byte num_vehicles; ///< Number of vehicles currently slotted to this stop |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
65 |
struct RoadStop *next; ///< Next stop of the given type at this station |
5708
4c4c5ec2bed6
(svn r8185) -Codechange: Equipped Roadstops with new/delete operators and gave them proper constructors/destructors (Thanks to KUDr for a nice interactive C++ lesson)
celestar
parents:
5683
diff
changeset
|
66 |
|
7377
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
67 |
RoadStop(TileIndex tile = 0); |
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
68 |
virtual ~RoadStop(); |
5708
4c4c5ec2bed6
(svn r8185) -Codechange: Equipped Roadstops with new/delete operators and gave them proper constructors/destructors (Thanks to KUDr for a nice interactive C++ lesson)
celestar
parents:
5683
diff
changeset
|
69 |
|
7496
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
70 |
/** |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
71 |
* Determines whether a road stop exists |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
72 |
* @return true if and only is the road stop exists |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
73 |
*/ |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
74 |
inline bool IsValid() const { return this->xy != 0; } |
5990
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
75 |
|
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
76 |
/* For accessing status */ |
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
77 |
bool HasFreeBay() const; |
6012
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
78 |
bool IsFreeBay(uint nr) const; |
5990
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
79 |
uint AllocateBay(); |
6012
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
80 |
void AllocateDriveThroughBay(uint nr); |
5990
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
81 |
void FreeBay(uint nr); |
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
82 |
bool IsEntranceBusy() const; |
280fbef32d44
(svn r8694) -Codechange: make RoadStop's status accessible via accessor functions.
rubidium
parents:
5936
diff
changeset
|
83 |
void SetEntranceBusy(bool busy); |
7469
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
84 |
|
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
85 |
RoadStop *GetNextRoadStop(const Vehicle *v) const; |
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
86 |
}; |
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
87 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
88 |
struct StationSpecList { |
3587 | 89 |
const StationSpec *spec; |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
90 |
uint32 grfid; ///< GRF ID of this custom station |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
91 |
uint8 localidx; ///< Station ID within GRF of station |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
92 |
}; |
3587 | 93 |
|
5676
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
94 |
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */ |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
95 |
struct StationRect : public Rect { |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
96 |
enum StationRectMode |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
97 |
{ |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
98 |
ADD_TEST = 0, |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
99 |
ADD_TRY, |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
100 |
ADD_FORCE |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
101 |
}; |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
102 |
|
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
103 |
StationRect(); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
104 |
void MakeEmpty(); |
5910
f1409c7e8a87
(svn r8536) -Fix (FS#577): Road Vehicles now can obtain a slot even if the station is very spread out
celestar
parents:
5896
diff
changeset
|
105 |
bool PtInExtendedRect(int x, int y, int distance = 0) const; |
5676
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
106 |
bool IsEmpty() const; |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
107 |
bool BeforeAddTile(TileIndex tile, StationRectMode mode); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
108 |
bool BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
109 |
bool AfterRemoveTile(Station *st, TileIndex tile); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
110 |
bool AfterRemoveRect(Station *st, TileIndex tile, int w, int h); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
111 |
|
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
112 |
static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
113 |
|
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
114 |
StationRect& operator = (Rect src); |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
115 |
}; |
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
116 |
|
7377
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
117 |
struct Station : PoolItem<Station, StationID, &_Station_pool> { |
7469
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
118 |
public: |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
119 |
RoadStop *GetPrimaryRoadStop(RoadStop::Type type) const |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
120 |
{ |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
121 |
return type == RoadStop::BUS ? bus_stops : truck_stops; |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
122 |
} |
5876 | 123 |
|
7469
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
124 |
RoadStop *GetPrimaryRoadStop(const Vehicle *v) const; |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
125 |
|
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
126 |
const AirportFTAClass *Airport() const |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
127 |
{ |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
128 |
if (airport_tile == 0) return GetAirport(AT_DUMMY); |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
129 |
return GetAirport(airport_type); |
2c1dd5ce245d
(svn r10974) -Fix [FS#1144, FS#1155]: road vehicles that could not (properly) use a road stop still tried to go to that road stop.
rubidium
parents:
7413
diff
changeset
|
130 |
} |
6032 | 131 |
|
0 | 132 |
TileIndex xy; |
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
133 |
RoadStop *bus_stops; |
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
134 |
RoadStop *truck_stops; |
0 | 135 |
TileIndex train_tile; |
136 |
TileIndex airport_tile; |
|
137 |
TileIndex dock_tile; |
|
138 |
Town *town; |
|
8258
9fa31acb07bc
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
peter1138
parents:
8237
diff
changeset
|
139 |
StringID string_id; ///< Default name (town area) of station |
9fa31acb07bc
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
peter1138
parents:
8237
diff
changeset
|
140 |
char *name; ///< Custom name |
0 | 141 |
|
142 |
ViewportSign sign; |
|
143 |
||
144 |
uint16 had_vehicle_of_type; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
123
diff
changeset
|
145 |
|
0 | 146 |
byte time_since_load; |
147 |
byte time_since_unload; |
|
148 |
byte delete_ctr; |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
149 |
PlayerByte owner; |
0 | 150 |
byte facilities; |
151 |
byte airport_type; |
|
152 |
||
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
153 |
/* trainstation width/height */ |
0 | 154 |
byte trainst_w, trainst_h; |
155 |
||
3587 | 156 |
/** List of custom stations (StationSpecs) allocated to the station */ |
3786
ac7ff031ff5f
(svn r4782) - Newstations: fix issue with saving/loading games with newstations on big endian architectures.
peter1138
parents:
3765
diff
changeset
|
157 |
uint8 num_specs; |
3587 | 158 |
StationSpecList *speclist; |
159 |
||
4289
8981ce44336d
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
4268
diff
changeset
|
160 |
Date build_date; |
0 | 161 |
|
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6394
diff
changeset
|
162 |
uint64 airport_flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32 |
0 | 163 |
|
3580
14bf6e7715c8
(svn r4466) -Fix: (FS#71) Game no longer crashes when the last vehicle serving a station has been deleted.
celestar
parents:
3574
diff
changeset
|
164 |
byte last_vehicle_type; |
6500
f12678890222
(svn r9683) -Fix [FS#423]: improved loading does not use a huge amount of processing power anymore when having a lot of trains.
rubidium
parents:
6420
diff
changeset
|
165 |
std::list<Vehicle *> loading_vehicles; |
0 | 166 |
GoodsEntry goods[NUM_CARGO]; |
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
167 |
|
3687
f421ffcfeb00
(svn r4612) - NewStations: add random bits (for graphic variation) to stations
peter1138
parents:
3587
diff
changeset
|
168 |
uint16 random_bits; |
f421ffcfeb00
(svn r4612) - NewStations: add random bits (for graphic variation) to stations
peter1138
parents:
3587
diff
changeset
|
169 |
byte waiting_triggers; |
f421ffcfeb00
(svn r4612) - NewStations: add random bits (for graphic variation) to stations
peter1138
parents:
3587
diff
changeset
|
170 |
|
5676
7a641ebbc080
(svn r8136) -Codechange: Station spread rectangle manipulators turned into StationRect::methods.
KUDr
parents:
5670
diff
changeset
|
171 |
StationRect rect; ///< Station spread out rectangle (not saved) maintained by StationRect_xxx() functions |
5665
d6b5c720ad67
(svn r8125) -Codechange: Station is now constructed/destroyed using new/delete operators (don't worry, they still use the same memory pool). Few station related functions turned into Station::methods (just first step). All this new stuff moved from station_cmd.cpp to the new file (station.cpp).
KUDr
parents:
5601
diff
changeset
|
172 |
|
7404
70543a7025e0
(svn r10777) -Fix: don't put the ctor debug on lvl3, it is more a lvl5 debug
truelight
parents:
7377
diff
changeset
|
173 |
static const int cDebugCtorLevel = 5; |
5665
d6b5c720ad67
(svn r8125) -Codechange: Station is now constructed/destroyed using new/delete operators (don't worry, they still use the same memory pool). Few station related functions turned into Station::methods (just first step). All this new stuff moved from station_cmd.cpp to the new file (station.cpp).
KUDr
parents:
5601
diff
changeset
|
174 |
|
d6b5c720ad67
(svn r8125) -Codechange: Station is now constructed/destroyed using new/delete operators (don't worry, they still use the same memory pool). Few station related functions turned into Station::methods (just first step). All this new stuff moved from station_cmd.cpp to the new file (station.cpp).
KUDr
parents:
5601
diff
changeset
|
175 |
Station(TileIndex tile = 0); |
7377
b6479e048c6e
(svn r10746) -Codechange: add a generic superclass for almost all pool items so we do not have to duplicate code for each of the pool item classes and use it for the station and roadstop classes.
rubidium
parents:
7376
diff
changeset
|
176 |
virtual ~Station(); |
7376
066596e64cd5
(svn r10745) -Codechange: generalize the pool cleanup/initialize functions for stations (in such a manner that they can be used for other pools too).
rubidium
parents:
7272
diff
changeset
|
177 |
|
5721
fa4e587f59f5
(svn r8231) -Fix (r8125): MP desync caused by calling Random() from station constructor. This was wrong because station constructor is called also when loading savegame and when player tries to build station when it is not sure that it will succeed (thanks Rubidium)
KUDr
parents:
5718
diff
changeset
|
178 |
void AddFacility(byte new_facility_bit, TileIndex facil_xy); |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
179 |
|
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
180 |
/** |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
181 |
* Mark the sign of a station dirty for repaint. |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
182 |
* |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
183 |
* @ingroup dirty |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
184 |
*/ |
5665
d6b5c720ad67
(svn r8125) -Codechange: Station is now constructed/destroyed using new/delete operators (don't worry, they still use the same memory pool). Few station related functions turned into Station::methods (just first step). All this new stuff moved from station_cmd.cpp to the new file (station.cpp).
KUDr
parents:
5601
diff
changeset
|
185 |
void MarkDirty() const; |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
186 |
|
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
187 |
/** |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
188 |
* Marks the tiles of the station as dirty. |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
189 |
* |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
190 |
* @ingroup dirty |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7498
diff
changeset
|
191 |
*/ |
6823
1f2075619543
(svn r10062) -Codechange: Don't redraw all station tiles when cargo is added or removed if the station has no custom graphics.
peter1138
parents:
6677
diff
changeset
|
192 |
void MarkTilesDirty(bool cargo_change) const; |
5665
d6b5c720ad67
(svn r8125) -Codechange: Station is now constructed/destroyed using new/delete operators (don't worry, they still use the same memory pool). Few station related functions turned into Station::methods (just first step). All this new stuff moved from station_cmd.cpp to the new file (station.cpp).
KUDr
parents:
5601
diff
changeset
|
193 |
bool TileBelongsToRailStation(TileIndex tile) const; |
5998
2bfbade143ac
(svn r8709) -Fix/Codechange: Rename the function GetStationPlatforms into GetPlatformLength because that is what it really does. Overload it because there is already a GetPlatformLength (one gives the length of the whole platform, the other gives the remaining length in a given direction). Turned both functions into methods of Station. While messing around with it, fix a problem where loading times for overhanging trains are miscomputed.
celestar
parents:
5996
diff
changeset
|
194 |
uint GetPlatformLength(TileIndex tile, DiagDirection dir) const; |
2bfbade143ac
(svn r8709) -Fix/Codechange: Rename the function GetStationPlatforms into GetPlatformLength because that is what it really does. Overload it because there is already a GetPlatformLength (one gives the length of the whole platform, the other gives the remaining length in a given direction). Turned both functions into methods of Station. While messing around with it, fix a problem where loading times for overhanging trains are miscomputed.
celestar
parents:
5996
diff
changeset
|
195 |
uint GetPlatformLength(TileIndex tile) const; |
5896
a9f7bdd841d4
(svn r8514) -Codechange: Turn IsBuoy into a method of stations
celestar
parents:
5884
diff
changeset
|
196 |
bool IsBuoy() const; |
7496
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
197 |
|
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
198 |
/** |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
199 |
* Determines whether a station exists |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
200 |
* @return true if and only is the station exists |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
201 |
*/ |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7474
diff
changeset
|
202 |
inline bool IsValid() const { return this->xy != 0; } |
0 | 203 |
}; |
204 |
||
7272
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
205 |
enum StationType { |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
206 |
STATION_RAIL, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
207 |
STATION_AIRPORT, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
208 |
STATION_TRUCK, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
209 |
STATION_BUS, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
210 |
STATION_OILRIG, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
211 |
STATION_DOCK, |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
212 |
STATION_BUOY |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
213 |
}; |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
214 |
|
0 | 215 |
enum { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
216 |
FACIL_TRAIN = 0x01, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
217 |
FACIL_TRUCK_STOP = 0x02, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
218 |
FACIL_BUS_STOP = 0x04, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
219 |
FACIL_AIRPORT = 0x08, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
220 |
FACIL_DOCK = 0x10, |
0 | 221 |
}; |
222 |
||
223 |
enum { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
224 |
// HVOT_PENDING_DELETE = 1 << 0, // not needed anymore |
3554
86230061c3e7
(svn r4426) Code Cleaning : replacing tabs with spaces, removing obvious comments, aligning arrays etc...
belugas
parents:
3479
diff
changeset
|
225 |
HVOT_TRAIN = 1 << 1, |
86230061c3e7
(svn r4426) Code Cleaning : replacing tabs with spaces, removing obvious comments, aligning arrays etc...
belugas
parents:
3479
diff
changeset
|
226 |
HVOT_BUS = 1 << 2, |
86230061c3e7
(svn r4426) Code Cleaning : replacing tabs with spaces, removing obvious comments, aligning arrays etc...
belugas
parents:
3479
diff
changeset
|
227 |
HVOT_TRUCK = 1 << 3, |
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
228 |
HVOT_AIRCRAFT = 1 << 4, |
3554
86230061c3e7
(svn r4426) Code Cleaning : replacing tabs with spaces, removing obvious comments, aligning arrays etc...
belugas
parents:
3479
diff
changeset
|
229 |
HVOT_SHIP = 1 << 5, |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1742
diff
changeset
|
230 |
/* This bit is used to mark stations. No, it does not belong here, but what |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1742
diff
changeset
|
231 |
* can we do? ;-) */ |
3554
86230061c3e7
(svn r4426) Code Cleaning : replacing tabs with spaces, removing obvious comments, aligning arrays etc...
belugas
parents:
3479
diff
changeset
|
232 |
HVOT_BUOY = 1 << 6 |
0 | 233 |
}; |
234 |
||
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
235 |
enum CatchmentArea { |
5601
d58f82901b2f
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents:
5587
diff
changeset
|
236 |
CA_NONE = 0, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
237 |
CA_BUS = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
238 |
CA_TRUCK = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
239 |
CA_TRAIN = 4, |
7498
16bf3e859669
(svn r11013) -Fix [FS#1171]: MoveGoodsToStation's search area is too small as it assumed a lower maximum catchment area than the real maximum catchment area. Based on a patch by PhilSophus.
rubidium
parents:
7496
diff
changeset
|
240 |
CA_DOCK = 5, |
16bf3e859669
(svn r11013) -Fix [FS#1171]: MoveGoodsToStation's search area is too small as it assumed a lower maximum catchment area than the real maximum catchment area. Based on a patch by PhilSophus.
rubidium
parents:
7496
diff
changeset
|
241 |
|
16bf3e859669
(svn r11013) -Fix [FS#1171]: MoveGoodsToStation's search area is too small as it assumed a lower maximum catchment area than the real maximum catchment area. Based on a patch by PhilSophus.
rubidium
parents:
7496
diff
changeset
|
242 |
MAX_CATCHMENT = 10, ///< Airports have a catchment up to this number. |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
243 |
}; |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
449
diff
changeset
|
244 |
|
2498
3ed05caa4449
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2488
diff
changeset
|
245 |
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius); |
0 | 246 |
|
7891
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
247 |
/** A set of stations (\c const \c Station* ) */ |
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
248 |
typedef std::set<Station*> StationSet; |
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
249 |
|
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
250 |
StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h); |
aef0c16244d7
(svn r11442) -Feature: make news messages related to the industry (production) changes better configurable; you can now disable news messages popping up for industries you are not servicing. Patch by Alberth.
rubidium
parents:
7545
diff
changeset
|
251 |
|
2498
3ed05caa4449
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2488
diff
changeset
|
252 |
void ShowStationViewWindow(StationID station); |
6247 | 253 |
void UpdateAllStationVirtCoord(); |
0 | 254 |
|
6247 | 255 |
static inline StationID GetMaxStationIndex() |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
256 |
{ |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
257 |
/* TODO - This isn't the real content of the function, but |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
258 |
* with the new pool-system this will be replaced with one that |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5220
diff
changeset
|
259 |
* _really_ returns the highest index. Now it just returns |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
260 |
* the next safe value we are sure about everything is below. |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
261 |
*/ |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5220
diff
changeset
|
262 |
return GetStationPoolSize() - 1; |
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5220
diff
changeset
|
263 |
} |
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5220
diff
changeset
|
264 |
|
6247 | 265 |
static inline uint GetNumStations() |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5220
diff
changeset
|
266 |
{ |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
267 |
return GetStationPoolSize(); |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
268 |
} |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4352
diff
changeset
|
269 |
|
5996
4bcab9c286d8
(svn r8707) -Codechange: Turn IsValidStation into a method of Station
celestar
parents:
5995
diff
changeset
|
270 |
static inline bool IsValidStationID(StationID index) |
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
271 |
{ |
5996
4bcab9c286d8
(svn r8707) -Codechange: Turn IsValidStation into a method of Station
celestar
parents:
5995
diff
changeset
|
272 |
return index < GetStationPoolSize() && GetStation(index)->IsValid(); |
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
273 |
} |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
274 |
|
5996
4bcab9c286d8
(svn r8707) -Codechange: Turn IsValidStation into a method of Station
celestar
parents:
5995
diff
changeset
|
275 |
#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()) |
1272
9aa073c64fc7
(svn r1776) -Add: Dynamic stations. You can now have up to 64k of stations
truelight
parents:
1266
diff
changeset
|
276 |
#define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
915
diff
changeset
|
277 |
|
1284
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
278 |
|
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
279 |
/* Stuff for ROADSTOPS */ |
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
280 |
|
5835
7ef65a4a70ef
(svn r8401) -Codechange: Make 'IsValidRoadStop' a method of RoadStop and rename it to 'IsValid'
celestar
parents:
5721
diff
changeset
|
281 |
#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()) |
1284
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
282 |
#define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0) |
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
283 |
|
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
284 |
/* End of stuff for ROADSTOPS */ |
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
285 |
|
e1969eb0227b
(svn r1788) -Add: Made RoadStops dynamic. You can now create up to 64k roadstops.
truelight
parents:
1272
diff
changeset
|
286 |
|
6247 | 287 |
void AfterLoadStations(); |
1424
38b76de179c9
(svn r1928) Miscellaneous cleanups (data types, whitespace, const correctness)
tron
parents:
1368
diff
changeset
|
288 |
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad); |
38b76de179c9
(svn r1928) Miscellaneous cleanups (data types, whitespace, const correctness)
tron
parents:
1368
diff
changeset
|
289 |
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad); |
384
809833b4068d
(svn r576) -newgrf: Cleanup horrible table/(station|unmovable)_land.h DrawTileSeqStruct hacks needed for custom station supports (pasky)
darkvater
parents:
243
diff
changeset
|
290 |
|
809833b4068d
(svn r576) -newgrf: Cleanup horrible table/(station|unmovable)_land.h DrawTileSeqStruct hacks needed for custom station supports (pasky)
darkvater
parents:
243
diff
changeset
|
291 |
|
7272
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
292 |
const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); |
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7013
diff
changeset
|
293 |
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); |
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2498
diff
changeset
|
294 |
|
5836
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
295 |
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStop::Type type); |
a60d2114780e
(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
celestar
parents:
5835
diff
changeset
|
296 |
uint GetNumRoadStops(const Station* st, RoadStop::Type type); |
6247 | 297 |
RoadStop * AllocateRoadStop(); |
3123 | 298 |
void ClearSlot(Vehicle *v); |
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
299 |
|
8109
a501ce9046c4
(svn r11670) -Feature [FS#1565]: list neutral stations where the player has service in the station list too
smatz
parents:
8108
diff
changeset
|
300 |
bool HasStationInUse(StationID station, PlayerID player); |
a501ce9046c4
(svn r11670) -Feature [FS#1565]: list neutral stations where the player has service in the station list too
smatz
parents:
8108
diff
changeset
|
301 |
|
5884 | 302 |
void DeleteOilRig(TileIndex t); |
303 |
||
0 | 304 |
#endif /* STATION_H */ |