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