author | rubidium |
Sat, 24 Nov 2007 12:36:52 +0000 | |
changeset 7955 | 64310868e7aa |
parent 7949 | 730724a67d80 |
child 7991 | d6a95a5593ba |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6106
diff
changeset
|
3 |
/** @file rail_gui.cpp File for dealing with rail construction user interface */ |
2274
2c99425c1086
(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
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1884
diff
changeset
|
6 |
#include "openttd.h" |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1227
diff
changeset
|
7 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
449
diff
changeset
|
8 |
#include "table/strings.h" |
7266
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7241
diff
changeset
|
9 |
#include "strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
10 |
#include "functions.h" |
6453
226bcddeba32
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6247
diff
changeset
|
11 |
#include "landscape.h" |
5688
c4ba40106d5d
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
maedhros
parents:
5682
diff
changeset
|
12 |
#include "date.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
651
diff
changeset
|
13 |
#include "map.h" |
1209
2e00193652b2
(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
|
14 |
#include "tile.h" |
0 | 15 |
#include "window.h" |
16 |
#include "gui.h" |
|
17 |
#include "viewport.h" |
|
18 |
#include "gfx.h" |
|
337
cbe0c766c947
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
288
diff
changeset
|
19 |
#include "sound.h" |
0 | 20 |
#include "command.h" |
21 |
#include "vehicle.h" |
|
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
22 |
#include "station.h" |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1363
diff
changeset
|
23 |
#include "waypoint.h" |
1738
dfa8f078450a
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
24 |
#include "debug.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2049
diff
changeset
|
25 |
#include "variables.h" |
3776
1545763bfc75
(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
|
26 |
#include "newgrf_callbacks.h" |
1545763bfc75
(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
|
27 |
#include "newgrf_station.h" |
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
28 |
#include "train.h" |
0 | 29 |
|
7064
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
30 |
#include "bridge_map.h" |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
31 |
#include "rail_map.h" |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
32 |
#include "road_map.h" |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
33 |
#include "station_map.h" |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
34 |
#include "tunnel_map.h" |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
35 |
|
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
36 |
static RailType _cur_railtype; |
0 | 37 |
static bool _remove_button_clicked; |
3157
3f35e2d9c8e3
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
38 |
static DiagDirection _build_depot_direction; |
2639 | 39 |
static byte _waypoint_count = 1; |
395
788a9bba0889
(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
|
40 |
static byte _cur_waypoint_type; |
0 | 41 |
|
2630 | 42 |
static struct { |
0 | 43 |
byte orientation; |
44 |
byte numtracks; |
|
45 |
byte platlength; |
|
46 |
bool dragdrop; |
|
3776
1545763bfc75
(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
|
47 |
|
1545763bfc75
(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
|
48 |
bool newstations; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
49 |
StationClassIDByte station_class; |
3776
1545763bfc75
(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
|
50 |
byte station_type; |
1545763bfc75
(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
|
51 |
byte station_count; |
0 | 52 |
} _railstation; |
53 |
||
54 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
55 |
static void HandleStationPlacement(TileIndex start, TileIndex end); |
6247 | 56 |
static void ShowBuildTrainDepotPicker(); |
57 |
static void ShowBuildWaypointPicker(); |
|
58 |
static void ShowStationBuilder(); |
|
0 | 59 |
|
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
60 |
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 61 |
{ |
541 | 62 |
if (success) SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 63 |
} |
64 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
65 |
static void GenericPlaceRail(TileIndex tile, int cmd) |
0 | 66 |
{ |
67 |
DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E, |
|
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
68 |
(_remove_button_clicked || _ctrl_pressed) ? |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
69 |
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_NO_WATER : |
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
70 |
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_NO_WATER |
2639 | 71 |
); |
0 | 72 |
} |
73 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
74 |
static void PlaceRail_N(TileIndex tile) |
0 | 75 |
{ |
76 |
int cmd = _tile_fract_coords.x > _tile_fract_coords.y ? 4 : 5; |
|
77 |
GenericPlaceRail(tile, cmd); |
|
78 |
} |
|
79 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
80 |
static void PlaceRail_NE(TileIndex tile) |
0 | 81 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
82 |
VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_RAIL_NE); |
0 | 83 |
} |
84 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
85 |
static void PlaceRail_E(TileIndex tile) |
0 | 86 |
{ |
87 |
int cmd = _tile_fract_coords.x + _tile_fract_coords.y <= 15 ? 2 : 3; |
|
88 |
GenericPlaceRail(tile, cmd); |
|
89 |
} |
|
90 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
91 |
static void PlaceRail_NW(TileIndex tile) |
0 | 92 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
93 |
VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_RAIL_NW); |
0 | 94 |
} |
95 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
96 |
static void PlaceRail_AutoRail(TileIndex tile) |
0 | 97 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
98 |
VpStartPlaceSizing(tile, VPM_RAILDIRS, DDSP_PLACE_AUTORAIL); |
0 | 99 |
} |
100 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
101 |
static void PlaceExtraDepotRail(TileIndex tile, uint16 extra) |
0 | 102 |
{ |
3792
67c865c9315c
(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
|
103 |
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return; |
3269
62fb247bf94b
(svn r3981) More work for the rail accessing functions and enums
tron
parents:
3157
diff
changeset
|
104 |
if ((GetTrackBits(tile) & GB(extra, 8, 8)) == 0) return; |
0 | 105 |
|
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
106 |
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_NO_WATER); |
0 | 107 |
} |
108 |
||
109 |
static const uint16 _place_depot_extra[12] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
110 |
0x0604, 0x2102, 0x1202, 0x0505, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
111 |
0x2400, 0x2801, 0x1800, 0x1401, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
112 |
0x2203, 0x0904, 0x0A05, 0x1103, |
0 | 113 |
}; |
114 |
||
115 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
116 |
void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 117 |
{ |
118 |
if (success) { |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
119 |
DiagDirection dir = (DiagDirection)p2; |
0 | 120 |
|
541 | 121 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 122 |
ResetObjectToPlace(); |
123 |
||
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4547
diff
changeset
|
124 |
tile += TileOffsByDiagDir(dir); |
0 | 125 |
|
1035
812f837ee03f
(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
|
126 |
if (IsTileType(tile, MP_RAILWAY)) { |
0 | 127 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir]); |
128 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]); |
|
129 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]); |
|
130 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
131 |
} |
0 | 132 |
} |
133 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
134 |
static void PlaceRail_Depot(TileIndex tile) |
0 | 135 |
{ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
136 |
DoCommandP(tile, _cur_railtype, _build_depot_direction, CcRailDepot, |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
137 |
CMD_BUILD_TRAIN_DEPOT | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT)); |
0 | 138 |
} |
139 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
140 |
static void PlaceRail_Waypoint(TileIndex tile) |
0 | 141 |
{ |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
142 |
if (_remove_button_clicked || _ctrl_pressed) { |
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
143 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT)); |
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
144 |
} else { |
2625
19bf7f695537
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
145 |
DoCommandP(tile, _cur_waypoint_type, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT)); |
0 | 146 |
} |
147 |
} |
|
148 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
149 |
void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 150 |
{ |
151 |
if (success) { |
|
541 | 152 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
3776
1545763bfc75
(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
|
153 |
/* Only close the station builder window if the default station is chosen. */ |
1545763bfc75
(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
|
154 |
if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0) ResetObjectToPlace(); |
0 | 155 |
} |
156 |
} |
|
157 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
158 |
static void PlaceRail_Station(TileIndex tile) |
0 | 159 |
{ |
7955
64310868e7aa
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
7949
diff
changeset
|
160 |
if (_remove_button_clicked) { |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
161 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
162 |
} else if (_railstation.dragdrop) { |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
163 |
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); |
0 | 164 |
VpSetPlaceSizingLimit(_patches.station_spread); |
165 |
} else { |
|
3776
1545763bfc75
(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
|
166 |
DoCommandP(tile, |
6674
5d77615aeaf2
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
maedhros
parents:
6670
diff
changeset
|
167 |
_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), |
3776
1545763bfc75
(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
|
168 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
169 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
0 | 170 |
} |
171 |
} |
|
172 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
173 |
static void GenericPlaceSignals(TileIndex tile) |
0 | 174 |
{ |
6846
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
175 |
TrackBits trackbits = (TrackBits)GB(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0), 0, 6); |
0 | 176 |
|
6846
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
177 |
if (trackbits & TRACK_BIT_VERT) { // N-S direction |
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
178 |
trackbits = (_tile_fract_coords.x <= _tile_fract_coords.y) ? TRACK_BIT_RIGHT : TRACK_BIT_LEFT; |
2639 | 179 |
} |
0 | 180 |
|
6846
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
181 |
if (trackbits & TRACK_BIT_HORZ) { // E-W direction |
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
182 |
trackbits = (_tile_fract_coords.x + _tile_fract_coords.y <= 15) ? TRACK_BIT_UPPER : TRACK_BIT_LOWER; |
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
183 |
} |
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
184 |
|
6863
746e9481a436
(svn r10103) -Fix (r10086): TrackBitsToTrack doesn't cope well with TRACK_BIT_NONE (e.g. non-rail tiles), so use FindFirstTrack instead.
maedhros
parents:
6846
diff
changeset
|
185 |
Track track = FindFirstTrack(trackbits); |
6846
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
186 |
|
7955
64310868e7aa
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
7949
diff
changeset
|
187 |
if (_remove_button_clicked) { |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
188 |
DoCommandP(tile, track, 0, CcPlaySound1E, |
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
189 |
CMD_REMOVE_SIGNALS | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM)); |
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
190 |
} else { |
6846
175bf19b9def
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
6683
diff
changeset
|
191 |
uint32 p1 = track; |
5735
9f3729784816
(svn r8279) -Regression (r8274): Removing signals could fail under certain circumstances (not the proper bits of p1/p2 were set to trackbits). Moved trackbits back to bits 0..2, ctrl to 3, semaphore to 4. Also lower the decision of the ctrl-override of signal/semaphore from the GUI into the cmd function since we are passing the ctrl-bit anyways. Bug(s) found by Frostregen; thanks
Darkvater
parents:
5731
diff
changeset
|
192 |
SB(p1, 3, 1, _ctrl_pressed); |
9f3729784816
(svn r8279) -Regression (r8274): Removing signals could fail under certain circumstances (not the proper bits of p1/p2 were set to trackbits). Moved trackbits back to bits 0..2, ctrl to 3, semaphore to 4. Also lower the decision of the ctrl-override of signal/semaphore from the GUI into the cmd function since we are passing the ctrl-bit anyways. Bug(s) found by Frostregen; thanks
Darkvater
parents:
5731
diff
changeset
|
193 |
SB(p1, 4, 1, _cur_year < _patches.semaphore_build_before); |
5731
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
194 |
|
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
195 |
DoCommandP(tile, p1, 0, CcPlaySound1E, |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
196 |
CMD_BUILD_SIGNALS | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)); |
0 | 197 |
} |
198 |
} |
|
199 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
200 |
static void PlaceRail_Bridge(TileIndex tile) |
0 | 201 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
202 |
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); |
0 | 203 |
} |
204 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
205 |
void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 206 |
{ |
207 |
if (success) { |
|
541 | 208 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 209 |
ResetObjectToPlace(); |
210 |
} else { |
|
211 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
212 |
} |
|
213 |
} |
|
214 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
215 |
static void PlaceRail_Tunnel(TileIndex tile) |
0 | 216 |
{ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
217 |
DoCommandP(tile, _cur_railtype, 0, CcBuildRailTunnel, |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
218 |
CMD_BUILD_TUNNEL | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
0 | 219 |
} |
220 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
221 |
void PlaceProc_BuyLand(TileIndex tile) |
0 | 222 |
{ |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
223 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND)); |
0 | 224 |
} |
225 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
226 |
static void PlaceRail_ConvertRail(TileIndex tile) |
0 | 227 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
228 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CONVERT_RAIL); |
0 | 229 |
} |
230 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
231 |
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
|
232 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
233 |
VpStartPlaceSizing(tile, VPM_SIGNALDIRS, DDSP_BUILD_SIGNALS); |
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
|
234 |
} |
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
|
235 |
|
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
236 |
|
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
237 |
/** Enum referring to the widgets of the build rail toolbar */ |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
238 |
enum RailToolbarWidgets { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
239 |
RTW_CLOSEBOX = 0, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
240 |
RTW_CAPTION, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
241 |
RTW_STICKY, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
242 |
RTW_SPACER, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
243 |
RTW_BUILD_NS, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
244 |
RTW_BUILD_X, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
245 |
RTW_BUILD_EW, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
246 |
RTW_BUILD_Y, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
247 |
RTW_AUTORAIL, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
248 |
RTW_DEMOLISH, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
249 |
RTW_BUILD_DEPOT, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
250 |
RTW_BUILD_WAYPOINT, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
251 |
RTW_BUILD_STATION, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
252 |
RTW_BUILD_SIGNALS, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
253 |
RTW_BUILD_BRIDGE, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
254 |
RTW_BUILD_TUNNEL, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
255 |
RTW_REMOVE, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
256 |
RTW_CONVERT_RAIL, |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
257 |
}; |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
258 |
|
0 | 259 |
static void BuildRailClick_N(Window *w) |
260 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
261 |
HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, VHM_RECT, PlaceRail_N); |
0 | 262 |
} |
263 |
||
264 |
static void BuildRailClick_NE(Window *w) |
|
265 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
266 |
HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, VHM_RECT, PlaceRail_NE); |
0 | 267 |
} |
268 |
||
269 |
static void BuildRailClick_E(Window *w) |
|
270 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
271 |
HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, VHM_RECT, PlaceRail_E); |
0 | 272 |
} |
273 |
||
274 |
static void BuildRailClick_NW(Window *w) |
|
275 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
276 |
HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, VHM_RECT, PlaceRail_NW); |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
277 |
} |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
278 |
|
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
279 |
static void BuildRailClick_AutoRail(Window *w) |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
280 |
{ |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
281 |
HandlePlacePushButton(w, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, VHM_RAIL, PlaceRail_AutoRail); |
0 | 282 |
} |
283 |
||
284 |
static void BuildRailClick_Demolish(Window *w) |
|
285 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
286 |
HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); |
0 | 287 |
} |
288 |
||
289 |
static void BuildRailClick_Depot(Window *w) |
|
290 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
291 |
if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, VHM_RECT, PlaceRail_Depot)) { |
2514
859692ffa65a
(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
|
292 |
ShowBuildTrainDepotPicker(); |
859692ffa65a
(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
|
293 |
} |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
294 |
} |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
295 |
|
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
296 |
static void BuildRailClick_Waypoint(Window *w) |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
297 |
{ |
2625
19bf7f695537
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
298 |
_waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP); |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
299 |
if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, VHM_RECT, PlaceRail_Waypoint) && |
2639 | 300 |
_waypoint_count > 1) { |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
301 |
ShowBuildWaypointPicker(); |
2639 | 302 |
} |
0 | 303 |
} |
304 |
||
305 |
static void BuildRailClick_Station(Window *w) |
|
306 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
307 |
if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, VHM_RECT, PlaceRail_Station)) ShowStationBuilder(); |
0 | 308 |
} |
309 |
||
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
|
310 |
static void BuildRailClick_AutoSignals(Window *w) |
0 | 311 |
{ |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
312 |
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
0 | 313 |
} |
314 |
||
315 |
static void BuildRailClick_Bridge(Window *w) |
|
316 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
317 |
HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRail_Bridge); |
0 | 318 |
} |
319 |
||
320 |
static void BuildRailClick_Tunnel(Window *w) |
|
321 |
{ |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
322 |
HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, VHM_SPECIAL, PlaceRail_Tunnel); |
0 | 323 |
} |
324 |
||
325 |
static void BuildRailClick_Remove(Window *w) |
|
326 |
{ |
|
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
327 |
if (IsWindowWidgetDisabled(w, RTW_REMOVE)) return; |
0 | 328 |
SetWindowDirty(w); |
541 | 329 |
SndPlayFx(SND_15_BEEP); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
330 |
|
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
331 |
ToggleWidgetLoweredState(w, RTW_REMOVE); |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
332 |
_remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
333 |
SetSelectionRed(_remove_button_clicked); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
334 |
|
0 | 335 |
// handle station builder |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
336 |
if (_remove_button_clicked) { |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
337 |
SetTileSelectSize(1, 1); |
0 | 338 |
} |
339 |
} |
|
340 |
||
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
341 |
static void BuildRailClick_Convert(Window *w) |
0 | 342 |
{ |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
343 |
HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, VHM_RECT, PlaceRail_ConvertRail); |
0 | 344 |
} |
345 |
||
346 |
||
347 |
static void DoRailroadTrack(int mode) |
|
348 |
{ |
|
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
349 |
DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), NULL, |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
350 |
(_remove_button_clicked || _ctrl_pressed) ? |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
351 |
CMD_REMOVE_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) : |
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
352 |
CMD_BUILD_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) |
0 | 353 |
); |
354 |
} |
|
355 |
||
6247 | 356 |
static void HandleAutodirPlacement() |
0 | 357 |
{ |
358 |
TileHighlightData *thd = &_thd; |
|
1227
1d940a5e02d2
(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 |
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
|
360 |
|
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
361 |
if (thd->drawstyle & HT_RAIL) { // one tile case |
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
362 |
GenericPlaceRail(TileVirtXY(thd->selend.x, thd->selend.y), trackstat); |
1227
1d940a5e02d2
(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
|
363 |
return; |
0 | 364 |
} |
1227
1d940a5e02d2
(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
|
365 |
|
1d940a5e02d2
(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 |
DoRailroadTrack(trackstat); |
0 | 367 |
} |
368 |
||
6247 | 369 |
static void HandleAutoSignalPlacement() |
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
|
370 |
{ |
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
|
371 |
TileHighlightData *thd = &_thd; |
5735
9f3729784816
(svn r8279) -Regression (r8274): Removing signals could fail under certain circumstances (not the proper bits of p1/p2 were set to trackbits). Moved trackbits back to bits 0..2, ctrl to 3, semaphore to 4. Also lower the decision of the ctrl-override of signal/semaphore from the GUI into the cmd function since we are passing the ctrl-bit anyways. Bug(s) found by Frostregen; thanks
Darkvater
parents:
5731
diff
changeset
|
372 |
uint32 p2 = GB(thd->drawstyle, 0, 3); // 0..5 |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
373 |
|
1123
9c8b944a2737
(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 |
if (thd->drawstyle == HT_RECT) { // one tile case |
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
375 |
GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y)); |
1123
9c8b944a2737
(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
|
376 |
return; |
9c8b944a2737
(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
|
377 |
} |
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
|
378 |
|
7163
99ef91ad6415
(svn r10437) -Feature: Automatic signal completion, enabled by pressing ctrl when dragging signals. Signals will continue following track until an existing signal, junction or station are reached. This currently replaces the existing use of ctrl-drag for changing existing signal type.
peter1138
parents:
7131
diff
changeset
|
379 |
/* XXX Steal ctrl for autosignal function, until we get some GUI */ |
99ef91ad6415
(svn r10437) -Feature: Automatic signal completion, enabled by pressing ctrl when dragging signals. Signals will continue following track until an existing signal, junction or station are reached. This currently replaces the existing use of ctrl-drag for changing existing signal type.
peter1138
parents:
7131
diff
changeset
|
380 |
SB(p2, 3, 1, 0); |
5735
9f3729784816
(svn r8279) -Regression (r8274): Removing signals could fail under certain circumstances (not the proper bits of p1/p2 were set to trackbits). Moved trackbits back to bits 0..2, ctrl to 3, semaphore to 4. Also lower the decision of the ctrl-override of signal/semaphore from the GUI into the cmd function since we are passing the ctrl-bit anyways. Bug(s) found by Frostregen; thanks
Darkvater
parents:
5731
diff
changeset
|
381 |
SB(p2, 4, 1, _cur_year < _patches.semaphore_build_before); |
7163
99ef91ad6415
(svn r10437) -Feature: Automatic signal completion, enabled by pressing ctrl when dragging signals. Signals will continue following track until an existing signal, junction or station are reached. This currently replaces the existing use of ctrl-drag for changing existing signal type.
peter1138
parents:
7131
diff
changeset
|
382 |
SB(p2, 6, 1, _ctrl_pressed); |
5731
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
383 |
SB(p2, 24, 8, _patches.drag_signals_density); |
5688
c4ba40106d5d
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
maedhros
parents:
5682
diff
changeset
|
384 |
|
5731
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
385 |
/* _patches.drag_signals_density is given as a parameter such that each user |
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
386 |
* in a network game can specify his/her own signal density */ |
2639 | 387 |
DoCommandP( |
5731
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
388 |
TileVirtXY(thd->selstart.x, thd->selstart.y), |
2639 | 389 |
TileVirtXY(thd->selend.x, thd->selend.y), |
5731
c68613da5c4d
(svn r8274) -Codechange (r8151): Move the automatic semaphore/signal checks inside the CMD_ functions where they are supposed to be. Achieve this by adding a seperate bit to p1/p2 to hold the CTRL-modifier. While here, use proper types, and 'unify' the parameter bit-meanings. 0 - ctrl-pressed, 1 - signal/semaphore, 2-4 - trackbits, 5 - remove (internal), 24-31 - drag density.
Darkvater
parents:
5696
diff
changeset
|
390 |
p2, |
2639 | 391 |
CcPlaySound1E, |
7955
64310868e7aa
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
7949
diff
changeset
|
392 |
_remove_button_clicked ? |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
393 |
CMD_REMOVE_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) : |
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
394 |
CMD_BUILD_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) |
2639 | 395 |
); |
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
|
396 |
} |
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
|
397 |
|
2639 | 398 |
|
399 |
typedef void OnButtonClick(Window *w); |
|
400 |
||
0 | 401 |
static OnButtonClick * const _build_railroad_button_proc[] = { |
402 |
BuildRailClick_N, |
|
403 |
BuildRailClick_NE, |
|
404 |
BuildRailClick_E, |
|
405 |
BuildRailClick_NW, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
406 |
BuildRailClick_AutoRail, |
0 | 407 |
BuildRailClick_Demolish, |
408 |
BuildRailClick_Depot, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
409 |
BuildRailClick_Waypoint, |
0 | 410 |
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
|
411 |
BuildRailClick_AutoSignals, |
0 | 412 |
BuildRailClick_Bridge, |
413 |
BuildRailClick_Tunnel, |
|
414 |
BuildRailClick_Remove, |
|
5682
f109e2e62af8
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5668
diff
changeset
|
415 |
BuildRailClick_Convert |
0 | 416 |
}; |
417 |
||
418 |
static const uint16 _rail_keycodes[] = { |
|
419 |
'1', |
|
420 |
'2', |
|
421 |
'3', |
|
422 |
'4', |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
423 |
'5', |
0 | 424 |
'6', |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
425 |
'7', // depot |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
426 |
'8', // waypoint |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
427 |
'9', // station |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
428 |
'S', // signals |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
429 |
'B', // bridge |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
430 |
'T', // tunnel |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
431 |
'R', // remove |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
432 |
'C', // convert rail |
0 | 433 |
}; |
434 |
||
435 |
||
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
436 |
static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
437 |
{ |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
438 |
switch (clicked_widget) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
439 |
case RTW_REMOVE: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
440 |
/* If it is the removal button that has been clicked, do nothing, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
441 |
* as it is up to the other buttons to drive removal status */ |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
442 |
return; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
443 |
break; |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
444 |
case RTW_BUILD_NS: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
445 |
case RTW_BUILD_X: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
446 |
case RTW_BUILD_EW: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
447 |
case RTW_BUILD_Y: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
448 |
case RTW_AUTORAIL: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
449 |
case RTW_BUILD_WAYPOINT: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
450 |
case RTW_BUILD_STATION: |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
451 |
case RTW_BUILD_SIGNALS: |
4731
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
452 |
/* Removal button is enabled only if the rail/signal/waypoint/station |
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
453 |
* button is still lowered. Once raised, it has to be disabled */ |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
454 |
SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget)); |
4731
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
455 |
break; |
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
456 |
|
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
457 |
default: |
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
458 |
/* When any other buttons than rail/signal/waypoint/station, raise and |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
459 |
* disable the removal button */ |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
460 |
DisableWindowWidget(w, RTW_REMOVE); |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
461 |
RaiseWindowWidget(w, RTW_REMOVE); |
4731
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
462 |
break; |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
463 |
} |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
464 |
} |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
465 |
|
0 | 466 |
static void BuildRailToolbWndProc(Window *w, WindowEvent *e) |
467 |
{ |
|
2639 | 468 |
switch (e->event) { |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
469 |
case WE_CREATE: DisableWindowWidget(w, RTW_REMOVE); break; |
4731
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
470 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
471 |
case WE_PAINT: DrawWindowWidgets(w); break; |
4731
c5b97171c5ae
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
472 |
|
0 | 473 |
case WE_CLICK: |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
474 |
if (e->we.click.widget >= RTW_BUILD_NS) { |
0 | 475 |
_remove_button_clicked = false; |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
476 |
_build_railroad_button_proc[e->we.click.widget - RTW_BUILD_NS](w); |
0 | 477 |
} |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
478 |
UpdateRemoveWidgetStatus(w, e->we.click.widget); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
479 |
break; |
0 | 480 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
481 |
case WE_KEYPRESS: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
482 |
for (uint8 i = 0; i != lengthof(_rail_keycodes); i++) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
483 |
if (e->we.keypress.keycode == _rail_keycodes[i]) { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
484 |
e->we.keypress.cont = false; |
0 | 485 |
_remove_button_clicked = false; |
486 |
_build_railroad_button_proc[i](w); |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
487 |
UpdateRemoveWidgetStatus(w, i + RTW_BUILD_NS); |
0 | 488 |
break; |
489 |
} |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
490 |
} |
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
491 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 492 |
break; |
493 |
||
494 |
case WE_PLACE_OBJ: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
495 |
_place_proc(e->we.place.tile); |
0 | 496 |
return; |
497 |
||
498 |
case WE_PLACE_DRAG: { |
|
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
499 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); |
0 | 500 |
return; |
501 |
} |
|
502 |
||
503 |
case WE_PLACE_MOUSEUP: |
|
4994
aec94128f5d5
(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
|
504 |
if (e->we.place.pt.x != -1) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
505 |
TileIndex start_tile = e->we.place.starttile; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
506 |
TileIndex end_tile = e->we.place.tile; |
0 | 507 |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
508 |
switch (e->we.place.select_proc) { |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
509 |
case DDSP_BUILD_BRIDGE: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
510 |
ResetObjectToPlace(); |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
511 |
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
512 |
break; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
513 |
|
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
514 |
case DDSP_PLACE_AUTORAIL: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
515 |
HandleAutodirPlacement(); |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
516 |
break; |
6596
f200c4895149
(svn r9810) -Feature: Add drag and drop removal of station tiles (Wolf01)
peter1138
parents:
6453
diff
changeset
|
517 |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
518 |
case DDSP_BUILD_SIGNALS: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
519 |
HandleAutoSignalPlacement(); |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
520 |
break; |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
521 |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
522 |
case DDSP_DEMOLISH_AREA: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
523 |
GUIPlaceProcDragXY(e); |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
524 |
break; |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
525 |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
526 |
case DDSP_REMOVE_STATION: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
527 |
DoCommandP(end_tile, start_tile, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
528 |
break; |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
529 |
|
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
530 |
case DDSP_CONVERT_RAIL: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
531 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
532 |
break; |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
533 |
|
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
534 |
case DDSP_BUILD_STATION: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
535 |
HandleStationPlacement(start_tile, end_tile); |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
536 |
break; |
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6596
diff
changeset
|
537 |
|
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
538 |
case DDSP_PLACE_RAIL_NE: |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
539 |
case DDSP_PLACE_RAIL_NW: |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
540 |
DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y); |
7949
730724a67d80
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
rubidium
parents:
7928
diff
changeset
|
541 |
break; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
542 |
} |
0 | 543 |
} |
544 |
break; |
|
545 |
||
546 |
case WE_ABORT_PLACE_OBJ: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
547 |
RaiseWindowButtons(w); |
5147
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
548 |
DisableWindowWidget(w, RTW_REMOVE); |
866030c20f0a
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
549 |
InvalidateWidget(w, RTW_REMOVE); |
0 | 550 |
|
551 |
w = FindWindowById(WC_BUILD_STATION, 0); |
|
2639 | 552 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 553 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
2639 | 554 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 555 |
break; |
556 |
||
557 |
case WE_PLACE_PRESIZE: { |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
558 |
TileIndex tile = e->we.place.tile; |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
559 |
|
3491
35d747bb5e82
(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
|
560 |
DoCommand(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
2639 | 561 |
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); |
0 | 562 |
} break; |
2619
1b20d578a660
(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
|
563 |
|
1b20d578a660
(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
|
564 |
case WE_DESTROY: |
1b20d578a660
(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
|
565 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
1b20d578a660
(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
|
566 |
break; |
0 | 567 |
} |
568 |
} |
|
569 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
570 |
/** Widget definition for the rail toolbar */ |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
571 |
static const Widget _build_rail_widgets[] = { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
572 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // RTW_CLOSEBOX |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
573 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 337, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // RTW_CAPTION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
574 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 338, 349, 0, 13, 0x0, STR_STICKY_BUTTON}, // RTW_STICKY |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
575 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
576 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, // RTW_SPACER |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
577 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
578 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_RAIL_NS, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_NS |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
579 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_RAIL_NE, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_X |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
580 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_RAIL_EW, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_EW |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
581 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_RAIL_NW, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_Y |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
582 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_AUTORAIL, STR_BUILD_AUTORAIL_TIP}, // RTW_AUTORAIL |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
583 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
584 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 114, 135, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // RTW_DEMOLISH |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
585 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_DEPOT_RAIL, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, // RTW_BUILD_DEPOT |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
586 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_IMG_WAYPOINT, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, // RTW_BUILD_WAYPOINT |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
587 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
588 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 180, 221, 14, 35, SPR_IMG_RAIL_STATION, STR_101A_BUILD_RAILROAD_STATION}, // RTW_BUILD_STATION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
589 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 222, 243, 14, 35, SPR_IMG_RAIL_SIGNALS, STR_101B_BUILD_RAILROAD_SIGNALS}, // RTW_BUILD_SIGNALS |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
590 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 244, 285, 14, 35, SPR_IMG_BRIDGE, STR_101C_BUILD_RAILROAD_BRIDGE}, // RTW_BUILD_BRIDGE |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
591 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 286, 305, 14, 35, SPR_IMG_TUNNEL_RAIL, STR_101D_BUILD_RAILROAD_TUNNEL}, // RTW_BUILD_TUNNEL |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
592 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 306, 327, 14, 35, SPR_IMG_REMOVE, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
593 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_IMG_CONVERT_RAIL, STR_CONVERT_RAIL_TIP}, // RTW_CONVERT_RAIL |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
594 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
595 |
{ WIDGETS_END}, |
0 | 596 |
}; |
597 |
||
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
598 |
static const WindowDesc _build_rail_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7272
diff
changeset
|
599 |
WDP_ALIGN_TBR, 22, 350, 36, 350, 36, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5860
diff
changeset
|
600 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
601 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
602 |
_build_rail_widgets, |
0 | 603 |
BuildRailToolbWndProc |
604 |
}; |
|
605 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
606 |
|
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
607 |
/** Configures the rail toolbar for railtype given |
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
608 |
* @param railtype the railtype to display |
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
609 |
* @param w the window to modify |
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
610 |
*/ |
4171 | 611 |
static void SetupRailToolbar(RailType railtype, Window *w) |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
612 |
{ |
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
613 |
const RailtypeInfo *rti = GetRailTypeInfo(railtype); |
0 | 614 |
|
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
615 |
assert(railtype < RAILTYPE_END); |
4547
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
616 |
w->widget[RTW_CAPTION].data = rti->strings.toolbar_caption; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
617 |
w->widget[RTW_BUILD_NS].data = rti->gui_sprites.build_ns_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
618 |
w->widget[RTW_BUILD_X].data = rti->gui_sprites.build_x_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
619 |
w->widget[RTW_BUILD_EW].data = rti->gui_sprites.build_ew_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
620 |
w->widget[RTW_BUILD_Y].data = rti->gui_sprites.build_y_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
621 |
w->widget[RTW_AUTORAIL].data = rti->gui_sprites.auto_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
622 |
w->widget[RTW_BUILD_DEPOT].data = rti->gui_sprites.build_depot; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
623 |
w->widget[RTW_CONVERT_RAIL].data = rti->gui_sprites.convert_rail; |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
624 |
w->widget[RTW_BUILD_TUNNEL].data = rti->gui_sprites.build_tunnel; |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
625 |
} |
0 | 626 |
|
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
627 |
void ShowBuildRailToolbar(RailType railtype, int button) |
0 | 628 |
{ |
629 |
Window *w; |
|
630 |
||
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
631 |
if (!IsValidPlayer(_current_player)) return; |
4816
e555e273cf08
(svn r6740) -Fix: if a rail is not available, don't show toolbar even with hotkey 'A'
Darkvater
parents:
4747
diff
changeset
|
632 |
if (!ValParamRailtype(railtype)) return; |
946
2468063f35a4
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
926
diff
changeset
|
633 |
|
0 | 634 |
// don't recreate the window if we're clicking on a button and the window exists. |
635 |
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
|
636 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
637 |
_cur_railtype = railtype; |
2274
2c99425c1086
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
638 |
w = AllocateWindowDesc(&_build_rail_desc); |
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
639 |
SetupRailToolbar(railtype, w); |
0 | 640 |
} |
641 |
||
288
72ca19a694dd
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
darkvater
parents:
201
diff
changeset
|
642 |
_remove_button_clicked = false; |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
643 |
if (w != NULL && button >= RTW_CLOSEBOX) { |
4747
b6d0ac6a2316
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
644 |
_build_railroad_button_proc[button](w); |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
645 |
UpdateRemoveWidgetStatus(w, button + RTW_BUILD_NS); |
4747
b6d0ac6a2316
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
646 |
} |
5860 | 647 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); |
0 | 648 |
} |
649 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
650 |
/** Enum referring to the widgets of the rail stations window */ |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
651 |
enum BuildRailStationWidgets { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
652 |
BRSW_CLOSEBOX = 0, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
653 |
BRSW_CAPTION, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
654 |
BRSW_BACKGROUND, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
655 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
656 |
BRSW_PLATFORM_DIR_X, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
657 |
BRSW_PLATFORM_DIR_Y, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
658 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
659 |
BRSW_PLATFORM_NUM_BEGIN = BRSW_PLATFORM_DIR_Y, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
660 |
BRSW_PLATFORM_NUM_1, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
661 |
BRSW_PLATFORM_NUM_2, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
662 |
BRSW_PLATFORM_NUM_3, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
663 |
BRSW_PLATFORM_NUM_4, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
664 |
BRSW_PLATFORM_NUM_5, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
665 |
BRSW_PLATFORM_NUM_6, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
666 |
BRSW_PLATFORM_NUM_7, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
667 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
668 |
BRSW_PLATFORM_LEN_BEGIN = BRSW_PLATFORM_NUM_7, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
669 |
BRSW_PLATFORM_LEN_1, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
670 |
BRSW_PLATFORM_LEN_2, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
671 |
BRSW_PLATFORM_LEN_3, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
672 |
BRSW_PLATFORM_LEN_4, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
673 |
BRSW_PLATFORM_LEN_5, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
674 |
BRSW_PLATFORM_LEN_6, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
675 |
BRSW_PLATFORM_LEN_7, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
676 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
677 |
BRSW_PLATFORM_DRAG_N_DROP, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
678 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
679 |
BRSW_HIGHLIGHT_OFF, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
680 |
BRSW_HIGHLIGHT_ON, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
681 |
|
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
682 |
BRSW_NEWST_DROPDOWN, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
683 |
BRSW_NEWST_DROPDOWN_TEXT, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
684 |
BRSW_NEWST_LIST, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
685 |
BRSW_NEWST_SCROLL |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
686 |
}; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
687 |
|
449
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
688 |
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
689 |
* --pasky */ |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
690 |
|
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
691 |
static void HandleStationPlacement(TileIndex start, TileIndex end) |
0 | 692 |
{ |
926
a6d140a6a4de
(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
|
693 |
uint sx = TileX(start); |
a6d140a6a4de
(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
|
694 |
uint sy = TileY(start); |
a6d140a6a4de
(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
|
695 |
uint ex = TileX(end); |
a6d140a6a4de
(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
|
696 |
uint ey = TileY(end); |
0 | 697 |
uint w,h; |
698 |
||
6106 | 699 |
if (sx > ex) Swap(sx, ex); |
700 |
if (sy > ey) Swap(sy, ey); |
|
0 | 701 |
w = ex - sx + 1; |
702 |
h = ey - sy + 1; |
|
6106 | 703 |
if (!_railstation.orientation) Swap(w, h); |
0 | 704 |
|
3776
1545763bfc75
(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
|
705 |
DoCommandP(TileXY(sx, sy), |
6674
5d77615aeaf2
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
maedhros
parents:
6670
diff
changeset
|
706 |
_railstation.orientation | (w << 8) | (h << 16) | (_ctrl_pressed << 24), |
3776
1545763bfc75
(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
|
707 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7341
diff
changeset
|
708 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
0 | 709 |
} |
710 |
||
5049
43340069c983
(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
|
711 |
/* Check if the currently selected station size is allowed */ |
43340069c983
(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
|
712 |
static void CheckSelectedSize(Window *w, const StationSpec *statspec) |
43340069c983
(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
|
713 |
{ |
43340069c983
(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
|
714 |
if (statspec == NULL || _railstation.dragdrop) return; |
43340069c983
(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
|
715 |
|
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
716 |
if (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
717 |
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
5049
43340069c983
(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
|
718 |
_railstation.numtracks = 1; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
719 |
while (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
5049
43340069c983
(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
|
720 |
_railstation.numtracks++; |
43340069c983
(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
|
721 |
} |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
722 |
LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
5049
43340069c983
(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
|
723 |
} |
43340069c983
(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
|
724 |
|
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
725 |
if (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
726 |
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
5049
43340069c983
(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
|
727 |
_railstation.platlength = 1; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
728 |
while (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
5049
43340069c983
(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
|
729 |
_railstation.platlength++; |
43340069c983
(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
|
730 |
} |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
731 |
LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
5049
43340069c983
(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
|
732 |
} |
43340069c983
(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
|
733 |
} |
43340069c983
(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
|
734 |
|
1781
5e2fef482637
(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
|
735 |
static void StationBuildWndProc(Window *w, WindowEvent *e) |
5e2fef482637
(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
|
736 |
{ |
5e2fef482637
(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
|
737 |
switch (e->event) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
738 |
case WE_CREATE: |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
739 |
LowerWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
740 |
if (_railstation.dragdrop) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
741 |
LowerWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
742 |
} else { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
743 |
LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
744 |
LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
745 |
} |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
746 |
SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_OFF, !_station_show_coverage); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
747 |
SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_ON, _station_show_coverage); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
748 |
break; |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
749 |
|
0 | 750 |
case WE_PAINT: { |
3776
1545763bfc75
(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
|
751 |
bool newstations = _railstation.newstations; |
3921
bf161a808b51
(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 |
DrawPixelInfo tmp_dpi, *old_dpi; |
5514
0f1c3a0aa66e
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5475
diff
changeset
|
753 |
const StationSpec *statspec = newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
0 | 754 |
|
1781
5e2fef482637
(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
|
755 |
if (WP(w,def_d).close) return; |
0 | 756 |
|
757 |
if (_railstation.dragdrop) { |
|
758 |
SetTileSelectSize(1, 1); |
|
759 |
} else { |
|
760 |
int x = _railstation.numtracks; |
|
761 |
int y = _railstation.platlength; |
|
6106 | 762 |
if (_railstation.orientation == 0) Swap(x, y); |
2952 | 763 |
if (!_remove_button_clicked) |
0 | 764 |
SetTileSelectSize(x, y); |
765 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
766 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
767 |
int rad = (_patches.modified_catchment) ? CA_TRAIN : 4; |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
768 |
|
0 | 769 |
if (_station_show_coverage) |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
770 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 771 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
772 |
for (uint bits = 0; bits < 7; bits++) { |
5514
0f1c3a0aa66e
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5475
diff
changeset
|
773 |
bool disable = bits >= _patches.station_spread; |
0f1c3a0aa66e
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5475
diff
changeset
|
774 |
if (statspec == NULL) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
775 |
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, disable); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
776 |
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, disable); |
5514
0f1c3a0aa66e
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5475
diff
changeset
|
777 |
} else { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
778 |
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); |
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
779 |
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, HasBit(statspec->disallowed_lengths, bits) || disable); |
3776
1545763bfc75
(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 |
} |
1545763bfc75
(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 |
} |
1545763bfc75
(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 |
|
1545763bfc75
(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 |
SetDParam(0, GetStationClassName(_railstation.station_class)); |
0 | 784 |
DrawWindowWidgets(w); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
785 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
786 |
int y_offset = newstations ? 90 : 0; |
0 | 787 |
|
3921
bf161a808b51
(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
|
788 |
/* Set up a clipping area for the '/' station preview */ |
4429
b4eb6d97996f
(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
|
789 |
if (FillDrawPixelInfo(&tmp_dpi, 7, 26 + y_offset, 66, 48)) { |
3921
bf161a808b51
(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
|
790 |
old_dpi = _cur_dpi; |
bf161a808b51
(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
|
791 |
_cur_dpi = &tmp_dpi; |
bf161a808b51
(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
|
792 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { |
7272
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7266
diff
changeset
|
793 |
StationPickerDrawSprite(32, 16, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2); |
3921
bf161a808b51
(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
|
794 |
} |
bf161a808b51
(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
|
795 |
_cur_dpi = old_dpi; |
3776
1545763bfc75
(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
|
796 |
} |
3921
bf161a808b51
(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
|
797 |
|
bf161a808b51
(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
|
798 |
/* Set up a clipping area for the '\' station preview */ |
4429
b4eb6d97996f
(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
|
799 |
if (FillDrawPixelInfo(&tmp_dpi, 75, 26 + y_offset, 66, 48)) { |
3921
bf161a808b51
(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
|
800 |
old_dpi = _cur_dpi; |
bf161a808b51
(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
|
801 |
_cur_dpi = &tmp_dpi; |
bf161a808b51
(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
|
802 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) { |
7272
d47fc9e22d1c
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7266
diff
changeset
|
803 |
StationPickerDrawSprite(32, 16, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3); |
3921
bf161a808b51
(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
|
804 |
} |
bf161a808b51
(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
|
805 |
_cur_dpi = old_dpi; |
3776
1545763bfc75
(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
|
806 |
} |
0 | 807 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
808 |
DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, TC_FROMSTRING); |
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
809 |
DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, TC_FROMSTRING); |
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
810 |
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING); |
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
811 |
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING); |
3776
1545763bfc75
(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
|
812 |
|
7241
7fd23b6f6713
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7163
diff
changeset
|
813 |
DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad); |
3776
1545763bfc75
(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
|
814 |
|
1545763bfc75
(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
|
815 |
if (newstations) { |
1545763bfc75
(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
|
816 |
uint y = 35; |
1545763bfc75
(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
|
817 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
818 |
for (uint16 i = w->vscroll.pos; i < _railstation.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++) { |
3776
1545763bfc75
(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
|
819 |
const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, i); |
1545763bfc75
(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
|
820 |
|
1545763bfc75
(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
|
821 |
if (statspec != NULL && statspec->name != 0) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
822 |
if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
823 |
GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT)); |
3776
1545763bfc75
(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
|
824 |
} |
1545763bfc75
(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
|
825 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
826 |
DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); |
3776
1545763bfc75
(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
|
827 |
} else { |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
828 |
DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); |
3776
1545763bfc75
(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
|
829 |
} |
1545763bfc75
(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
|
830 |
|
1545763bfc75
(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
|
831 |
y += 14; |
1545763bfc75
(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
|
832 |
} |
1545763bfc75
(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
|
833 |
} |
0 | 834 |
} break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
835 |
|
0 | 836 |
case WE_CLICK: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
837 |
switch (e->we.click.widget) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
838 |
case BRSW_PLATFORM_DIR_X: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
839 |
case BRSW_PLATFORM_DIR_Y: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
840 |
RaiseWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
841 |
_railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
842 |
LowerWindowWidget(w, _railstation.orientation + BRSW_PLATFORM_DIR_X); |
541 | 843 |
SndPlayFx(SND_15_BEEP); |
0 | 844 |
SetWindowDirty(w); |
845 |
break; |
|
846 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
847 |
case BRSW_PLATFORM_NUM_1: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
848 |
case BRSW_PLATFORM_NUM_2: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
849 |
case BRSW_PLATFORM_NUM_3: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
850 |
case BRSW_PLATFORM_NUM_4: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
851 |
case BRSW_PLATFORM_NUM_5: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
852 |
case BRSW_PLATFORM_NUM_6: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
853 |
case BRSW_PLATFORM_NUM_7: { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
854 |
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
855 |
RaiseWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
856 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
857 |
_railstation.numtracks = e->we.click.widget - BRSW_PLATFORM_NUM_BEGIN; |
0 | 858 |
_railstation.dragdrop = false; |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
859 |
|
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
860 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
861 |
if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
862 |
/* The previously selected number of platforms in invalid */ |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
863 |
for (uint i = 0; i < 7; i++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
864 |
if (!HasBit(statspec->disallowed_lengths, i)) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
865 |
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
866 |
_railstation.platlength = i + 1; |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
867 |
break; |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
868 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
869 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
870 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
871 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
872 |
LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
873 |
LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
541 | 874 |
SndPlayFx(SND_15_BEEP); |
0 | 875 |
SetWindowDirty(w); |
876 |
break; |
|
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
877 |
} |
0 | 878 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
879 |
case BRSW_PLATFORM_LEN_1: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
880 |
case BRSW_PLATFORM_LEN_2: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
881 |
case BRSW_PLATFORM_LEN_3: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
882 |
case BRSW_PLATFORM_LEN_4: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
883 |
case BRSW_PLATFORM_LEN_5: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
884 |
case BRSW_PLATFORM_LEN_6: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
885 |
case BRSW_PLATFORM_LEN_7: { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
886 |
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
887 |
RaiseWindowWidget(w, BRSW_PLATFORM_DRAG_N_DROP); |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
888 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
889 |
_railstation.platlength = e->we.click.widget - BRSW_PLATFORM_LEN_BEGIN; |
0 | 890 |
_railstation.dragdrop = false; |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
891 |
|
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
892 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
893 |
if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
894 |
/* The previously selected number of tracks in invalid */ |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
895 |
for (uint i = 0; i < 7; i++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
896 |
if (!HasBit(statspec->disallowed_platforms, i)) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
897 |
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
898 |
_railstation.numtracks = i + 1; |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
899 |
break; |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
900 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
901 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
902 |
} |
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
903 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
904 |
LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
905 |
LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
541 | 906 |
SndPlayFx(SND_15_BEEP); |
0 | 907 |
SetWindowDirty(w); |
908 |
break; |
|
6207
a04057330c4d
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
rubidium
parents:
6117
diff
changeset
|
909 |
} |
0 | 910 |
|
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
911 |
case BRSW_PLATFORM_DRAG_N_DROP: { |
0 | 912 |
_railstation.dragdrop ^= true; |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
913 |
ToggleWidgetLoweredState(w, BRSW_PLATFORM_DRAG_N_DROP); |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
914 |
|
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
915 |
/* get the first allowed length/number of platforms */ |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
916 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
917 |
if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
918 |
for (uint i = 0; i < 7; i++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
919 |
if (!HasBit(statspec->disallowed_lengths, i)) { |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
920 |
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
921 |
_railstation.platlength = i + 1; |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
922 |
break; |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
923 |
} |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
924 |
} |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
925 |
} |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
926 |
if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
927 |
for (uint i = 0; i < 7; i++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
928 |
if (!HasBit(statspec->disallowed_platforms, i)) { |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
929 |
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
930 |
_railstation.numtracks = i + 1; |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
931 |
break; |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
932 |
} |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
933 |
} |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
934 |
} |
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
935 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
936 |
SetWindowWidgetLoweredState(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
937 |
SetWindowWidgetLoweredState(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); |
541 | 938 |
SndPlayFx(SND_15_BEEP); |
0 | 939 |
SetWindowDirty(w); |
7773
6a97c5cba126
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
7729
diff
changeset
|
940 |
} break; |
0 | 941 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
942 |
case BRSW_HIGHLIGHT_OFF: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
943 |
case BRSW_HIGHLIGHT_ON: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
944 |
_station_show_coverage = (e->we.click.widget != BRSW_HIGHLIGHT_OFF); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
945 |
SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_OFF, !_station_show_coverage); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
946 |
SetWindowWidgetLoweredState(w, BRSW_HIGHLIGHT_ON, _station_show_coverage); |
541 | 947 |
SndPlayFx(SND_15_BEEP); |
0 | 948 |
SetWindowDirty(w); |
949 |
break; |
|
3776
1545763bfc75
(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
|
950 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
951 |
case BRSW_NEWST_DROPDOWN: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
952 |
case BRSW_NEWST_DROPDOWN_TEXT: |
3776
1545763bfc75
(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
|
953 |
ShowDropDownMenu(w, BuildStationClassDropdown(), _railstation.station_class, 23, 0, 1 << STAT_CLASS_WAYP); |
1545763bfc75
(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
|
954 |
break; |
1545763bfc75
(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 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
956 |
case BRSW_NEWST_LIST: { |
3776
1545763bfc75
(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
|
957 |
const StationSpec *statspec; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
958 |
int y = (e->we.click.pt.y - 32) / 14; |
3776
1545763bfc75
(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
|
959 |
|
1545763bfc75
(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
|
960 |
if (y >= w->vscroll.cap) return; |
1545763bfc75
(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
|
961 |
y += w->vscroll.pos; |
1545763bfc75
(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
|
962 |
if (y >= _railstation.station_count) return; |
1545763bfc75
(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 |
|
1545763bfc75
(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
|
964 |
/* Check station availability callback */ |
1545763bfc75
(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
|
965 |
statspec = GetCustomStationSpec(_railstation.station_class, y); |
1545763bfc75
(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
|
966 |
if (statspec != NULL && |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
967 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
3776
1545763bfc75
(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 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
1545763bfc75
(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
|
969 |
|
1545763bfc75
(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
|
970 |
_railstation.station_type = y; |
5049
43340069c983
(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
|
971 |
|
43340069c983
(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
|
972 |
CheckSelectedSize(w, statspec); |
43340069c983
(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
|
973 |
|
3776
1545763bfc75
(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 |
SndPlayFx(SND_15_BEEP); |
1545763bfc75
(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 |
SetWindowDirty(w); |
1545763bfc75
(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
|
976 |
break; |
1545763bfc75
(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
|
977 |
} |
0 | 978 |
} |
979 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
980 |
|
3776
1545763bfc75
(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
|
981 |
case WE_DROPDOWN_SELECT: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
982 |
if (_railstation.station_class != e->we.dropdown.index) { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
983 |
_railstation.station_class = (StationClassID)e->we.dropdown.index; |
3776
1545763bfc75
(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 |
_railstation.station_type = 0; |
1545763bfc75
(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
|
985 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1545763bfc75
(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
|
986 |
|
5049
43340069c983
(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
|
987 |
CheckSelectedSize(w, GetCustomStationSpec(_railstation.station_class, _railstation.station_type)); |
43340069c983
(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
|
988 |
|
3776
1545763bfc75
(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 |
w->vscroll.count = _railstation.station_count; |
1545763bfc75
(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 |
w->vscroll.pos = _railstation.station_type; |
1545763bfc75
(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 |
} |
1545763bfc75
(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
|
992 |
|
1545763bfc75
(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
|
993 |
SndPlayFx(SND_15_BEEP); |
1545763bfc75
(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 |
SetWindowDirty(w); |
1545763bfc75
(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 |
break; |
1545763bfc75
(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 |
|
2639 | 997 |
case WE_MOUSELOOP: |
0 | 998 |
if (WP(w,def_d).close) { |
999 |
DeleteWindow(w); |
|
1000 |
return; |
|
1001 |
} |
|
1002 |
CheckRedrawStationCoverage(w); |
|
2639 | 1003 |
break; |
1074
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1004 |
|
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1005 |
case WE_DESTROY: |
2639 | 1006 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1007 |
break; |
0 | 1008 |
} |
1009 |
} |
|
1010 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1011 |
/** Widget definition of the standard build rail station window */ |
0 | 1012 |
static const Widget _station_builder_widgets[] = { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1013 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRSW_CLOSEBOX |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1014 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRSW_CAPTION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1015 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 199, 0x0, STR_NULL}, // BRSW_BACKGROUND |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1016 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_X |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1017 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_Y |
0 | 1018 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1019 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 87, 98, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_1 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1020 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 87, 98, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_2 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1021 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 87, 98, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_3 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1022 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 87, 98, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_4 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1023 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 87, 98, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_5 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1024 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 87, 98, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_6 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1025 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 87, 98, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_7 |
0 | 1026 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1027 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 112, 123, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_1 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1028 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 112, 123, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_2 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1029 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 112, 123, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_3 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1030 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 112, 123, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_4 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1031 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 112, 123, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_5 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1032 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 112, 123, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_6 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1033 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 112, 123, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_7 |
0 | 1034 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1035 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 126, 137, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, // BRSW_PLATFORM_DRAG_N_DROP |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1036 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 152, 163, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, // BRSW_HIGHLIGHT_OFF |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1037 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 152, 163, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, // BRSW_HIGHLIGHT_ON |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
1038 |
{ WIDGETS_END}, |
0 | 1039 |
}; |
1040 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1041 |
/** Widget definition of the build NewGRF rail station window */ |
3776
1545763bfc75
(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
|
1042 |
static const Widget _newstation_builder_widgets[] = { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1043 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRSW_CLOSEBOX |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1044 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRSW_CAPTION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1045 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 289, 0x0, STR_NULL}, // BRSW_BACKGROUND |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1046 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_X |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1047 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_Y |
3776
1545763bfc75
(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
|
1048 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1049 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 177, 188, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_1 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1050 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 177, 188, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_2 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1051 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 177, 188, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_3 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1052 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 177, 188, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_4 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1053 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 177, 188, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_5 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1054 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 177, 188, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_6 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1055 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 177, 188, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_7 |
3776
1545763bfc75
(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
|
1056 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1057 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 202, 213, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_1 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1058 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 202, 213, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_2 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1059 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 202, 213, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_3 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1060 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 202, 213, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_4 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1061 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 202, 213, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_5 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1062 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 202, 213, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_6 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1063 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 202, 213, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_7 |
3776
1545763bfc75
(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
|
1064 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1065 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 216, 227, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, // BRSW_PLATFORM_DRAG_N_DROP |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1066 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 242, 253, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, // BRSW_HIGHLIGHT_OFF |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1067 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 242, 253, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, // BRSW_HIGHLIGHT_ON |
3776
1545763bfc75
(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
|
1068 |
|
1545763bfc75
(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
|
1069 |
/* newstations gui additions */ |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1070 |
{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1071 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN_TEXT |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1072 |
{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP}, // BRSW_NEWST_LIST |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1073 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRSW_NEWST_SCROLL |
3776
1545763bfc75
(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
|
1074 |
{ WIDGETS_END}, |
1545763bfc75
(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
|
1075 |
}; |
1545763bfc75
(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
|
1076 |
|
0 | 1077 |
static const WindowDesc _station_builder_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7272
diff
changeset
|
1078 |
WDP_AUTO, WDP_AUTO, 148, 200, 148, 200, |
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1079 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 1080 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1081 |
_station_builder_widgets, |
|
1082 |
StationBuildWndProc |
|
1083 |
}; |
|
1084 |
||
3776
1545763bfc75
(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
|
1085 |
static const WindowDesc _newstation_builder_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7272
diff
changeset
|
1086 |
WDP_AUTO, WDP_AUTO, 148, 290, 148, 290, |
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1087 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
3776
1545763bfc75
(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
|
1088 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1545763bfc75
(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
|
1089 |
_newstation_builder_widgets, |
1545763bfc75
(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
|
1090 |
StationBuildWndProc |
1545763bfc75
(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 |
}; |
1545763bfc75
(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 |
|
6247 | 1093 |
static void ShowStationBuilder() |
0 | 1094 |
{ |
3776
1545763bfc75
(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 |
Window *w; |
1545763bfc75
(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 |
if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) { |
1545763bfc75
(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 |
w = AllocateWindowDesc(&_station_builder_desc); |
1545763bfc75
(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 |
_railstation.newstations = false; |
1545763bfc75
(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 |
} else { |
1545763bfc75
(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
|
1100 |
w = AllocateWindowDesc(&_newstation_builder_desc); |
1545763bfc75
(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
|
1101 |
_railstation.newstations = true; |
1545763bfc75
(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
|
1102 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1545763bfc75
(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
|
1103 |
|
1545763bfc75
(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
|
1104 |
w->vscroll.count = _railstation.station_count; |
1545763bfc75
(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
|
1105 |
w->vscroll.cap = 5; |
7922
a7e266f966d9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
7904
diff
changeset
|
1106 |
w->vscroll.pos = Clamp(_railstation.station_type - 2, 0, w->vscroll.count - w->vscroll.cap); |
3776
1545763bfc75
(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
|
1107 |
} |
0 | 1108 |
} |
1109 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1110 |
/** Enum referring to the widgets of the build rail depot window */ |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1111 |
enum BuildRailDepotWidgets { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1112 |
BRDW_CLOSEBOX = 0, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1113 |
BRDW_CAPTION, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1114 |
BRDW_BACKGROUND, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1115 |
BRDW_DEPOT_NE, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1116 |
BRDW_DEPOT_SE, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1117 |
BRDW_DEPOT_SW, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1118 |
BRDW_DEPOT_NW, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1119 |
}; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1120 |
|
0 | 1121 |
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) |
1122 |
{ |
|
2952 | 1123 |
switch (e->event) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1124 |
case WE_CREATE: LowerWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); break; |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1125 |
|
0 | 1126 |
case WE_PAINT: { |
1127 |
DrawWindowWidgets(w); |
|
1128 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1129 |
DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1130 |
DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _cur_railtype); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1131 |
DrawTrainDepotSprite( 2, 69, DIAGDIR_SW, _cur_railtype); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1132 |
DrawTrainDepotSprite( 2, 17, DIAGDIR_NW, _cur_railtype); |
0 | 1133 |
break; |
1134 |
} |
|
2639 | 1135 |
|
1136 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1137 |
switch (e->we.click.widget) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1138 |
case BRDW_DEPOT_NE: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1139 |
case BRDW_DEPOT_SE: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1140 |
case BRDW_DEPOT_SW: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1141 |
case BRDW_DEPOT_NW: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1142 |
RaiseWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1143 |
_build_depot_direction = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1144 |
LowerWindowWidget(w, _build_depot_direction + BRDW_DEPOT_NE); |
2639 | 1145 |
SndPlayFx(SND_15_BEEP); |
1146 |
SetWindowDirty(w); |
|
1147 |
break; |
|
0 | 1148 |
} |
2639 | 1149 |
break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1150 |
|
0 | 1151 |
case WE_MOUSELOOP: |
2639 | 1152 |
if (WP(w,def_d).close) DeleteWindow(w); |
0 | 1153 |
return; |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1154 |
|
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1155 |
case WE_DESTROY: |
2639 | 1156 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1157 |
break; |
0 | 1158 |
} |
1159 |
} |
|
1160 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1161 |
/** Widget definition of the build rail depot window */ |
0 | 1162 |
static const Widget _build_depot_widgets[] = { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1163 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRDW_CLOSEBOX |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1164 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRDW_CAPTION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1165 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, // BRDW_BACKGROUND |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1166 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_NE |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1167 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_SE |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1168 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_SW |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1169 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_NW |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
1170 |
{ WIDGETS_END}, |
0 | 1171 |
}; |
1172 |
||
1173 |
static const WindowDesc _build_depot_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7272
diff
changeset
|
1174 |
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, |
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1175 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
0 | 1176 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1177 |
_build_depot_widgets, |
|
1178 |
BuildTrainDepotWndProc |
|
1179 |
}; |
|
1180 |
||
6247 | 1181 |
static void ShowBuildTrainDepotPicker() |
0 | 1182 |
{ |
1183 |
AllocateWindowDesc(&_build_depot_desc); |
|
1184 |
} |
|
1185 |
||
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1186 |
/** Enum referring to the widgets of the build NewGRF rail waypoint window */ |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1187 |
enum BuildRailWaypointWidgets { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1188 |
BRWW_CLOSEBOX = 0, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1189 |
BRWW_CAPTION, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1190 |
BRWW_BACKGROUND, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1191 |
BRWW_WAYPOINT_1, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1192 |
BRWW_WAYPOINT_2, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1193 |
BRWW_WAYPOINT_3, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1194 |
BRWW_WAYPOINT_4, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1195 |
BRWW_WAYPOINT_5, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1196 |
BRWW_SCROLL, |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1197 |
}; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1198 |
|
395
788a9bba0889
(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
|
1199 |
static void BuildWaypointWndProc(Window *w, WindowEvent *e) |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1200 |
{ |
1738
dfa8f078450a
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1201 |
switch (e->event) { |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1202 |
case WE_PAINT: { |
2639 | 1203 |
uint i; |
1204 |
||
4853
f66ef6209e9d
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1205 |
for (i = 0; i < w->hscroll.cap; i++) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1206 |
SetWindowWidgetLoweredState(w, i + BRWW_WAYPOINT_1, (w->hscroll.pos + i) == _cur_waypoint_type); |
4853
f66ef6209e9d
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1207 |
} |
f66ef6209e9d
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1208 |
|
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1209 |
DrawWindowWidgets(w); |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1210 |
|
4853
f66ef6209e9d
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1211 |
for (i = 0; i < w->hscroll.cap; i++) { |
f66ef6209e9d
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1212 |
if (w->hscroll.pos + i < w->hscroll.count) { |
3776
1545763bfc75
(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
|
1213 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, w->hscroll.pos + i); |
1545763bfc75
(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
|
1214 |
|
2625
19bf7f695537
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1215 |
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype); |
3776
1545763bfc75
(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
|
1216 |
|
1545763bfc75
(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
|
1217 |
if (statspec != NULL && |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
1218 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
3776
1545763bfc75
(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
|
1219 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
1220 |
GfxFillRect(4 + i * 68, 18, 67 + i * 68, 75, (1 << PALETTE_MODIFIER_GREYOUT)); |
3776
1545763bfc75
(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
|
1221 |
} |
2639 | 1222 |
} |
2627
7a29af37b416
(svn r3169) Little bit of coding style fixing, and change from value to lengthof()
peter1138
parents:
2625
diff
changeset
|
1223 |
} |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1224 |
break; |
1738
dfa8f078450a
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1225 |
} |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1226 |
case WE_CLICK: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1227 |
switch (e->we.click.widget) { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1228 |
case BRWW_WAYPOINT_1: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1229 |
case BRWW_WAYPOINT_2: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1230 |
case BRWW_WAYPOINT_3: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1231 |
case BRWW_WAYPOINT_4: |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1232 |
case BRWW_WAYPOINT_5: { |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1233 |
byte type = e->we.click.widget - BRWW_WAYPOINT_1 + w->hscroll.pos; |
3776
1545763bfc75
(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
|
1234 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1235 |
/* Check station availability callback */ |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1236 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, type); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1237 |
if (statspec != NULL && |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7922
diff
changeset
|
1238 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1239 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
3776
1545763bfc75
(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
|
1240 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1241 |
_cur_waypoint_type = type; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1242 |
SndPlayFx(SND_15_BEEP); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1243 |
SetWindowDirty(w); |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1244 |
break; |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1245 |
} |
3776
1545763bfc75
(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
|
1246 |
} |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1247 |
break; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1248 |
} |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1249 |
|
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1250 |
case WE_MOUSELOOP: |
2639 | 1251 |
if (WP(w,def_d).close) DeleteWindow(w); |
1738
dfa8f078450a
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1252 |
break; |
1074
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1253 |
|
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1254 |
case WE_DESTROY: |
2639 | 1255 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1074
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1256 |
break; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1257 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1258 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1259 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1260 |
/** Widget definition for the build NewGRF rail waypoint window */ |
395
788a9bba0889
(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
|
1261 |
static const Widget _build_waypoint_widgets[] = { |
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1262 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRWW_CLOSEBOX |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1263 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 343, 0, 13, STR_WAYPOINT, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRWW_CAPTION |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1264 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 343, 14, 91, 0x0, STR_NULL}, // BRWW_BACKGROUND |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1265 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1266 |
{ WWT_PANEL, RESIZE_NONE, 7, 3, 68, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_1 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1267 |
{ WWT_PANEL, RESIZE_NONE, 7, 71, 136, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_2 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1268 |
{ WWT_PANEL, RESIZE_NONE, 7, 139, 204, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_3 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1269 |
{ WWT_PANEL, RESIZE_NONE, 7, 207, 272, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_4 |
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1270 |
{ WWT_PANEL, RESIZE_NONE, 7, 275, 340, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_5 |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1271 |
|
7729
04c9f8150a5e
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
7521
diff
changeset
|
1272 |
{ WWT_HSCROLLBAR, RESIZE_NONE, 7, 1, 343, 80, 91, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRWW_SCROLL |
417 | 1273 |
{ WIDGETS_END}, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1274 |
}; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1275 |
|
395
788a9bba0889
(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
|
1276 |
static const WindowDesc _build_waypoint_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7272
diff
changeset
|
1277 |
WDP_AUTO, WDP_AUTO, 344, 92, 344, 92, |
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1278 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1279 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
395
788a9bba0889
(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
|
1280 |
_build_waypoint_widgets, |
788a9bba0889
(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
|
1281 |
BuildWaypointWndProc |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1282 |
}; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1283 |
|
6247 | 1284 |
static void ShowBuildWaypointPicker() |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1285 |
{ |
395
788a9bba0889
(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
|
1286 |
Window *w = AllocateWindowDesc(&_build_waypoint_desc); |
411
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1287 |
w->hscroll.cap = 5; |
2625
19bf7f695537
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1288 |
w->hscroll.count = _waypoint_count; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1289 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1290 |
|
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1291 |
|
6247 | 1292 |
void InitializeRailGui() |
0 | 1293 |
{ |
3157
3f35e2d9c8e3
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
1294 |
_build_depot_direction = DIAGDIR_NW; |
0 | 1295 |
_railstation.numtracks = 1; |
1296 |
_railstation.platlength = 1; |
|
1297 |
_railstation.dragdrop = true; |
|
1298 |
} |
|
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1299 |
|
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1300 |
void ReinitGuiAfterToggleElrail(bool disable) |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1301 |
{ |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1302 |
extern RailType _last_built_railtype; |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1303 |
if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) { |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1304 |
Window *w; |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1305 |
_last_built_railtype = _cur_railtype = RAILTYPE_RAIL; |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1306 |
w = FindWindowById(WC_BUILD_TOOLBAR, 0); |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1307 |
if (w != NULL && w->wndproc == BuildRailToolbWndProc) { |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1308 |
SetupRailToolbar(_cur_railtype, w); |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1309 |
SetWindowDirty(w); |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1310 |
} |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1311 |
} |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1312 |
MarkWholeScreenDirty(); |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1313 |
} |
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1314 |
|
7064
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1315 |
void SetDefaultRailGui() |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1316 |
{ |
7131
b7fe92b21292
(svn r10405) -Fix [FS#972]: do not try to determine the default railtype in the scenario editor.
rubidium
parents:
7064
diff
changeset
|
1317 |
if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; |
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1318 |
|
7064
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1319 |
extern RailType _last_built_railtype; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1320 |
RailType rt = (RailType)_patches.default_rail_type; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1321 |
if (rt >= RAILTYPE_END) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1322 |
if (rt == RAILTYPE_END + 2) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1323 |
/* Find the most used rail type */ |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1324 |
RailType count[RAILTYPE_END]; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1325 |
memset(count, 0, sizeof(count)); |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1326 |
for (TileIndex t = 0; t < MapSize(); t++) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1327 |
if (IsTileType(t, MP_RAILWAY) || |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1328 |
IsLevelCrossingTile(t) || |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1329 |
IsRailwayStationTile(t) || |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1330 |
(IsTunnelTile(t) && GetTunnelTransportType(t) == TRANSPORT_RAIL) || |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1331 |
(IsBridgeTile(t) && GetBridgeTransportType(t) == TRANSPORT_RAIL) |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1332 |
) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1333 |
count[GetRailType(t)]++; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1334 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1335 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1336 |
|
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1337 |
rt = RAILTYPE_RAIL; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1338 |
for (RailType r = RAILTYPE_ELECTRIC; r < RAILTYPE_END; r++) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1339 |
if (count[r] >= count[rt]) rt = r; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1340 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1341 |
|
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1342 |
/* No rail, just get the first available one */ |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1343 |
if (count[rt] == 0) rt = RAILTYPE_END; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1344 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1345 |
switch (rt) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1346 |
case RAILTYPE_END + 0: |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1347 |
rt = RAILTYPE_RAIL; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1348 |
while (rt < RAILTYPE_END && !HasRailtypeAvail(GetPlayer(_local_player), rt)) rt++; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1349 |
break; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1350 |
|
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1351 |
case RAILTYPE_END + 1: |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1352 |
rt = GetBestRailtype(GetPlayer(_local_player)); |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1353 |
break; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1354 |
|
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1355 |
default: |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1356 |
break; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1357 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1358 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1359 |
|
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1360 |
_last_built_railtype = _cur_railtype = rt; |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1361 |
Window *w = FindWindowById(WC_BUILD_TOOLBAR, 0); |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1362 |
if (w != NULL && w->wndproc == BuildRailToolbWndProc) { |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1363 |
SetupRailToolbar(_cur_railtype, w); |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1364 |
SetWindowDirty(w); |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1365 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1366 |
} |
81d35e1f3e37
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium
parents:
6863
diff
changeset
|
1367 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7773
diff
changeset
|
1368 |