annotate src/road_gui.cpp @ 8114:2d6af5d7a142 draft

(svn r11675) -Codechange: split the string types from the string functions.
author rubidium <rubidium@openttd.org>
date Fri, 21 Dec 2007 19:49:27 +0000
parents 4faab45e2603
children 9cc845deddfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
6393
ffd35446c110 (svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas <belugas@openttd.org>
parents: 6247
diff changeset
3 /** @file road_gui.cpp */
ffd35446c110 (svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas <belugas@openttd.org>
parents: 6247
diff changeset
4
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
6 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
7 #include "table/sprites.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
8 #include "table/strings.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
9 #include "functions.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
10 #include "map.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
11 #include "gui.h"
8107
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
12 #include "window_gui.h"
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
13 #include "station_gui.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
14 #include "viewport.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
15 #include "gfx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
16 #include "sound.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
17 #include "command.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
18 #include "variables.h"
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
19 #include "road_cmd.h"
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
20 #include "road_map.h"
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
21 #include "station_map.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
22 //needed for catchments
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
23 #include "station.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
24
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
25
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
26 static void ShowRVStationPicker(RoadStop::Type rs);
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6102
diff changeset
27 static void ShowRoadDepotPicker();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
28
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
29 static bool _remove_button_clicked;
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
30 static bool _one_way_button_clicked;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
31
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
32 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
33 * Define the values of the RoadFlags
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
34 * @see CmdBuildLongRoad
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
35 */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
36 enum RoadFlags {
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
37 RF_NONE = 0x00,
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
38 RF_START_HALFROAD_Y = 0x01, // The start tile in Y-dir should have only a half road
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
39 RF_END_HALFROAD_Y = 0x02, // The end tile in Y-dir should have only a half road
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
40 RF_DIR_Y = 0x04, // The direction is Y-dir
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
41 RF_DIR_X = RF_NONE, // Dummy; Dir X is set when RF_DIR_Y is not set
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
42 RF_START_HALFROAD_X = 0x08, // The start tile in X-dir should have only a half road
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
43 RF_END_HALFROAD_X = 0x10, // The end tile in X-dir should have only a half road
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
44 };
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
45 DECLARE_ENUM_AS_BIT_SET(RoadFlags);
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
46
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
47 static RoadFlags _place_road_flag;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
48
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
49 static RoadType _cur_roadtype;
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
50
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
51 static DiagDirection _road_depot_orientation;
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
52 static DiagDirection _road_station_picker_orientation;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
53
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
54 void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
55 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
56 if (success) SndPlayTileFx(SND_1F_SPLAT, tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
57 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
59 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
60 * Set the initial flags for the road constuction.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
61 * The flags are:
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
62 * @li The direction is the X-dir
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
63 * @li The first tile has a partitial RoadBit (true or false)
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
64 *
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
65 * @param tile The start tile
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
66 */
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
67 static void PlaceRoad_X_Dir(TileIndex tile)
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
68 {
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
69 _place_road_flag = RF_DIR_X;
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
70 if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
71 VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR);
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
72 }
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
73
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
74 /**
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
75 * Set the initial flags for the road constuction.
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
76 * The flags are:
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
77 * @li The direction is the Y-dir
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
78 * @li The first tile has a partitial RoadBit (true or false)
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
79 *
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
80 * @param tile The start tile
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
81 */
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
82 static void PlaceRoad_Y_Dir(TileIndex tile)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
83 {
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
84 _place_road_flag = RF_DIR_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
85 if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
86 VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
87 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
88
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
89 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
90 * Set the initial flags for the road constuction.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
91 * The flags are:
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
92 * @li The direction is not set.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
93 * @li The first tile has a partitial RoadBit (true or false)
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
94 *
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
95 * @param tile The start tile
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
96 */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
97 static void PlaceRoad_AutoRoad(TileIndex tile)
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
98 {
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
99 _place_road_flag = RF_NONE;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
100 if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
101 if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
102 VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD);
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
103 }
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
104
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
105 static void PlaceRoad_Bridge(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
106 {
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
107 VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
108 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
109
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
110
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
111 void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
112 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
113 if (success) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
114 SndPlayTileFx(SND_20_SPLAT_2, tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
115 ResetObjectToPlace();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
116 } else {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
117 SetRedErrorSquare(_build_tunnel_endtile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
118 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
119 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
120
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
121 /** Structure holding information per roadtype for several functions */
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
122 struct RoadTypeInfo {
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
123 StringID err_build_road; ///< Building a normal piece of road
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
124 StringID err_remove_road; ///< Removing a normal piece of road
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
125 StringID err_depot; ///< Building a depot
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
126 StringID err_build_station[2]; ///< Building a bus or truck station
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
127 StringID err_remove_station[2]; ///< Removing of a bus or truck station
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
128
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
129 StringID picker_title[2]; ///< Title for the station picker for bus or truck stations
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
130 StringID picker_tooltip[2]; ///< Tooltip for the station picker for bus or truck stations
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
131
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
132 SpriteID cursor_nesw; ///< Cursor for building NE and SW bits
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
133 SpriteID cursor_nwse; ///< Cursor for building NW and SE bits
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
134 SpriteID cursor_autoroad; ///< Cursor for building autoroad
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
135 };
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
136
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
137 /** What errors/cursors must be shown for several types of roads */
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
138 static const RoadTypeInfo _road_type_infos[] = {
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
139 {
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
140 STR_1804_CAN_T_BUILD_ROAD_HERE,
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
141 STR_1805_CAN_T_REMOVE_ROAD_FROM,
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
142 STR_1807_CAN_T_BUILD_ROAD_VEHICLE,
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
143 { STR_1808_CAN_T_BUILD_BUS_STATION, STR_1809_CAN_T_BUILD_TRUCK_STATION },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
144 { STR_CAN_T_REMOVE_BUS_STATION, STR_CAN_T_REMOVE_TRUCK_STATION },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
145 { STR_3042_BUS_STATION_ORIENTATION, STR_3043_TRUCK_STATION_ORIENT },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
146 { STR_3051_SELECT_BUS_STATION_ORIENTATION, STR_3052_SELECT_TRUCK_LOADING_BAY },
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
147
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
148 SPR_CURSOR_ROAD_NESW,
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
149 SPR_CURSOR_ROAD_NWSE,
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
150 SPR_CURSOR_AUTOROAD,
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
151 },
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
152 {
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
153 STR_1804_CAN_T_BUILD_TRAMWAY_HERE,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
154 STR_1805_CAN_T_REMOVE_TRAMWAY_FROM,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
155 STR_1807_CAN_T_BUILD_TRAM_VEHICLE,
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
156 { STR_1808_CAN_T_BUILD_PASSENGER_TRAM_STATION, STR_1809_CAN_T_BUILD_CARGO_TRAM_STATION },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
157 { STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION, STR_CAN_T_REMOVE_CARGO_TRAM_STATION },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
158 { STR_3042_PASSENGER_TRAM_STATION_ORIENTATION, STR_3043_CARGO_TRAM_STATION_ORIENT },
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
159 { STR_3051_SELECT_PASSENGER_TRAM_STATION_ORIENTATION, STR_3052_SELECT_CARGO_TRAM_STATION_ORIENTATION },
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
160
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
161 SPR_CURSOR_TRAMWAY_NESW,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
162 SPR_CURSOR_TRAMWAY_NWSE,
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
163 SPR_CURSOR_AUTOTRAM,
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
164 },
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
165 };
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
166
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
167 static void PlaceRoad_Tunnel(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
168 {
7521
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
169 DoCommandP(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE));
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
170 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
171
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
172 static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
173 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
174 tile += TileOffsByDiagDir(direction);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
175 // if there is a roadpiece just outside of the station entrance, build a connecting route
7370
fba35a9abf79 (svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
176 if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
177 if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
178 DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
179 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
180 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
181 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
182
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
183 void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
184 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
185 if (success) {
6662
baa28c8cfe84 (svn r9893) -Fix (r9892): various small bugs that only act up when using something different than plain roads.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
186 DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
187 SndPlayTileFx(SND_1F_SPLAT, tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
188 ResetObjectToPlace();
6662
baa28c8cfe84 (svn r9893) -Fix (r9892): various small bugs that only act up when using something different than plain roads.
rubidium <rubidium@openttd.org>
parents: 6661
diff changeset
189 BuildRoadOutsideStation(tile, dir);
6102
02d711c318c9 (svn r8837) -Fix [FS#626]: drive through stations did not connect to neighbouring roads (mart3p).
rubidium <rubidium@openttd.org>
parents: 6039
diff changeset
190 /* For a drive-through road stop build connecting road for other entrance */
7928
4e8dfd103163 (svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7913
diff changeset
191 if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
192 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
193 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
194
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
195 static void PlaceRoad_Depot(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
196 {
7521
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
197 DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, CcRoadDepot, CMD_BUILD_ROAD_DEPOT | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot));
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
198 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
199
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
200 static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
201 {
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
202 uint32 p1 = _road_station_picker_orientation;
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
203
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
204 if (p1 >= DIAGDIR_END) {
7931
44ff7a6d801f (svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents: 7928
diff changeset
205 SetBit(p2, 1); // It's a drive-through stop
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
206 p1 -= DIAGDIR_END; // Adjust picker result to actual direction
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
207 }
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
208 DoCommandP(tile, p1, p2, CcRoadDepot, cmd);
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
209 }
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
210
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
211 static void PlaceRoad_BusStation(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
212 {
7956
8dde26620a83 (svn r11512) -Change: make the subsidy window able to resize to something smaller than 640x127 (especially the 640 part) when the screen is really too small.
rubidium <rubidium@openttd.org>
parents: 7949
diff changeset
213 if (_remove_button_clicked) {
6676
74b4291fed5e (svn r9907) -Codechange: prepare the road gui for more road types.
rubidium <rubidium@openttd.org>
parents: 6674
diff changeset
214 DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
215 } else {
7521
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
216 PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::BUS]));
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
217 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
218 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
219
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
220 static void PlaceRoad_TruckStation(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
221 {
7956
8dde26620a83 (svn r11512) -Change: make the subsidy window able to resize to something smaller than 640x127 (especially the 640 part) when the screen is really too small.
rubidium <rubidium@openttd.org>
parents: 7949
diff changeset
222 if (_remove_button_clicked) {
7339
24e049467042 (svn r10702) -Fix: "Can't build ..." instead of "Can't remove ..." message shown for road stops for trucks/cargo trams.
rubidium <rubidium@openttd.org>
parents: 7272
diff changeset
223 DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::TRUCK]));
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
224 } else {
7521
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
225 PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
226 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
227 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
228
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
229 static void PlaceRoad_DemolishArea(TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
230 {
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
231 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
232 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
233
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
234 /** Enum referring to the widgets of the build road toolbar */
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
235 enum RoadToolbarWidgets {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
236 RTW_CLOSEBOX = 0,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
237 RTW_CAPTION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
238 RTW_STICKY,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
239 RTW_ROAD_X,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
240 RTW_ROAD_Y,
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
241 RTW_AUTOROAD,
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
242 RTW_DEMOLISH,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
243 RTW_DEPOT,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
244 RTW_BUS_STATION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
245 RTW_TRUCK_STATION,
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
246 RTW_ONE_WAY,
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
247 RTW_BUILD_BRIDGE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
248 RTW_BUILD_TUNNEL,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
249 RTW_REMOVE,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
250 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
251
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
252 typedef void OnButtonClick(Window *w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
253
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
254 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
255 * Function that handles the click on the
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
256 * X road placement button.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
257 *
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
258 * @param w The current window
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
259 */
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
260 static void BuildRoadClick_X_Dir(Window *w)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
261 {
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
262 HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, VHM_RECT, PlaceRoad_X_Dir);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
263 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
264
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
265 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
266 * Function that handles the click on the
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
267 * Y road placement button.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
268 *
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
269 * @param w The current window
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
270 */
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
271 static void BuildRoadClick_Y_Dir(Window *w)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
272 {
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
273 HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, VHM_RECT, PlaceRoad_Y_Dir);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
274 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
275
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
276 /**
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
277 * Function that handles the click on the
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
278 * autoroad placement button.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
279 *
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
280 * @param w The current window
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
281 */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
282 static void BuildRoadClick_AutoRoad(Window *w)
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
283 {
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
284 HandlePlacePushButton(w, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, VHM_RECT, PlaceRoad_AutoRoad);
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
285 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
286
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
287 static void BuildRoadClick_Demolish(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
288 {
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
289 HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceRoad_DemolishArea);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
290 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
291
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
292 static void BuildRoadClick_Depot(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
293 {
7086
787d1ac148e4 (svn r10353) -Fix/Feature [FS#669]: disallow (in the GUI) the building of infrastructure you do not have available vehicles for. This means that the airport building button is disabled till you can actually build aircraft. The game itself will not disallow you to build the infrastructure and this "new" behaviour can be overriden with a patch setting.
rubidium <rubidium@openttd.org>
parents: 6779
diff changeset
294 if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
295 if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, VHM_RECT, PlaceRoad_Depot)) ShowRoadDepotPicker();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
296 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
297
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
298 static void BuildRoadClick_BusStation(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
299 {
7086
787d1ac148e4 (svn r10353) -Fix/Feature [FS#669]: disallow (in the GUI) the building of infrastructure you do not have available vehicles for. This means that the airport building button is disabled till you can actually build aircraft. The game itself will not disallow you to build the infrastructure and this "new" behaviour can be overriden with a patch setting.
rubidium <rubidium@openttd.org>
parents: 6779
diff changeset
300 if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
301 if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, VHM_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
302 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
303
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
304 static void BuildRoadClick_TruckStation(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
305 {
7086
787d1ac148e4 (svn r10353) -Fix/Feature [FS#669]: disallow (in the GUI) the building of infrastructure you do not have available vehicles for. This means that the airport building button is disabled till you can actually build aircraft. The game itself will not disallow you to build the infrastructure and this "new" behaviour can be overriden with a patch setting.
rubidium <rubidium@openttd.org>
parents: 6779
diff changeset
306 if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
307 if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, VHM_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
308 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
309
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
310 /**
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
311 * Function that handles the click on the
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
312 * one way road button.
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
313 *
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
314 * @param w The current window
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
315 */
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
316 static void BuildRoadClick_OneWay(Window *w)
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
317 {
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
318 if (w->IsWidgetDisabled(RTW_ONE_WAY)) return;
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
319 SetWindowDirty(w);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
320 w->ToggleWidgetLoweredState(RTW_ONE_WAY);
7907
7131136aab9d (svn r11459) -Fix: (r11457) The selection highlight color hasn't been reset
skidd13 <skidd13@openttd.org>
parents: 7906
diff changeset
321 SetSelectionRed(false);
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
322 }
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
323
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
324 static void BuildRoadClick_Bridge(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
325 {
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
326 HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRoad_Bridge);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
327 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
328
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
329 static void BuildRoadClick_Tunnel(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
330 {
7794
719f4c7173ae (svn r11344) -Codechange: Removes some magic numbers referring the highlighting mode in road_gui.cpp
belugas <belugas@openttd.org>
parents: 7789
diff changeset
331 HandlePlacePushButton(w, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, VHM_SPECIAL, PlaceRoad_Tunnel);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
332 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
333
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
334 static void BuildRoadClick_Remove(Window *w)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
335 {
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
336 if (w->IsWidgetDisabled(RTW_REMOVE)) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
337 SetWindowDirty(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
338 SndPlayFx(SND_15_BEEP);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
339 w->ToggleWidgetLoweredState(RTW_REMOVE);
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
340 SetSelectionRed(w->IsWidgetLowered(RTW_REMOVE));
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
341 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
342
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
343 /** Array with the handlers of the button-clicks for the road-toolbar */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
344 static OnButtonClick* const _build_road_button_proc[] = {
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
345 BuildRoadClick_X_Dir,
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
346 BuildRoadClick_Y_Dir,
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
347 BuildRoadClick_AutoRoad,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
348 BuildRoadClick_Demolish,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
349 BuildRoadClick_Depot,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
350 BuildRoadClick_BusStation,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
351 BuildRoadClick_TruckStation,
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
352 BuildRoadClick_OneWay,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
353 BuildRoadClick_Bridge,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
354 BuildRoadClick_Tunnel,
5682
7a3b79babecb (svn r8143) Remove the landscaping button from the build toolbars.
tron <tron@openttd.org>
parents: 5587
diff changeset
355 BuildRoadClick_Remove
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
356 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
357
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
358 /** Array with the keycode of the button-clicks for the road-toolbar */
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
359 static const uint16 _road_keycodes[] = {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
360 '1',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
361 '2',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
362 '3',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
363 '4',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
364 '5',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
365 '6',
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
366 '7',
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
367 '8',
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
368 'B',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
369 'T',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
370 'R',
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
371 };
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
372
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
373 /**
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
374 * Update the remove button lowered state of the road toolbar
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
375 *
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
376 * @param w The toolbar window
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
377 * @param clicked_widget The widget which the player clicked just now
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
378 */
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
379 static void UpdateOptionWidgetStatus(Window *w, int clicked_widget)
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
380 {
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
381 /* The remove and the one way button state is driven
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
382 * by the other buttons so they don't act on themselfs.
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
383 * Both are only valid if they are able to apply as options. */
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
384 switch (clicked_widget) {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
385 case RTW_REMOVE:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
386 w->RaiseWidget(RTW_ONE_WAY);
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
387 break;
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
388 case RTW_ONE_WAY:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
389 w->RaiseWidget(RTW_REMOVE);
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
390 break;
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
391 case RTW_BUS_STATION:
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
392 case RTW_TRUCK_STATION:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
393 w->DisableWidget(RTW_ONE_WAY);
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
394 w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget));
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
395 break;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
396 case RTW_ROAD_X:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
397 case RTW_ROAD_Y:
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
398 case RTW_AUTOROAD:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
399 w->SetWidgetsDisabledState(!w->IsWidgetLowered(clicked_widget),
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
400 RTW_REMOVE,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
401 RTW_ONE_WAY,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
402 WIDGET_LIST_END);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
403 break;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
404 default:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
405 /* When any other buttons than road/station, raise and
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
406 * disable the removal button */
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
407 w->SetWidgetsDisabledState(true,
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
408 RTW_REMOVE,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
409 RTW_ONE_WAY,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
410 WIDGET_LIST_END);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
411 w->SetWidgetsLoweredState (false,
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
412 RTW_REMOVE,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
413 RTW_ONE_WAY,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
414 WIDGET_LIST_END);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
415 break;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
416 }
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
417 }
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
418
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
419 static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
420 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
421 switch (e->event) {
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
422 case WE_CREATE:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
423 w->SetWidgetsDisabledState(true,
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
424 RTW_REMOVE,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
425 RTW_ONE_WAY,
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
426 WIDGET_LIST_END);
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
427 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
428
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
429 case WE_PAINT:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
430 w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
431 RTW_DEPOT,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
432 RTW_BUS_STATION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
433 RTW_TRUCK_STATION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
434 WIDGET_LIST_END);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
435 DrawWindowWidgets(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
436 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
437
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
438 case WE_CLICK:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
439 if (e->we.click.widget >= RTW_ROAD_X) {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
440 _remove_button_clicked = false;
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
441 _one_way_button_clicked = false;
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
442 _build_road_button_proc[e->we.click.widget - RTW_ROAD_X](w);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
443 }
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
444 UpdateOptionWidgetStatus(w, e->we.click.widget);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
445 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
446
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
447 case WE_KEYPRESS:
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
448 for (uint8 i = 0; i != lengthof(_road_keycodes); i++) {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
449 if (e->we.keypress.keycode == _road_keycodes[i]) {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
450 e->we.keypress.cont = false;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
451 _remove_button_clicked = false;
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
452 _one_way_button_clicked = false;
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
453 _build_road_button_proc[i](w);
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
454 UpdateOptionWidgetStatus(w, i + RTW_ROAD_X);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
455 break;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
456 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
457 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
458 MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
459 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
460
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
461 case WE_PLACE_OBJ:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
462 _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
463 _one_way_button_clicked = w->IsWidgetLowered(RTW_ONE_WAY);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
464 _place_proc(e->we.place.tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
465 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
466
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
467 case WE_ABORT_PLACE_OBJ:
8027
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
468 w->RaiseButtons();
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
469 w->SetWidgetsDisabledState(true,
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
470 RTW_REMOVE,
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
471 RTW_ONE_WAY,
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
472 WIDGET_LIST_END);
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
473 w->InvalidateWidget(RTW_REMOVE);
be5384b24dc2 (svn r11587) -Fix (r11457): The one way road button wasn't reset on abort
skidd13 <skidd13@openttd.org>
parents: 7997
diff changeset
474 w->InvalidateWidget(RTW_ONE_WAY);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
475
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
476 w = FindWindowById(WC_BUS_STATION, 0);
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
477 if (w != NULL) WP(w, def_d).close = true;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
478 w = FindWindowById(WC_TRUCK_STATION, 0);
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
479 if (w != NULL) WP(w, def_d).close = true;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
480 w = FindWindowById(WC_BUILD_DEPOT, 0);
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
481 if (w != NULL) WP(w, def_d).close = true;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
482 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
483
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
484 case WE_PLACE_DRAG:
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
485 /* Here we update the end tile flags
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
486 * of the road placement actions.
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
487 * At first we reset the end halfroad
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
488 * bits and if needed we set them again. */
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
489 switch (e->we.place.select_proc) {
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
490 case DDSP_PLACE_ROAD_X_DIR:
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
491 _place_road_flag &= ~RF_END_HALFROAD_X;
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
492 if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
493 break;
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
494
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
495 case DDSP_PLACE_ROAD_Y_DIR:
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
496 _place_road_flag &= ~RF_END_HALFROAD_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
497 if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
498 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
499
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
500 case DDSP_PLACE_AUTOROAD:
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
501 _place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
502 if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
503 if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
504
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
505 /* For autoroad we need to update the
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
506 * direction of the road */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
507 if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
7913
bf426a51dacf (svn r11466) -Fix (r11339): operator priority problem resulting in problematic autoroad placement in some cases
smatz <smatz@openttd.org>
parents: 7907
diff changeset
508 ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
bf426a51dacf (svn r11466) -Fix (r11339): operator priority problem resulting in problematic autoroad placement in some cases
smatz <smatz@openttd.org>
parents: 7907
diff changeset
509 (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
510 /* Set dir = X */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
511 _place_road_flag &= ~RF_DIR_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
512 } else {
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
513 /* Set dir = Y */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
514 _place_road_flag |= RF_DIR_Y;
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
515 }
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
516
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
517 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
518 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
519
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
520 VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
521 return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
522
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
523 case WE_PLACE_MOUSEUP:
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
524 if (e->we.place.pt.x != -1) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
525 TileIndex start_tile = e->we.place.starttile;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
526 TileIndex end_tile = e->we.place.tile;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
527
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
528 switch (e->we.place.select_proc) {
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
529 case DDSP_BUILD_BRIDGE:
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
530 ResetObjectToPlace();
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
531 ShowBuildBridgeWindow(start_tile, end_tile, 0x80 | RoadTypeToRoadTypes(_cur_roadtype));
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
532 break;
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
533
6670
5ff577cb6c43 (svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros <maedhros@openttd.org>
parents: 6669
diff changeset
534 case DDSP_DEMOLISH_AREA:
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
535 DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
536 break;
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
537
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
538 case DDSP_PLACE_ROAD_X_DIR:
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
539 case DDSP_PLACE_ROAD_Y_DIR:
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
540 case DDSP_PLACE_AUTOROAD:
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
541 /* Flag description:
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
542 * Use the first three bits (0x07) if dir == Y
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
543 * else use the last 2 bits (X dir has
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
544 * not the 3rd bit set) */
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
545 _place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
546
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
547 DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), CcPlaySound1D,
7904
ed094cb05df3 (svn r11455) -Codechange: make autoroad, 'normal' road building and 'normal' rail building all react the same on CTRL as autorail.
rubidium <rubidium@openttd.org>
parents: 7895
diff changeset
548 (_ctrl_pressed || _remove_button_clicked) ?
7521
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
549 CMD_REMOVE_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
f5b39ff47e0e (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents: 7370
diff changeset
550 CMD_BUILD_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road));
6669
66456dace92f (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros <maedhros@openttd.org>
parents: 6666
diff changeset
551 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
552 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
553 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
554 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
555
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
556 case WE_PLACE_PRESIZE: {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
557 TileIndex tile = e->we.place.tile;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
558
6678
886dba034e9f (svn r9909) -Fix (r9897): Highlight road tunnels properly when building them.
maedhros <maedhros@openttd.org>
parents: 6677
diff changeset
559 DoCommand(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, DC_AUTO, CMD_BUILD_TUNNEL);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
560 VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
561 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
562 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
563
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
564 case WE_DESTROY:
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
565 if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
566 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
567 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
568 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
569
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
570 /** Widget definition of the build road toolbar */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
571 static const Widget _build_road_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
572 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // RTW_CLOSEBOX
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
573 { WWT_CAPTION, RESIZE_NONE, 7, 11, 250, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // RTW_CAPTION
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
574 { WWT_STICKYBOX, RESIZE_NONE, 7, 251, 262, 0, 13, 0x0, STR_STICKY_BUTTON}, // RTW_STICKY
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
575
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
576 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_ROAD_X_DIR, STR_180B_BUILD_ROAD_SECTION}, // RTW_ROAD_X
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
577 { WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_ROAD_Y_DIR, STR_180B_BUILD_ROAD_SECTION}, // RTW_ROAD_Y
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
578 { WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_AUTOROAD, STR_BUILD_AUTOROAD_TIP}, // RTW_AUTOROAD
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
579 { WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // RTW_DEMOLISH
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
580 { WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_ROAD_DEPOT, STR_180C_BUILD_ROAD_VEHICLE_DEPOT}, // RTW_DEPOT
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
581 { WWT_IMGBTN, RESIZE_NONE, 7, 110, 131, 14, 35, SPR_IMG_BUS_STATION, STR_180D_BUILD_BUS_STATION}, // RTW_BUS_STATION
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
582 { WWT_IMGBTN, RESIZE_NONE, 7, 132, 153, 14, 35, SPR_IMG_TRUCK_BAY, STR_180E_BUILD_TRUCK_LOADING_BAY}, // RTW_TRUCK_STATION
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
583 { WWT_IMGBTN, RESIZE_NONE, 7, 154, 175, 14, 35, SPR_IMG_ROAD_ONE_WAY, STR_TOGGLE_ONE_WAY_ROAD}, // RTW_ONE_WAY
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
584 { WWT_IMGBTN, RESIZE_NONE, 7, 176, 218, 14, 35, SPR_IMG_BRIDGE, STR_180F_BUILD_ROAD_BRIDGE}, // RTW_BUILD_BRIDGE
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
585 { WWT_IMGBTN, RESIZE_NONE, 7, 219, 240, 14, 35, SPR_IMG_ROAD_TUNNEL, STR_1810_BUILD_ROAD_TUNNEL}, // RTW_BUILD_TUNNEL
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
586 { WWT_IMGBTN, RESIZE_NONE, 7, 241, 262, 14, 35, SPR_IMG_REMOVE, STR_1811_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
587
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
588 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
589 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
590
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
591 static const WindowDesc _build_road_desc = {
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
592 WDP_ALIGN_TBR, 22, 263, 36, 263, 36,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5860
diff changeset
593 WC_BUILD_TOOLBAR, WC_NONE,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
594 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
595 _build_road_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
596 BuildRoadToolbWndProc
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
597 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
598
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
599 /** Widget definition of the build tram toolbar */
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
600 static const Widget _build_tramway_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
601 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // RTW_CLOSEBOX
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
602 { WWT_CAPTION, RESIZE_NONE, 7, 11, 228, 0, 13, STR_1802_TRAMWAY_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // RTW_CAPTION
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
603 { WWT_STICKYBOX, RESIZE_NONE, 7, 229, 240, 0, 13, 0x0, STR_STICKY_BUTTON}, // RTW_STICKY
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
604
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
605 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_TRAMWAY_X_DIR, STR_180B_BUILD_TRAMWAY_SECTION}, // RTW_ROAD_X
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
606 { WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_TRAMWAY_Y_DIR, STR_180B_BUILD_TRAMWAY_SECTION}, // RTW_ROAD_Y
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
607 { WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_AUTOTRAM, STR_BUILD_AUTOTRAM_TIP}, // RTW_AUTOROAD
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
608 { WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // RTW_DEMOLISH
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
609 { WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_ROAD_DEPOT, STR_180C_BUILD_TRAM_VEHICLE_DEPOT}, // RTW_DEPOT
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
610 { WWT_IMGBTN, RESIZE_NONE, 7, 110, 131, 14, 35, SPR_IMG_BUS_STATION, STR_180D_BUILD_PASSENGER_TRAM_STATION}, // RTW_BUS_STATION
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
611 { WWT_IMGBTN, RESIZE_NONE, 7, 132, 153, 14, 35, SPR_IMG_TRUCK_BAY, STR_180E_BUILD_CARGO_TRAM_STATION}, // RTW_TRUCK_STATION
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
612 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, // RTW_ONE_WAY
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
613 { WWT_IMGBTN, RESIZE_NONE, 7, 154, 196, 14, 35, SPR_IMG_BRIDGE, STR_180F_BUILD_TRAMWAY_BRIDGE}, // RTW_BUILD_BRIDGE
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
614 { WWT_IMGBTN, RESIZE_NONE, 7, 197, 218, 14, 35, SPR_IMG_ROAD_TUNNEL, STR_1810_BUILD_TRAMWAY_TUNNEL}, // RTW_BUILD_TUNNEL
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
615 { WWT_IMGBTN, RESIZE_NONE, 7, 219, 240, 14, 35, SPR_IMG_REMOVE, STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS}, // RTW_REMOVE
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
616
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
617 { WIDGETS_END},
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
618 };
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
619
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
620 static const WindowDesc _build_tramway_desc = {
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
621 WDP_ALIGN_TBR, 22, 241, 36, 241, 36,
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
622 WC_BUILD_TOOLBAR, WC_NONE,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
623 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
624 _build_tramway_widgets,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
625 BuildRoadToolbWndProc
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
626 };
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
627
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
628 void ShowBuildRoadToolbar(RoadType roadtype)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
629 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
630 if (!IsValidPlayer(_current_player)) return;
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
631 _cur_roadtype = roadtype;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
632
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
633 DeleteWindowById(WC_BUILD_TOOLBAR, 0);
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
634 Window *w = AllocateWindowDesc(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc);
5860
dc5ff33e8dda (svn r8436) -Fix
tron <tron@openttd.org>
parents: 5836
diff changeset
635 if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
636 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
637
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
638 /** Widget definition of the build road toolbar in the scenario editor */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
639 static const Widget _build_road_scen_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
640 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // RTW_CLOSEBOX
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
641 { WWT_CAPTION, RESIZE_NONE, 7, 11, 184, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // RTW_CAPTION
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
642 { WWT_STICKYBOX, RESIZE_NONE, 7, 185, 196, 0, 13, 0x0, STR_STICKY_BUTTON}, // RTW_STICKY
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
643
7895
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
644 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_ROAD_X_DIR, STR_180B_BUILD_ROAD_SECTION}, // RTW_ROAD_X
899d4210aa6d (svn r11446) -Codechange: change the naming of road related code parts to something more descriptive
skidd13 <skidd13@openttd.org>
parents: 7794
diff changeset
645 { WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_ROAD_Y_DIR, STR_180B_BUILD_ROAD_SECTION}, // RTW_ROAD_Y
7789
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
646 { WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_AUTOROAD, STR_BUILD_AUTOROAD_TIP}, // RTW_AUTOROAD
bf6bc46be9da (svn r11339) -Add: autoroad; same as autorail, but for road and trams and only on X and Y direction. Patch by Octopussy and skidd13.
rubidium <rubidium@openttd.org>
parents: 7729
diff changeset
647 { WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, // RTW_DEMOLISH
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
648 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, // RTW_DEPOT
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
649 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, // RTW_BUS_STATION
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
650 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, // RTW_TRUCK_STATION
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
651 { WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_ROAD_ONE_WAY, STR_TOGGLE_ONE_WAY_ROAD}, // RTW_ONE_WAY
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
652 { WWT_IMGBTN, RESIZE_NONE, 7, 110, 152, 14, 35, SPR_IMG_BRIDGE, STR_180F_BUILD_ROAD_BRIDGE}, // RTW_BUILD_BRIDGE
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
653 { WWT_IMGBTN, RESIZE_NONE, 7, 153, 174, 14, 35, SPR_IMG_ROAD_TUNNEL, STR_1810_BUILD_ROAD_TUNNEL}, // RTW_BUILD_TUNNEL
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
654 { WWT_IMGBTN, RESIZE_NONE, 7, 175, 196, 14, 35, SPR_IMG_REMOVE, STR_1811_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
655 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
656 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
657
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
658 static const WindowDesc _build_road_scen_desc = {
7906
170816015868 (svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
skidd13 <skidd13@openttd.org>
parents: 7904
diff changeset
659 WDP_AUTO, WDP_AUTO, 197, 36, 197, 36,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5860
diff changeset
660 WC_SCEN_BUILD_ROAD, WC_NONE,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
661 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
662 _build_road_scen_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
663 BuildRoadToolbWndProc
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
664 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
665
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6102
diff changeset
666 void ShowBuildRoadScenToolbar()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
667 {
6779
2a981bdfe1d5 (svn r10015) -Fix: one could build (only) tram tracks when that was the last built roadtype (in a normal game).
rubidium <rubidium@openttd.org>
parents: 6764
diff changeset
668 _cur_roadtype = ROADTYPE_ROAD;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
669 AllocateWindowDescFront(&_build_road_scen_desc, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
670 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
671
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
672 /** Enum referring to the widgets of the build road depot window */
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
673 enum BuildRoadDepotWidgets {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
674 BRDW_CLOSEBOX = 0,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
675 BRDW_CAPTION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
676 BRDW_BACKGROUND,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
677 BRDW_DEPOT_NE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
678 BRDW_DEPOT_SE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
679 BRDW_DEPOT_SW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
680 BRDW_DEPOT_NW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
681 };
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
682
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
683 static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
684 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
685 switch (e->event) {
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
686 case WE_CREATE: w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
687
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
688 case WE_PAINT:
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
689 DrawWindowWidgets(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
690
6666
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
691 DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
692 DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
693 DrawRoadDepotSprite( 2, 69, DIAGDIR_SW, _cur_roadtype);
61e17c4bac25 (svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium <rubidium@openttd.org>
parents: 6662
diff changeset
694 DrawRoadDepotSprite( 2, 17, DIAGDIR_NW, _cur_roadtype);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
695 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
696
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
697 case WE_CLICK:
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
698 switch (e->we.click.widget) {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
699 case BRDW_DEPOT_NW:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
700 case BRDW_DEPOT_NE:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
701 case BRDW_DEPOT_SW:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
702 case BRDW_DEPOT_SE:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
703 w->RaiseWidget(_road_depot_orientation + BRDW_DEPOT_NE);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
704 _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
705 w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
706 SndPlayFx(SND_15_BEEP);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
707 SetWindowDirty(w);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
708 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
709 }
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
710 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
711
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
712 case WE_MOUSELOOP:
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
713 if (WP(w, def_d).close) DeleteWindow(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
714 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
715
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
716 case WE_DESTROY:
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
717 if (!WP(w, def_d).close) ResetObjectToPlace();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
718 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
719 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
720 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
721
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
722 /** Widget definition of the build road depot window */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
723 static const Widget _build_road_depot_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
724 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRDW_CLOSEBOX
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
725 { WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1806_ROAD_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRDW_CAPTION
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
726 { WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, // BRDW_BACKGROUND
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
727 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, // BRDW_DEPOT_NE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
728 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, // BRDW_DEPOT_SE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
729 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, // BRDW_DEPOT_SW
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
730 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, // BRDW_DEPOT_NW
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
731 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
732 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
733
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
734 /** Widget definition of the build tram depot window */
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
735 static const Widget _build_tram_depot_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
736 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRDW_CLOSEBOX
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
737 { WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1806_TRAM_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRDW_CAPTION
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
738 { WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, // BRDW_BACKGROUND
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
739 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1813_SELECT_TRAM_VEHICLE_DEPOT}, // BRDW_DEPOT_NE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
740 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1813_SELECT_TRAM_VEHICLE_DEPOT}, // BRDW_DEPOT_SE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
741 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1813_SELECT_TRAM_VEHICLE_DEPOT}, // BRDW_DEPOT_SW
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
742 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1813_SELECT_TRAM_VEHICLE_DEPOT}, // BRDW_DEPOT_NW
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
743 { WIDGETS_END},
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
744 };
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
745
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
746 static const WindowDesc _build_road_depot_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7339
diff changeset
747 WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
748 WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
749 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
750 _build_road_depot_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
751 BuildRoadDepotWndProc
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
752 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
753
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
754 static const WindowDesc _build_tram_depot_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7339
diff changeset
755 WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
756 WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
757 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
758 _build_tram_depot_widgets,
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
759 BuildRoadDepotWndProc
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
760 };
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
761
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6102
diff changeset
762 static void ShowRoadDepotPicker()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
763 {
6691
d2fb32d942f7 (svn r9923) -Add: support for Action 0 Road vehicles, property 1C, bit 0.
rubidium <rubidium@openttd.org>
parents: 6678
diff changeset
764 AllocateWindowDesc(_cur_roadtype == ROADTYPE_ROAD ? &_build_road_depot_desc : &_build_tram_depot_desc);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
765 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
766
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
767 /** Enum referring to the widgets of the build road station window */
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
768 enum BuildRoadStationWidgets {
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
769 BRSW_CLOSEBOX = 0,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
770 BRSW_CAPTION,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
771 BRSW_BACKGROUND,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
772 BRSW_STATION_NE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
773 BRSW_STATION_SE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
774 BRSW_STATION_SW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
775 BRSW_STATION_NW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
776 BRSW_STATION_X,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
777 BRSW_STATION_Y,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
778 BRSW_LT_OFF,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
779 BRSW_LT_ON,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
780 BRSW_INFO,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
781 };
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
782
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
783 static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
784 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
785 switch (e->event) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
786 case WE_CREATE:
6677
8451c7d3a664 (svn r9908) -Codechange: prepare the station picker for more road types.
rubidium <rubidium@openttd.org>
parents: 6676
diff changeset
787 /* Trams don't have non-drivethrough stations */
8451c7d3a664 (svn r9908) -Codechange: prepare the station picker for more road types.
rubidium <rubidium@openttd.org>
parents: 6676
diff changeset
788 if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
8451c7d3a664 (svn r9908) -Codechange: prepare the station picker for more road types.
rubidium <rubidium@openttd.org>
parents: 6676
diff changeset
789 _road_station_picker_orientation = DIAGDIR_END;
8451c7d3a664 (svn r9908) -Codechange: prepare the station picker for more road types.
rubidium <rubidium@openttd.org>
parents: 6676
diff changeset
790 }
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
791 w->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM,
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
792 BRSW_STATION_NE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
793 BRSW_STATION_SE,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
794 BRSW_STATION_SW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
795 BRSW_STATION_NW,
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
796 WIDGET_LIST_END);
6677
8451c7d3a664 (svn r9908) -Codechange: prepare the station picker for more road types.
rubidium <rubidium@openttd.org>
parents: 6676
diff changeset
797
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
798 w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
799 w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
800 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
801
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
802 case WE_PAINT: {
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
803 if (WP(w, def_d).close) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
804
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
805 DrawWindowWidgets(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
806
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
807 if (_station_show_coverage) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
808 int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : 4;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
809 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
810 } else {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
811 SetTileSelectSize(1, 1);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
812 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
813
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
814 StationType st = (w->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
815
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
816 StationPickerDrawSprite(103, 35, st, RAILTYPE_BEGIN, ROADTYPE_ROAD, 0);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
817 StationPickerDrawSprite(103, 85, st, RAILTYPE_BEGIN, ROADTYPE_ROAD, 1);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
818 StationPickerDrawSprite( 35, 85, st, RAILTYPE_BEGIN, ROADTYPE_ROAD, 2);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
819 StationPickerDrawSprite( 35, 35, st, RAILTYPE_BEGIN, ROADTYPE_ROAD, 3);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
820
7272
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
821 StationPickerDrawSprite(171, 35, st, RAILTYPE_BEGIN, _cur_roadtype, 4);
dc7fb38ec443 (svn r10601) -Codechange: store (and use) the type of stations instead of hardcoding station types by graphics IDs.
rubidium <rubidium@openttd.org>
parents: 7266
diff changeset
822 StationPickerDrawSprite(171, 85, st, RAILTYPE_BEGIN, _cur_roadtype, 5);
6012
542153c1c803 (svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
823
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
824 DrawStationCoverageAreaText(2, 146,
7241
c40c1ad02f45 (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 <rubidium@openttd.org>
parents: 7086
diff changeset
825 (w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
826 3);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
827
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
828 } break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
829
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
830 case WE_CLICK: {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
831 switch (e->we.click.widget) {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
832 case BRSW_STATION_NE:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
833 case BRSW_STATION_SE:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
834 case BRSW_STATION_SW:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
835 case BRSW_STATION_NW:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
836 case BRSW_STATION_X:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
837 case BRSW_STATION_Y:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
838 w->RaiseWidget(_road_station_picker_orientation + BRSW_STATION_NE);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
839 _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
840 w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
841 SndPlayFx(SND_15_BEEP);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
842 SetWindowDirty(w);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
843 break;
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
844
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
845 case BRSW_LT_OFF:
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
846 case BRSW_LT_ON:
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
847 w->RaiseWidget(_station_show_coverage + BRSW_LT_OFF);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
848 _station_show_coverage = (e->we.click.widget != BRSW_LT_OFF);
7997
d109780d515b (svn r11555) -Codechange: use the new members introduced in r11551.
rubidium <rubidium@openttd.org>
parents: 7956
diff changeset
849 w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
850 SndPlayFx(SND_15_BEEP);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
851 SetWindowDirty(w);
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
852 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
853 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
854 } break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
855
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
856 case WE_MOUSELOOP: {
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
857 if (WP(w, def_d).close) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
858 DeleteWindow(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
859 return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
860 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
861
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
862 CheckRedrawStationCoverage(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
863 } break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
864
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
865 case WE_DESTROY:
6491
696f0e1b046e (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium <rubidium@openttd.org>
parents: 6393
diff changeset
866 if (!WP(w, def_d).close) ResetObjectToPlace();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
867 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
868 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
869 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
870
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
871 /** Widget definition of the build raod station window */
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
872 static const Widget _rv_station_picker_widgets[] = {
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
873 { WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // BRSW_CLOSEBOX
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
874 { WWT_CAPTION, RESIZE_NONE, 7, 11, 206, 0, 13, STR_NULL, STR_018C_WINDOW_TITLE_DRAG_THIS}, // BRSW_CAPTION
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
875 { WWT_PANEL, RESIZE_NONE, 7, 0, 206, 14, 176, 0x0, STR_NULL}, // BRSW_BACKGROUND
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
876
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
877 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_NULL}, // BRSW_STATION_NE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
878 { WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_NULL}, // BRSW_STATION_SE
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
879 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_NULL}, // BRSW_STATION_SW
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
880 { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_NULL}, // BRSW_STATION_NW
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
881 { WWT_PANEL, RESIZE_NONE, 14, 139, 204, 17, 66, 0x0, STR_NULL}, // BRSW_STATION_X
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
882 { WWT_PANEL, RESIZE_NONE, 14, 139, 204, 69, 118, 0x0, STR_NULL}, // BRSW_STATION_Y
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
883
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
884 { WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, // BRSW_LT_OFF
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
885 { WWT_TEXTBTN, RESIZE_NONE, 14, 70, 129, 133, 144, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, // BRSW_LT_ON
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
886 { WWT_LABEL, RESIZE_NONE, 7, 0, 139, 120, 133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL}, // BRSW_INFO
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
887 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
888 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
889
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
890 static const WindowDesc _rv_station_picker_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7339
diff changeset
891 WDP_AUTO, WDP_AUTO, 207, 177, 207, 177,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
892 WC_BUS_STATION, WC_BUILD_TOOLBAR,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
893 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
894 _rv_station_picker_widgets,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
895 RoadStationPickerWndProc
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
896 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
897
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
898 static void ShowRVStationPicker(RoadStop::Type rs)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
899 {
6693
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
900 Window *w = AllocateWindowDesc(&_rv_station_picker_desc);
cb2e0e8820f5 (svn r9925) -Fix: wrong tooltips in station picker.
rubidium <rubidium@openttd.org>
parents: 6691
diff changeset
901 if (w == NULL) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
902
6701
8cd8e1fa4b16 (svn r9933) -Fix (9925): unified a little too much.
rubidium <rubidium@openttd.org>
parents: 6693
diff changeset
903 w->window_class = (rs == RoadStop::BUS) ? WC_BUS_STATION : WC_TRUCK_STATION;
7729
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
904 w->widget[BRSW_CAPTION].data = _road_type_infos[_cur_roadtype].picker_title[rs];
0eeced3fd703 (svn r11264) -Codechange: replace a lot of magic numbers with enums for the rail and road GUIs. Patch by skidd13.
rubidium <rubidium@openttd.org>
parents: 7521
diff changeset
905 for (uint i = BRSW_STATION_NE; i < BRSW_LT_OFF; i++) w->widget[i].tooltips = _road_type_infos[_cur_roadtype].picker_tooltip[rs];
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
906 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
907
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6102
diff changeset
908 void InitializeRoadGui()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
909 {
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
910 _road_depot_orientation = DIAGDIR_NW;
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
911 _road_station_picker_orientation = DIAGDIR_NW;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
912 }