author | rubidium |
Sat, 29 Dec 2007 09:24:26 +0000 | |
changeset 8653 | a83f7a536919 |
parent 8640 | 1e93b81e96d2 |
child 8701 | 051036216675 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6443
b8f06d8eb7be
(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:
6432
diff
changeset
|
3 |
/** @file rail_gui.cpp File for dealing with rail construction user interface */ |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1884
diff
changeset
|
6 |
#include "openttd.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1227
diff
changeset
|
7 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
449
diff
changeset
|
8 |
#include "table/strings.h" |
8615
6b91ca653bad
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8612
diff
changeset
|
9 |
#include "tile_cmd.h" |
6949
72d11a1e1e60
(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:
6573
diff
changeset
|
10 |
#include "landscape.h" |
0 | 11 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
12 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
13 |
#include "station_gui.h" |
0 | 14 |
#include "viewport.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
15 |
#include "command_func.h" |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
16 |
#include "station.h" |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1363
diff
changeset
|
17 |
#include "waypoint.h" |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
18 |
#include "debug.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2049
diff
changeset
|
19 |
#include "variables.h" |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
20 |
#include "newgrf_callbacks.h" |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
21 |
#include "newgrf_station.h" |
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
22 |
#include "train.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8604
diff
changeset
|
23 |
#include "strings_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8624
diff
changeset
|
24 |
#include "functions.h" |
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8624
diff
changeset
|
25 |
#include "window_func.h" |
8636
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8635
diff
changeset
|
26 |
#include "date_func.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8640
diff
changeset
|
27 |
#include "sound_func.h" |
0 | 28 |
|
7560
f7b5ab184882
(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:
7359
diff
changeset
|
29 |
#include "bridge_map.h" |
f7b5ab184882
(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:
7359
diff
changeset
|
30 |
#include "rail_map.h" |
f7b5ab184882
(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:
7359
diff
changeset
|
31 |
#include "road_map.h" |
f7b5ab184882
(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:
7359
diff
changeset
|
32 |
#include "station_map.h" |
f7b5ab184882
(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:
7359
diff
changeset
|
33 |
#include "tunnel_map.h" |
8579
3efbb430092e
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
smatz
parents:
8528
diff
changeset
|
34 |
#include "tunnelbridge_map.h" |
3efbb430092e
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
smatz
parents:
8528
diff
changeset
|
35 |
|
7560
f7b5ab184882
(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:
7359
diff
changeset
|
36 |
|
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
37 |
static RailType _cur_railtype; |
0 | 38 |
static bool _remove_button_clicked; |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
39 |
static DiagDirection _build_depot_direction; |
2639 | 40 |
static byte _waypoint_count = 1; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
41 |
static byte _cur_waypoint_type; |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
42 |
static bool _convert_signal_button; // convert signal button in the signal GUI pressed |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
43 |
static SignalVariant _cur_signal_variant; // set the signal variant (for signal GUI) |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
44 |
static SignalType _cur_signal_type; // set the signal type (for signal GUI) |
0 | 45 |
|
2630 | 46 |
static struct { |
0 | 47 |
byte orientation; |
48 |
byte numtracks; |
|
49 |
byte platlength; |
|
50 |
bool dragdrop; |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
51 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
52 |
bool newstations; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
53 |
StationClassIDByte station_class; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
54 |
byte station_type; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
55 |
byte station_count; |
0 | 56 |
} _railstation; |
57 |
||
58 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
59 |
static void HandleStationPlacement(TileIndex start, TileIndex end); |
6573 | 60 |
static void ShowBuildTrainDepotPicker(); |
61 |
static void ShowBuildWaypointPicker(); |
|
62 |
static void ShowStationBuilder(); |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
63 |
static void ShowSignalBuilder(); |
0 | 64 |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
65 |
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 66 |
{ |
541 | 67 |
if (success) SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 68 |
} |
69 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
70 |
static void GenericPlaceRail(TileIndex tile, int cmd) |
0 | 71 |
{ |
72 |
DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E, |
|
8445
f681905b6f4f
(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:
8424
diff
changeset
|
73 |
(_remove_button_clicked || _ctrl_pressed) ? |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
74 |
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_NO_WATER : |
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
75 |
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_NO_WATER |
2639 | 76 |
); |
0 | 77 |
} |
78 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
79 |
static void PlaceRail_N(TileIndex tile) |
0 | 80 |
{ |
81 |
int cmd = _tile_fract_coords.x > _tile_fract_coords.y ? 4 : 5; |
|
82 |
GenericPlaceRail(tile, cmd); |
|
83 |
} |
|
84 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
85 |
static void PlaceRail_NE(TileIndex tile) |
0 | 86 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
87 |
VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_RAIL_NE); |
0 | 88 |
} |
89 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
90 |
static void PlaceRail_E(TileIndex tile) |
0 | 91 |
{ |
92 |
int cmd = _tile_fract_coords.x + _tile_fract_coords.y <= 15 ? 2 : 3; |
|
93 |
GenericPlaceRail(tile, cmd); |
|
94 |
} |
|
95 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
96 |
static void PlaceRail_NW(TileIndex tile) |
0 | 97 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
98 |
VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_RAIL_NW); |
0 | 99 |
} |
100 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
101 |
static void PlaceRail_AutoRail(TileIndex tile) |
0 | 102 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
103 |
VpStartPlaceSizing(tile, VPM_RAILDIRS, DDSP_PLACE_AUTORAIL); |
0 | 104 |
} |
105 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
106 |
static void PlaceExtraDepotRail(TileIndex tile, uint16 extra) |
0 | 107 |
{ |
3792
2eb8388731bf
(svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents:
3782
diff
changeset
|
108 |
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return; |
3269
95e7bffcb3c5
(svn r3981) More work for the rail accessing functions and enums
tron
parents:
3157
diff
changeset
|
109 |
if ((GetTrackBits(tile) & GB(extra, 8, 8)) == 0) return; |
0 | 110 |
|
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
111 |
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_NO_WATER); |
0 | 112 |
} |
113 |
||
114 |
static const uint16 _place_depot_extra[12] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
115 |
0x0604, 0x2102, 0x1202, 0x0505, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
116 |
0x2400, 0x2801, 0x1800, 0x1401, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
117 |
0x2203, 0x0904, 0x0A05, 0x1103, |
0 | 118 |
}; |
119 |
||
120 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
121 |
void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 122 |
{ |
123 |
if (success) { |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
124 |
DiagDirection dir = (DiagDirection)p2; |
0 | 125 |
|
541 | 126 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 127 |
ResetObjectToPlace(); |
128 |
||
4559
c853d2440065
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4547
diff
changeset
|
129 |
tile += TileOffsByDiagDir(dir); |
0 | 130 |
|
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
980
diff
changeset
|
131 |
if (IsTileType(tile, MP_RAILWAY)) { |
0 | 132 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir]); |
133 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]); |
|
134 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]); |
|
135 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
136 |
} |
0 | 137 |
} |
138 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
139 |
static void PlaceRail_Depot(TileIndex tile) |
0 | 140 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
141 |
DoCommandP(tile, _cur_railtype, _build_depot_direction, CcRailDepot, |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
142 |
CMD_BUILD_TRAIN_DEPOT | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT)); |
0 | 143 |
} |
144 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
145 |
static void PlaceRail_Waypoint(TileIndex tile) |
0 | 146 |
{ |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
147 |
if (_remove_button_clicked || _ctrl_pressed) { |
f681905b6f4f
(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:
8424
diff
changeset
|
148 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT)); |
f681905b6f4f
(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:
8424
diff
changeset
|
149 |
} else { |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
150 |
DoCommandP(tile, _cur_waypoint_type, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT)); |
0 | 151 |
} |
152 |
} |
|
153 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
154 |
void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 155 |
{ |
156 |
if (success) { |
|
541 | 157 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
158 |
/* Only close the station builder window if the default station is chosen. */ |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
159 |
if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0) ResetObjectToPlace(); |
0 | 160 |
} |
161 |
} |
|
162 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
163 |
static void PlaceRail_Station(TileIndex tile) |
0 | 164 |
{ |
8451
21eef6f9f401
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
8445
diff
changeset
|
165 |
if (_remove_button_clicked) { |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
166 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
167 |
} else if (_railstation.dragdrop) { |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
168 |
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); |
0 | 169 |
VpSetPlaceSizingLimit(_patches.station_spread); |
170 |
} else { |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
171 |
DoCommandP(tile, |
7170
bd34b6d0e4f1
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
maedhros
parents:
7166
diff
changeset
|
172 |
_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
173 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
174 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
0 | 175 |
} |
176 |
} |
|
177 |
||
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
178 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
179 |
* Build a new signal or edit/remove a present signal, use CmdBuildSingleSignal() or CmdRemoveSingleSignal() in rail_cmd.cpp |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
180 |
* |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
181 |
* @param tile The tile where the signal will build or edit |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
182 |
*/ |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
183 |
static void GenericPlaceSignals(TileIndex tile) |
0 | 184 |
{ |
7342
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
185 |
TrackBits trackbits = (TrackBits)GB(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0), 0, 6); |
0 | 186 |
|
7342
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
187 |
if (trackbits & TRACK_BIT_VERT) { // N-S direction |
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
188 |
trackbits = (_tile_fract_coords.x <= _tile_fract_coords.y) ? TRACK_BIT_RIGHT : TRACK_BIT_LEFT; |
2639 | 189 |
} |
0 | 190 |
|
7342
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
191 |
if (trackbits & TRACK_BIT_HORZ) { // E-W direction |
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
192 |
trackbits = (_tile_fract_coords.x + _tile_fract_coords.y <= 15) ? TRACK_BIT_UPPER : TRACK_BIT_LOWER; |
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
193 |
} |
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
194 |
|
7359
8844ff8a2d96
(svn r10103) -Fix (r10086): TrackBitsToTrack doesn't cope well with TRACK_BIT_NONE (e.g. non-rail tiles), so use FindFirstTrack instead.
maedhros
parents:
7342
diff
changeset
|
195 |
Track track = FindFirstTrack(trackbits); |
7342
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
196 |
|
8451
21eef6f9f401
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
8445
diff
changeset
|
197 |
if (_remove_button_clicked) { |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
198 |
DoCommandP(tile, track, 0, CcPlaySound1E, |
f681905b6f4f
(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:
8424
diff
changeset
|
199 |
CMD_REMOVE_SIGNALS | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM)); |
f681905b6f4f
(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:
8424
diff
changeset
|
200 |
} else { |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
201 |
if (!_patches.enable_signal_gui) _cur_signal_variant = _cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
202 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
203 |
/* various bitstuffed elements for CmdBuildSingleSignal() */ |
7342
fcc74271f850
(svn r10086) -Codechange: Use more sensible types and functions in GenericPlaceSignals.
maedhros
parents:
7179
diff
changeset
|
204 |
uint32 p1 = track; |
5986
1b9ab9629d36
(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:
5982
diff
changeset
|
205 |
SB(p1, 3, 1, _ctrl_pressed); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
206 |
SB(p1, 4, 1, _cur_signal_variant); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
207 |
SB(p1, 5, 2, _patches.enable_signal_gui ? _cur_signal_type : SIGTYPE_NORMAL); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
208 |
SB(p1, 7, 1, _convert_signal_button); |
5982
54218ea5af1e
(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:
5947
diff
changeset
|
209 |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
210 |
DoCommandP(tile, p1, 0, CcPlaySound1E, CMD_BUILD_SIGNALS | |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
211 |
CMD_MSG(_convert_signal_button ? STR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_1010_CAN_T_BUILD_SIGNALS_HERE)); |
0 | 212 |
} |
213 |
} |
|
214 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
215 |
static void PlaceRail_Bridge(TileIndex tile) |
0 | 216 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
217 |
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE); |
0 | 218 |
} |
219 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
220 |
void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 221 |
{ |
222 |
if (success) { |
|
541 | 223 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 224 |
ResetObjectToPlace(); |
225 |
} else { |
|
226 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
227 |
} |
|
228 |
} |
|
229 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
230 |
static void PlaceRail_Tunnel(TileIndex tile) |
0 | 231 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
232 |
DoCommandP(tile, _cur_railtype, 0, CcBuildRailTunnel, |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
233 |
CMD_BUILD_TUNNEL | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
0 | 234 |
} |
235 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
236 |
void PlaceProc_BuyLand(TileIndex tile) |
0 | 237 |
{ |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
238 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND)); |
0 | 239 |
} |
240 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
241 |
static void PlaceRail_ConvertRail(TileIndex tile) |
0 | 242 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
243 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CONVERT_RAIL); |
0 | 244 |
} |
245 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
246 |
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
|
247 |
{ |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
248 |
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
|
249 |
} |
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
|
250 |
|
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
251 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
252 |
/** Enum referring to the widgets of the build rail toolbar */ |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
253 |
enum RailToolbarWidgets { |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
254 |
RTW_CLOSEBOX = 0, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
255 |
RTW_CAPTION, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
256 |
RTW_STICKY, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
257 |
RTW_SPACER, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
258 |
RTW_BUILD_NS, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
259 |
RTW_BUILD_X, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
260 |
RTW_BUILD_EW, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
261 |
RTW_BUILD_Y, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
262 |
RTW_AUTORAIL, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
263 |
RTW_DEMOLISH, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
264 |
RTW_BUILD_DEPOT, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
265 |
RTW_BUILD_WAYPOINT, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
266 |
RTW_BUILD_STATION, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
267 |
RTW_BUILD_SIGNALS, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
268 |
RTW_BUILD_BRIDGE, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
269 |
RTW_BUILD_TUNNEL, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
270 |
RTW_REMOVE, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
271 |
RTW_CONVERT_RAIL, |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
272 |
}; |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
273 |
|
0 | 274 |
static void BuildRailClick_N(Window *w) |
275 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
276 |
HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, VHM_RECT, PlaceRail_N); |
0 | 277 |
} |
278 |
||
279 |
static void BuildRailClick_NE(Window *w) |
|
280 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
281 |
HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, VHM_RECT, PlaceRail_NE); |
0 | 282 |
} |
283 |
||
284 |
static void BuildRailClick_E(Window *w) |
|
285 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
286 |
HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, VHM_RECT, PlaceRail_E); |
0 | 287 |
} |
288 |
||
289 |
static void BuildRailClick_NW(Window *w) |
|
290 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
291 |
HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, VHM_RECT, PlaceRail_NW); |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
292 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
293 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
294 |
static void BuildRailClick_AutoRail(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
295 |
{ |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
296 |
HandlePlacePushButton(w, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, VHM_RAIL, PlaceRail_AutoRail); |
0 | 297 |
} |
298 |
||
299 |
static void BuildRailClick_Demolish(Window *w) |
|
300 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
301 |
HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); |
0 | 302 |
} |
303 |
||
304 |
static void BuildRailClick_Depot(Window *w) |
|
305 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
306 |
if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, VHM_RECT, PlaceRail_Depot)) { |
2514
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2274
diff
changeset
|
307 |
ShowBuildTrainDepotPicker(); |
8887b1f005c7
(svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array.
tron
parents:
2274
diff
changeset
|
308 |
} |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
309 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
310 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
311 |
static void BuildRailClick_Waypoint(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
312 |
{ |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
313 |
_waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP); |
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
314 |
if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, VHM_RECT, PlaceRail_Waypoint) && |
2639 | 315 |
_waypoint_count > 1) { |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
316 |
ShowBuildWaypointPicker(); |
2639 | 317 |
} |
0 | 318 |
} |
319 |
||
320 |
static void BuildRailClick_Station(Window *w) |
|
321 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
322 |
if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, VHM_RECT, PlaceRail_Station)) ShowStationBuilder(); |
0 | 323 |
} |
324 |
||
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
325 |
/** The "build signal"-button proc from BuildRailToolbWndProc() (start ShowSignalBuilder() and/or 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
|
326 |
static void BuildRailClick_AutoSignals(Window *w) |
0 | 327 |
{ |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
328 |
if (_patches.enable_signal_gui) { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
329 |
if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
330 |
} else { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
331 |
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
332 |
} |
0 | 333 |
} |
334 |
||
335 |
static void BuildRailClick_Bridge(Window *w) |
|
336 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
337 |
HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRail_Bridge); |
0 | 338 |
} |
339 |
||
340 |
static void BuildRailClick_Tunnel(Window *w) |
|
341 |
{ |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
342 |
HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, VHM_SPECIAL, PlaceRail_Tunnel); |
0 | 343 |
} |
344 |
||
345 |
static void BuildRailClick_Remove(Window *w) |
|
346 |
{ |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
347 |
if (w->IsWidgetDisabled(RTW_REMOVE)) return; |
0 | 348 |
SetWindowDirty(w); |
541 | 349 |
SndPlayFx(SND_15_BEEP); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
350 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
351 |
w->ToggleWidgetLoweredState(RTW_REMOVE); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
352 |
_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
353 |
SetSelectionRed(_remove_button_clicked); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
354 |
|
0 | 355 |
// handle station builder |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
356 |
if (_remove_button_clicked) { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
357 |
SetTileSelectSize(1, 1); |
0 | 358 |
} |
359 |
} |
|
360 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
361 |
static void BuildRailClick_Convert(Window *w) |
0 | 362 |
{ |
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
363 |
HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, VHM_RECT, PlaceRail_ConvertRail); |
0 | 364 |
} |
365 |
||
366 |
||
367 |
static void DoRailroadTrack(int mode) |
|
368 |
{ |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
369 |
DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), NULL, |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
370 |
(_remove_button_clicked || _ctrl_pressed) ? |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
371 |
CMD_REMOVE_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) : |
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
372 |
CMD_BUILD_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) |
0 | 373 |
); |
374 |
} |
|
375 |
||
6573 | 376 |
static void HandleAutodirPlacement() |
0 | 377 |
{ |
378 |
TileHighlightData *thd = &_thd; |
|
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
379 |
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
|
380 |
|
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
381 |
if (thd->drawstyle & HT_RAIL) { // one tile case |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
382 |
GenericPlaceRail(TileVirtXY(thd->selend.x, thd->selend.y), trackstat); |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
383 |
return; |
0 | 384 |
} |
1227
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
385 |
|
3552f20fcfcb
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
386 |
DoRailroadTrack(trackstat); |
0 | 387 |
} |
388 |
||
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
389 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
390 |
* Build new signals or remove signals or (if only one tile marked) edit a signal. |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
391 |
* |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
392 |
* If one tile marked abort and use GenericPlaceSignals() |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
393 |
* else use CmdBuildSingleSignal() or CmdRemoveSingleSignal() in rail_cmd.cpp to build many signals |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
394 |
*/ |
6573 | 395 |
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
|
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 |
TileHighlightData *thd = &_thd; |
5986
1b9ab9629d36
(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:
5982
diff
changeset
|
398 |
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
|
399 |
|
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
400 |
if (thd->drawstyle == HT_RECT) { // one tile case |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
401 |
GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y)); |
1123
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
402 |
return; |
449eb47ca680
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
403 |
} |
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
|
404 |
|
7659
5456fc83a700
(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:
7627
diff
changeset
|
405 |
/* XXX Steal ctrl for autosignal function, until we get some GUI */ |
5456fc83a700
(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:
7627
diff
changeset
|
406 |
SB(p2, 3, 1, 0); |
5986
1b9ab9629d36
(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:
5982
diff
changeset
|
407 |
SB(p2, 4, 1, _cur_year < _patches.semaphore_build_before); |
7659
5456fc83a700
(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:
7627
diff
changeset
|
408 |
SB(p2, 6, 1, _ctrl_pressed); |
5982
54218ea5af1e
(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:
5947
diff
changeset
|
409 |
SB(p2, 24, 8, _patches.drag_signals_density); |
5939
77530457a36b
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
maedhros
parents:
5933
diff
changeset
|
410 |
|
5982
54218ea5af1e
(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:
5947
diff
changeset
|
411 |
/* _patches.drag_signals_density is given as a parameter such that each user |
54218ea5af1e
(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:
5947
diff
changeset
|
412 |
* in a network game can specify his/her own signal density */ |
2639 | 413 |
DoCommandP( |
5982
54218ea5af1e
(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:
5947
diff
changeset
|
414 |
TileVirtXY(thd->selstart.x, thd->selstart.y), |
2639 | 415 |
TileVirtXY(thd->selend.x, thd->selend.y), |
5982
54218ea5af1e
(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:
5947
diff
changeset
|
416 |
p2, |
2639 | 417 |
CcPlaySound1E, |
8451
21eef6f9f401
(svn r11511) -Revert parts of r11505: forgot that CTRL might be used for other features, like adjacent stations or signals.
rubidium
parents:
8445
diff
changeset
|
418 |
_remove_button_clicked ? |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
419 |
CMD_REMOVE_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) : |
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
420 |
CMD_BUILD_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) |
2639 | 421 |
); |
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
|
422 |
} |
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
|
423 |
|
2639 | 424 |
|
425 |
typedef void OnButtonClick(Window *w); |
|
426 |
||
0 | 427 |
static OnButtonClick * const _build_railroad_button_proc[] = { |
428 |
BuildRailClick_N, |
|
429 |
BuildRailClick_NE, |
|
430 |
BuildRailClick_E, |
|
431 |
BuildRailClick_NW, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
432 |
BuildRailClick_AutoRail, |
0 | 433 |
BuildRailClick_Demolish, |
434 |
BuildRailClick_Depot, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
435 |
BuildRailClick_Waypoint, |
0 | 436 |
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
|
437 |
BuildRailClick_AutoSignals, |
0 | 438 |
BuildRailClick_Bridge, |
439 |
BuildRailClick_Tunnel, |
|
440 |
BuildRailClick_Remove, |
|
5933
0835f3342b79
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5919
diff
changeset
|
441 |
BuildRailClick_Convert |
0 | 442 |
}; |
443 |
||
444 |
static const uint16 _rail_keycodes[] = { |
|
445 |
'1', |
|
446 |
'2', |
|
447 |
'3', |
|
448 |
'4', |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
449 |
'5', |
0 | 450 |
'6', |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
451 |
'7', // depot |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
452 |
'8', // waypoint |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
453 |
'9', // station |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
454 |
'S', // signals |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
455 |
'B', // bridge |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
456 |
'T', // tunnel |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
457 |
'R', // remove |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
458 |
'C', // convert rail |
0 | 459 |
}; |
460 |
||
461 |
||
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
462 |
static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget) |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
463 |
{ |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
464 |
switch (clicked_widget) { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
465 |
case RTW_REMOVE: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
466 |
/* If it is the removal button that has been clicked, do nothing, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
467 |
* as it is up to the other buttons to drive removal status */ |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
468 |
return; |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
469 |
break; |
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
470 |
case RTW_BUILD_NS: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
471 |
case RTW_BUILD_X: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
472 |
case RTW_BUILD_EW: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
473 |
case RTW_BUILD_Y: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
474 |
case RTW_AUTORAIL: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
475 |
case RTW_BUILD_WAYPOINT: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
476 |
case RTW_BUILD_STATION: |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5116
diff
changeset
|
477 |
case RTW_BUILD_SIGNALS: |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
478 |
/* Removal button is enabled only if the rail/signal/waypoint/station |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
479 |
* button is still lowered. Once raised, it has to be disabled */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
480 |
w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget)); |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
481 |
break; |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
482 |
|
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
483 |
default: |
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
484 |
/* When any other buttons than rail/signal/waypoint/station, raise and |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
485 |
* disable the removal button */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
486 |
w->DisableWidget(RTW_REMOVE); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
487 |
w->RaiseWidget(RTW_REMOVE); |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
488 |
break; |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
489 |
} |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
490 |
} |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
491 |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
492 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
493 |
* Railway toolbar window event definition |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
494 |
* |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
495 |
* @param w window pointer |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
496 |
* @param e event been triggered |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
497 |
*/ |
0 | 498 |
static void BuildRailToolbWndProc(Window *w, WindowEvent *e) |
499 |
{ |
|
2639 | 500 |
switch (e->event) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
501 |
case WE_CREATE: w->DisableWidget(RTW_REMOVE); break; |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
502 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
503 |
case WE_PAINT: DrawWindowWidgets(w); break; |
4731
0febcf07eb48
(svn r6643) -Fix(r6631): Adjust proper disabled and lowered states of removal button on railtoolbar
belugas
parents:
4727
diff
changeset
|
504 |
|
0 | 505 |
case WE_CLICK: |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
506 |
if (e->we.click.widget >= RTW_BUILD_NS) { |
0 | 507 |
_remove_button_clicked = false; |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
508 |
_build_railroad_button_proc[e->we.click.widget - RTW_BUILD_NS](w); |
0 | 509 |
} |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
510 |
UpdateRemoveWidgetStatus(w, e->we.click.widget); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4634
diff
changeset
|
511 |
break; |
0 | 512 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
513 |
case WE_KEYPRESS: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
514 |
for (uint8 i = 0; i != lengthof(_rail_keycodes); i++) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
515 |
if (e->we.keypress.keycode == _rail_keycodes[i]) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
516 |
e->we.keypress.cont = false; |
0 | 517 |
_remove_button_clicked = false; |
518 |
_build_railroad_button_proc[i](w); |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
519 |
UpdateRemoveWidgetStatus(w, i + RTW_BUILD_NS); |
0 | 520 |
break; |
521 |
} |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
522 |
} |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
523 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 524 |
break; |
525 |
||
526 |
case WE_PLACE_OBJ: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
527 |
_place_proc(e->we.place.tile); |
0 | 528 |
return; |
529 |
||
530 |
case WE_PLACE_DRAG: { |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
531 |
/* no dragging if you have pressed the convert button */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
532 |
if (_convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return; |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
533 |
|
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
534 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); |
0 | 535 |
return; |
536 |
} |
|
537 |
||
538 |
case WE_PLACE_MOUSEUP: |
|
4994
ec6d8b5551f4
(svn r7000) -Fix: Incorrect use of e->we.click when the event is a 'place'. This didn't cause any
Darkvater
parents:
4939
diff
changeset
|
539 |
if (e->we.place.pt.x != -1) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
540 |
TileIndex start_tile = e->we.place.starttile; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
541 |
TileIndex end_tile = e->we.place.tile; |
0 | 542 |
|
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
543 |
switch (e->we.place.select_proc) { |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
544 |
case DDSP_BUILD_BRIDGE: |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
545 |
ResetObjectToPlace(); |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
546 |
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
547 |
break; |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1542
diff
changeset
|
548 |
|
8445
f681905b6f4f
(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:
8424
diff
changeset
|
549 |
case DDSP_PLACE_AUTORAIL: |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
550 |
HandleAutodirPlacement(); |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
551 |
break; |
7092
3fa66ad549c8
(svn r9810) -Feature: Add drag and drop removal of station tiles (Wolf01)
peter1138
parents:
6949
diff
changeset
|
552 |
|
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
553 |
case DDSP_BUILD_SIGNALS: |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
554 |
HandleAutoSignalPlacement(); |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
555 |
break; |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
556 |
|
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
557 |
case DDSP_DEMOLISH_AREA: |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
558 |
GUIPlaceProcDragXY(e); |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
559 |
break; |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
560 |
|
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
561 |
case DDSP_REMOVE_STATION: |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
562 |
DoCommandP(end_tile, start_tile, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
563 |
break; |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
564 |
|
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
565 |
case DDSP_CONVERT_RAIL: |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
566 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
567 |
break; |
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
568 |
|
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
569 |
case DDSP_BUILD_STATION: |
7165
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
570 |
HandleStationPlacement(start_tile, end_tile); |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
571 |
break; |
37eb253f3c06
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
7092
diff
changeset
|
572 |
|
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
573 |
case DDSP_PLACE_RAIL_NE: |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
574 |
case DDSP_PLACE_RAIL_NW: |
7166
3937d5ea59df
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
7165
diff
changeset
|
575 |
DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y); |
8445
f681905b6f4f
(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:
8424
diff
changeset
|
576 |
break; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3921
diff
changeset
|
577 |
} |
0 | 578 |
} |
579 |
break; |
|
580 |
||
581 |
case WE_ABORT_PLACE_OBJ: |
|
8528
04b4ef9abd9b
(svn r11592) -Codechange: Use the Window member RaiseButtons and remove the now useless RaiseWindowButtons function
belugas
parents:
8524
diff
changeset
|
582 |
w->RaiseButtons(); |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
583 |
w->DisableWidget(RTW_REMOVE); |
8524
baf4ab1ba18d
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
8493
diff
changeset
|
584 |
w->InvalidateWidget(RTW_REMOVE); |
0 | 585 |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
586 |
w = FindWindowById(WC_BUILD_SIGNAL, 0); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
587 |
if (w != NULL) WP(w, def_d).close = true; |
0 | 588 |
w = FindWindowById(WC_BUILD_STATION, 0); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
589 |
if (w != NULL) WP(w, def_d).close = true; |
0 | 590 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
591 |
if (w != NULL) WP(w, def_d).close = true; |
0 | 592 |
break; |
593 |
||
594 |
case WE_PLACE_PRESIZE: { |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
595 |
TileIndex tile = e->we.place.tile; |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
596 |
|
3491
4c8427796c64
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3269
diff
changeset
|
597 |
DoCommand(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
2639 | 598 |
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); |
0 | 599 |
} break; |
2619
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
600 |
|
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
601 |
case WE_DESTROY: |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
602 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2571
diff
changeset
|
603 |
break; |
0 | 604 |
} |
605 |
} |
|
606 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
607 |
/** Widget definition for the rail toolbar */ |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
608 |
static const Widget _build_rail_widgets[] = { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
609 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // RTW_CLOSEBOX |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
610 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 337, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // RTW_CAPTION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
611 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 338, 349, 0, 13, 0x0, STR_STICKY_BUTTON}, // RTW_STICKY |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
612 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
613 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, // RTW_SPACER |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
614 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
615 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_RAIL_NS, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_NS |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
616 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_RAIL_NE, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_X |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
617 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_RAIL_EW, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_EW |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
618 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_RAIL_NW, STR_1018_BUILD_RAILROAD_TRACK}, // RTW_BUILD_Y |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
619 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_AUTORAIL, STR_BUILD_AUTORAIL_TIP}, // RTW_AUTORAIL |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
620 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
621 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 114, 135, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // RTW_DEMOLISH |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
622 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_DEPOT_RAIL, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, // RTW_BUILD_DEPOT |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
623 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_IMG_WAYPOINT, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, // RTW_BUILD_WAYPOINT |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
624 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
625 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 180, 221, 14, 35, SPR_IMG_RAIL_STATION, STR_101A_BUILD_RAILROAD_STATION}, // RTW_BUILD_STATION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
626 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 222, 243, 14, 35, SPR_IMG_RAIL_SIGNALS, STR_101B_BUILD_RAILROAD_SIGNALS}, // RTW_BUILD_SIGNALS |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
627 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 244, 285, 14, 35, SPR_IMG_BRIDGE, STR_101C_BUILD_RAILROAD_BRIDGE}, // RTW_BUILD_BRIDGE |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
628 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 286, 305, 14, 35, SPR_IMG_TUNNEL_RAIL, STR_101D_BUILD_RAILROAD_TUNNEL}, // RTW_BUILD_TUNNEL |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
629 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 306, 327, 14, 35, SPR_IMG_REMOVE, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
630 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_IMG_CONVERT_RAIL, STR_CONVERT_RAIL_TIP}, // RTW_CONVERT_RAIL |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
631 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
632 |
{ WIDGETS_END}, |
0 | 633 |
}; |
634 |
||
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
635 |
static const WindowDesc _build_rail_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7768
diff
changeset
|
636 |
WDP_ALIGN_TBR, 22, 350, 36, 350, 36, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6111
diff
changeset
|
637 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
638 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
639 |
_build_rail_widgets, |
0 | 640 |
BuildRailToolbWndProc |
641 |
}; |
|
642 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
643 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
644 |
/** Configures the rail toolbar for railtype given |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
645 |
* @param railtype the railtype to display |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
646 |
* @param w the window to modify |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
647 |
*/ |
4171 | 648 |
static void SetupRailToolbar(RailType railtype, Window *w) |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
649 |
{ |
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
650 |
const RailtypeInfo *rti = GetRailTypeInfo(railtype); |
0 | 651 |
|
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
652 |
assert(railtype < RAILTYPE_END); |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
653 |
w->widget[RTW_CAPTION].data = rti->strings.toolbar_caption; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
654 |
w->widget[RTW_BUILD_NS].data = rti->gui_sprites.build_ns_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
655 |
w->widget[RTW_BUILD_X].data = rti->gui_sprites.build_x_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
656 |
w->widget[RTW_BUILD_EW].data = rti->gui_sprites.build_ew_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
657 |
w->widget[RTW_BUILD_Y].data = rti->gui_sprites.build_y_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
658 |
w->widget[RTW_AUTORAIL].data = rti->gui_sprites.auto_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
659 |
w->widget[RTW_BUILD_DEPOT].data = rti->gui_sprites.build_depot; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
660 |
w->widget[RTW_CONVERT_RAIL].data = rti->gui_sprites.convert_rail; |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4429
diff
changeset
|
661 |
w->widget[RTW_BUILD_TUNNEL].data = rti->gui_sprites.build_tunnel; |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
662 |
} |
0 | 663 |
|
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
664 |
void ShowBuildRailToolbar(RailType railtype, int button) |
0 | 665 |
{ |
666 |
Window *w; |
|
667 |
||
5005
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
668 |
if (!IsValidPlayer(_current_player)) return; |
4816
956f36063319
(svn r6740) -Fix: if a rail is not available, don't show toolbar even with hotkey 'A'
Darkvater
parents:
4747
diff
changeset
|
669 |
if (!ValParamRailtype(railtype)) return; |
946
81cf624bbdc5
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
926
diff
changeset
|
670 |
|
0 | 671 |
// don't recreate the window if we're clicking on a button and the window exists. |
672 |
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
|
673 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
674 |
_cur_railtype = railtype; |
2274
d94004c14b6c
(svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
celestar
parents:
2186
diff
changeset
|
675 |
w = AllocateWindowDesc(&_build_rail_desc); |
2520
75eb66d6e371
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2514
diff
changeset
|
676 |
SetupRailToolbar(railtype, w); |
0 | 677 |
} |
678 |
||
288
6bd97cdf1652
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
darkvater
parents:
201
diff
changeset
|
679 |
_remove_button_clicked = false; |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
680 |
if (w != NULL && button >= RTW_CLOSEBOX) { |
4747
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
681 |
_build_railroad_button_proc[button](w); |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
682 |
UpdateRemoveWidgetStatus(w, button + RTW_BUILD_NS); |
4747
c49af691700f
(svn r6659) -Fix r6619: Fix widget state setting of the rail toolbar when using global hotkeys.
glx
parents:
4738
diff
changeset
|
683 |
} |
6111 | 684 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); |
0 | 685 |
} |
686 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
687 |
/** Enum referring to the widgets of the rail stations window */ |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
688 |
enum BuildRailStationWidgets { |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
689 |
BRSW_CLOSEBOX = 0, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
690 |
BRSW_CAPTION, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
691 |
BRSW_BACKGROUND, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
692 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
693 |
BRSW_PLATFORM_DIR_X, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
694 |
BRSW_PLATFORM_DIR_Y, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
695 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
696 |
BRSW_PLATFORM_NUM_BEGIN = BRSW_PLATFORM_DIR_Y, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
697 |
BRSW_PLATFORM_NUM_1, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
698 |
BRSW_PLATFORM_NUM_2, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
699 |
BRSW_PLATFORM_NUM_3, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
700 |
BRSW_PLATFORM_NUM_4, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
701 |
BRSW_PLATFORM_NUM_5, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
702 |
BRSW_PLATFORM_NUM_6, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
703 |
BRSW_PLATFORM_NUM_7, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
704 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
705 |
BRSW_PLATFORM_LEN_BEGIN = BRSW_PLATFORM_NUM_7, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
706 |
BRSW_PLATFORM_LEN_1, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
707 |
BRSW_PLATFORM_LEN_2, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
708 |
BRSW_PLATFORM_LEN_3, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
709 |
BRSW_PLATFORM_LEN_4, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
710 |
BRSW_PLATFORM_LEN_5, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
711 |
BRSW_PLATFORM_LEN_6, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
712 |
BRSW_PLATFORM_LEN_7, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
713 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
714 |
BRSW_PLATFORM_DRAG_N_DROP, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
715 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
716 |
BRSW_HIGHLIGHT_OFF, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
717 |
BRSW_HIGHLIGHT_ON, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
718 |
|
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
719 |
BRSW_NEWST_DROPDOWN, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
720 |
BRSW_NEWST_DROPDOWN_TEXT, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
721 |
BRSW_NEWST_LIST, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
722 |
BRSW_NEWST_SCROLL |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
723 |
}; |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
724 |
|
449
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
725 |
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
726 |
* --pasky */ |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
727 |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
728 |
static void HandleStationPlacement(TileIndex start, TileIndex end) |
0 | 729 |
{ |
926
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
730 |
uint sx = TileX(start); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
731 |
uint sy = TileY(start); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
732 |
uint ex = TileX(end); |
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
733 |
uint ey = TileY(end); |
0 | 734 |
uint w,h; |
735 |
||
6432 | 736 |
if (sx > ex) Swap(sx, ex); |
737 |
if (sy > ey) Swap(sy, ey); |
|
0 | 738 |
w = ex - sx + 1; |
739 |
h = ey - sy + 1; |
|
6432 | 740 |
if (!_railstation.orientation) Swap(w, h); |
0 | 741 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
742 |
DoCommandP(TileXY(sx, sy), |
7170
bd34b6d0e4f1
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
maedhros
parents:
7166
diff
changeset
|
743 |
_railstation.orientation | (w << 8) | (h << 16) | (_ctrl_pressed << 24), |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
744 |
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
745 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
0 | 746 |
} |
747 |
||
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
748 |
/* Check if the currently selected station size is allowed */ |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
749 |
static void CheckSelectedSize(Window *w, const StationSpec *statspec) |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
750 |
{ |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
751 |
if (statspec == NULL || _railstation.dragdrop) return; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
752 |
|
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
753 |
if (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
754 |
w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
755 |
_railstation.numtracks = 1; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
756 |
while (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
757 |
_railstation.numtracks++; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
758 |
} |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
759 |
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
760 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
761 |
|
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
762 |
if (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
763 |
w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
764 |
_railstation.platlength = 1; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
765 |
while (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
766 |
_railstation.platlength++; |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
767 |
} |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
768 |
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
769 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
770 |
} |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
771 |
|
1781
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
772 |
static void StationBuildWndProc(Window *w, WindowEvent *e) |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
773 |
{ |
92e08797c84b
(svn r2285) - Codechange: Fix up some of the missing things from server-checking; namely bridge-type, bridge-length, dragged end-tile (bridge/station), station_spread
Darkvater
parents:
1738
diff
changeset
|
774 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
775 |
case WE_CREATE: |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
776 |
w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
777 |
if (_railstation.dragdrop) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
778 |
w->LowerWidget(BRSW_PLATFORM_DRAG_N_DROP); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
779 |
} else { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
780 |
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
781 |
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
782 |
} |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
783 |
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
784 |
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
785 |
break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
786 |
|
0 | 787 |
case WE_PAINT: { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
788 |
bool newstations = _railstation.newstations; |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
789 |
DrawPixelInfo tmp_dpi, *old_dpi; |
5765
65eb8a67aca0
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5726
diff
changeset
|
790 |
const StationSpec *statspec = newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
0 | 791 |
|
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
792 |
if (WP(w, def_d).close) return; |
0 | 793 |
|
794 |
if (_railstation.dragdrop) { |
|
795 |
SetTileSelectSize(1, 1); |
|
796 |
} else { |
|
797 |
int x = _railstation.numtracks; |
|
798 |
int y = _railstation.platlength; |
|
6432 | 799 |
if (_railstation.orientation == 0) Swap(x, y); |
2952 | 800 |
if (!_remove_button_clicked) |
0 | 801 |
SetTileSelectSize(x, y); |
802 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
803 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
804 |
int rad = (_patches.modified_catchment) ? CA_TRAIN : 4; |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
805 |
|
0 | 806 |
if (_station_show_coverage) |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
807 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 808 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
809 |
for (uint bits = 0; bits < 7; bits++) { |
5765
65eb8a67aca0
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5726
diff
changeset
|
810 |
bool disable = bits >= _patches.station_spread; |
65eb8a67aca0
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5726
diff
changeset
|
811 |
if (statspec == NULL) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
812 |
w->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
813 |
w->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable); |
5765
65eb8a67aca0
(svn r7812) -Fix: rail station build window was not correctly updated after station_spread change
glx
parents:
5726
diff
changeset
|
814 |
} else { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
815 |
w->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
816 |
w->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, HasBit(statspec->disallowed_lengths, bits) || disable); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
817 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
818 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
819 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
820 |
SetDParam(0, GetStationClassName(_railstation.station_class)); |
0 | 821 |
DrawWindowWidgets(w); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
822 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
823 |
int y_offset = newstations ? 90 : 0; |
0 | 824 |
|
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
825 |
/* Set up a clipping area for the '/' station preview */ |
4429
1bb01569940c
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents:
4344
diff
changeset
|
826 |
if (FillDrawPixelInfo(&tmp_dpi, 7, 26 + y_offset, 66, 48)) { |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
827 |
old_dpi = _cur_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
828 |
_cur_dpi = &tmp_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
829 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { |
7768
2060e8d65a72
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7762
diff
changeset
|
830 |
StationPickerDrawSprite(32, 16, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2); |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
831 |
} |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
832 |
_cur_dpi = old_dpi; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
833 |
} |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
834 |
|
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
835 |
/* Set up a clipping area for the '\' station preview */ |
4429
1bb01569940c
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents:
4344
diff
changeset
|
836 |
if (FillDrawPixelInfo(&tmp_dpi, 75, 26 + y_offset, 66, 48)) { |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
837 |
old_dpi = _cur_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
838 |
_cur_dpi = &tmp_dpi; |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
839 |
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) { |
7768
2060e8d65a72
(svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium
parents:
7762
diff
changeset
|
840 |
StationPickerDrawSprite(32, 16, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3); |
3921
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
841 |
} |
1cde1b48313a
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
peter1138
parents:
3900
diff
changeset
|
842 |
_cur_dpi = old_dpi; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
843 |
} |
0 | 844 |
|
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
845 |
DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, TC_FROMSTRING); |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
846 |
DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, TC_FROMSTRING); |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
847 |
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING); |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
848 |
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
849 |
|
7737
7ab95e599292
(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:
7659
diff
changeset
|
850 |
DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
851 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
852 |
if (newstations) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
853 |
uint y = 35; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
854 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
855 |
for (uint16 i = w->vscroll.pos; i < _railstation.station_count && i < (uint)(w->vscroll.pos + w->vscroll.cap); i++) { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
856 |
const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, i); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
857 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
858 |
if (statspec != NULL && statspec->name != 0) { |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
859 |
if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5838
diff
changeset
|
860 |
GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT)); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
861 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
862 |
|
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
863 |
DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
864 |
} else { |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
865 |
DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
866 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
867 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
868 |
y += 14; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
869 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
870 |
} |
0 | 871 |
} break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
872 |
|
0 | 873 |
case WE_CLICK: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
874 |
switch (e->we.click.widget) { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
875 |
case BRSW_PLATFORM_DIR_X: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
876 |
case BRSW_PLATFORM_DIR_Y: |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
877 |
w->RaiseWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
878 |
_railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
879 |
w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); |
541 | 880 |
SndPlayFx(SND_15_BEEP); |
0 | 881 |
SetWindowDirty(w); |
882 |
break; |
|
883 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
884 |
case BRSW_PLATFORM_NUM_1: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
885 |
case BRSW_PLATFORM_NUM_2: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
886 |
case BRSW_PLATFORM_NUM_3: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
887 |
case BRSW_PLATFORM_NUM_4: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
888 |
case BRSW_PLATFORM_NUM_5: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
889 |
case BRSW_PLATFORM_NUM_6: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
890 |
case BRSW_PLATFORM_NUM_7: { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
891 |
w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
892 |
w->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
893 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
894 |
_railstation.numtracks = e->we.click.widget - BRSW_PLATFORM_NUM_BEGIN; |
0 | 895 |
_railstation.dragdrop = false; |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
896 |
|
8c40cbf81651
(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:
6443
diff
changeset
|
897 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
898 |
if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
899 |
/* The previously selected number of platforms in invalid */ |
8c40cbf81651
(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:
6443
diff
changeset
|
900 |
for (uint i = 0; i < 7; i++) { |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
901 |
if (!HasBit(statspec->disallowed_lengths, i)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
902 |
w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
903 |
_railstation.platlength = i + 1; |
8c40cbf81651
(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:
6443
diff
changeset
|
904 |
break; |
8c40cbf81651
(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:
6443
diff
changeset
|
905 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
906 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
907 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
908 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
909 |
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
910 |
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
541 | 911 |
SndPlayFx(SND_15_BEEP); |
0 | 912 |
SetWindowDirty(w); |
913 |
break; |
|
6533
8c40cbf81651
(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:
6443
diff
changeset
|
914 |
} |
0 | 915 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
916 |
case BRSW_PLATFORM_LEN_1: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
917 |
case BRSW_PLATFORM_LEN_2: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
918 |
case BRSW_PLATFORM_LEN_3: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
919 |
case BRSW_PLATFORM_LEN_4: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
920 |
case BRSW_PLATFORM_LEN_5: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
921 |
case BRSW_PLATFORM_LEN_6: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
922 |
case BRSW_PLATFORM_LEN_7: { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
923 |
w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
924 |
w->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
925 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
926 |
_railstation.platlength = e->we.click.widget - BRSW_PLATFORM_LEN_BEGIN; |
0 | 927 |
_railstation.dragdrop = false; |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
928 |
|
8c40cbf81651
(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:
6443
diff
changeset
|
929 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
930 |
if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
931 |
/* The previously selected number of tracks in invalid */ |
8c40cbf81651
(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:
6443
diff
changeset
|
932 |
for (uint i = 0; i < 7; i++) { |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
933 |
if (!HasBit(statspec->disallowed_platforms, i)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
934 |
w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
6533
8c40cbf81651
(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:
6443
diff
changeset
|
935 |
_railstation.numtracks = i + 1; |
8c40cbf81651
(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:
6443
diff
changeset
|
936 |
break; |
8c40cbf81651
(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:
6443
diff
changeset
|
937 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
938 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
939 |
} |
8c40cbf81651
(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:
6443
diff
changeset
|
940 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
941 |
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
942 |
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
541 | 943 |
SndPlayFx(SND_15_BEEP); |
0 | 944 |
SetWindowDirty(w); |
945 |
break; |
|
6533
8c40cbf81651
(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:
6443
diff
changeset
|
946 |
} |
0 | 947 |
|
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
948 |
case BRSW_PLATFORM_DRAG_N_DROP: { |
0 | 949 |
_railstation.dragdrop ^= true; |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
950 |
w->ToggleWidgetLoweredState(BRSW_PLATFORM_DRAG_N_DROP); |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
951 |
|
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
952 |
/* get the first allowed length/number of platforms */ |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
953 |
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
954 |
if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
955 |
for (uint i = 0; i < 7; i++) { |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
956 |
if (!HasBit(statspec->disallowed_lengths, i)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
957 |
w->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
958 |
_railstation.platlength = i + 1; |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
959 |
break; |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
960 |
} |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
961 |
} |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
962 |
} |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
963 |
if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
964 |
for (uint i = 0; i < 7; i++) { |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
965 |
if (!HasBit(statspec->disallowed_platforms, i)) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
966 |
w->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
967 |
_railstation.numtracks = i + 1; |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
968 |
break; |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
969 |
} |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
970 |
} |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
971 |
} |
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
972 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
973 |
w->SetWidgetLoweredState(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
974 |
w->SetWidgetLoweredState(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); |
541 | 975 |
SndPlayFx(SND_15_BEEP); |
0 | 976 |
SetWindowDirty(w); |
8269
6f5f0490eb77
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
rubidium
parents:
8225
diff
changeset
|
977 |
} break; |
0 | 978 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
979 |
case BRSW_HIGHLIGHT_OFF: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
980 |
case BRSW_HIGHLIGHT_ON: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
981 |
_station_show_coverage = (e->we.click.widget != BRSW_HIGHLIGHT_OFF); |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
982 |
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
983 |
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); |
541 | 984 |
SndPlayFx(SND_15_BEEP); |
0 | 985 |
SetWindowDirty(w); |
986 |
break; |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
987 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
988 |
case BRSW_NEWST_DROPDOWN: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
989 |
case BRSW_NEWST_DROPDOWN_TEXT: |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
990 |
ShowDropDownMenu(w, BuildStationClassDropdown(), _railstation.station_class, 23, 0, 1 << STAT_CLASS_WAYP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
991 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
992 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
993 |
case BRSW_NEWST_LIST: { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
994 |
const StationSpec *statspec; |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
995 |
int y = (e->we.click.pt.y - 32) / 14; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
996 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
997 |
if (y >= w->vscroll.cap) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
998 |
y += w->vscroll.pos; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
999 |
if (y >= _railstation.station_count) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1000 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1001 |
/* Check station availability callback */ |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1002 |
statspec = GetCustomStationSpec(_railstation.station_class, y); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1003 |
if (statspec != NULL && |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
1004 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1005 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1006 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1007 |
_railstation.station_type = y; |
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
1008 |
|
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
1009 |
CheckSelectedSize(w, statspec); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
1010 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1011 |
SndPlayFx(SND_15_BEEP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1012 |
SetWindowDirty(w); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1013 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1014 |
} |
0 | 1015 |
} |
1016 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1017 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1018 |
case WE_DROPDOWN_SELECT: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1019 |
if (_railstation.station_class != e->we.dropdown.index) { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1020 |
_railstation.station_class = (StationClassID)e->we.dropdown.index; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1021 |
_railstation.station_type = 0; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1022 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1023 |
|
5049
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
1024 |
CheckSelectedSize(w, GetCustomStationSpec(_railstation.station_class, _railstation.station_type)); |
ddddf6e2da75
(svn r7099) -Fix (r4768): When changing the selected newstation type, ensure the station size chosen is permitted. If not, pick the first valid sizes.
peter1138
parents:
5005
diff
changeset
|
1025 |
|
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1026 |
w->vscroll.count = _railstation.station_count; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1027 |
w->vscroll.pos = _railstation.station_type; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1028 |
} |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1029 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1030 |
SndPlayFx(SND_15_BEEP); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1031 |
SetWindowDirty(w); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1032 |
break; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1033 |
|
2639 | 1034 |
case WE_MOUSELOOP: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1035 |
if (WP(w, def_d).close) { |
0 | 1036 |
DeleteWindow(w); |
1037 |
return; |
|
1038 |
} |
|
1039 |
CheckRedrawStationCoverage(w); |
|
2639 | 1040 |
break; |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1041 |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1042 |
case WE_DESTROY: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1043 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1044 |
break; |
0 | 1045 |
} |
1046 |
} |
|
1047 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1048 |
/** Widget definition of the standard build rail station window */ |
0 | 1049 |
static const Widget _station_builder_widgets[] = { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1050 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRSW_CLOSEBOX |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1051 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRSW_CAPTION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1052 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 199, 0x0, STR_NULL}, // BRSW_BACKGROUND |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1053 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_X |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1054 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_Y |
0 | 1055 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1056 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 87, 98, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_1 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1057 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 87, 98, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_2 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1058 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 87, 98, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_3 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1059 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 87, 98, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_4 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1060 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 87, 98, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_5 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1061 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 87, 98, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_6 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1062 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 87, 98, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_7 |
0 | 1063 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1064 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 112, 123, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_1 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1065 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 112, 123, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_2 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1066 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 112, 123, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_3 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1067 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 112, 123, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_4 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1068 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 112, 123, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_5 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1069 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 112, 123, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_6 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1070 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 112, 123, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_7 |
0 | 1071 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1072 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 126, 137, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, // BRSW_PLATFORM_DRAG_N_DROP |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1073 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 152, 163, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, // BRSW_HIGHLIGHT_OFF |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1074 |
{ 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
|
1075 |
{ WIDGETS_END}, |
0 | 1076 |
}; |
1077 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1078 |
/** Widget definition of the build NewGRF rail station window */ |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1079 |
static const Widget _newstation_builder_widgets[] = { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1080 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRSW_CLOSEBOX |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1081 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRSW_CAPTION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1082 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 289, 0x0, STR_NULL}, // BRSW_BACKGROUND |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1083 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_X |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1084 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 116, 163, 0x0, STR_304E_SELECT_RAILROAD_STATION}, // BRSW_PLATFORM_DIR_Y |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1085 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1086 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 177, 188, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_1 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1087 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 177, 188, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_2 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1088 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 177, 188, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_3 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1089 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 177, 188, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_4 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1090 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 177, 188, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_5 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1091 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 177, 188, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_6 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1092 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 177, 188, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, // BRSW_PLATFORM_NUM_7 |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1093 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1094 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 22, 36, 202, 213, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_1 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1095 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 51, 202, 213, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_2 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1096 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 52, 66, 202, 213, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_3 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1097 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 67, 81, 202, 213, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_4 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1098 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 82, 96, 202, 213, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_5 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1099 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 97, 111, 202, 213, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_6 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1100 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 112, 126, 202, 213, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, // BRSW_PLATFORM_LEN_7 |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1101 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1102 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 37, 111, 216, 227, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, // BRSW_PLATFORM_DRAG_N_DROP |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1103 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 242, 253, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, // BRSW_HIGHLIGHT_OFF |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1104 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 242, 253, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, // BRSW_HIGHLIGHT_ON |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1105 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1106 |
/* newstations gui additions */ |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1107 |
{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1108 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN_TEXT |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1109 |
{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP}, // BRSW_NEWST_LIST |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1110 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRSW_NEWST_SCROLL |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1111 |
{ WIDGETS_END}, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1112 |
}; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1113 |
|
0 | 1114 |
static const WindowDesc _station_builder_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7768
diff
changeset
|
1115 |
WDP_AUTO, WDP_AUTO, 148, 200, 148, 200, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1116 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 1117 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1118 |
_station_builder_widgets, |
|
1119 |
StationBuildWndProc |
|
1120 |
}; |
|
1121 |
||
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1122 |
static const WindowDesc _newstation_builder_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7768
diff
changeset
|
1123 |
WDP_AUTO, WDP_AUTO, 148, 290, 148, 290, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1124 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1125 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1126 |
_newstation_builder_widgets, |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1127 |
StationBuildWndProc |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1128 |
}; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1129 |
|
6573 | 1130 |
static void ShowStationBuilder() |
0 | 1131 |
{ |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1132 |
Window *w; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1133 |
if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1134 |
w = AllocateWindowDesc(&_station_builder_desc); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1135 |
_railstation.newstations = false; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1136 |
} else { |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1137 |
w = AllocateWindowDesc(&_newstation_builder_desc); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1138 |
_railstation.newstations = true; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1139 |
_railstation.station_count = GetNumCustomStations(_railstation.station_class); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1140 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1141 |
w->vscroll.count = _railstation.station_count; |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1142 |
w->vscroll.cap = 5; |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8400
diff
changeset
|
1143 |
w->vscroll.pos = Clamp(_railstation.station_type - 2, 0, w->vscroll.count - w->vscroll.cap); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1144 |
} |
0 | 1145 |
} |
1146 |
||
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1147 |
/** Enum referring to the widgets of the signal window */ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1148 |
enum BuildSignalWidgets { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1149 |
BSW_CLOSEBOX = 0, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1150 |
BSW_CAPTION, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1151 |
BSW_SEMAPHORE_NORM, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1152 |
BSW_SEMAPHORE_ENTRY, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1153 |
BSW_SEMAPHORE_EXIT, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1154 |
BSW_SEMAPHORE_COMBO, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1155 |
BSW_ELECTRIC_NORM, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1156 |
BSW_ELECTRIC_ENTRY, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1157 |
BSW_ELECTRIC_EXIT, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1158 |
BSW_ELECTRIC_COMBO, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1159 |
BSW_CONVERT, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1160 |
BSW_DRAG_SIGNALS_DENSITY, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1161 |
BSW_DRAG_SIGNALS_DENSITY_DECREASE, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1162 |
BSW_DRAG_SIGNALS_DENSITY_INCREASE, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1163 |
}; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1164 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1165 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1166 |
* Draw dynamic a signal-sprite in a button in the signal GUI |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1167 |
* Draw the sprite +1px to the right and down if the button is lowered and change the sprite to sprite + 1 (red to green light) |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1168 |
* |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1169 |
* @param w Window on which the widget is located |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1170 |
* @param widget_index index of this widget in the window |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1171 |
* @param image the sprite to draw |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1172 |
* @param xrel the relativ x value of the sprite in the grf |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1173 |
* @param xsize the width of the sprite |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1174 |
*/ |
8624
c5753e14d8dc
(svn r11689) -Fix: compilation error and most of warnings for gcc 4.3
smatz
parents:
8617
diff
changeset
|
1175 |
static void DrawSignalSprite(const Window *w, byte widget_index, SpriteID image, int8 xrel, uint8 xsize) |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1176 |
{ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1177 |
DrawSprite(image + w->IsWidgetLowered(widget_index), PAL_NONE, |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1178 |
w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 - xrel - xsize / 2 + |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1179 |
w->IsWidgetLowered(widget_index), w->widget[widget_index].bottom - 3 + w->IsWidgetLowered(widget_index)); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1180 |
} |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1181 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1182 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1183 |
* Signal selection window event definition |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1184 |
* |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1185 |
* @param w window pointer |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1186 |
* @param e event been triggered |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1187 |
*/ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1188 |
static void SignalBuildWndProc(Window *w, WindowEvent *e) |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1189 |
{ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1190 |
switch (e->event) { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1191 |
case WE_PAINT: |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1192 |
w->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1193 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1194 |
w->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1195 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1196 |
w->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _patches.drag_signals_density == 1); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1197 |
w->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _patches.drag_signals_density == 20); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1198 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1199 |
DrawWindowWidgets(w); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1200 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1201 |
/* The 'hardcoded' off sets are needed because they are reused sprites. */ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1202 |
DrawSignalSprite(w, BSW_SEMAPHORE_NORM, SPR_IMG_SIGNAL_SEMAPHORE_NORM, 0, 12); // xsize of sprite + 1 == 9 |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1203 |
DrawSignalSprite(w, BSW_SEMAPHORE_ENTRY, SPR_IMG_SIGNAL_SEMAPHORE_ENTRY, -1, 13); // xsize of sprite + 1 == 10 |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1204 |
DrawSignalSprite(w, BSW_SEMAPHORE_EXIT, SPR_IMG_SIGNAL_SEMAPHORE_EXIT, 0, 12); // xsize of sprite + 1 == 9 |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1205 |
DrawSignalSprite(w, BSW_SEMAPHORE_COMBO, SPR_IMG_SIGNAL_SEMAPHORE_COMBO, 0, 12); // xsize of sprite + 1 == 9 |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1206 |
DrawSignalSprite(w, BSW_ELECTRIC_NORM, SPR_IMG_SIGNAL_ELECTRIC_NORM, -1, 4); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1207 |
DrawSignalSprite(w, BSW_ELECTRIC_ENTRY, SPR_IMG_SIGNAL_ELECTRIC_ENTRY, -2, 6); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1208 |
DrawSignalSprite(w, BSW_ELECTRIC_EXIT, SPR_IMG_SIGNAL_ELECTRIC_EXIT, -2, 6); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1209 |
DrawSignalSprite(w, BSW_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_COMBO, -2, 6); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1210 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1211 |
/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1212 |
SetDParam(0, _patches.drag_signals_density); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1213 |
DrawStringCentered(w->widget[BSW_DRAG_SIGNALS_DENSITY].left + (w->widget[BSW_DRAG_SIGNALS_DENSITY].right - |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1214 |
w->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1215 |
w->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1216 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1217 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1218 |
case WE_CLICK: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1219 |
switch (e->we.click.widget) { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1220 |
case BSW_SEMAPHORE_NORM: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1221 |
case BSW_SEMAPHORE_ENTRY: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1222 |
case BSW_SEMAPHORE_EXIT: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1223 |
case BSW_SEMAPHORE_COMBO: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1224 |
case BSW_ELECTRIC_NORM: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1225 |
case BSW_ELECTRIC_ENTRY: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1226 |
case BSW_ELECTRIC_EXIT: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1227 |
case BSW_ELECTRIC_COMBO: |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1228 |
w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1229 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1230 |
_cur_signal_type = (SignalType)((uint)((e->we.click.widget - BSW_SEMAPHORE_NORM) % (SIGTYPE_COMBO + 1))); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1231 |
_cur_signal_variant = e->we.click.widget >= BSW_ELECTRIC_NORM ? SIG_ELECTRIC : SIG_SEMAPHORE; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1232 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1233 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1234 |
case BSW_CONVERT: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1235 |
_convert_signal_button = !_convert_signal_button; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1236 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1237 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1238 |
case BSW_DRAG_SIGNALS_DENSITY_DECREASE: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1239 |
if (_patches.drag_signals_density > 1) _patches.drag_signals_density--; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1240 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1241 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1242 |
case BSW_DRAG_SIGNALS_DENSITY_INCREASE: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1243 |
if (_patches.drag_signals_density < 20) _patches.drag_signals_density++; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1244 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1245 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1246 |
default: break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1247 |
} |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1248 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1249 |
SetWindowDirty(w); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1250 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1251 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1252 |
case WE_MOUSELOOP: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1253 |
if (WP(w, def_d).close) DeleteWindow(w); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1254 |
return; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1255 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1256 |
case WE_DESTROY: |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1257 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1258 |
break; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1259 |
} |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1260 |
} |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1261 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1262 |
/** Widget definition of the build signal window */ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1263 |
static const Widget _signal_builder_widgets[] = { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1264 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BSW_CLOSEBOX |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1265 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 109, 0, 13, STR_SIGNAL_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BSW_CAPTION |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1266 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1267 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 40, STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_NORM_TIP}, // BSW_SEMAPHORE_NORM |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1268 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 40, STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TIP}, // BSW_SEMAPHORE_ENTRY |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1269 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 40, STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TIP}, // BSW_SEMAPHORE_EXIT |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1270 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 40, STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TIP}, // BSW_SEMAPHORE_COMBO |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1271 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1272 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 41, 67, STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_NORM_TIP}, // BSW_ELECTRIC_NORM |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1273 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 41, 67, STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TIP}, // BSW_ELECTRIC_ENTRY |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1274 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 41, 67, STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_EXIT_TIP}, // BSW_ELECTRIC_EXIT |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1275 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 41, 67, STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_COMBO_TIP}, // BSW_ELECTRIC_COMBO |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1276 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1277 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 40, SPR_IMG_SIGNAL_CONVERT, STR_SIGNAL_CONVERT_TIP}, // BSW_CONVERT |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1278 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 41, 67, STR_NULL, STR_DRAG_SIGNALS_DENSITY_TIP}, // BSW_DRAG_SIGNALS_DENSITY |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1279 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 90, 98, 54, 65, SPR_ARROW_LEFT, STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_DECREASE |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1280 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 99, 107, 54, 65, SPR_ARROW_RIGHT, STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP}, // BSW_DRAG_SIGNALS_DENSITY_INCREASE |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1281 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1282 |
{ WIDGETS_END}, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1283 |
}; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1284 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1285 |
/** Signal selection window description */ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1286 |
static const WindowDesc _signal_builder_desc = { |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1287 |
WDP_AUTO, WDP_AUTO, 110, 68, 110, 68, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1288 |
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1289 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1290 |
_signal_builder_widgets, |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1291 |
SignalBuildWndProc |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1292 |
}; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1293 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1294 |
/** |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1295 |
* Open the signal selection window |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1296 |
* @pre reset all signal GUI relevant variables |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1297 |
*/ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1298 |
static void ShowSignalBuilder() |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1299 |
{ |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1300 |
_convert_signal_button = false; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1301 |
_cur_signal_variant = _cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1302 |
_cur_signal_type = SIGTYPE_NORMAL; |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1303 |
|
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1304 |
AllocateWindowDesc(&_signal_builder_desc); |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1305 |
} |
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1306 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1307 |
/** Enum referring to the widgets of the build rail depot window */ |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1308 |
enum BuildRailDepotWidgets { |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1309 |
BRDW_CLOSEBOX = 0, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1310 |
BRDW_CAPTION, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1311 |
BRDW_BACKGROUND, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1312 |
BRDW_DEPOT_NE, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1313 |
BRDW_DEPOT_SE, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1314 |
BRDW_DEPOT_SW, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1315 |
BRDW_DEPOT_NW, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1316 |
}; |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1317 |
|
0 | 1318 |
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) |
1319 |
{ |
|
2952 | 1320 |
switch (e->event) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1321 |
case WE_CREATE: w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); break; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1322 |
|
0 | 1323 |
case WE_PAINT: { |
1324 |
DrawWindowWidgets(w); |
|
1325 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1326 |
DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1327 |
DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _cur_railtype); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1328 |
DrawTrainDepotSprite( 2, 69, DIAGDIR_SW, _cur_railtype); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1329 |
DrawTrainDepotSprite( 2, 17, DIAGDIR_NW, _cur_railtype); |
0 | 1330 |
break; |
1331 |
} |
|
2639 | 1332 |
|
1333 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1334 |
switch (e->we.click.widget) { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1335 |
case BRDW_DEPOT_NE: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1336 |
case BRDW_DEPOT_SE: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1337 |
case BRDW_DEPOT_SW: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1338 |
case BRDW_DEPOT_NW: |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1339 |
w->RaiseWidget(_build_depot_direction + BRDW_DEPOT_NE); |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1340 |
_build_depot_direction = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1341 |
w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); |
2639 | 1342 |
SndPlayFx(SND_15_BEEP); |
1343 |
SetWindowDirty(w); |
|
1344 |
break; |
|
0 | 1345 |
} |
2639 | 1346 |
break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1347 |
|
0 | 1348 |
case WE_MOUSELOOP: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1349 |
if (WP(w, def_d).close) DeleteWindow(w); |
0 | 1350 |
return; |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1351 |
|
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1352 |
case WE_DESTROY: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1353 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
1354 |
break; |
0 | 1355 |
} |
1356 |
} |
|
1357 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1358 |
/** Widget definition of the build rail depot window */ |
0 | 1359 |
static const Widget _build_depot_widgets[] = { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1360 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRDW_CLOSEBOX |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1361 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRDW_CAPTION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1362 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, // BRDW_BACKGROUND |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1363 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_NE |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1364 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_SE |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1365 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, // BRDW_DEPOT_SW |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1366 |
{ 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
|
1367 |
{ WIDGETS_END}, |
0 | 1368 |
}; |
1369 |
||
1370 |
static const WindowDesc _build_depot_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7768
diff
changeset
|
1371 |
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1372 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
0 | 1373 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1374 |
_build_depot_widgets, |
|
1375 |
BuildTrainDepotWndProc |
|
1376 |
}; |
|
1377 |
||
6573 | 1378 |
static void ShowBuildTrainDepotPicker() |
0 | 1379 |
{ |
1380 |
AllocateWindowDesc(&_build_depot_desc); |
|
1381 |
} |
|
1382 |
||
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1383 |
/** Enum referring to the widgets of the build NewGRF rail waypoint window */ |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1384 |
enum BuildRailWaypointWidgets { |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1385 |
BRWW_CLOSEBOX = 0, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1386 |
BRWW_CAPTION, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1387 |
BRWW_BACKGROUND, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1388 |
BRWW_WAYPOINT_1, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1389 |
BRWW_WAYPOINT_2, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1390 |
BRWW_WAYPOINT_3, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1391 |
BRWW_WAYPOINT_4, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1392 |
BRWW_WAYPOINT_5, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1393 |
BRWW_SCROLL, |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1394 |
}; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1395 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1396 |
static void BuildWaypointWndProc(Window *w, WindowEvent *e) |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1397 |
{ |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1398 |
switch (e->event) { |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1399 |
case WE_PAINT: { |
2639 | 1400 |
uint i; |
1401 |
||
4853
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1402 |
for (i = 0; i < w->hscroll.cap; i++) { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8487
diff
changeset
|
1403 |
w->SetWidgetLoweredState(i + BRWW_WAYPOINT_1, (w->hscroll.pos + i) == _cur_waypoint_type); |
4853
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1404 |
} |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1405 |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1406 |
DrawWindowWidgets(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1407 |
|
4853
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1408 |
for (i = 0; i < w->hscroll.cap; i++) { |
ce3345eb82be
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
glx
parents:
4848
diff
changeset
|
1409 |
if (w->hscroll.pos + i < w->hscroll.count) { |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1410 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, w->hscroll.pos + i); |
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1411 |
|
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1412 |
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1413 |
|
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1414 |
if (statspec != NULL && |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
1415 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1416 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) { |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5838
diff
changeset
|
1417 |
GfxFillRect(4 + i * 68, 18, 67 + i * 68, 75, (1 << PALETTE_MODIFIER_GREYOUT)); |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1418 |
} |
2639 | 1419 |
} |
2627
8c964f74bd7b
(svn r3169) Little bit of coding style fixing, and change from value to lengthof()
peter1138
parents:
2625
diff
changeset
|
1420 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1421 |
break; |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1422 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1423 |
case WE_CLICK: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4559
diff
changeset
|
1424 |
switch (e->we.click.widget) { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1425 |
case BRWW_WAYPOINT_1: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1426 |
case BRWW_WAYPOINT_2: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1427 |
case BRWW_WAYPOINT_3: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1428 |
case BRWW_WAYPOINT_4: |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1429 |
case BRWW_WAYPOINT_5: { |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1430 |
byte type = e->we.click.widget - BRWW_WAYPOINT_1 + w->hscroll.pos; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1431 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1432 |
/* Check station availability callback */ |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1433 |
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, type); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1434 |
if (statspec != NULL && |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8418
diff
changeset
|
1435 |
HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1436 |
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return; |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1437 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1438 |
_cur_waypoint_type = type; |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1439 |
SndPlayFx(SND_15_BEEP); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1440 |
SetWindowDirty(w); |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1441 |
break; |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1442 |
} |
3776
1a8d467577f4
(svn r4768) - Newstations: Add newstation selector GUI. The additions are only active if a newstation set is loaded, otherwise it will look the same.
peter1138
parents:
3567
diff
changeset
|
1443 |
} |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1444 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1445 |
} |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1446 |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1447 |
case WE_MOUSELOOP: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1448 |
if (WP(w, def_d).close) DeleteWindow(w); |
1738
6c7f9d12197d
(svn r2242) -Fix: [ 1193414 ] Fix for waypoint GUI, scrolling and button-actions (Hackykid)
Darkvater
parents:
1656
diff
changeset
|
1449 |
break; |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1450 |
|
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1451 |
case WE_DESTROY: |
8487
bab0d066128b
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium
parents:
8451
diff
changeset
|
1452 |
if (!WP(w, def_d).close) ResetObjectToPlace(); |
1074
5f45c1b03f2f
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
1453 |
break; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1454 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1455 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1456 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1457 |
/** Widget definition for the build NewGRF rail waypoint window */ |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1458 |
static const Widget _build_waypoint_widgets[] = { |
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1459 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRWW_CLOSEBOX |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1460 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 343, 0, 13, STR_WAYPOINT, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRWW_CAPTION |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1461 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 343, 14, 91, 0x0, STR_NULL}, // BRWW_BACKGROUND |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1462 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1463 |
{ WWT_PANEL, RESIZE_NONE, 7, 3, 68, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_1 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1464 |
{ WWT_PANEL, RESIZE_NONE, 7, 71, 136, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_2 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1465 |
{ WWT_PANEL, RESIZE_NONE, 7, 139, 204, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_3 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1466 |
{ WWT_PANEL, RESIZE_NONE, 7, 207, 272, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_4 |
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1467 |
{ WWT_PANEL, RESIZE_NONE, 7, 275, 340, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, // BRWW_WAYPOINT_5 |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1468 |
|
8225
7cf635a89c7d
(svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium
parents:
8017
diff
changeset
|
1469 |
{ WWT_HSCROLLBAR, RESIZE_NONE, 7, 1, 343, 80, 91, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRWW_SCROLL |
417 | 1470 |
{ WIDGETS_END}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1471 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1472 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1473 |
static const WindowDesc _build_waypoint_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7768
diff
changeset
|
1474 |
WDP_AUTO, WDP_AUTO, 344, 92, 344, 92, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5049
diff
changeset
|
1475 |
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1476 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1477 |
_build_waypoint_widgets, |
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1478 |
BuildWaypointWndProc |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1479 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1480 |
|
6573 | 1481 |
static void ShowBuildWaypointPicker() |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1482 |
{ |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1483 |
Window *w = AllocateWindowDesc(&_build_waypoint_desc); |
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1484 |
w->hscroll.cap = 5; |
2625
66b3d632dcd2
(svn r3167) - NewGRF: Start moving custom station code to separate files.
peter1138
parents:
2619
diff
changeset
|
1485 |
w->hscroll.count = _waypoint_count; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1486 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1487 |
|
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1488 |
|
6573 | 1489 |
void InitializeRailGui() |
0 | 1490 |
{ |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3132
diff
changeset
|
1491 |
_build_depot_direction = DIAGDIR_NW; |
0 | 1492 |
_railstation.numtracks = 1; |
1493 |
_railstation.platlength = 1; |
|
1494 |
_railstation.dragdrop = true; |
|
1495 |
} |
|
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1496 |
|
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1497 |
void ReinitGuiAfterToggleElrail(bool disable) |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1498 |
{ |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1499 |
extern RailType _last_built_railtype; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1500 |
if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) { |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1501 |
Window *w; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1502 |
_last_built_railtype = _cur_railtype = RAILTYPE_RAIL; |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1503 |
w = FindWindowById(WC_BUILD_TOOLBAR, 0); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1504 |
if (w != NULL && w->wndproc == BuildRailToolbWndProc) { |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1505 |
SetupRailToolbar(_cur_railtype, w); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1506 |
SetWindowDirty(w); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1507 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1508 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1509 |
MarkWholeScreenDirty(); |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1510 |
} |
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1511 |
|
7560
f7b5ab184882
(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:
7359
diff
changeset
|
1512 |
void SetDefaultRailGui() |
f7b5ab184882
(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:
7359
diff
changeset
|
1513 |
{ |
7627
17d48c4a22ca
(svn r10405) -Fix [FS#972]: do not try to determine the default railtype in the scenario editor.
rubidium
parents:
7560
diff
changeset
|
1514 |
if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; |
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5105
diff
changeset
|
1515 |
|
7560
f7b5ab184882
(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:
7359
diff
changeset
|
1516 |
extern RailType _last_built_railtype; |
f7b5ab184882
(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:
7359
diff
changeset
|
1517 |
RailType rt = (RailType)_patches.default_rail_type; |
f7b5ab184882
(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:
7359
diff
changeset
|
1518 |
if (rt >= RAILTYPE_END) { |
f7b5ab184882
(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:
7359
diff
changeset
|
1519 |
if (rt == RAILTYPE_END + 2) { |
f7b5ab184882
(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:
7359
diff
changeset
|
1520 |
/* Find the most used rail type */ |
f7b5ab184882
(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:
7359
diff
changeset
|
1521 |
RailType count[RAILTYPE_END]; |
f7b5ab184882
(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:
7359
diff
changeset
|
1522 |
memset(count, 0, sizeof(count)); |
f7b5ab184882
(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:
7359
diff
changeset
|
1523 |
for (TileIndex t = 0; t < MapSize(); t++) { |
8584
a8b6dffead63
(svn r11649) -Codechange: some code can be simplified thanks to changes in r11642
smatz
parents:
8579
diff
changeset
|
1524 |
if (IsTileType(t, MP_RAILWAY) || IsLevelCrossingTile(t) || IsRailwayStationTile(t) || |
a8b6dffead63
(svn r11649) -Codechange: some code can be simplified thanks to changes in r11642
smatz
parents:
8579
diff
changeset
|
1525 |
(IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL)) { |
7560
f7b5ab184882
(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:
7359
diff
changeset
|
1526 |
count[GetRailType(t)]++; |
f7b5ab184882
(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:
7359
diff
changeset
|
1527 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1528 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1529 |
|
f7b5ab184882
(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:
7359
diff
changeset
|
1530 |
rt = RAILTYPE_RAIL; |
f7b5ab184882
(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:
7359
diff
changeset
|
1531 |
for (RailType r = RAILTYPE_ELECTRIC; r < RAILTYPE_END; r++) { |
f7b5ab184882
(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:
7359
diff
changeset
|
1532 |
if (count[r] >= count[rt]) rt = r; |
f7b5ab184882
(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:
7359
diff
changeset
|
1533 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1534 |
|
f7b5ab184882
(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:
7359
diff
changeset
|
1535 |
/* No rail, just get the first available one */ |
f7b5ab184882
(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:
7359
diff
changeset
|
1536 |
if (count[rt] == 0) rt = RAILTYPE_END; |
f7b5ab184882
(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:
7359
diff
changeset
|
1537 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1538 |
switch (rt) { |
f7b5ab184882
(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:
7359
diff
changeset
|
1539 |
case RAILTYPE_END + 0: |
f7b5ab184882
(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:
7359
diff
changeset
|
1540 |
rt = RAILTYPE_RAIL; |
f7b5ab184882
(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:
7359
diff
changeset
|
1541 |
while (rt < RAILTYPE_END && !HasRailtypeAvail(GetPlayer(_local_player), rt)) rt++; |
f7b5ab184882
(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:
7359
diff
changeset
|
1542 |
break; |
f7b5ab184882
(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:
7359
diff
changeset
|
1543 |
|
f7b5ab184882
(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:
7359
diff
changeset
|
1544 |
case RAILTYPE_END + 1: |
f7b5ab184882
(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:
7359
diff
changeset
|
1545 |
rt = GetBestRailtype(GetPlayer(_local_player)); |
f7b5ab184882
(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:
7359
diff
changeset
|
1546 |
break; |
f7b5ab184882
(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:
7359
diff
changeset
|
1547 |
|
f7b5ab184882
(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:
7359
diff
changeset
|
1548 |
default: |
f7b5ab184882
(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:
7359
diff
changeset
|
1549 |
break; |
f7b5ab184882
(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:
7359
diff
changeset
|
1550 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1551 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1552 |
|
f7b5ab184882
(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:
7359
diff
changeset
|
1553 |
_last_built_railtype = _cur_railtype = rt; |
f7b5ab184882
(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:
7359
diff
changeset
|
1554 |
Window *w = FindWindowById(WC_BUILD_TOOLBAR, 0); |
f7b5ab184882
(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:
7359
diff
changeset
|
1555 |
if (w != NULL && w->wndproc == BuildRailToolbWndProc) { |
f7b5ab184882
(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:
7359
diff
changeset
|
1556 |
SetupRailToolbar(_cur_railtype, w); |
f7b5ab184882
(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:
7359
diff
changeset
|
1557 |
SetWindowDirty(w); |
f7b5ab184882
(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:
7359
diff
changeset
|
1558 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1559 |
} |
f7b5ab184882
(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:
7359
diff
changeset
|
1560 |
|
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8269
diff
changeset
|
1561 |