summaryrefslogtreecommitdiff
path: root/waypoint.h
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-16 22:20:15 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-16 22:20:15 +0000
commit479a9c2e47358cd5cb040e89c66a4de11d1b457d (patch)
tree981b72e2eee14dca280a68f1b688ab83202c9f73 /waypoint.h
parentea1921d2e0a45a94af69365c38533944fa46c0fa (diff)
downloadopenttd-479a9c2e47358cd5cb040e89c66a4de11d1b457d.tar.xz
(svn r3212) - Waypoints/Depots: Store waypoint index in m2 for waypoints. This moves the ground type bits from m2 to m4 for waypoints and depots (leaving room for depot index in m2 in future), and moves the custom graphics ID to the waypoint struct.
- Waypoints: Until now stat_id was saved but never assigned to. Instead we now save the GRFID/local index of the custom graphics so that GRF file changes can leave graphics intact.
Diffstat (limited to 'waypoint.h')
-rw-r--r--waypoint.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/waypoint.h b/waypoint.h
index a9c3432ea..427fd9d79 100644
--- a/waypoint.h
+++ b/waypoint.h
@@ -6,18 +6,21 @@
#include "pool.h"
struct Waypoint {
- TileIndex xy;
- uint16 index;
-
- uint16 town_index;
- byte town_cn; // The Nth waypoint for this town (consecutive number)
- StringID string; // If this is zero, town + town_cn is used for naming
-
- ViewportSign sign;
- uint16 build_date;
- byte stat_id;
- uint32 grfid;
- byte deleted; // this is a delete counter. when it reaches 0, the waypoint struct is deleted.
+ TileIndex xy; ///< Tile of waypoint
+ uint16 index; ///< Index of waypoint
+
+ uint16 town_index; ///< Town associated with the waypoint
+ byte town_cn; ///< The Nth waypoint for this town (consecutive number)
+ StringID string; ///< If this is zero (i.e. no custom name), town + town_cn is used for naming
+
+ ViewportSign sign; ///< Dimensions of sign (not saved)
+ uint16 build_date; ///< Date of construction
+
+ byte stat_id; ///< ID of waypoint within the waypoint class (not saved)
+ uint32 grfid; ///< ID of GRF file
+ byte localidx; ///< Index of station within GRF file
+
+ byte deleted; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
};
enum {
@@ -56,13 +59,24 @@ static inline bool IsRailWaypoint(TileIndex tile)
return (_m[tile].m5 & 0xFC) == 0xC4;
}
+/**
+ * Fetch a waypoint by tile
+ * @param tile Tile of waypoint
+ * @return Waypoint
+ */
+static inline Waypoint *GetWaypointByTile(TileIndex tile)
+{
+ assert(IsTileType(tile, MP_RAILWAY) && IsRailWaypoint(tile));
+ return GetWaypoint(_m[tile].m2);
+}
+
int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove);
Station *ComposeWaypointStation(TileIndex tile);
-Waypoint *GetWaypointByTile(TileIndex tile);
void ShowRenameWaypointWindow(const Waypoint *cp);
void DrawWaypointSprite(int x, int y, int image, RailType railtype);
void UpdateWaypointSign(Waypoint *cp);
void FixOldWaypoints(void);
void UpdateAllWaypointSigns(void);
+void UpdateAllWaypointCustomGraphics(void);
#endif /* WAYPOINT_H */