summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rail.h11
-rw-r--r--rail_gui.c24
-rw-r--r--railtypes.h35
-rw-r--r--table/sprites.h7
4 files changed, 62 insertions, 15 deletions
diff --git a/rail.h b/rail.h
index 215a291dd..ba5025dbe 100644
--- a/rail.h
+++ b/rail.h
@@ -172,6 +172,17 @@ typedef struct RailtypeInfo {
} gui_sprites;
struct {
+ CursorID rail_ns;
+ CursorID rail_swne;
+ CursorID rail_ew;
+ CursorID rail_nwse;
+ CursorID autorail;
+ CursorID depot;
+ CursorID tunnel;
+ CursorID convert;
+ } cursor;
+
+ struct {
StringID toolbar_caption;
} strings;
diff --git a/rail_gui.c b/rail_gui.c
index 057b6849c..a541ff789 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -220,27 +220,27 @@ static void PlaceRail_AutoSignals(TileIndex tile)
static void BuildRailClick_N(Window *w)
{
- HandlePlacePushButton(w, 4, _cur_railtype*4 + SPR_CURSOR_NS_TRACK, 1, PlaceRail_N);
+ HandlePlacePushButton(w, 4, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, 1, PlaceRail_N);
}
static void BuildRailClick_NE(Window *w)
{
- HandlePlacePushButton(w, 5, _cur_railtype*4 + SPR_CURSOR_SWNE_TRACK, 1, PlaceRail_NE);
+ HandlePlacePushButton(w, 5, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, 1, PlaceRail_NE);
}
static void BuildRailClick_E(Window *w)
{
- HandlePlacePushButton(w, 6, _cur_railtype*4 + SPR_CURSOR_EW_TRACK, 1, PlaceRail_E);
+ HandlePlacePushButton(w, 6, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, 1, PlaceRail_E);
}
static void BuildRailClick_NW(Window *w)
{
- HandlePlacePushButton(w, 7, _cur_railtype*4 + SPR_CURSOR_NWSE_TRACK, 1, PlaceRail_NW);
+ HandlePlacePushButton(w, 7, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, 1, PlaceRail_NW);
}
static void BuildRailClick_AutoRail(Window *w)
{
- HandlePlacePushButton(w, 8, SPR_CURSOR_AUTORAIL + _cur_railtype, VHM_RAIL, PlaceRail_AutoRail);
+ HandlePlacePushButton(w, 8, GetRailTypeInfo(_cur_railtype)->cursor.autorail, VHM_RAIL, PlaceRail_AutoRail);
}
static void BuildRailClick_Demolish(Window *w)
@@ -248,15 +248,11 @@ static void BuildRailClick_Demolish(Window *w)
HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
}
-static const CursorID _depot_cursors[] = {
- SPR_CURSOR_RAIL_DEPOT,
- SPR_CURSOR_MONO_DEPOT,
- SPR_CURSOR_MAGLEV_DEPOT,
-};
-
static void BuildRailClick_Depot(Window *w)
{
- if (HandlePlacePushButton(w, 10, _depot_cursors[_cur_railtype], 1, PlaceRail_Depot)) ShowBuildTrainDepotPicker();
+ if (HandlePlacePushButton(w, 10, GetRailTypeInfo(_cur_railtype)->cursor.depot, 1, PlaceRail_Depot)) {
+ ShowBuildTrainDepotPicker();
+ }
}
static void BuildRailClick_Waypoint(Window *w)
@@ -284,7 +280,7 @@ static void BuildRailClick_Bridge(Window *w)
static void BuildRailClick_Tunnel(Window *w)
{
- HandlePlacePushButton(w, 15, SPR_CURSOR_TUNNEL_RAIL + _cur_railtype, 3, PlaceRail_Tunnel);
+ HandlePlacePushButton(w, 15, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, 3, PlaceRail_Tunnel);
}
static void BuildRailClick_Remove(Window *w)
@@ -310,7 +306,7 @@ static void BuildRailClick_Remove(Window *w)
static void BuildRailClick_Convert(Window *w)
{
- HandlePlacePushButton(w, 17, SPR_CURSOR_CONVERT_RAIL + _cur_railtype * 2, 1, PlaceRail_ConvertRail);
+ HandlePlacePushButton(w, 17, GetRailTypeInfo(_cur_railtype)->cursor.convert, 1, PlaceRail_ConvertRail);
}
static void BuildRailClick_Landscaping(Window *w)
diff --git a/railtypes.h b/railtypes.h
index 9e09e3e65..bb1b6a10c 100644
--- a/railtypes.h
+++ b/railtypes.h
@@ -6,7 +6,7 @@
/** Global Railtype definition
*/
-const RailtypeInfo _railtypes[RAILTYPE_END] = {
+const RailtypeInfo _railtypes[] = {
/** Railway */
{ /* Main Sprites */
{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_Y, SPR_RAIL_SINGLE_X,
@@ -19,6 +19,17 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
{ 0x4E3, 0x4E4, 0x4E5, 0x4E6,
SPR_OPENTTD_BASE + 0, 0x50E, 0x97E, SPR_OPENTTD_BASE + 25 },
+ {
+ SPR_CURSOR_NS_TRACK,
+ SPR_CURSOR_SWNE_TRACK,
+ SPR_CURSOR_EW_TRACK,
+ SPR_CURSOR_NWSE_TRACK,
+ SPR_CURSOR_AUTORAIL,
+ SPR_CURSOR_RAIL_DEPOT,
+ SPR_CURSOR_TUNNEL_RAIL,
+ SPR_CURSOR_CONVERT_RAIL
+ },
+
/* strings */
{ STR_100A_RAILROAD_CONSTRUCTION },
@@ -44,6 +55,17 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
{ 0x4E7, 0x4E8, 0x4E9, 0x4EA,
SPR_OPENTTD_BASE + 1, SPR_OPENTTD_BASE + 12, 0x97F, SPR_OPENTTD_BASE + 27 },
+ {
+ SPR_CURSOR_NS_MONO,
+ SPR_CURSOR_SWNE_MONO,
+ SPR_CURSOR_EW_MONO,
+ SPR_CURSOR_NWSE_MONO,
+ SPR_CURSOR_AUTOMONO,
+ SPR_CURSOR_MONO_DEPOT,
+ SPR_CURSOR_TUNNEL_MONO,
+ SPR_CURSOR_CONVERT_MONO
+ },
+
/* strings */
{ STR_100B_MONORAIL_CONSTRUCTION },
@@ -69,6 +91,17 @@ const RailtypeInfo _railtypes[RAILTYPE_END] = {
{ 0x4EB, 0x4EC, 0x4EE, 0x4ED,
SPR_OPENTTD_BASE + 2, SPR_OPENTTD_BASE + 13, 0x980, SPR_OPENTTD_BASE + 29 },
+ {
+ SPR_CURSOR_NS_MAGLEV,
+ SPR_CURSOR_SWNE_MAGLEV,
+ SPR_CURSOR_EW_MAGLEV,
+ SPR_CURSOR_NWSE_MAGLEV,
+ SPR_CURSOR_AUTOMAGLEV,
+ SPR_CURSOR_MAGLEV_DEPOT,
+ SPR_CURSOR_TUNNEL_MAGLEV,
+ SPR_CURSOR_CONVERT_MAGLEV
+ },
+
/* strings */
{ STR_100C_MAGLEV_CONSTRUCTION },
diff --git a/table/sprites.h b/table/sprites.h
index 442282b33..cb2e0c1b9 100644
--- a/table/sprites.h
+++ b/table/sprites.h
@@ -936,15 +936,22 @@ typedef enum CursorSprites {
SPR_CURSOR_RAIL_DEPOT = 1296,
SPR_CURSOR_RAIL_STATION = 1300,
+
SPR_CURSOR_TUNNEL_RAIL = 2434,
SPR_CURSOR_TUNNEL_MONO = 2435,
SPR_CURSOR_TUNNEL_MAGLEV = 2436,
SPR_CURSOR_AUTORAIL = SPR_OPENTTD_BASE + 4,
+ SPR_CURSOR_AUTOMONO = SPR_OPENTTD_BASE + 5,
+ SPR_CURSOR_AUTOMAGLEV = SPR_OPENTTD_BASE + 6,
+
SPR_CURSOR_WAYPOINT = SPR_OPENTTD_BASE + 7,
SPR_CURSOR_MONO_DEPOT = SPR_OPENTTD_BASE + 14,
SPR_CURSOR_MAGLEV_DEPOT = SPR_OPENTTD_BASE + 15,
+
SPR_CURSOR_CONVERT_RAIL = SPR_OPENTTD_BASE + 26,
+ SPR_CURSOR_CONVERT_MONO = SPR_OPENTTD_BASE + 28,
+ SPR_CURSOR_CONVERT_MAGLEV = SPR_OPENTTD_BASE + 30,
/* road cursors */
SPR_CURSOR_ROAD_NESW = 1311,