author | celestar |
Sat, 30 Dec 2006 17:16:07 +0000 | |
branch | custombridgeheads |
changeset 5607 | 5169e3e15ce9 |
parent 5231 | 3bf4c8b8ddeb |
child 5394 | 58afc8e5ff3e |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
3 |
/** @file rail_gui.c File for dealing with rail construction user interface */ |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1884
diff
changeset
|
6 |
#include "openttd.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1227
diff
changeset
|
7 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
449
diff
changeset
|
8 |
#include "table/strings.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
9 |
#include "functions.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
651
diff
changeset
|
10 |
#include "map.h" |
1209
a1ac96655b79
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents:
1123
diff
changeset
|
11 |
#include "tile.h" |
0 | 12 |
#include "window.h" |
13 |
#include "gui.h" |
|
14 |
#include "viewport.h" |
|
15 |
#include "gfx.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
288
diff
changeset
|
16 |
#include "sound.h" |
0 | 17 |
#include "command.h" |
18 |
#include "vehicle.h" |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
19 |
#include "station.h" |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1363
diff
changeset
|
20 |
#include "waypoint.h" |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
21 |
#include "debug.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2049
diff
changeset
|
22 |
#include "variables.h" |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
23 |
#include "newgrf_callbacks.h" |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
24 |
#include "newgrf_station.h" |
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
25 |
#include "train.h" |
0 | 26 |
|
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
27 |
static RailType _cur_railtype; |
0 | 28 |
static bool _remove_button_clicked; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
29 |
static DiagDirection _build_depot_direction; |
2639 | 30 |
static byte _waypoint_count = 1; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
31 |
static byte _cur_waypoint_type; |
0 | 32 |
|
2630 | 33 |
static struct { |
0 | 34 |
byte orientation; |
35 |
byte numtracks; |
|
36 |
byte platlength; |
|
37 |
bool dragdrop; |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
38 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
39 |
bool newstations; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
40 |
byte station_class; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
41 |
byte station_type; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
42 |
byte station_count; |
0 | 43 |
} _railstation; |
44 |
||
45 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
46 |
static void HandleStationPlacement(TileIndex start, TileIndex end); |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
47 |
static void ShowBuildTrainDepotPicker(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
48 |
static void ShowBuildWaypointPicker(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
49 |
static void ShowStationBuilder(void); |
0 | 50 |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
51 |
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 52 |
{ |
541 | 53 |
if (success) SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 54 |
} |
55 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
56 |
static void GenericPlaceRail(TileIndex tile, int cmd) |
0 | 57 |
{ |
58 |
DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E, |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
59 |
_remove_button_clicked ? |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
60 |
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER : |
0 | 61 |
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER |
2639 | 62 |
); |
0 | 63 |
} |
64 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
65 |
static void PlaceRail_N(TileIndex tile) |
0 | 66 |
{ |
67 |
int cmd = _tile_fract_coords.x > _tile_fract_coords.y ? 4 : 5; |
|
68 |
GenericPlaceRail(tile, cmd); |
|
69 |
} |
|
70 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
71 |
static void PlaceRail_NE(TileIndex tile) |
0 | 72 |
{ |
73 |
VpStartPlaceSizing(tile, VPM_FIX_Y); |
|
74 |
} |
|
75 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
76 |
static void PlaceRail_E(TileIndex tile) |
0 | 77 |
{ |
78 |
int cmd = _tile_fract_coords.x + _tile_fract_coords.y <= 15 ? 2 : 3; |
|
79 |
GenericPlaceRail(tile, cmd); |
|
80 |
} |
|
81 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
82 |
static void PlaceRail_NW(TileIndex tile) |
0 | 83 |
{ |
84 |
VpStartPlaceSizing(tile, VPM_FIX_X); |
|
85 |
} |
|
86 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
87 |
static void PlaceRail_AutoRail(TileIndex tile) |
0 | 88 |
{ |
89 |
VpStartPlaceSizing(tile, VPM_RAILDIRS); |
|
90 |
} |
|
91 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
92 |
static void PlaceExtraDepotRail(TileIndex tile, uint16 extra) |
0 | 93 |
{ |
3792
2eb8388731bf
(svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents:
3782
diff
changeset
|
94 |
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return; |
3269
95e7bffcb3c5
(svn r3981) More work for the rail accessing functions and enums
tron
parents:
3157
diff
changeset
|
95 |
if ((GetTrackBits(tile) & GB(extra, 8, 8)) == 0) return; |
0 | 96 |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
97 |
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_AUTO | CMD_NO_WATER); |
0 | 98 |
} |
99 |
||
100 |
static const uint16 _place_depot_extra[12] = { |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
101 |
0x0604, 0x2102, 0x1202, 0x0505, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
102 |
0x2400, 0x2801, 0x1800, 0x1401, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
103 |
0x2203, 0x0904, 0x0A05, 0x1103, |
0 | 104 |
}; |
105 |
||
106 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
107 |
void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 108 |
{ |
109 |
if (success) { |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
110 |
DiagDirection dir = p2; |
0 | 111 |
|
541 | 112 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 113 |
ResetObjectToPlace(); |
114 |
||
4559
c853d2440065
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4547
diff
changeset
|
115 |
tile += TileOffsByDiagDir(dir); |
0 | 116 |
|
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
980
diff
changeset
|
117 |
if (IsTileType(tile, MP_RAILWAY)) { |
0 | 118 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir]); |
119 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]); |
|
120 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]); |
|
121 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
122 |
} |
0 | 123 |
} |
124 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
125 |
static void PlaceRail_Depot(TileIndex tile) |
0 | 126 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
127 |
DoCommandP(tile, _cur_railtype, _build_depot_direction, CcRailDepot, |
0 | 128 |
CMD_BUILD_TRAIN_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT)); |
129 |
} |
|
130 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
131 |
static void PlaceRail_Waypoint(TileIndex tile) |
0 | 132 |
{ |
133 |
if (!_remove_button_clicked) { |
|
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
134 |
DoCommandP(tile, _cur_waypoint_type, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT)); |
0 | 135 |
} else { |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
136 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT)); |
0 | 137 |
} |
138 |
} |
|
139 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
140 |
void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 141 |
{ |
142 |
if (success) { |
|
541 | 143 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
144 |
/* Only close the station builder window if the default station is chosen. */ |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
145 |
if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0) ResetObjectToPlace(); |
0 | 146 |
} |
147 |
} |
|
148 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
149 |
static void PlaceRail_Station(TileIndex tile) |
0 | 150 |
{ |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
151 |
if (_remove_button_clicked) { |
0 | 152 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
153 |
} else if (_railstation.dragdrop) { |
0 | 154 |
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED); |
155 |
VpSetPlaceSizingLimit(_patches.station_spread); |
|
156 |
} else { |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
157 |
DoCommandP(tile, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
158 |
_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16), |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
159 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
0 | 160 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
161 |
} |
|
162 |
} |
|
163 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
164 |
static void GenericPlaceSignals(TileIndex tile) |
0 | 165 |
{ |
166 |
uint trackstat; |
|
2639 | 167 |
uint i; |
0 | 168 |
|
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
59
diff
changeset
|
169 |
trackstat = (byte)GetTileTrackStatus(tile, TRANSPORT_RAIL); |
0 | 170 |
|
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
171 |
if ((trackstat & 0x30)) // N-S direction |
0 | 172 |
trackstat = (_tile_fract_coords.x <= _tile_fract_coords.y) ? 0x20 : 0x10; |
173 |
||
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
174 |
if ((trackstat & 0x0C)) // E-W direction |
0 | 175 |
trackstat = (_tile_fract_coords.x + _tile_fract_coords.y <= 15) ? 4 : 8; |
176 |
||
177 |
// Lookup the bit index |
|
178 |
i = 0; |
|
2639 | 179 |
if (trackstat != 0) { |
180 |
for (; !(trackstat & 1); trackstat >>= 1) i++; |
|
181 |
} |
|
0 | 182 |
|
183 |
if (!_remove_button_clicked) { |
|
184 |
DoCommandP(tile, i + (_ctrl_pressed ? 8 : 0), 0, CcPlaySound1E, |
|
185 |
CMD_BUILD_SIGNALS | CMD_AUTO | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)); |
|
186 |
} else { |
|
187 |
DoCommandP(tile, i, 0, CcPlaySound1E, |
|
188 |
CMD_REMOVE_SIGNALS | CMD_AUTO | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM)); |
|
189 |
} |
|
190 |
} |
|
191 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
192 |
static void PlaceRail_Bridge(TileIndex tile) |
0 | 193 |
{ |
194 |
VpStartPlaceSizing(tile, VPM_X_OR_Y); |
|
195 |
} |
|
196 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
197 |
void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 198 |
{ |
199 |
if (success) { |
|
541 | 200 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 201 |
ResetObjectToPlace(); |
202 |
} else { |
|
203 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
204 |
} |
|
205 |
} |
|
206 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
207 |
static void PlaceRail_Tunnel(TileIndex tile) |
0 | 208 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
209 |
DoCommandP(tile, _cur_railtype, 0, CcBuildRailTunnel, |
0 | 210 |
CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
211 |
} |
|
212 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
213 |
void PlaceProc_BuyLand(TileIndex tile) |
0 | 214 |
{ |
215 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND)); |
|
216 |
} |
|
217 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
218 |
static void PlaceRail_ConvertRail(TileIndex tile) |
0 | 219 |
{ |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
220 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_ConvertRailArea); |
0 | 221 |
} |
222 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
223 |
static void PlaceRail_AutoSignals(TileIndex tile) |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
224 |
{ |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
225 |
VpStartPlaceSizing(tile, VPM_SIGNALDIRS); |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
226 |
} |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
227 |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
228 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
229 |
/** Enum referring to the widgets of the build rail toolbar */ |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
230 |
enum { |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
231 |
RTW_CAPTION = 1, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
232 |
RTW_BUILD_NS = 4, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
233 |
RTW_BUILD_X = 5, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
234 |
RTW_BUILD_EW = 6, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
235 |
RTW_BUILD_Y = 7, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
236 |
RTW_AUTORAIL = 8, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
237 |
RTW_DEMOLISH = 9, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
238 |
RTW_BUILD_DEPOT = 10, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
239 |
RTW_BUILD_WAYPOINT = 11, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
240 |
RTW_BUILD_STATION = 12, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
241 |
RTW_BUILD_SIGNALS = 13, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
242 |
RTW_BUILD_BRIDGE = 14, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
243 |
RTW_BUILD_TUNNEL = 15, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
244 |
RTW_REMOVE = 16, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
245 |
RTW_CONVERT_RAIL = 17 |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
246 |
}; |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
247 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
248 |
|
0 | 249 |
static void BuildRailClick_N(Window *w) |
250 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
251 |
HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, 1, PlaceRail_N); |
0 | 252 |
} |
253 |
||
254 |
static void BuildRailClick_NE(Window *w) |
|
255 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
256 |
HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, 1, PlaceRail_NE); |
0 | 257 |
} |
258 |
||
259 |
static void BuildRailClick_E(Window *w) |
|
260 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
261 |
HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, 1, PlaceRail_E); |
0 | 262 |
} |
263 |
||
264 |
static void BuildRailClick_NW(Window *w) |
|
265 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
266 |
HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, 1, PlaceRail_NW); |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
267 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
268 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
269 |
static void BuildRailClick_AutoRail(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
270 |
{ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
271 |
HandlePlacePushButton(w, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, VHM_RAIL, PlaceRail_AutoRail); |
0 | 272 |
} |
273 |
||
274 |
static void BuildRailClick_Demolish(Window *w) |
|
275 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
276 |
HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); |
0 | 277 |
} |
278 |
||
279 |
static void BuildRailClick_Depot(Window *w) |
|
280 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
281 |
if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, 1, PlaceRail_Depot)) { |
2514
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2274
diff
changeset
|
282 |
ShowBuildTrainDepotPicker(); |
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2274
diff
changeset
|
283 |
} |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
284 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
285 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
286 |
static void BuildRailClick_Waypoint(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
287 |
{ |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
288 |
_waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP); |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
289 |
if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, 1, PlaceRail_Waypoint) && |
2639 | 290 |
_waypoint_count > 1) { |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
291 |
ShowBuildWaypointPicker(); |
2639 | 292 |
} |
0 | 293 |
} |
294 |
||
295 |
static void BuildRailClick_Station(Window *w) |
|
296 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
297 |
if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, 1, PlaceRail_Station)) ShowStationBuilder(); |
0 | 298 |
} |
299 |
||
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
300 |
static void BuildRailClick_AutoSignals(Window *w) |
0 | 301 |
{ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
302 |
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
0 | 303 |
} |
304 |
||
305 |
static void BuildRailClick_Bridge(Window *w) |
|
306 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
307 |
HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, 1, PlaceRail_Bridge); |
0 | 308 |
} |
309 |
||
310 |
static void BuildRailClick_Tunnel(Window *w) |
|
311 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
312 |
HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, 3, PlaceRail_Tunnel); |
0 | 313 |
} |
314 |
||
315 |
static void BuildRailClick_Remove(Window *w) |
|
316 |
{ |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
317 |
if (IsWindowWidgetDisabled(w, RTW_REMOVE)) return; |
0 | 318 |
SetWindowDirty(w); |
541 | 319 |
SndPlayFx(SND_15_BEEP); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
320 |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
321 |
ToggleWidgetLoweredState(w, RTW_REMOVE); |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
322 |
_remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
323 |
SetSelectionRed(_remove_button_clicked); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
324 |
|
0 | 325 |
// handle station builder |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
326 |
if (_remove_button_clicked) { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
327 |
SetTileSelectSize(1, 1); |
0 | 328 |
} |
329 |
} |
|
330 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
331 |
static void BuildRailClick_Convert(Window *w) |
0 | 332 |
{ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
333 |
HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, 1, PlaceRail_ConvertRail); |
0 | 334 |
} |
335 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
336 |
static void BuildRailClick_Landscaping(Window *w) |
0 | 337 |
{ |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
338 |
ShowTerraformToolbar(); |
0 | 339 |
} |
340 |
||
341 |
static void DoRailroadTrack(int mode) |
|
342 |
{ |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
343 |
DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), NULL, |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
344 |
_remove_button_clicked ? |
0 | 345 |
CMD_REMOVE_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) : |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
346 |
CMD_BUILD_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) |
0 | 347 |
); |
348 |
} |
|
349 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
350 |
static void HandleAutodirPlacement(void) |
0 | 351 |
{ |
352 |
TileHighlightData *thd = &_thd; |
|
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
353 |
int trackstat = thd->drawstyle & 0xF; // 0..5 |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
354 |
|
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
355 |
if (thd->drawstyle & HT_RAIL) { // one tile case |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
356 |
GenericPlaceRail(TileVirtXY(thd->selend.x, thd->selend.y), trackstat); |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
357 |
return; |
0 | 358 |
} |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
359 |
|
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
360 |
DoRailroadTrack(trackstat); |
0 | 361 |
} |
362 |
||
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
363 |
static void HandleAutoSignalPlacement(void) |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
364 |
{ |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
365 |
TileHighlightData *thd = &_thd; |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
366 |
byte trackstat = thd->drawstyle & 0xF; // 0..5 |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
367 |
|
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
368 |
if (thd->drawstyle == HT_RECT) { // one tile case |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
369 |
GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y)); |
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
370 |
return; |
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
371 |
} |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
372 |
|
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
373 |
// _patches.drag_signals_density is given as a parameter such that each user in a network |
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
374 |
// game can specify his/her own signal density |
2639 | 375 |
DoCommandP( |
376 |
TileVirtXY(thd->selstart.x, thd->selstart.y), |
|
377 |
TileVirtXY(thd->selend.x, thd->selend.y), |
|
378 |
(_ctrl_pressed ? 1 << 3 : 0) | (trackstat << 4) | (_patches.drag_signals_density << 24), |
|
379 |
CcPlaySound1E, |
|
380 |
_remove_button_clicked ? |
|
381 |
CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) : |
|
382 |
CMD_BUILD_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) |
|
383 |
); |
|
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
384 |
} |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
385 |
|
2639 | 386 |
|
387 |
typedef void OnButtonClick(Window *w); |
|
388 |
||
0 | 389 |
static OnButtonClick * const _build_railroad_button_proc[] = { |
390 |
BuildRailClick_N, |
|
391 |
BuildRailClick_NE, |
|
392 |
BuildRailClick_E, |
|
393 |
BuildRailClick_NW, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
394 |
BuildRailClick_AutoRail, |
0 | 395 |
BuildRailClick_Demolish, |
396 |
BuildRailClick_Depot, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
397 |
BuildRailClick_Waypoint, |
0 | 398 |
BuildRailClick_Station, |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
399 |
BuildRailClick_AutoSignals, |
0 | 400 |
BuildRailClick_Bridge, |
401 |
BuildRailClick_Tunnel, |
|
402 |
BuildRailClick_Remove, |
|
403 |
BuildRailClick_Convert, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
404 |
BuildRailClick_Landscaping, |
0 | 405 |
}; |
406 |
||
407 |
static const uint16 _rail_keycodes[] = { |
|
408 |
'1', |
|
409 |
'2', |
|
410 |
'3', |
|
411 |
'4', |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
412 |
'5', |
0 | 413 |
'6', |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
414 |
'7', // depot |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
415 |
'8', // waypoint |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
416 |
'9', // station |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
417 |
'S', // signals |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
418 |
'B', // bridge |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
419 |
'T', // tunnel |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
420 |
'R', // remove |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
421 |
'C', // convert rail |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
422 |
'L', // landscaping |
0 | 423 |
}; |
424 |
||
425 |
||
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
426 |
static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
427 |
{ |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
428 |
/* If it is the removal button that has been clicked, do nothing, |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
429 |
* as it is up to the other buttons to drive removal status */ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
430 |
if (clicked_widget == RTW_REMOVE) return; |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
431 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
432 |
switch (clicked_widget) { |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
433 |
case RTW_BUILD_NS: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
434 |
case RTW_BUILD_X: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
435 |
case RTW_BUILD_EW: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
436 |
case RTW_BUILD_Y: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
437 |
case RTW_AUTORAIL: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
438 |
case RTW_BUILD_WAYPOINT: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
439 |
case RTW_BUILD_STATION: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
440 |
case RTW_BUILD_SIGNALS: |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
441 |
/* Removal button is enabled only if the rail/signal/waypoint/station |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
442 |
* button is still lowered. Once raised, it has to be disabled */ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
443 |
SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget)); |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
444 |
break; |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
445 |
|
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
446 |
default: |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
447 |
/* When any other buttons than rail/signal/waypoint/station, raise and |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
448 |
* disable the removal button*/ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
449 |
DisableWindowWidget(w, RTW_REMOVE); |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
450 |
RaiseWindowWidget(w, RTW_REMOVE); |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
451 |
break; |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
452 |
} |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
453 |
} |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
454 |
|
0 | 455 |
static void BuildRailToolbWndProc(Window *w, WindowEvent *e) |
456 |
{ |
|
2639 | 457 |
switch (e->event) { |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
458 |
case WE_CREATE: DisableWindowWidget(w, RTW_REMOVE); break; |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
459 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
460 |
case WE_PAINT: DrawWindowWidgets(w); break; |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
461 |
|
0 | 462 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
463 |
if (e->we.click.widget >= 4) { |
0 | 464 |
_remove_button_clicked = false; |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
465 |
_build_railroad_button_proc[e->we.click.widget - 4](w); |
0 | 466 |
} |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
467 |
UpdateRemoveWidgetStatus(w, e->we.click.widget); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
468 |
break; |
0 | 469 |
|
470 |
case WE_KEYPRESS: { |
|
2639 | 471 |
uint i; |
616
3ab1124303e0
(svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik
parents:
606
diff
changeset
|
472 |
|
2639 | 473 |
for (i = 0; i != lengthof(_rail_keycodes); i++) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
474 |
if (e->we.keypress.keycode == _rail_keycodes[i]) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
475 |
e->we.keypress.cont = false; |
0 | 476 |
_remove_button_clicked = false; |
477 |
_build_railroad_button_proc[i](w); |
|
4738
88248024964a
(svn r6650) - Fix (r6619): Fix widget state setting of the rail toolbar when using hotkeys.
peter1138
parents:
4731
diff
changeset
|
478 |
UpdateRemoveWidgetStatus(w, i + 4); |
0 | 479 |
break; |
480 |
} |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
481 |
} |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
482 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 483 |
break; |
484 |
} |
|
485 |
||
486 |
case WE_PLACE_OBJ: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
487 |
_place_proc(e->we.place.tile); |
0 | 488 |
return; |
489 |
||
490 |
case WE_PLACE_DRAG: { |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
491 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.userdata & 0xF); |
0 | 492 |
return; |
493 |
} |
|
494 |
||
495 |
case WE_PLACE_MOUSEUP: |
|
4994
ec6d8b5551f4
(svn r7000) -Fix: Incorrect use of e->we.click when the event is a 'place'. This didn't cause any
Darkvater
parents:
4939
diff
changeset
|
496 |
if (e->we.place.pt.x != -1) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
497 |
TileIndex start_tile = e->we.place.starttile; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
498 |
TileIndex end_tile = e->we.place.tile; |
0 | 499 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
500 |
if (e->we.place.userdata == VPM_X_OR_Y) { |
0 | 501 |
ResetObjectToPlace(); |
502 |
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
503 |
} else if (e->we.place.userdata == VPM_RAILDIRS) { |
0 | 504 |
bool old = _remove_button_clicked; |
505 |
if (_ctrl_pressed) _remove_button_clicked = true; |
|
506 |
HandleAutodirPlacement(); |
|
507 |
_remove_button_clicked = old; |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
508 |
} else if (e->we.place.userdata == VPM_SIGNALDIRS) { |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
509 |
HandleAutoSignalPlacement(); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
510 |
} else if ((e->we.place.userdata & 0xF) == VPM_X_AND_Y) { |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
511 |
if (GUIPlaceProcDragXY(e)) break; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
512 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
513 |
if ((e->we.place.userdata >> 4) == GUI_PlaceProc_ConvertRailArea >> 4) |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
514 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
515 |
} else if (e->we.place.userdata == VPM_X_AND_Y_LIMITED) { |
0 | 516 |
HandleStationPlacement(start_tile, end_tile); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
517 |
} else { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
518 |
DoRailroadTrack(e->we.place.userdata & 1); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
519 |
} |
0 | 520 |
} |
521 |
break; |
|
522 |
||
523 |
case WE_ABORT_PLACE_OBJ: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
524 |
RaiseWindowButtons(w); |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
525 |
DisableWindowWidget(w, RTW_REMOVE); |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
526 |
InvalidateWidget(w, RTW_REMOVE); |
0 | 527 |
|
528 |
w = FindWindowById(WC_BUILD_STATION, 0); |
|
2639 | 529 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 530 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
2639 | 531 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 532 |
break; |
533 |
||
534 |
case WE_PLACE_PRESIZE: { |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
535 |
TileIndex tile = e->we.place.tile; |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
536 |
|
3491
4c8427796c64
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3269
diff
changeset
|
537 |
DoCommand(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
2639 | 538 |
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); |
0 | 539 |
} break; |
2619
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
540 |
|
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
541 |
case WE_DESTROY: |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
542 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
543 |
break; |
0 | 544 |
} |
545 |
} |
|
546 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
547 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
548 |
static const Widget _build_rail_widgets[] = { |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
549 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
550 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
551 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 552 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
553 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
554 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
555 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_RAIL_NS, STR_1018_BUILD_RAILROAD_TRACK}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
556 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_RAIL_NE, STR_1018_BUILD_RAILROAD_TRACK}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
557 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_RAIL_EW, STR_1018_BUILD_RAILROAD_TRACK}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
558 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_RAIL_NW, STR_1018_BUILD_RAILROAD_TRACK}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
559 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_AUTORAIL, STR_BUILD_AUTORAIL_TIP}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
560 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
561 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 114, 135, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
562 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_DEPOT_RAIL, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
563 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_IMG_WAYPOINT, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
564 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
565 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 180, 221, 14, 35, SPR_IMG_RAIL_STATION, STR_101A_BUILD_RAILROAD_STATION}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
566 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 222, 243, 14, 35, SPR_IMG_RAIL_SIGNALS, STR_101B_BUILD_RAILROAD_SIGNALS}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
567 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 244, 285, 14, 35, SPR_IMG_BRIDGE, STR_101C_BUILD_RAILROAD_BRIDGE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
568 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 286, 305, 14, 35, SPR_IMG_TUNNEL_RAIL, STR_101D_BUILD_RAILROAD_TUNNEL}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
569 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 306, 327, 14, 35, SPR_IMG_REMOVE, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
570 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_IMG_CONVERT_RAIL, STR_CONVERT_RAIL_TIP}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
571 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
572 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
0 | 573 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
574 |
{ WIDGETS_END}, |
0 | 575 |
}; |
576 |
||
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
577 |
static const WindowDesc _build_rail_desc = { |
5072
df5bde83a4bc
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5070
diff
changeset
|
578 |
WDP_ALIGN_TBR, 22, 372, 36, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
579 |
WC_BUILD_TOOLBAR, 0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
580 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
581 |
_build_rail_widgets, |
0 | 582 |
BuildRailToolbWndProc |
583 |
}; |
|
584 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
585 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
586 |
/** Configures the rail toolbar for railtype given |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
587 |
* @param railtype the railtype to display |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
588 |
* @param w the window to modify |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
589 |
*/ |
4171 | 590 |
static void SetupRailToolbar(RailType railtype, Window *w) |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
591 |
{ |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
592 |
const RailtypeInfo *rti = GetRailTypeInfo(railtype); |
0 | 593 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
594 |
assert(railtype < RAILTYPE_END); |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
595 |
w->widget[RTW_CAPTION].data = rti->strings.toolbar_caption; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
596 |
w->widget[RTW_BUILD_NS].data = rti->gui_sprites.build_ns_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
597 |
w->widget[RTW_BUILD_X].data = rti->gui_sprites.build_x_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
598 |
w->widget[RTW_BUILD_EW].data = rti->gui_sprites.build_ew_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
599 |
w->widget[RTW_BUILD_Y].data = rti->gui_sprites.build_y_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
600 |
w->widget[RTW_AUTORAIL].data = rti->gui_sprites.auto_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
601 |
w->widget[RTW_BUILD_DEPOT].data = rti->gui_sprites.build_depot; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
602 |
w->widget[RTW_CONVERT_RAIL].data = rti->gui_sprites.convert_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
603 |
w->widget[RTW_BUILD_TUNNEL].data = rti->gui_sprites.build_tunnel; |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
604 |
} |
0 | 605 |
|
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
606 |
void ShowBuildRailToolbar(RailType railtype, int button) |
0 | 607 |
{ |
608 |
Window *w; |
|
609 |
||
5005
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
610 |
if (!IsValidPlayer(_current_player)) return; |
4816
956f36063319
(svn r6740) -Fix: if a rail is not available, don't show toolbar even with hotkey 'A'
Darkvater
parents:
4747
diff
changeset
|
611 |
if (!ValParamRailtype(railtype)) return; |
946
81cf624bbdc5
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
926
diff
changeset
|
612 |
|
0 | 613 |
// don't recreate the window if we're clicking on a button and the window exists. |
614 |
if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) { |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
615 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
616 |
_cur_railtype = railtype; |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
617 |
w = AllocateWindowDesc(&_build_rail_desc); |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
618 |
SetupRailToolbar(railtype, w); |
0 | 619 |
} |
620 |
||
288
6bd97cdf1652
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
darkvater
parents:
201
diff
changeset
|
621 |
_remove_button_clicked = false; |
4747
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
622 |
if (w != NULL && button >= 0) { |
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
623 |
_build_railroad_button_proc[button](w); |
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
624 |
UpdateRemoveWidgetStatus(w, button + 4); |
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
625 |
} |
2619
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
626 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); |
0 | 627 |
} |
628 |
||
449
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
629 |
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
630 |
* --pasky */ |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
631 |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
632 |
static void HandleStationPlacement(TileIndex start, TileIndex end) |
0 | 633 |
{ |
926
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
634 |
uint sx = TileX(start); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
635 |
uint sy = TileY(start); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
636 |
uint ex = TileX(end); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
637 |
uint ey = TileY(end); |
0 | 638 |
uint w,h; |
639 |
||
1884
ae1d6213c6dd
(svn r2390) - Codechange: Fix some warnings on GCC 4.0.0
hackykid
parents:
1782
diff
changeset
|
640 |
if (sx > ex) uintswap(sx,ex); |
ae1d6213c6dd
(svn r2390) - Codechange: Fix some warnings on GCC 4.0.0
hackykid
parents:
1782
diff
changeset
|
641 |
if (sy > ey) uintswap(sy,ey); |
0 | 642 |
w = ex - sx + 1; |
643 |
h = ey - sy + 1; |
|
1884
ae1d6213c6dd
(svn r2390) - Codechange: Fix some warnings on GCC 4.0.0
hackykid
parents:
1782
diff
changeset
|
644 |
if (!_railstation.orientation) uintswap(w,h); |
0 | 645 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
646 |
DoCommandP(TileXY(sx, sy), |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
647 |
_railstation.orientation | (w << 8) | (h << 16), |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
648 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
649 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
0 | 650 |
} |
651 |
||
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
652 |
/* Check if the currently selected station size is allowed */ |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
653 |
static void CheckSelectedSize(Window *w, const StationSpec *statspec) |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
654 |
{ |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
655 |
if (statspec == NULL || _railstation.dragdrop) return; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
656 |
|
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
657 |
if (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
658 |
RaiseWindowWidget(w, _railstation.numtracks + 4); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
659 |
_railstation.numtracks = 1; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
660 |
while (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
661 |
_railstation.numtracks++; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
662 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
663 |
LowerWindowWidget(w, _railstation.numtracks + 4); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
664 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
665 |
|
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
666 |
if (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
667 |
RaiseWindowWidget(w, _railstation.platlength + 11); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
668 |
_railstation.platlength = 1; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
669 |
while (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
670 |
_railstation.platlength++; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
671 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
672 |
LowerWindowWidget(w, _railstation.platlength + 11); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
673 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
674 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
675 |
|
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
676 |
static void StationBuildWndProc(Window *w, WindowEvent *e) |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
677 |
{ |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
678 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
679 |
case WE_CREATE: |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
680 |
LowerWindowWidget(w, _railstation.orientation + 3); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
681 |
if (_railstation.dragdrop) { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
682 |
LowerWindowWidget(w, 19); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
683 |
} else { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
684 |
LowerWindowWidget(w, _railstation.numtracks + 4); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
685 |
LowerWindowWidget(w, _railstation.platlength + 11); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
686 |
} |
4727
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
687 |
SetWindowWidgetLoweredState(w, 20, !_station_show_coverage); |
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
688 |
SetWindowWidgetLoweredState(w, 21, _station_show_coverage); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
689 |
break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
690 |
|
0 | 691 |
case WE_PAINT: { |
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
692 |
int rad; |
0 | 693 |
uint bits; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
694 |
bool newstations = _railstation.newstations; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
695 |
int y_offset; |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
696 |
DrawPixelInfo tmp_dpi, *old_dpi; |
0 | 697 |
|
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
698 |
if (WP(w,def_d).close) return; |
0 | 699 |
|
700 |
if (_railstation.dragdrop) { |
|
701 |
SetTileSelectSize(1, 1); |
|
702 |
} else { |
|
703 |
int x = _railstation.numtracks; |
|
704 |
int y = _railstation.platlength; |
|
705 |
if (_railstation.orientation == 0) intswap(x,y); |
|
2952 | 706 |
if (!_remove_button_clicked) |
0 | 707 |
SetTileSelectSize(x, y); |
708 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
709 |
|
980
4d1b8af9866b
(svn r1476) -Fix: [1099209] Catchment area with drag&drop stations (Celestar)
darkvater
parents:
946
diff
changeset
|
710 |
rad = (_patches.modified_catchment) ? CA_TRAIN : 4; |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
711 |
|
0 | 712 |
if (_station_show_coverage) |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
713 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 714 |
|
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
715 |
/* Update buttons for correct spread value */ |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
716 |
for (bits = _patches.station_spread; bits < 7; bits++) { |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
717 |
DisableWindowWidget(w, bits + 5); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
718 |
DisableWindowWidget(w, bits + 12); |
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
719 |
} |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
720 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
721 |
if (newstations) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
722 |
const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, _railstation.station_type); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
723 |
|
5231
3bf4c8b8ddeb
(svn r7351) -Fix (r6619): Disabled platform length and numbers were not reset for the default station.
peter1138
parents:
5147
diff
changeset
|
724 |
for (bits = 0; bits < 7; bits++) { |
3bf4c8b8ddeb
(svn r7351) -Fix (r6619): Disabled platform length and numbers were not reset for the default station.
peter1138
parents:
5147
diff
changeset
|
725 |
if (statspec == NULL) { |
3bf4c8b8ddeb
(svn r7351) -Fix (r6619): Disabled platform length and numbers were not reset for the default station.
peter1138
parents:
5147
diff
changeset
|
726 |
EnableWindowWidget(w, bits + 5); |
3bf4c8b8ddeb
(svn r7351) -Fix (r6619): Disabled platform length and numbers were not reset for the default station.
peter1138
parents:
5147
diff
changeset
|
727 |
EnableWindowWidget(w, bits + 12); |
3bf4c8b8ddeb
(svn r7351) -Fix (r6619): Disabled platform length and numbers were not reset for the default station.
peter1138
parents:
5147
diff
changeset
|
728 |
} else { |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
729 |
SetWindowWidgetDisabledState(w, bits + 5, HASBIT(statspec->disallowed_platforms, bits)); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
730 |
SetWindowWidgetDisabledState(w, bits + 12, HASBIT(statspec->disallowed_lengths, bits)); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
731 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
732 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
733 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
734 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
735 |
SetDParam(0, GetStationClassName(_railstation.station_class)); |
0 | 736 |
DrawWindowWidgets(w); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
737 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
738 |
y_offset = newstations ? 90 : 0; |
0 | 739 |
|
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
740 |
/* Set up a clipping area for the '/' station preview */ |
4429
1bb01569940c
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents:
4344
diff
changeset
|
741 |
if (FillDrawPixelInfo(&tmp_dpi, 7, 26 + y_offset, 66, 48)) { |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
742 |
old_dpi = _cur_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
743 |
_cur_dpi = &tmp_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
744 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
745 |
StationPickerDrawSprite(32, 16, _cur_railtype, 2); |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
746 |
} |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
747 |
_cur_dpi = old_dpi; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
748 |
} |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
749 |
|
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
750 |
/* Set up a clipping area for the '\' station preview */ |
4429
1bb01569940c
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents:
4344
diff
changeset
|
751 |
if (FillDrawPixelInfo(&tmp_dpi, 75, 26 + y_offset, 66, 48)) { |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
752 |
old_dpi = _cur_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
753 |
_cur_dpi = &tmp_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
754 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) { |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
755 |
StationPickerDrawSprite(32, 16, _cur_railtype, 3); |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
756 |
} |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
757 |
_cur_dpi = old_dpi; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
758 |
} |
0 | 759 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
760 |
DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, 0); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
761 |
DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, 0); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
762 |
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, 0); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
763 |
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
764 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
765 |
DrawStationCoverageAreaText(2, 166 + y_offset, (uint)-1, rad); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
766 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
767 |
if (newstations) { |
3796
4176bf40364e
(svn r4792) - Codechange: change a uint to a uint16 to avoid a signed/unsigned warning from some compilers.
peter1138
parents:
3792
diff
changeset
|
768 |
uint16 i; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
769 |
uint y = 35; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
770 |
|
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3796
diff
changeset
|
771 |
for (i = w->vscroll.pos; i < _railstation.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++) { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
772 |
const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, i); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
773 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
774 |
if (statspec != NULL && statspec->name != 0) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
775 |
if (HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
776 |
GfxFillRect(8, y - 2, 127, y + 10, PALETTE_MODIFIER_GREYOUT); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
777 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
778 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
779 |
DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? 12 : 16, 118); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
780 |
} else { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
781 |
DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? 12 : 16, 118); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
782 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
783 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
784 |
y += 14; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
785 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
786 |
} |
0 | 787 |
} break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
788 |
|
0 | 789 |
case WE_CLICK: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
790 |
switch (e->we.click.widget) { |
0 | 791 |
case 3: |
792 |
case 4: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
793 |
RaiseWindowWidget(w, _railstation.orientation + 3); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
794 |
_railstation.orientation = e->we.click.widget - 3; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
795 |
LowerWindowWidget(w, _railstation.orientation + 3); |
541 | 796 |
SndPlayFx(SND_15_BEEP); |
0 | 797 |
SetWindowDirty(w); |
798 |
break; |
|
799 |
||
800 |
case 5: |
|
801 |
case 6: |
|
802 |
case 7: |
|
803 |
case 8: |
|
804 |
case 9: |
|
805 |
case 10: |
|
806 |
case 11: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
807 |
RaiseWindowWidget(w, _railstation.numtracks + 4); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
808 |
RaiseWindowWidget(w, 19); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
809 |
_railstation.numtracks = (e->we.click.widget - 5) + 1; |
0 | 810 |
_railstation.dragdrop = false; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
811 |
LowerWindowWidget(w, _railstation.platlength + 11); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
812 |
LowerWindowWidget(w, _railstation.numtracks + 4); |
541 | 813 |
SndPlayFx(SND_15_BEEP); |
0 | 814 |
SetWindowDirty(w); |
815 |
break; |
|
816 |
||
817 |
case 12: |
|
818 |
case 13: |
|
819 |
case 14: |
|
820 |
case 15: |
|
821 |
case 16: |
|
822 |
case 17: |
|
823 |
case 18: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
824 |
RaiseWindowWidget(w, _railstation.platlength + 11); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
825 |
RaiseWindowWidget(w, 19); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
826 |
_railstation.platlength = (e->we.click.widget - 12) + 1; |
0 | 827 |
_railstation.dragdrop = false; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
828 |
LowerWindowWidget(w, _railstation.platlength + 11); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
829 |
LowerWindowWidget(w, _railstation.numtracks + 4); |
541 | 830 |
SndPlayFx(SND_15_BEEP); |
0 | 831 |
SetWindowDirty(w); |
832 |
break; |
|
833 |
||
834 |
case 19: |
|
835 |
_railstation.dragdrop ^= true; |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
836 |
ToggleWidgetLoweredState(w, 19); |
4727
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
837 |
SetWindowWidgetLoweredState(w, _railstation.numtracks + 4, !_railstation.dragdrop); |
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
838 |
SetWindowWidgetLoweredState(w, _railstation.platlength + 11, !_railstation.dragdrop); |
541 | 839 |
SndPlayFx(SND_15_BEEP); |
0 | 840 |
SetWindowDirty(w); |
841 |
break; |
|
842 |
||
843 |
case 20: |
|
844 |
case 21: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
845 |
_station_show_coverage = e->we.click.widget - 20; |
4727
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
846 |
SetWindowWidgetLoweredState(w, 20, !_station_show_coverage); |
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
847 |
SetWindowWidgetLoweredState(w, 21, _station_show_coverage); |
541 | 848 |
SndPlayFx(SND_15_BEEP); |
0 | 849 |
SetWindowDirty(w); |
850 |
break; |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
851 |
|
3782
89858a50ee93
(svn r4775) - Newstations: allow clicking on any part of the station class dropdown to bring up the list, instead of just the button (thanks tron)
peter1138
parents:
3781
diff
changeset
|
852 |
case 22: |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
853 |
case 23: |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
854 |
ShowDropDownMenu(w, BuildStationClassDropdown(), _railstation.station_class, 23, 0, 1 << STAT_CLASS_WAYP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
855 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
856 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
857 |
case 24: { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
858 |
const StationSpec *statspec; |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
859 |
int y = (e->we.click.pt.y - 32) / 14; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
860 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
861 |
if (y >= w->vscroll.cap) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
862 |
y += w->vscroll.pos; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
863 |
if (y >= _railstation.station_count) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
864 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
865 |
/* Check station availability callback */ |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
866 |
statspec = GetCustomStationSpec(_railstation.station_class, y); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
867 |
if (statspec != NULL && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
868 |
HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
869 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
870 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
871 |
_railstation.station_type = y; |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
872 |
|
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
873 |
CheckSelectedSize(w, statspec); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
874 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
875 |
SndPlayFx(SND_15_BEEP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
876 |
SetWindowDirty(w); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
877 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
878 |
} |
0 | 879 |
} |
880 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
881 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
882 |
case WE_DROPDOWN_SELECT: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
883 |
if (_railstation.station_class != e->we.dropdown.index) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
884 |
_railstation.station_class = e->we.dropdown.index; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
885 |
_railstation.station_type = 0; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
886 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
887 |
|
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
888 |
CheckSelectedSize(w, GetCustomStationSpec(_railstation.station_class, _railstation.station_type)); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
889 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
890 |
w->vscroll.count = _railstation.station_count; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
891 |
w->vscroll.pos = _railstation.station_type; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
892 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
893 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
894 |
SndPlayFx(SND_15_BEEP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
895 |
SetWindowDirty(w); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
896 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
897 |
|
2639 | 898 |
case WE_MOUSELOOP: |
0 | 899 |
if (WP(w,def_d).close) { |
900 |
DeleteWindow(w); |
|
901 |
return; |
|
902 |
} |
|
903 |
CheckRedrawStationCoverage(w); |
|
2639 | 904 |
break; |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
905 |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
906 |
case WE_DESTROY: |
2639 | 907 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
908 |
break; |
0 | 909 |
} |
910 |
} |
|
911 |
||
912 |
static const Widget _station_builder_widgets[] = { |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
913 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
914 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
915 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 199, 0x0, STR_NULL}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
916 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
917 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
0 | 918 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
919 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 87, 98, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
920 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 87, 98, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
921 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 87, 98, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
922 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 87, 98, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
923 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 87, 98, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
924 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 87, 98, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
925 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 87, 98, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
0 | 926 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
927 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 112, 123, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
928 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 112, 123, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
929 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 112, 123, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
930 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 112, 123, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
931 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 112, 123, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
932 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 112, 123, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
933 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 112, 123, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
0 | 934 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
935 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 126, 137, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
936 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 152, 163, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
937 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 152, 163, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
938 |
{ WIDGETS_END}, |
0 | 939 |
}; |
940 |
||
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
941 |
static const Widget _newstation_builder_widgets[] = { |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
942 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
943 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
944 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 289, 0x0, STR_NULL}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
945 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
946 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
947 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
948 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 177, 188, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
949 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 177, 188, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
950 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 177, 188, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
951 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 177, 188, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
952 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 177, 188, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
953 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 177, 188, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
954 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 177, 188, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
955 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
956 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 202, 213, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
957 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 202, 213, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
958 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 202, 213, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
959 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 202, 213, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
960 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 202, 213, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
961 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 202, 213, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
962 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 202, 213, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
963 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
964 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 216, 227, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
965 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 242, 253, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
966 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 242, 253, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
967 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
968 |
/* newstations gui additions */ |
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
969 |
{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
970 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
971 |
{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
972 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
973 |
{ WIDGETS_END}, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
974 |
}; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
975 |
|
0 | 976 |
static const WindowDesc _station_builder_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
977 |
WDP_AUTO, WDP_AUTO, 148, 200, |
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
978 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 979 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
980 |
_station_builder_widgets, |
|
981 |
StationBuildWndProc |
|
982 |
}; |
|
983 |
||
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
984 |
static const WindowDesc _newstation_builder_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
985 |
WDP_AUTO, WDP_AUTO, 148, 290, |
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
986 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
987 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
988 |
_newstation_builder_widgets, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
989 |
StationBuildWndProc |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
990 |
}; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
991 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
992 |
static void ShowStationBuilder(void) |
0 | 993 |
{ |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
994 |
Window *w; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
995 |
if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
996 |
w = AllocateWindowDesc(&_station_builder_desc); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
997 |
_railstation.newstations = false; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
998 |
} else { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
999 |
w = AllocateWindowDesc(&_newstation_builder_desc); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1000 |
_railstation.newstations = true; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1001 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1002 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1003 |
w->vscroll.count = _railstation.station_count; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1004 |
w->vscroll.cap = 5; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1005 |
w->vscroll.pos = clamp(_railstation.station_type - 2, 0, w->vscroll.count - w->vscroll.cap); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1006 |
} |
0 | 1007 |
} |
1008 |
||
1009 |
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) |
|
1010 |
{ |
|
2952 | 1011 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1012 |
case WE_CREATE: LowerWindowWidget(w, _build_depot_direction + 3); break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1013 |
|
0 | 1014 |
case WE_PAINT: { |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
1015 |
RailType r; |
0 | 1016 |
|
1017 |
DrawWindowWidgets(w); |
|
1018 |
||
1019 |
r = _cur_railtype; |
|
1020 |
DrawTrainDepotSprite(70, 17, 0, r); |
|
1021 |
DrawTrainDepotSprite(70, 69, 1, r); |
|
2639 | 1022 |
DrawTrainDepotSprite( 2, 69, 2, r); |
1023 |
DrawTrainDepotSprite( 2, 17, 3, r); |
|
0 | 1024 |
break; |
1025 |
} |
|
2639 | 1026 |
|
1027 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1028 |
switch (e->we.click.widget) { |
2639 | 1029 |
case 3: |
1030 |
case 4: |
|
1031 |
case 5: |
|
1032 |
case 6: |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1033 |
RaiseWindowWidget(w, _build_depot_direction + 3); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1034 |
_build_depot_direction = e->we.click.widget - 3; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1035 |
LowerWindowWidget(w, _build_depot_direction + 3); |
2639 | 1036 |
SndPlayFx(SND_15_BEEP); |
1037 |
SetWindowDirty(w); |
|
1038 |
break; |
|
0 | 1039 |
} |
2639 | 1040 |
break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1041 |
|
0 | 1042 |
case WE_MOUSELOOP: |
2639 | 1043 |
if (WP(w,def_d).close) DeleteWindow(w); |
0 | 1044 |
return; |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1045 |
|
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1046 |
case WE_DESTROY: |
2639 | 1047 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1048 |
break; |
0 | 1049 |
} |
1050 |
} |
|
1051 |
||
1052 |
static const Widget _build_depot_widgets[] = { |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
1053 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1054 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
1055 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1056 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1057 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1058 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1059 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
1060 |
{ WIDGETS_END}, |
0 | 1061 |
}; |
1062 |
||
1063 |
static const WindowDesc _build_depot_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1064 |
WDP_AUTO, WDP_AUTO, 140, 122, |
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1065 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
0 | 1066 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1067 |
_build_depot_widgets, |
|
1068 |
BuildTrainDepotWndProc |
|
1069 |
}; |
|
1070 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
1071 |
static void ShowBuildTrainDepotPicker(void) |
0 | 1072 |
{ |
1073 |
AllocateWindowDesc(&_build_depot_desc); |
|
1074 |
} |
|
1075 |
||
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1076 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1077 |
static void BuildWaypointWndProc(Window *w, WindowEvent *e) |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1078 |
{ |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1079 |
switch (e->event) { |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1080 |
case WE_PAINT: { |
2639 | 1081 |
uint i; |
1082 |
||
4853
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1083 |
for (i = 0; i < w->hscroll.cap; i++) { |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1084 |
SetWindowWidgetLoweredState(w, i + 3, (w->hscroll.pos + i) == _cur_waypoint_type); |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1085 |
} |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1086 |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1087 |
DrawWindowWidgets(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1088 |
|
4853
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1089 |
for (i = 0; i < w->hscroll.cap; i++) { |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1090 |
if (w->hscroll.pos + i < w->hscroll.count) { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1091 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, w->hscroll.pos + i); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1092 |
|
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1093 |
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1094 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1095 |
if (statspec != NULL && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1096 |
HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1097 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1098 |
GfxFillRect(4 + i * 68, 18, 67 + i * 68, 75, PALETTE_MODIFIER_GREYOUT); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1099 |
} |
2639 | 1100 |
} |
2627
8c964f74bd7b
(svn r3169) Little bit of coding style fixing, and change from value to lengthof()
peter1138
parents:
2625
diff
changeset
|
1101 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1102 |
break; |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1103 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1104 |
case WE_CLICK: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1105 |
switch (e->we.click.widget) { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1106 |
case 3: case 4: case 5: case 6: case 7: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1107 |
byte type = e->we.click.widget - 3 + w->hscroll.pos; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1108 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1109 |
/* Check station availability callback */ |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1110 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, type); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1111 |
if (statspec != NULL && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1112 |
HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1113 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1114 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1115 |
_cur_waypoint_type = type; |
541 | 1116 |
SndPlayFx(SND_15_BEEP); |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1117 |
SetWindowDirty(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1118 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1119 |
} |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1120 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1121 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1122 |
} |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1123 |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1124 |
case WE_MOUSELOOP: |
2639 | 1125 |
if (WP(w,def_d).close) DeleteWindow(w); |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1126 |
break; |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1127 |
|
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1128 |
case WE_DESTROY: |
2639 | 1129 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1130 |
break; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1131 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1132 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1133 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1134 |
static const Widget _build_waypoint_widgets[] = { |
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
1135 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1136 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 343, 0, 13, STR_WAYPOINT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1137 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 343, 14, 91, 0x0, 0}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1138 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
1139 |
{ WWT_PANEL, RESIZE_NONE, 7, 3, 68, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1140 |
{ WWT_PANEL, RESIZE_NONE, 7, 71, 136, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1141 |
{ WWT_PANEL, RESIZE_NONE, 7, 139, 204, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1142 |
{ WWT_PANEL, RESIZE_NONE, 7, 207, 272, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
5d0e40cd67b9
(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:
4171
diff
changeset
|
1143 |
{ WWT_PANEL, RESIZE_NONE, 7, 275, 340, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1144 |
|
4344
5d0e40cd67b9
(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:
4171
diff
changeset
|
1145 |
{ WWT_HSCROLLBAR, RESIZE_NONE, 7, 1, 343, 80, 91, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
417 | 1146 |
{ WIDGETS_END}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1147 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1148 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1149 |
static const WindowDesc _build_waypoint_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1150 |
WDP_AUTO, WDP_AUTO, 344, 92, |
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1151 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1152 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1153 |
_build_waypoint_widgets, |
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1154 |
BuildWaypointWndProc |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1155 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1156 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
1157 |
static void ShowBuildWaypointPicker(void) |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1158 |
{ |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1159 |
Window *w = AllocateWindowDesc(&_build_waypoint_desc); |
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1160 |
w->hscroll.cap = 5; |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1161 |
w->hscroll.count = _waypoint_count; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1162 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1163 |
|
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1164 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
1165 |
void InitializeRailGui(void) |
0 | 1166 |
{ |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
1167 |
_build_depot_direction = DIAGDIR_NW; |
0 | 1168 |
_railstation.numtracks = 1; |
1169 |
_railstation.platlength = 1; |
|
1170 |
_railstation.dragdrop = true; |
|
1171 |
} |
|
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1172 |
|
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1173 |
void ReinitGuiAfterToggleElrail(bool disable) |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1174 |
{ |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1175 |
extern RailType _last_built_railtype; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1176 |
if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) { |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1177 |
Window *w; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1178 |
_last_built_railtype = _cur_railtype = RAILTYPE_RAIL; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1179 |
w = FindWindowById(WC_BUILD_TOOLBAR, 0); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1180 |
if (w != NULL && w->wndproc == BuildRailToolbWndProc) { |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1181 |
SetupRailToolbar(_cur_railtype, w); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1182 |
SetWindowDirty(w); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1183 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1184 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1185 |
MarkWholeScreenDirty(); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1186 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1187 |
|
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1188 |