author | miham |
Wed, 17 Aug 2005 12:30:07 +0000 | |
changeset 2349 | df02d0ffb588 |
parent 2254 | 72f8883ff3ac |
child 2520 | 75eb66d6e371 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
3 |
#ifndef WAYPOINT_H |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
4 |
#define WAYPOINT_H |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
5 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
6 |
#include "pool.h" |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
7 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
8 |
struct Waypoint { |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
9 |
TileIndex xy; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
10 |
uint16 index; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
11 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
12 |
uint16 town_index; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
13 |
byte town_cn; // The Nth waypoint for this town (consecutive number) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
14 |
StringID string; // If this is zero, town + town_cn is used for naming |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
15 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
16 |
ViewportSign sign; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
17 |
uint16 build_date; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
18 |
byte stat_id; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
19 |
byte deleted; // this is a delete counter. when it reaches 0, the waypoint struct is deleted. |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
20 |
}; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
21 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
22 |
enum { |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
23 |
RAIL_TYPE_WAYPOINT = 0xC4, |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
24 |
RAIL_WAYPOINT_TRACK_MASK = 1, |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
25 |
}; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
26 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
27 |
extern MemoryPool _waypoint_pool; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
28 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
29 |
/** |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
30 |
* Get the pointer to the waypoint with index 'index' |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
31 |
*/ |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
32 |
static inline Waypoint *GetWaypoint(uint index) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
33 |
{ |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
34 |
return (Waypoint*)GetItemFromPool(&_waypoint_pool, index); |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
35 |
} |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
36 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
37 |
/** |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
38 |
* Get the current size of the WaypointPool |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
39 |
*/ |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
40 |
static inline uint16 GetWaypointPoolSize(void) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
41 |
{ |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
42 |
return _waypoint_pool.total_items; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
43 |
} |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
44 |
|
1718
cef0773365eb
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
tron
parents:
1542
diff
changeset
|
45 |
static inline bool IsWaypointIndex(uint index) |
cef0773365eb
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
tron
parents:
1542
diff
changeset
|
46 |
{ |
cef0773365eb
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
tron
parents:
1542
diff
changeset
|
47 |
return index < GetWaypointPoolSize(); |
cef0773365eb
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
tron
parents:
1542
diff
changeset
|
48 |
} |
cef0773365eb
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
tron
parents:
1542
diff
changeset
|
49 |
|
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
50 |
#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = GetWaypoint(start); wp != NULL; wp = (wp->index + 1 < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1) : NULL) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
51 |
#define FOR_ALL_WAYPOINTS(wp) FOR_ALL_WAYPOINTS_FROM(wp, 0) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
52 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
53 |
static inline bool IsRailWaypoint(byte m5) |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
54 |
{ |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
55 |
return (m5 & 0xFC) == 0xC4; |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
56 |
} |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
57 |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1718
diff
changeset
|
58 |
int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove); |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1718
diff
changeset
|
59 |
Station *ComposeWaypointStation(TileIndex tile); |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
60 |
Waypoint *GetWaypointByTile(TileIndex tile); |
2116 | 61 |
void ShowRenameWaypointWindow(const Waypoint *cp); |
2254
72f8883ff3ac
(svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo
celestar
parents:
2186
diff
changeset
|
62 |
void DrawWaypointSprite(int x, int y, int image, uint railtype); |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
63 |
void UpdateWaypointSign(Waypoint *cp); |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
64 |
void FixOldWaypoints(void); |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
65 |
void UpdateAllWaypointSigns(void); |
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
66 |
|
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
diff
changeset
|
67 |
#endif /* WAYPOINT_H */ |