author | maedhros |
Wed, 23 May 2007 13:52:10 +0000 | |
changeset 6670 | f0300bf50643 |
parent 6669 | bb48a810a509 |
child 6672 | b688fe8f73b9 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
3 |
/** @file main_gui.cpp */ |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1885
diff
changeset
|
6 |
#include "openttd.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
7 |
#include "heightmap.h" |
2292 | 8 |
#include "currency.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
9 |
#include "functions.h" |
1349
15979a2e9001
(svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
1336
diff
changeset
|
10 |
#include "spritecache.h" |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
11 |
#include "station.h" |
1309
4403a69da4f8
(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
tron
parents:
1230
diff
changeset
|
12 |
#include "strings.h" |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1362
diff
changeset
|
13 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
497
diff
changeset
|
14 |
#include "table/strings.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
670
diff
changeset
|
15 |
#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:
1199
diff
changeset
|
16 |
#include "tile.h" |
0 | 17 |
#include "window.h" |
18 |
#include "gui.h" |
|
19 |
#include "viewport.h" |
|
20 |
#include "gfx.h" |
|
21 |
#include "player.h" |
|
22 |
#include "command.h" |
|
23 |
#include "news.h" |
|
24 |
#include "town.h" |
|
130
b593afdae262
(svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik
parents:
126
diff
changeset
|
25 |
#include "vehicle.h" |
126 | 26 |
#include "console.h" |
337
cbe0c766c947
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
222
diff
changeset
|
27 |
#include "sound.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5432
diff
changeset
|
28 |
#include "network/network.h" |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
29 |
#include "signs.h" |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
30 |
#include "waypoint.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2150
diff
changeset
|
31 |
#include "variables.h" |
2676
59b65b4fb480
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2652
diff
changeset
|
32 |
#include "train.h" |
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
33 |
#include "unmovable_map.h" |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
34 |
#include "string.h" |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
35 |
#include "screenshot.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
36 |
#include "genworld.h" |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
37 |
#include "settings.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4184
diff
changeset
|
38 |
#include "date.h" |
4668
f7256d0e7682
(svn r6562) -Codechange: merged the vehicle list window widget arrays
bjarni
parents:
4634
diff
changeset
|
39 |
#include "vehicle_gui.h" |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
40 |
#include "transparency_gui.h" |
5237
4fce3ea379c2
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
5235
diff
changeset
|
41 |
#include "newgrf_config.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
42 |
|
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5432
diff
changeset
|
43 |
#include "network/network_data.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5432
diff
changeset
|
44 |
#include "network/network_client.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5432
diff
changeset
|
45 |
#include "network/network_server.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5432
diff
changeset
|
46 |
#include "network/network_gui.h" |
4942
7fb6c39eb421
(svn r6930) -Codechange: Move industry name into IndustrySpec
belugas
parents:
4938
diff
changeset
|
47 |
#include "industry.h" |
0 | 48 |
|
5413 | 49 |
static int _rename_id = 1; |
50 |
static int _rename_what = -1; |
|
0 | 51 |
|
52 |
static byte _terraform_size = 1; |
|
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5108
diff
changeset
|
53 |
RailType _last_built_railtype; |
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
54 |
RoadType _last_built_roadtype; |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
55 |
static int _scengen_town_size = 1; // depress medium-sized towns per default |
0 | 56 |
|
6247 | 57 |
extern void GenerateIndustries(); |
58 |
extern bool GenerateTowns(); |
|
0 | 59 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
60 |
|
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
61 |
void HandleOnEditText(const char *str) |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
62 |
{ |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
63 |
int id = _rename_id; |
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
64 |
_cmd_text = str; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
65 |
|
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
66 |
switch (_rename_what) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
67 |
case 0: // Rename a s sign, if string is empty, delete sign |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1772
diff
changeset
|
68 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME)); |
0 | 69 |
break; |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
70 |
case 1: // Rename a waypoint |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
71 |
if (*str == '\0') return; |
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:
355
diff
changeset
|
72 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME)); |
0 | 73 |
break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
74 |
#ifdef ENABLE_NETWORK |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
75 |
case 3: { // Give money, you can only give money in excess of loan |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
76 |
const Player *p = GetPlayer(_current_player); |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
77 |
int32 money = min(p->money64 - p->current_loan, atoi(str) / _currency->rate); |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
78 |
char msg[20]; |
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
79 |
|
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
80 |
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0 |
813
640a517dc129
(svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight
parents:
793
diff
changeset
|
81 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
82 |
/* Give 'id' the money, and substract it from ourself */ |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
83 |
if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS))) break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
84 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
85 |
/* Inform the player of this action */ |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
86 |
snprintf(msg, sizeof(msg), "%d", money); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
87 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
88 |
if (!_network_server) { |
5261
8e2633e0fbe7
(svn r7391) -Fix r6814: when sending money in multiplayer, the corresponding chat message was for the wrong player (off by one)
glx
parents:
5237
diff
changeset
|
89 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, id, msg); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
90 |
} else { |
5261
8e2633e0fbe7
(svn r7391) -Fix r6814: when sending money in multiplayer, the corresponding chat message was for the wrong player (off by one)
glx
parents:
5237
diff
changeset
|
91 |
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, id, msg, NETWORK_SERVER_INDEX); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
92 |
} |
6492
286a52449b54
(svn r9673) -Cleanup: remove spaces before tabs and replace non-indenting tabs with spaces.
rubidium
parents:
6486
diff
changeset
|
93 |
} break; |
5413 | 94 |
#endif /* ENABLE_NETWORK */ |
95 |
default: NOT_REACHED(); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
96 |
} |
5413 | 97 |
|
98 |
_rename_id = _rename_what = -1; |
|
0 | 99 |
} |
100 |
||
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
101 |
/** |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
102 |
* This code is shared for the majority of the pushbuttons. |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
103 |
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
104 |
* |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
105 |
* @param w Window which called the function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
106 |
* @param widget ID of the widget (=button) that called this function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
107 |
* @param cursor How should the cursor image change? E.g. cursor with depot image in it |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
108 |
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
109 |
* @param placeproc Procedure which will be called when someone clicks on the map |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
110 |
* @return true if the button is clicked, false if it's unclicked |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
111 |
*/ |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
112 |
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc) |
0 | 113 |
{ |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
114 |
if (IsWindowWidgetDisabled(w, widget)) return false; |
0 | 115 |
|
2621
2bacc2e9c68f
(svn r3159) Remove the read-only variable _no_button_sound
tron
parents:
2615
diff
changeset
|
116 |
SndPlayFx(SND_15_BEEP); |
0 | 117 |
SetWindowDirty(w); |
118 |
||
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
119 |
if (IsWindowWidgetLowered(w, widget)) { |
0 | 120 |
ResetObjectToPlace(); |
121 |
return false; |
|
122 |
} |
|
123 |
||
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
124 |
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
125 |
LowerWindowWidget(w, widget); |
0 | 126 |
_place_proc = placeproc; |
127 |
return true; |
|
128 |
} |
|
129 |
||
130 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
131 |
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 132 |
{ |
541 | 133 |
if (success) SndPlayTileFx(SND_12_EXPLOSION, tile); |
0 | 134 |
} |
135 |
||
136 |
||
137 |
static void ToolbarPauseClick(Window *w) |
|
138 |
{ |
|
2549 | 139 |
if (_networking && !_network_server) return; // only server can pause the game |
213
770e504a6e51
(svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater
parents:
206
diff
changeset
|
140 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
141 |
if (DoCommandP(0, _pause_game ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP); |
0 | 142 |
} |
143 |
||
144 |
static void ToolbarFastForwardClick(Window *w) |
|
145 |
{ |
|
146 |
_fast_forward ^= true; |
|
541 | 147 |
SndPlayFx(SND_15_BEEP); |
0 | 148 |
} |
149 |
||
150 |
||
6494
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
151 |
/** Toggle all transparency options, except for signs */ |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
152 |
static void ToggleTransparency() |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
153 |
{ |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
154 |
static byte trans_opt = ~0; |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
155 |
|
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
156 |
if (GB(_transparent_opt, 1, 7) == 0) { |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
157 |
SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7)); |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
158 |
} else { |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
159 |
trans_opt = _transparent_opt; |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
160 |
SB(_transparent_opt, 1, 7, 0); |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
161 |
} |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
162 |
|
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
163 |
MarkWholeScreenDirty(); |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
164 |
} |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
165 |
|
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
166 |
|
410 | 167 |
static void MenuClickSettings(int index) |
0 | 168 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
169 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
170 |
case 0: ShowGameOptions(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
171 |
case 1: ShowGameDifficulty(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
172 |
case 2: ShowPatchesSelection(); return; |
5352
86fca6a41aa1
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5261
diff
changeset
|
173 |
case 3: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
174 |
|
6591
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
175 |
case 5: TOGGLEBIT(_display_opt, DO_SHOW_TOWN_NAMES); break; |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
176 |
case 6: TOGGLEBIT(_display_opt, DO_SHOW_STATION_NAMES); break; |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
177 |
case 7: TOGGLEBIT(_display_opt, DO_SHOW_SIGNS); break; |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
178 |
case 8: TOGGLEBIT(_display_opt, DO_WAYPOINTS); break; |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
179 |
case 9: TOGGLEBIT(_display_opt, DO_FULL_ANIMATION); break; |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
180 |
case 10: TOGGLEBIT(_display_opt, DO_FULL_DETAIL); break; |
6494
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
181 |
case 11: ToggleTransparency(); break; |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
182 |
case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break; |
0 | 183 |
} |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
184 |
MarkWholeScreenDirty(); |
0 | 185 |
} |
186 |
||
410 | 187 |
static void MenuClickSaveLoad(int index) |
0 | 188 |
{ |
189 |
if (_game_mode == GM_EDITOR) { |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
190 |
switch (index) { |
5894
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
191 |
case 0: ShowSaveLoadDialog(SLD_SAVE_SCENARIO); break; |
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
192 |
case 1: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
193 |
case 2: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; |
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
194 |
case 3: AskExitToGameMenu(); break; |
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
195 |
case 5: HandleExitGameRequest(); break; |
0 | 196 |
} |
197 |
} else { |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
198 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
199 |
case 0: ShowSaveLoadDialog(SLD_SAVE_GAME); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
200 |
case 1: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
201 |
case 2: AskExitToGameMenu(); break; |
4548
6165e12570bf
(svn r6380) -Codechange: unify all ways to quit OTTD.
rubidium
parents:
4536
diff
changeset
|
202 |
case 3: HandleExitGameRequest(); break; |
0 | 203 |
} |
204 |
} |
|
205 |
} |
|
206 |
||
410 | 207 |
static void MenuClickMap(int index) |
0 | 208 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
209 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
210 |
case 0: ShowSmallMap(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
211 |
case 1: ShowExtraViewPortWindow(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
212 |
case 2: ShowSignList(); break; |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
213 |
case 3: ShowTransparencyToolbar(); break; |
0 | 214 |
} |
215 |
} |
|
216 |
||
410 | 217 |
static void MenuClickTown(int index) |
0 | 218 |
{ |
219 |
ShowTownDirectory(); |
|
220 |
} |
|
221 |
||
410 | 222 |
static void MenuClickScenMap(int index) |
0 | 223 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
224 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
225 |
case 0: ShowSmallMap(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
226 |
case 1: ShowExtraViewPortWindow(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
227 |
case 2: ShowSignList(); break; |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
228 |
case 3: ShowTransparencyToolbar(); break; |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
229 |
case 4: ShowTownDirectory(); break; |
0 | 230 |
} |
231 |
} |
|
232 |
||
410 | 233 |
static void MenuClickSubsidies(int index) |
0 | 234 |
{ |
235 |
ShowSubsidiesList(); |
|
236 |
} |
|
237 |
||
410 | 238 |
static void MenuClickStations(int index) |
0 | 239 |
{ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
240 |
ShowPlayerStations((PlayerID)index); |
0 | 241 |
} |
242 |
||
410 | 243 |
static void MenuClickFinances(int index) |
0 | 244 |
{ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
245 |
ShowPlayerFinances((PlayerID)index); |
0 | 246 |
} |
247 |
||
410 | 248 |
static void MenuClickCompany(int index) |
0 | 249 |
{ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
250 |
if (_networking && index == 0) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
251 |
ShowClientList(); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
252 |
} else { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
253 |
if (_networking) index--; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
254 |
ShowPlayerCompany((PlayerID)index); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
255 |
} |
0 | 256 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
257 |
|
410 | 258 |
static void MenuClickGraphs(int index) |
0 | 259 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
260 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
261 |
case 0: ShowOperatingProfitGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
262 |
case 1: ShowIncomeGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
263 |
case 2: ShowDeliveredCargoGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
264 |
case 3: ShowPerformanceHistoryGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
265 |
case 4: ShowCompanyValueGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
266 |
case 5: ShowCargoPaymentRates(); break; |
0 | 267 |
} |
268 |
} |
|
269 |
||
410 | 270 |
static void MenuClickLeague(int index) |
0 | 271 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
272 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
273 |
case 0: ShowCompanyLeagueTable(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
274 |
case 1: ShowPerformanceRatingDetail(); break; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
275 |
} |
0 | 276 |
} |
277 |
||
410 | 278 |
static void MenuClickIndustry(int index) |
0 | 279 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
280 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
281 |
case 0: ShowIndustryDirectory(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
282 |
case 1: ShowBuildIndustryWindow(); break; |
0 | 283 |
} |
284 |
} |
|
285 |
||
410 | 286 |
static void MenuClickShowTrains(int index) |
0 | 287 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
288 |
ShowVehicleListWindow((PlayerID)index, VEH_TRAIN); |
0 | 289 |
} |
290 |
||
410 | 291 |
static void MenuClickShowRoad(int index) |
0 | 292 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
293 |
ShowVehicleListWindow((PlayerID)index, VEH_ROAD); |
0 | 294 |
} |
295 |
||
410 | 296 |
static void MenuClickShowShips(int index) |
0 | 297 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
298 |
ShowVehicleListWindow((PlayerID)index, VEH_SHIP); |
0 | 299 |
} |
300 |
||
410 | 301 |
static void MenuClickShowAir(int index) |
0 | 302 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
303 |
ShowVehicleListWindow((PlayerID)index, VEH_AIRCRAFT); |
0 | 304 |
} |
305 |
||
410 | 306 |
static void MenuClickBuildRail(int index) |
0 | 307 |
{ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
308 |
_last_built_railtype = (RailType)index; |
0 | 309 |
ShowBuildRailToolbar(_last_built_railtype, -1); |
310 |
} |
|
311 |
||
410 | 312 |
static void MenuClickBuildRoad(int index) |
0 | 313 |
{ |
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
314 |
_last_built_roadtype = (RoadType)index; |
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
315 |
ShowBuildRoadToolbar(_last_built_roadtype); |
0 | 316 |
} |
317 |
||
410 | 318 |
static void MenuClickBuildWater(int index) |
0 | 319 |
{ |
320 |
ShowBuildDocksToolbar(); |
|
321 |
} |
|
322 |
||
410 | 323 |
static void MenuClickBuildAir(int index) |
0 | 324 |
{ |
325 |
ShowBuildAirToolbar(); |
|
326 |
} |
|
327 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
328 |
#ifdef ENABLE_NETWORK |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4824
diff
changeset
|
329 |
void ShowNetworkGiveMoneyWindow(PlayerID player) |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
330 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
331 |
_rename_id = player; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
332 |
_rename_what = 3; |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
333 |
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
334 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
335 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
336 |
|
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
337 |
void ShowRenameSignWindow(const Sign *si) |
0 | 338 |
{ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
339 |
_rename_id = si->index; |
0 | 340 |
_rename_what = 0; |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
341 |
ShowQueryString(si->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, NULL, CS_ALPHANUMERAL); |
0 | 342 |
} |
343 |
||
2116 | 344 |
void ShowRenameWaypointWindow(const Waypoint *wp) |
0 | 345 |
{ |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
346 |
int id = wp->index; |
697
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
347 |
|
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
348 |
/* Are we allowed to change the name of the waypoint? */ |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
349 |
if (!CheckTileOwnership(wp->xy)) { |
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:
872
diff
changeset
|
350 |
ShowErrorMessage(_error_message, STR_CANT_CHANGE_WAYPOINT_NAME, |
3422
a6eba3443452
(svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty
celestar
parents:
3326
diff
changeset
|
351 |
TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE); |
697
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
352 |
return; |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
353 |
} |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
354 |
|
0 | 355 |
_rename_id = id; |
356 |
_rename_what = 1; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
357 |
SetDParam(0, id); |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
358 |
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL); |
0 | 359 |
} |
360 |
||
6247 | 361 |
static void SelectSignTool() |
0 | 362 |
{ |
2639 | 363 |
if (_cursor.sprite == SPR_CURSOR_SIGN) { |
0 | 364 |
ResetObjectToPlace(); |
2639 | 365 |
} else { |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
366 |
SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0); |
0 | 367 |
_place_proc = PlaceProc_Sign; |
368 |
} |
|
369 |
} |
|
370 |
||
410 | 371 |
static void MenuClickForest(int index) |
0 | 372 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
373 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
374 |
case 0: ShowTerraformToolbar(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
375 |
case 1: ShowBuildTreesToolbar(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
376 |
case 2: SelectSignTool(); break; |
0 | 377 |
} |
378 |
} |
|
379 |
||
410 | 380 |
static void MenuClickMusicWindow(int index) |
0 | 381 |
{ |
382 |
ShowMusicWindow(); |
|
383 |
} |
|
384 |
||
410 | 385 |
static void MenuClickNewspaper(int index) |
0 | 386 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
387 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
388 |
case 0: ShowLastNewsMessage(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
389 |
case 1: ShowMessageOptions(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
390 |
case 2: ShowMessageHistory(); break; |
0 | 391 |
} |
392 |
} |
|
393 |
||
6247 | 394 |
static void MenuClickSmallScreenshot() |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
395 |
{ |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
396 |
SetScreenshotType(SC_VIEWPORT); |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
397 |
} |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
398 |
|
6247 | 399 |
static void MenuClickWorldScreenshot() |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
400 |
{ |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
401 |
SetScreenshotType(SC_WORLD); |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
402 |
} |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
403 |
|
410 | 404 |
static void MenuClickHelp(int index) |
0 | 405 |
{ |
2432
c48585a8b05f
(svn r2958) - Feature: [ 1258971 ] Menu option to toggle console. Mainly for MacOS's or PDA's. (toholio)
Darkvater
parents:
2430
diff
changeset
|
406 |
switch (index) { |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
407 |
case 0: PlaceLandBlockInfo(); break; |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
408 |
case 2: IConsoleSwitch(); break; |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
409 |
case 3: MenuClickSmallScreenshot(); break; |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
410 |
case 4: MenuClickWorldScreenshot(); break; |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
411 |
case 5: ShowAboutWindow(); break; |
0 | 412 |
} |
413 |
} |
|
414 |
||
2639 | 415 |
|
416 |
typedef void MenuClickedProc(int index); |
|
417 |
||
0 | 418 |
static MenuClickedProc * const _menu_clicked_procs[] = { |
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:
4337
diff
changeset
|
419 |
NULL, /* 0 */ |
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:
4337
diff
changeset
|
420 |
NULL, /* 1 */ |
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:
4337
diff
changeset
|
421 |
MenuClickSettings, /* 2 */ |
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:
4337
diff
changeset
|
422 |
MenuClickSaveLoad, /* 3 */ |
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:
4337
diff
changeset
|
423 |
MenuClickMap, /* 4 */ |
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:
4337
diff
changeset
|
424 |
MenuClickTown, /* 5 */ |
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:
4337
diff
changeset
|
425 |
MenuClickSubsidies, /* 6 */ |
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:
4337
diff
changeset
|
426 |
MenuClickStations, /* 7 */ |
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:
4337
diff
changeset
|
427 |
MenuClickFinances, /* 8 */ |
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:
4337
diff
changeset
|
428 |
MenuClickCompany, /* 9 */ |
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:
4337
diff
changeset
|
429 |
MenuClickGraphs, /* 10 */ |
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:
4337
diff
changeset
|
430 |
MenuClickLeague, /* 11 */ |
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:
4337
diff
changeset
|
431 |
MenuClickIndustry, /* 12 */ |
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:
4337
diff
changeset
|
432 |
MenuClickShowTrains, /* 13 */ |
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:
4337
diff
changeset
|
433 |
MenuClickShowRoad, /* 14 */ |
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:
4337
diff
changeset
|
434 |
MenuClickShowShips, /* 15 */ |
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:
4337
diff
changeset
|
435 |
MenuClickShowAir, /* 16 */ |
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:
4337
diff
changeset
|
436 |
MenuClickScenMap, /* 17 */ |
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:
4337
diff
changeset
|
437 |
NULL, /* 18 */ |
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:
4337
diff
changeset
|
438 |
MenuClickBuildRail, /* 19 */ |
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:
4337
diff
changeset
|
439 |
MenuClickBuildRoad, /* 20 */ |
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:
4337
diff
changeset
|
440 |
MenuClickBuildWater, /* 21 */ |
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:
4337
diff
changeset
|
441 |
MenuClickBuildAir, /* 22 */ |
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:
4337
diff
changeset
|
442 |
MenuClickForest, /* 23 */ |
0 | 443 |
MenuClickMusicWindow, /* 24 */ |
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:
4337
diff
changeset
|
444 |
MenuClickNewspaper, /* 25 */ |
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:
4337
diff
changeset
|
445 |
MenuClickHelp, /* 26 */ |
0 | 446 |
}; |
447 |
||
448 |
static void MenuWndProc(Window *w, WindowEvent *e) |
|
449 |
{ |
|
2639 | 450 |
switch (e->event) { |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
451 |
case WE_CREATE: w->widget[0].right = w->width - 1; break; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
452 |
|
0 | 453 |
case WE_PAINT: { |
4822
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
454 |
int x, y; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
455 |
|
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
456 |
byte count = WP(w, menu_d).item_count; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
457 |
byte sel = WP(w, menu_d).sel_index; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
458 |
uint16 chk = WP(w, menu_d).checked_items; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
459 |
StringID string = WP(w, menu_d).string_id; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
460 |
byte dis = WP(w, menu_d).disabled_items; |
0 | 461 |
|
462 |
DrawWindowWidgets(w); |
|
463 |
||
464 |
x = 1; |
|
465 |
y = 1; |
|
466 |
||
4822
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
467 |
for (; count != 0; count--, string++, sel--) { |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
468 |
byte color = HASBIT(dis, 0) ? 14 : (sel == 0) ? 12 : 16; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
469 |
if (sel == 0) GfxFillRect(x, y, x + w->width - 3, y + 9, 0); |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
470 |
|
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
471 |
if (HASBIT(chk, 0)) DrawString(x + 2, y, STR_CHECKMARK, color); |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
472 |
DrawString(x + 2, y, string, color); |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
473 |
|
0 | 474 |
y += 10; |
475 |
chk >>= 1; |
|
4822
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
476 |
dis >>= 1; |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
477 |
} |
0 | 478 |
} break; |
479 |
||
480 |
case WE_DESTROY: { |
|
481 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
482 |
RaiseWindowWidget(v, WP(w,menu_d).main_button); |
0 | 483 |
SetWindowDirty(v); |
484 |
return; |
|
485 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
486 |
|
0 | 487 |
case WE_POPUPMENU_SELECT: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
488 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
0 | 489 |
int action_id; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
490 |
|
0 | 491 |
|
492 |
if (index < 0) { |
|
493 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
494 |
if (GetWidgetFromPos(w2, e->we.popupmenu.pt.x - w2->left, e->we.popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
0 | 495 |
index = WP(w,menu_d).sel_index; |
496 |
} |
|
497 |
||
498 |
action_id = WP(w,menu_d).action_id; |
|
499 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
500 |
|
4822
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
501 |
if (index >= 0) { |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
502 |
assert((uint)index <= lengthof(_menu_clicked_procs)); |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
503 |
_menu_clicked_procs[action_id](index); |
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
504 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
505 |
|
0 | 506 |
break; |
507 |
} |
|
2639 | 508 |
|
0 | 509 |
case WE_POPUPMENU_OVER: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
510 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
0 | 511 |
|
2639 | 512 |
if (index == -1 || index == WP(w,menu_d).sel_index) return; |
0 | 513 |
|
514 |
WP(w,menu_d).sel_index = index; |
|
515 |
SetWindowDirty(w); |
|
516 |
return; |
|
517 |
} |
|
518 |
} |
|
519 |
} |
|
520 |
||
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
521 |
/* Dynamic widget length determined by toolbar-string length. |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
522 |
* See PopupMainToolbMenu en MenuWndProc */ |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
523 |
static const Widget _menu_widgets[] = { |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
524 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 0, 0, 0, 0x0, STR_NULL}, |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
525 |
{ WIDGETS_END}, |
0 | 526 |
}; |
527 |
||
528 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
529 |
static const Widget _player_menu_widgets[] = { |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
530 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 240, 0, 81, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
531 |
{ WIDGETS_END}, |
0 | 532 |
}; |
533 |
||
534 |
||
535 |
static int GetPlayerIndexFromMenu(int index) |
|
536 |
{ |
|
537 |
if (index >= 0) { |
|
4171 | 538 |
const Player *p; |
2630 | 539 |
|
0 | 540 |
FOR_ALL_PLAYERS(p) { |
2639 | 541 |
if (p->is_active && --index < 0) return p->index; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
542 |
} |
0 | 543 |
} |
544 |
return -1; |
|
545 |
} |
|
546 |
||
547 |
static void UpdatePlayerMenuHeight(Window *w) |
|
548 |
{ |
|
4824
c49e6ffcb89a
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4822
diff
changeset
|
549 |
byte num = ActivePlayerCount(); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
550 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
551 |
/* Increase one to fit in PlayerList in the menu when in network */ |
2639 | 552 |
if (_networking && WP(w,menu_d).main_button == 9) num++; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
553 |
|
0 | 554 |
if (WP(w,menu_d).item_count != num) { |
555 |
WP(w,menu_d).item_count = num; |
|
556 |
SetWindowDirty(w); |
|
557 |
num = num * 10 + 2; |
|
558 |
w->height = num; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
559 |
w->widget[0].bottom = w->widget[0].top + num - 1; |
0 | 560 |
SetWindowDirty(w); |
561 |
} |
|
562 |
} |
|
563 |
||
564 |
static void PlayerMenuWndProc(Window *w, WindowEvent *e) |
|
565 |
{ |
|
2639 | 566 |
switch (e->event) { |
0 | 567 |
case WE_PAINT: { |
568 |
int x,y; |
|
569 |
byte sel, color; |
|
570 |
Player *p; |
|
571 |
uint16 chk; |
|
572 |
||
573 |
UpdatePlayerMenuHeight(w); |
|
574 |
DrawWindowWidgets(w); |
|
575 |
||
576 |
x = 1; |
|
577 |
y = 1; |
|
578 |
sel = WP(w,menu_d).sel_index; |
|
579 |
chk = WP(w,menu_d).checked_items; // let this mean gray items. |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
580 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
581 |
/* 9 = playerlist */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
582 |
if (_networking && WP(w,menu_d).main_button == 9) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
583 |
if (sel == 0) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
584 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
585 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
586 |
DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, 0x0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
587 |
y += 10; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
588 |
sel--; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
589 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
590 |
|
0 | 591 |
FOR_ALL_PLAYERS(p) { |
592 |
if (p->is_active) { |
|
593 |
if (p->index == sel) { |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
594 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
0 | 595 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
596 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
597 |
DrawPlayerIcon(p->index, x + 2, y + 1); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
598 |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
599 |
SetDParam(0, p->name_1); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
600 |
SetDParam(1, p->name_2); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
601 |
SetDParam(2, GetPlayerNameString(p->index, 3)); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
602 |
|
2150
f710b959b1c4
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2147
diff
changeset
|
603 |
color = (p->index == sel) ? 0xC : 0x10; |
0 | 604 |
if (chk&1) color = 14; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
605 |
DrawString(x + 19, y, STR_7021, color); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
606 |
|
0 | 607 |
y += 10; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
608 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
609 |
chk >>= 1; |
0 | 610 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
611 |
|
0 | 612 |
break; |
613 |
} |
|
614 |
||
615 |
case WE_DESTROY: { |
|
616 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
617 |
RaiseWindowWidget(v, WP(w,menu_d).main_button); |
0 | 618 |
SetWindowDirty(v); |
619 |
return; |
|
620 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
621 |
|
0 | 622 |
case WE_POPUPMENU_SELECT: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
623 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
0 | 624 |
int action_id = WP(w,menu_d).action_id; |
625 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
626 |
/* We have a new entry at the top of the list of menu 9 when networking |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
627 |
* so keep that in count */ |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
628 |
if (_networking && WP(w,menu_d).main_button == 9) { |
2639 | 629 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
630 |
} else { |
|
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
631 |
index = GetPlayerIndexFromMenu(index); |
2639 | 632 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
633 |
|
0 | 634 |
if (index < 0) { |
635 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
636 |
if (GetWidgetFromPos(w2, e->we.popupmenu.pt.x - w2->left, e->we.popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
0 | 637 |
index = WP(w,menu_d).sel_index; |
638 |
} |
|
639 |
||
640 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
641 |
|
0 | 642 |
if (index >= 0) { |
643 |
assert(index >= 0 && index < 30); |
|
644 |
_menu_clicked_procs[action_id](index); |
|
645 |
} |
|
646 |
break; |
|
647 |
} |
|
648 |
case WE_POPUPMENU_OVER: { |
|
649 |
int index; |
|
650 |
UpdatePlayerMenuHeight(w); |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
651 |
index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
652 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
653 |
/* We have a new entry at the top of the list of menu 9 when networking |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
654 |
* so keep that in count */ |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
655 |
if (_networking && WP(w,menu_d).main_button == 9) { |
2639 | 656 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
657 |
} else { |
|
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
658 |
index = GetPlayerIndexFromMenu(index); |
2639 | 659 |
} |
660 |
||
661 |
if (index == -1 || index == WP(w,menu_d).sel_index) return; |
|
0 | 662 |
|
663 |
WP(w,menu_d).sel_index = index; |
|
664 |
SetWindowDirty(w); |
|
665 |
return; |
|
666 |
} |
|
667 |
} |
|
668 |
} |
|
669 |
||
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
670 |
/** Get the maximum length of a given string in a string-list. This is an |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
671 |
* implicit string-list where the ID's are consecutive |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
672 |
* @param base_string StringID of the first string in the list |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
673 |
* @param count amount of StringID's in the list |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
674 |
* @return the length of the longest string */ |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
675 |
static int GetStringListMaxWidth(StringID base_string, byte count) |
0 | 676 |
{ |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
677 |
char buffer[512]; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
678 |
int width, max_width; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
679 |
byte i; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
680 |
|
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
681 |
max_width = 0; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
682 |
for (i = 0; i != count; i++) { |
4912
0f51b47cb983
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4907
diff
changeset
|
683 |
GetString(buffer, base_string + i, lastof(buffer)); |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
684 |
width = GetStringBoundingBox(buffer).width; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
685 |
if (width > max_width) max_width = width; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
686 |
} |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
687 |
|
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
688 |
return max_width; |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
689 |
} |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
690 |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
691 |
/** Show a general dropdown menu. The positioning of the dropdown menu |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
692 |
* defaults to the left side of the parent_button, eg the button that caused |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
693 |
* this window to appear. The only exceptions are when the right side of this |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
694 |
* dropdown would fall outside the main toolbar window, in that case it is |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
695 |
* aligned with the toolbar's right side. |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
696 |
* Since the disable-mask is only 8 bits right now, these dropdowns are |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
697 |
* restricted to 8 items max if any bits of disabled_mask are active. |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
698 |
* @param w Pointer to a window this dropdown menu belongs to. Has no effect |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
699 |
* whatsoever, only graphically for positioning. |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
700 |
* @param parent_button The widget identifier of the button that was clicked for |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
701 |
* this dropdown. The created dropdown then knows what button to raise (button) on |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
702 |
* action and whose function to execute (action). |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
703 |
* It is possible to appoint another button for an action event by setting the |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
704 |
* upper 8 bits of this parameter. If non is set, action is presumed to be the same |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
705 |
* as button. So<br> |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
706 |
* button bits 0 - 7 - widget clicked to get dropdown |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
707 |
* action bits 8 - 15 - function of widget to execute on select (defaults to bits 0 - 7) |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
708 |
* @param base_string The first StringID shown in the dropdown list. All others are |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
709 |
* consecutive indeces from the language file. XXX - fix? Use ingame-string tables? |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
710 |
* @param item_count Number of strings in the list, see previous parameter |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
711 |
* @param disabled_mask Bitmask of disabled strings in the list |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
712 |
* @return Return a pointer to the newly created dropdown window */ |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
713 |
static Window *PopupMainToolbMenu(Window *w, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask) |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
714 |
{ |
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
715 |
int width; |
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
716 |
int x = w->widget[GB(parent_button, 0, 8)].left; |
0 | 717 |
|
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
718 |
assert(disabled_mask == 0 || item_count <= 8); |
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
719 |
LowerWindowWidget(w, parent_button); |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
720 |
InvalidateWidget(w, parent_button); |
0 | 721 |
|
722 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
723 |
||
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
724 |
/* Extend the dropdown toolbar to the longest string in the list and |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
725 |
* also make sure the dropdown is fully visible within the window. |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
726 |
* x + w->left because x is supposed to be the offset of the toolbar-button |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
727 |
* we clicked on and w->left the toolbar window itself. So meaning that |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
728 |
* the default position is aligned with the left side of the clicked button */ |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
729 |
width = max(GetStringListMaxWidth(base_string, item_count) + 6, 140); |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
730 |
x = w->left + clamp(x, 0, w->width - width); // or alternatively '_screen.width - width' |
4820
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
731 |
|
dd69fb4c3fcd
(svn r6744) -Fix: Determine the length of the main toolbar dropdown list based
Darkvater
parents:
4781
diff
changeset
|
732 |
w = AllocateWindow(x, 22, width, item_count * 10 + 2, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets); |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
733 |
w->widget[0].bottom = item_count * 10 + 1; |
0 | 734 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
735 |
|
0 | 736 |
WP(w,menu_d).item_count = item_count; |
737 |
WP(w,menu_d).sel_index = 0; |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
738 |
WP(w,menu_d).main_button = GB(parent_button, 0, 8); |
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
739 |
WP(w,menu_d).action_id = (GB(parent_button, 8, 8) != 0) ? GB(parent_button, 8, 8) : parent_button; |
0 | 740 |
WP(w,menu_d).string_id = base_string; |
741 |
WP(w,menu_d).checked_items = 0; |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
742 |
WP(w,menu_d).disabled_items = disabled_mask; |
0 | 743 |
|
744 |
_popup_menu_active = true; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
745 |
|
541 | 746 |
SndPlayFx(SND_15_BEEP); |
0 | 747 |
return w; |
748 |
} |
|
749 |
||
750 |
static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
|
751 |
{ |
|
752 |
x += w->left; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
753 |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
754 |
LowerWindowWidget(w, main_button); |
0 | 755 |
InvalidateWidget(w, main_button); |
756 |
||
757 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
758 |
w = AllocateWindow(x, 0x16, 0xF1, 0x52, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets); |
|
759 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
|
760 |
WP(w,menu_d).item_count = 0; |
|
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
761 |
WP(w,menu_d).sel_index = (_local_player != PLAYER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0); |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
762 |
if (_networking && main_button == 9) { |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
763 |
if (_local_player != PLAYER_SPECTATOR) { |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
764 |
WP(w,menu_d).sel_index++; |
2639 | 765 |
} else { |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
766 |
/* Select client list by default for spectators */ |
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
767 |
WP(w,menu_d).sel_index = 0; |
2639 | 768 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
769 |
} |
0 | 770 |
WP(w,menu_d).action_id = main_button; |
771 |
WP(w,menu_d).main_button = main_button; |
|
772 |
WP(w,menu_d).checked_items = gray; |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
773 |
WP(w,menu_d).disabled_items = 0; |
0 | 774 |
_popup_menu_active = true; |
541 | 775 |
SndPlayFx(SND_15_BEEP); |
0 | 776 |
return w; |
777 |
} |
|
778 |
||
779 |
static void ToolbarSaveClick(Window *w) |
|
780 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
781 |
PopupMainToolbMenu(w, 3, STR_015C_SAVE_GAME, 4, 0); |
0 | 782 |
} |
783 |
||
784 |
static void ToolbarMapClick(Window *w) |
|
785 |
{ |
|
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
786 |
PopupMainToolbMenu(w, 4, STR_02DE_MAP_OF_WORLD, 4, 0); |
0 | 787 |
} |
788 |
||
789 |
static void ToolbarTownClick(Window *w) |
|
790 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
791 |
PopupMainToolbMenu(w, 5, STR_02BB_TOWN_DIRECTORY, 1, 0); |
0 | 792 |
} |
793 |
||
794 |
static void ToolbarSubsidiesClick(Window *w) |
|
795 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
796 |
PopupMainToolbMenu(w, 6, STR_02DD_SUBSIDIES, 1, 0); |
0 | 797 |
} |
798 |
||
799 |
static void ToolbarStationsClick(Window *w) |
|
800 |
{ |
|
801 |
PopupMainPlayerToolbMenu(w, 162, 7, 0); |
|
802 |
} |
|
803 |
||
804 |
static void ToolbarMoneyClick(Window *w) |
|
805 |
{ |
|
806 |
PopupMainPlayerToolbMenu(w, 191, 8, 0); |
|
807 |
} |
|
808 |
||
809 |
static void ToolbarPlayersClick(Window *w) |
|
810 |
{ |
|
811 |
PopupMainPlayerToolbMenu(w, 213, 9, 0); |
|
812 |
} |
|
813 |
||
814 |
static void ToolbarGraphsClick(Window *w) |
|
815 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
816 |
PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6, 0); |
0 | 817 |
} |
818 |
||
819 |
static void ToolbarLeagueClick(Window *w) |
|
820 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
821 |
PopupMainToolbMenu(w, 11, STR_015A_COMPANY_LEAGUE_TABLE, 2, 0); |
0 | 822 |
} |
823 |
||
824 |
static void ToolbarIndustryClick(Window *w) |
|
825 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
826 |
/* Disable build-industry menu if we are a spectator */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
827 |
PopupMainToolbMenu(w, 12, STR_INDUSTRY_DIR, 2, (_current_player == PLAYER_SPECTATOR) ? (1 << 1) : 0); |
0 | 828 |
} |
829 |
||
830 |
static void ToolbarTrainClick(Window *w) |
|
831 |
{ |
|
4171 | 832 |
const Vehicle *v; |
0 | 833 |
int dis = -1; |
2639 | 834 |
|
835 |
FOR_ALL_VEHICLES(v) { |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
836 |
if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner); |
2639 | 837 |
} |
0 | 838 |
PopupMainPlayerToolbMenu(w, 310, 13, dis); |
839 |
} |
|
840 |
||
841 |
static void ToolbarRoadClick(Window *w) |
|
842 |
{ |
|
4171 | 843 |
const Vehicle *v; |
0 | 844 |
int dis = -1; |
2639 | 845 |
|
846 |
FOR_ALL_VEHICLES(v) { |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
847 |
if (v->type == VEH_ROAD) CLRBIT(dis, v->owner); |
2639 | 848 |
} |
0 | 849 |
PopupMainPlayerToolbMenu(w, 332, 14, dis); |
850 |
} |
|
851 |
||
852 |
static void ToolbarShipClick(Window *w) |
|
853 |
{ |
|
4171 | 854 |
const Vehicle *v; |
0 | 855 |
int dis = -1; |
2639 | 856 |
|
857 |
FOR_ALL_VEHICLES(v) { |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
858 |
if (v->type == VEH_SHIP) CLRBIT(dis, v->owner); |
2639 | 859 |
} |
0 | 860 |
PopupMainPlayerToolbMenu(w, 354, 15, dis); |
861 |
} |
|
862 |
||
863 |
static void ToolbarAirClick(Window *w) |
|
864 |
{ |
|
4171 | 865 |
const Vehicle *v; |
0 | 866 |
int dis = -1; |
2639 | 867 |
|
868 |
FOR_ALL_VEHICLES(v) { |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
869 |
if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner); |
2639 | 870 |
} |
0 | 871 |
PopupMainPlayerToolbMenu(w, 376, 16, dis); |
872 |
} |
|
873 |
||
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
874 |
/* Zooms a viewport in a window in or out */ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
875 |
/* No button handling or what so ever */ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
876 |
bool DoZoomInOutWindow(int how, Window *w) |
0 | 877 |
{ |
878 |
ViewPort *vp; |
|
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
879 |
|
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
880 |
assert(w != NULL); |
0 | 881 |
vp = w->viewport; |
882 |
||
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
883 |
switch (how) { |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
884 |
case ZOOM_IN: |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
885 |
if (vp->zoom == ZOOM_LVL_MIN) return false; |
6624
880e29b1f25e
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6591
diff
changeset
|
886 |
vp->zoom = (ZoomLevel)((byte)vp->zoom - 1); |
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
887 |
vp->virtual_width >>= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
888 |
vp->virtual_height >>= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
889 |
|
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
890 |
WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
891 |
WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
892 |
break; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
893 |
case ZOOM_OUT: |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
894 |
if (vp->zoom == ZOOM_LVL_MAX) return false; |
6624
880e29b1f25e
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6591
diff
changeset
|
895 |
vp->zoom = (ZoomLevel)((byte)vp->zoom + 1); |
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
896 |
|
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
897 |
WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
898 |
WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
899 |
|
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
900 |
vp->virtual_width <<= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
901 |
vp->virtual_height <<= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
902 |
break; |
0 | 903 |
} |
5214
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
904 |
if (vp != NULL) { // the vp can be null when how == ZOOM_NONE |
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
905 |
vp->virtual_left = WP(w, vp_d).scrollpos_x; |
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
906 |
vp->virtual_top = WP(w, vp_d).scrollpos_y; |
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
907 |
} |
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
908 |
SetWindowDirty(w); |
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
909 |
/* Update the windows that have zoom-buttons to perhaps disable their buttons */ |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
910 |
SendWindowMessageClass(w->window_class, how, w->window_number, 0); |
0 | 911 |
return true; |
912 |
} |
|
913 |
||
914 |
static void ToolbarZoomInClick(Window *w) |
|
915 |
{ |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
916 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 917 |
HandleButtonClick(w, 17); |
541 | 918 |
SndPlayFx(SND_15_BEEP); |
0 | 919 |
} |
920 |
} |
|
921 |
||
922 |
static void ToolbarZoomOutClick(Window *w) |
|
923 |
{ |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
924 |
if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 925 |
HandleButtonClick(w, 18); |
541 | 926 |
SndPlayFx(SND_15_BEEP); |
0 | 927 |
} |
928 |
} |
|
929 |
||
930 |
static void ToolbarBuildRailClick(Window *w) |
|
931 |
{ |
|
4171 | 932 |
const Player *p = GetPlayer(_local_player); |
0 | 933 |
Window *w2; |
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
934 |
w2 = PopupMainToolbMenu(w, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes); |
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
935 |
WP(w2, menu_d).sel_index = _last_built_railtype; |
0 | 936 |
} |
937 |
||
938 |
static void ToolbarBuildRoadClick(Window *w) |
|
939 |
{ |
|
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
940 |
Window *w2 = PopupMainToolbMenu(w, 20, STR_180A_ROAD_CONSTRUCTION, 1, 0); |
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
941 |
WP(w2, menu_d).sel_index = _last_built_roadtype; |
0 | 942 |
} |
943 |
||
944 |
static void ToolbarBuildWaterClick(Window *w) |
|
945 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
946 |
PopupMainToolbMenu(w, 21, STR_9800_DOCK_CONSTRUCTION, 1, 0); |
0 | 947 |
} |
948 |
||
949 |
static void ToolbarBuildAirClick(Window *w) |
|
950 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
951 |
PopupMainToolbMenu(w, 22, STR_A01D_AIRPORT_CONSTRUCTION, 1, 0); |
0 | 952 |
} |
953 |
||
954 |
static void ToolbarForestClick(Window *w) |
|
955 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
956 |
PopupMainToolbMenu(w, 23, STR_LANDSCAPING, 3, 0); |
0 | 957 |
} |
958 |
||
959 |
static void ToolbarMusicClick(Window *w) |
|
960 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
961 |
PopupMainToolbMenu(w, 24, STR_01D3_SOUND_MUSIC, 1, 0); |
0 | 962 |
} |
963 |
||
964 |
static void ToolbarNewspaperClick(Window *w) |
|
965 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
966 |
PopupMainToolbMenu(w, 25, STR_0200_LAST_MESSAGE_NEWS_REPORT, 3, 0); |
0 | 967 |
} |
968 |
||
969 |
static void ToolbarHelpClick(Window *w) |
|
970 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
971 |
PopupMainToolbMenu(w, 26, STR_02D5_LAND_BLOCK_INFO, 6, 0); |
0 | 972 |
} |
973 |
||
974 |
static void ToolbarOptionsClick(Window *w) |
|
975 |
{ |
|
4822
cc1a5189d4d7
(svn r6746) -Codechange: Remove the need for double strings in "checkmarked" items. While
Darkvater
parents:
4821
diff
changeset
|
976 |
uint16 x = 0; |
0 | 977 |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
978 |
w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 13, 0); |
0 | 979 |
|
6591
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
980 |
if (HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) SETBIT(x, 5); |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
981 |
if (HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x, 6); |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
982 |
if (HASBIT(_display_opt, DO_SHOW_SIGNS)) SETBIT(x, 7); |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
983 |
if (HASBIT(_display_opt, DO_WAYPOINTS)) SETBIT(x, 8); |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
984 |
if (HASBIT(_display_opt, DO_FULL_ANIMATION)) SETBIT(x, 9); |
514c1a22e10e
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
peter1138
parents:
6494
diff
changeset
|
985 |
if (HASBIT(_display_opt, DO_FULL_DETAIL)) SETBIT(x, 10); |
6494
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
986 |
if (GB(_transparent_opt, 1, 7) != 0) SETBIT(x, 11); |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
987 |
if (HASBIT(_transparent_opt, TO_SIGNS)) SETBIT(x, 12); |
0 | 988 |
WP(w,menu_d).checked_items = x; |
989 |
} |
|
990 |
||
991 |
||
992 |
static void ToolbarScenSaveOrLoad(Window *w) |
|
993 |
{ |
|
5894
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
994 |
PopupMainToolbMenu(w, 3, STR_0292_SAVE_SCENARIO, 6, 0); |
0 | 995 |
} |
996 |
||
997 |
static void ToolbarScenDateBackward(Window *w) |
|
998 |
{ |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
999 |
/* don't allow too fast scrolling */ |
0 | 1000 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
1001 |
HandleButtonClick(w, 6); |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1002 |
SetWindowDirty(w); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1003 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1004 |
_patches_newgame.starting_year = clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1005 |
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
0 | 1006 |
} |
1007 |
_left_button_clicked = false; |
|
1008 |
} |
|
1009 |
||
1010 |
static void ToolbarScenDateForward(Window *w) |
|
1011 |
{ |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1012 |
/* don't allow too fast scrolling */ |
0 | 1013 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
1014 |
HandleButtonClick(w, 7); |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1015 |
SetWindowDirty(w); |
0 | 1016 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1017 |
_patches_newgame.starting_year = clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1018 |
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
0 | 1019 |
} |
1020 |
_left_button_clicked = false; |
|
1021 |
} |
|
1022 |
||
1023 |
static void ToolbarScenMapTownDir(Window *w) |
|
1024 |
{ |
|
4821
71d1da6c6f03
(svn r6745) -Codechange: Have the dropdown menus fall fully inside the top toolbar. So
Darkvater
parents:
4820
diff
changeset
|
1025 |
/* Scenario editor button, *hack*hack* use different button to activate */ |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
1026 |
PopupMainToolbMenu(w, 8 | (17 << 8), STR_02DE_MAP_OF_WORLD, 5, 0); |
0 | 1027 |
} |
1028 |
||
1029 |
static void ToolbarScenZoomIn(Window *w) |
|
1030 |
{ |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
1031 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 1032 |
HandleButtonClick(w, 9); |
541 | 1033 |
SndPlayFx(SND_15_BEEP); |
0 | 1034 |
} |
1035 |
} |
|
1036 |
||
1037 |
static void ToolbarScenZoomOut(Window *w) |
|
1038 |
{ |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
1039 |
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 1040 |
HandleButtonClick(w, 10); |
541 | 1041 |
SndPlayFx(SND_15_BEEP); |
0 | 1042 |
} |
1043 |
} |
|
1044 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1045 |
void ZoomInOrOutToCursorWindow(bool in, Window *w) |
0 | 1046 |
{ |
4171 | 1047 |
ViewPort *vp; |
0 | 1048 |
Point pt; |
1049 |
||
1050 |
assert(w != 0); |
|
1051 |
||
1052 |
vp = w->viewport; |
|
1053 |
||
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
1054 |
if (_game_mode != GM_MENU) { |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
1055 |
if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX)) |
0 | 1056 |
return; |
1057 |
||
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
1058 |
pt = GetTileZoomCenterWindow(in,w); |
0 | 1059 |
if (pt.x != -1) { |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
1060 |
ScrollWindowTo(pt.x, pt.y, w); |
0 | 1061 |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
1062 |
DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w); |
0 | 1063 |
} |
1064 |
} |
|
1065 |
} |
|
1066 |
||
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1067 |
/** |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1068 |
* Raise/Lower a bigger chunk of land at the same time in the editor. When |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1069 |
* raising get the lowest point, when lowering the highest point, and set all |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1070 |
* tiles in the selection to that height. |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1071 |
* @todo : Incorporate into game itself to allow for ingame raising/lowering of |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1072 |
* larger chunks at the same time OR remove altogether, as we have 'level land' ? |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1073 |
* @param tile The top-left tile where the terraforming will start |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1074 |
* @param mode 1 for raising, 0 for lowering land |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1075 |
*/ |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1076 |
static void CommonRaiseLowerBigLand(TileIndex tile, int mode) |
0 | 1077 |
{ |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1078 |
int sizex, sizey; |
5601
d58f82901b2f
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents:
5587
diff
changeset
|
1079 |
uint h; |
0 | 1080 |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1081 |
_generating_world = true; // used to create green terraformed land |
0 | 1082 |
|
1083 |
if (_terraform_size == 1) { |
|
3182
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1084 |
StringID msg = |
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1085 |
mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE; |
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1086 |
|
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1087 |
DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(msg)); |
0 | 1088 |
} else { |
541 | 1089 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1090 |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1091 |
assert(_terraform_size != 0); |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1092 |
/* check out for map overflows */ |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1093 |
sizex = min(MapSizeX() - TileX(tile) - 1, _terraform_size); |
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1094 |
sizey = min(MapSizeY() - TileY(tile) - 1, _terraform_size); |
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1095 |
|
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1096 |
if (sizex == 0 || sizey == 0) return; |
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1097 |
|
0 | 1098 |
if (mode != 0) { |
1099 |
/* Raise land */ |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1100 |
h = 15; // XXX - max height |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1101 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1102 |
h = min(h, TileHeight(tile2)); |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1103 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1104 |
} else { |
1105 |
/* Lower land */ |
|
1106 |
h = 0; |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1107 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1108 |
h = max(h, TileHeight(tile2)); |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1109 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1110 |
} |
1111 |
||
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1112 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
63e0601a43cc
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1113 |
if (TileHeight(tile2) == h) { |
0 | 1114 |
DoCommandP(tile2, 8, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO); |
1115 |
} |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1116 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1117 |
} |
1118 |
||
1119 |
_generating_world = false; |
|
1120 |
} |
|
1121 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1122 |
static void PlaceProc_RaiseBigLand(TileIndex tile) |
0 | 1123 |
{ |
1124 |
CommonRaiseLowerBigLand(tile, 1); |
|
1125 |
} |
|
1126 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1127 |
static void PlaceProc_LowerBigLand(TileIndex tile) |
0 | 1128 |
{ |
1129 |
CommonRaiseLowerBigLand(tile, 0); |
|
1130 |
} |
|
1131 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1132 |
static void PlaceProc_RockyArea(TileIndex tile) |
0 | 1133 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1134 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS); |
0 | 1135 |
} |
1136 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1137 |
static void PlaceProc_LightHouse(TileIndex tile) |
0 | 1138 |
{ |
3636
a36cc46e754d
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
3622
diff
changeset
|
1139 |
if (!IsTileType(tile, MP_CLEAR) || IsSteepSlope(GetTileSlope(tile, NULL))) { |
0 | 1140 |
return; |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1141 |
} |
0 | 1142 |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1143 |
MakeLighthouse(tile); |
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1144 |
MarkTileDirtyByTile(tile); |
541 | 1145 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1146 |
} |
1147 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1148 |
static void PlaceProc_Transmitter(TileIndex tile) |
0 | 1149 |
{ |
3636
a36cc46e754d
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents:
3622
diff
changeset
|
1150 |
if (!IsTileType(tile, MP_CLEAR) || IsSteepSlope(GetTileSlope(tile, NULL))) { |
0 | 1151 |
return; |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1152 |
} |
0 | 1153 |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1154 |
MakeTransmitter(tile); |
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1155 |
MarkTileDirtyByTile(tile); |
541 | 1156 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1157 |
} |
1158 |
||
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1159 |
static void PlaceProc_DesertArea(TileIndex tile) |
0 | 1160 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1161 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT); |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1162 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1163 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1164 |
static void PlaceProc_WaterArea(TileIndex tile) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1165 |
{ |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1166 |
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_WATER); |
0 | 1167 |
} |
1168 |
||
1169 |
static const Widget _scen_edit_land_gen_widgets[] = { |
|
2725
775e3e14ca46
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2676
diff
changeset
|
1170 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1171 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0223_LAND_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1172 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 170, 181, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
5890
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1173 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 181, 14, 102, 0x0, STR_NULL}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1174 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 23, 16, 37, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1175 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 24, 45, 16, 37, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1176 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 46, 67, 16, 37, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_LAND}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1177 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 68, 89, 16, 37, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1178 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 90, 111, 16, 37, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1179 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 112, 134, 16, 37, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1180 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 135, 157, 16, 37, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // XXX - dynamic |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1181 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 158, 179, 16, 37, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1182 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 139, 150, 45, 56, SPR_ARROW_UP, STR_0228_INCREASE_SIZE_OF_LAND_AREA}, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1183 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 139, 150, 58, 69, SPR_ARROW_DOWN, STR_0229_DECREASE_SIZE_OF_LAND_AREA}, |
5894
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
1184 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 24, 157, 76, 87, STR_SE_NEW_WORLD, STR_022A_GENERATE_RANDOM_LAND}, |
afbd6aea0d56
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater
parents:
5893
diff
changeset
|
1185 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 24, 157, 89, 100, STR_022B_RESET_LANDSCAPE, STR_RESET_LANDSCAPE_TOOLTIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1186 |
{ WIDGETS_END}, |
0 | 1187 |
}; |
1188 |
||
1189 |
static const int8 _multi_terraform_coords[][2] = { |
|
1190 |
{ 0, -2}, |
|
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:
4337
diff
changeset
|
1191 |
{ 4, 0}, { -4, 0}, { 0, 2}, |
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:
4337
diff
changeset
|
1192 |
{ -8, 2}, { -4, 4}, { 0, 6}, { 4, 4}, { 8, 2}, |
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:
4337
diff
changeset
|
1193 |
{-12, 0}, { -8, -2}, { -4, -4}, { 0, -6}, { 4, -4}, { 8, -2}, { 12, 0}, |
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:
4337
diff
changeset
|
1194 |
{-16, 2}, {-12, 4}, { -8, 6}, { -4, 8}, { 0, 10}, { 4, 8}, { 8, 6}, { 12, 4}, { 16, 2}, |
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:
4337
diff
changeset
|
1195 |
{-20, 0}, {-16, -2}, {-12, -4}, { -8, -6}, { -4, -8}, { 0,-10}, { 4, -8}, { 8, -6}, { 12, -4}, { 16, -2}, { 20, 0}, |
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:
4337
diff
changeset
|
1196 |
{-24, 2}, {-20, 4}, {-16, 6}, {-12, 8}, { -8, 10}, { -4, 12}, { 0, 14}, { 4, 12}, { 8, 10}, { 12, 8}, { 16, 6}, { 20, 4}, { 24, 2}, |
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:
4337
diff
changeset
|
1197 |
{-28, 0}, {-24, -2}, {-20, -4}, {-16, -6}, {-12, -8}, { -8,-10}, { -4,-12}, { 0,-14}, { 4,-12}, { 8,-10}, { 12, -8}, { 16, -6}, { 20, -4}, { 24, -2}, { 28, 0}, |
0 | 1198 |
}; |
1199 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1200 |
/** |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1201 |
* @todo Merge with terraform_gui.cpp (move there) after I have cooled down at its braindeadness |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1202 |
* and changed OnButtonClick to include the widget as well in the function declaration. Post 0.4.0 - Darkvater |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1203 |
*/ |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1204 |
static void EditorTerraformClick_Dynamite(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1205 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1206 |
HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1207 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1208 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1209 |
static void EditorTerraformClick_LowerBigLand(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1210 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1211 |
HandlePlacePushButton(w, 5, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerBigLand); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1212 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1213 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1214 |
static void EditorTerraformClick_RaiseBigLand(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1215 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1216 |
HandlePlacePushButton(w, 6, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseBigLand); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1217 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1218 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1219 |
static void EditorTerraformClick_LevelLand(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1220 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1221 |
HandlePlacePushButton(w, 7, SPR_CURSOR_LEVEL_LAND, 2, PlaceProc_LevelLand); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1222 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1223 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1224 |
static void EditorTerraformClick_WaterArea(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1225 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1226 |
HandlePlacePushButton(w, 8, SPR_CURSOR_CANAL, 1, PlaceProc_WaterArea); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1227 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1228 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1229 |
static void EditorTerraformClick_RockyArea(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1230 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1231 |
HandlePlacePushButton(w, 9, SPR_CURSOR_ROCKY_AREA, 1, PlaceProc_RockyArea); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1232 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1233 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1234 |
static void EditorTerraformClick_DesertLightHouse(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1235 |
{ |
6357
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6259
diff
changeset
|
1236 |
HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse); |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1237 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1238 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1239 |
static void EditorTerraformClick_Transmitter(Window *w) |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1240 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1241 |
HandlePlacePushButton(w, 11, SPR_CURSOR_TRANSMITTER, 1, PlaceProc_Transmitter); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1242 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1243 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1244 |
static const uint16 _editor_terraform_keycodes[] = { |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1245 |
'D', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1246 |
'Q', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1247 |
'W', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1248 |
'E', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1249 |
'R', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1250 |
'T', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1251 |
'Y', |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1252 |
'U' |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1253 |
}; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1254 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1255 |
typedef void OnButtonClick(Window *w); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1256 |
static OnButtonClick * const _editor_terraform_button_proc[] = { |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1257 |
EditorTerraformClick_Dynamite, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1258 |
EditorTerraformClick_LowerBigLand, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1259 |
EditorTerraformClick_RaiseBigLand, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1260 |
EditorTerraformClick_LevelLand, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1261 |
EditorTerraformClick_WaterArea, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1262 |
EditorTerraformClick_RockyArea, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1263 |
EditorTerraformClick_DesertLightHouse, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1264 |
EditorTerraformClick_Transmitter |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1265 |
}; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1266 |
|
5890
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1267 |
|
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1268 |
/** Callback function for the scenario editor 'reset landscape' confirmation window |
6481
85ad87daf4b0
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6449
diff
changeset
|
1269 |
* @param w Window unused |
85ad87daf4b0
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6449
diff
changeset
|
1270 |
* @param confirmed boolean value, true when yes was clicked, false otherwise */ |
5890
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1271 |
static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1272 |
{ |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1273 |
if (confirmed) { |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1274 |
Player *p; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1275 |
|
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1276 |
/* Set generating_world to true to get instant-green grass after removing |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1277 |
* player property. */ |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1278 |
_generating_world = true; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1279 |
/* Delete all players */ |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1280 |
FOR_ALL_PLAYERS(p) { |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1281 |
if (p->is_active) { |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1282 |
ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR); |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1283 |
p->is_active = false; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1284 |
} |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1285 |
} |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1286 |
_generating_world = false; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1287 |
|
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1288 |
/* Delete all stations owned by a player */ |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1289 |
Station *st; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1290 |
FOR_ALL_STATIONS(st) { |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1291 |
if (IsValidPlayer(st->owner)) delete st; |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1292 |
} |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1293 |
} |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1294 |
} |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1295 |
|
0 | 1296 |
static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) |
1297 |
{ |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1298 |
switch (e->event) { |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1299 |
case WE_CREATE: |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1300 |
/* XXX - lighthouse button is widget 10!! Don't forget when changing */ |
6357
f0f5e7d1713c
(svn r9400) -Codechange: Use some more representative enum names for landscape types.
belugas
parents:
6259
diff
changeset
|
1301 |
w->widget[10].tooltips = (_opt.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1302 |
break; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1303 |
|
0 | 1304 |
case WE_PAINT: |
1305 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1306 |
|
0 | 1307 |
{ |
1308 |
int n = _terraform_size * _terraform_size; |
|
1309 |
const int8 *coords = &_multi_terraform_coords[0][0]; |
|
1310 |
||
1311 |
assert(n != 0); |
|
1312 |
do { |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
1313 |
DrawSprite(SPR_WHITE_POINT, PAL_NONE, 77 + coords[0], 55 + coords[1]); |
0 | 1314 |
coords += 2; |
1315 |
} while (--n); |
|
1316 |
} |
|
1317 |
||
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1318 |
if (IsWindowWidgetLowered(w, 5) || IsWindowWidgetLowered(w, 6)) // change area-size if raise/lower corner is selected |
0 | 1319 |
SetTileSelectSize(_terraform_size, _terraform_size); |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1320 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1321 |
break; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1322 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1323 |
case WE_KEYPRESS: { |
2639 | 1324 |
uint i; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1325 |
|
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1326 |
for (i = 0; i != lengthof(_editor_terraform_keycodes); i++) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1327 |
if (e->we.keypress.keycode == _editor_terraform_keycodes[i]) { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1328 |
e->we.keypress.cont = false; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1329 |
_editor_terraform_button_proc[i](w); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1330 |
break; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1331 |
} |
0 | 1332 |
} |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1333 |
} break; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1334 |
|
0 | 1335 |
case WE_CLICK: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1336 |
switch (e->we.click.widget) { |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1337 |
case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1338 |
_editor_terraform_button_proc[e->we.click.widget - 4](w); |
0 | 1339 |
break; |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1340 |
case 12: case 13: { // Increase/Decrease terraform size |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1341 |
int size = (e->we.click.widget == 12) ? 1 : -1; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1342 |
HandleButtonClick(w, e->we.click.widget); |
0 | 1343 |
size += _terraform_size; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1344 |
|
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4429
diff
changeset
|
1345 |
if (!IS_INT_INSIDE(size, 1, 8 + 1)) return; |
0 | 1346 |
_terraform_size = size; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1347 |
|
541 | 1348 |
SndPlayFx(SND_15_BEEP); |
0 | 1349 |
SetWindowDirty(w); |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1350 |
} break; |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1351 |
case 14: // gen random land |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1352 |
HandleButtonClick(w, 14); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1353 |
ShowCreateScenario(); |
0 | 1354 |
break; |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1355 |
case 15: // Reset landscape |
5890
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1356 |
ShowQuery( |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1357 |
STR_022C_RESET_LANDSCAPE, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1358 |
STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1359 |
NULL, |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1360 |
ResetLandscapeConfirmationCallback); |
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1361 |
break; |
0 | 1362 |
} |
1363 |
break; |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1364 |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1365 |
case WE_TIMEOUT: { |
5235
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5214
diff
changeset
|
1366 |
uint i; |
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5214
diff
changeset
|
1367 |
for (i = 0; i < w->widget_count; i++) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1368 |
if (IsWindowWidgetLowered(w, i)) { |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1369 |
RaiseWindowWidget(w, i); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1370 |
InvalidateWidget(w, i); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1371 |
} |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1372 |
if (i == 3) i = 11; |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1373 |
} |
0 | 1374 |
break; |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1375 |
} |
0 | 1376 |
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:
4548
diff
changeset
|
1377 |
_place_proc(e->we.place.tile); |
0 | 1378 |
break; |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1379 |
case WE_PLACE_DRAG: |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6666
diff
changeset
|
1380 |
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method); |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1381 |
break; |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1382 |
|
0 | 1383 |
case WE_PLACE_MOUSEUP: |
4994
aec94128f5d5
(svn r7000) -Fix: Incorrect use of e->we.click when the event is a 'place'. This didn't cause any
Darkvater
parents:
4942
diff
changeset
|
1384 |
if (e->we.place.pt.x != -1) { |
6670
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1385 |
switch (e->we.place.select_proc) { |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1386 |
case DDSP_CREATE_ROCKS: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1387 |
case DDSP_CREATE_DESERT: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1388 |
case DDSP_CREATE_WATER: |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1389 |
GUIPlaceProcDragXY(e); |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1390 |
break; |
f0300bf50643
(svn r9901) -Codechange: Decide what to do with selected land areas based on the specific variable, not how it was highlighted.
maedhros
parents:
6669
diff
changeset
|
1391 |
} |
0 | 1392 |
} |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1393 |
break; |
0 | 1394 |
|
1395 |
case WE_ABORT_PLACE_OBJ: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1396 |
RaiseWindowButtons(w); |
0 | 1397 |
SetWindowDirty(w); |
1398 |
break; |
|
1399 |
} |
|
1400 |
} |
|
1401 |
||
1402 |
static const WindowDesc _scen_edit_land_gen_desc = { |
|
5890
a5ba89d7f278
(svn r8507) -Codechange/Feature: Don't remove player-owned property on-load in the scenario editor. Add a button to the landscape window to do this.
Darkvater
parents:
5750
diff
changeset
|
1403 |
WDP_AUTO, WDP_AUTO, 182, 103, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1404 |
WC_SCEN_LAND_GEN, WC_NONE, |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1405 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1406 |
_scen_edit_land_gen_widgets, |
1407 |
ScenEditLandGenWndProc, |
|
1408 |
}; |
|
1409 |
||
6247 | 1410 |
static inline void ShowEditorTerraformToolBar() |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1411 |
{ |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1412 |
AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0); |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1413 |
} |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1414 |
|
0 | 1415 |
static void ToolbarScenGenLand(Window *w) |
1416 |
{ |
|
1417 |
HandleButtonClick(w, 11); |
|
541 | 1418 |
SndPlayFx(SND_15_BEEP); |
0 | 1419 |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1420 |
ShowEditorTerraformToolBar(); |
0 | 1421 |
} |
1422 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1423 |
void CcBuildTown(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 1424 |
{ |
1425 |
if (success) { |
|
541 | 1426 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1427 |
ResetObjectToPlace(); |
1428 |
} |
|
1429 |
} |
|
1430 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1431 |
static void PlaceProc_Town(TileIndex tile) |
0 | 1432 |
{ |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1433 |
uint32 size = min(_scengen_town_size, (int)TSM_CITY); |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1434 |
uint32 mode = _scengen_town_size > TSM_CITY ? TSM_CITY : TSM_FIXED; |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1435 |
DoCommandP(tile, size, mode, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE)); |
0 | 1436 |
} |
1437 |
||
1438 |
||
1439 |
static const Widget _scen_edit_town_gen_widgets[] = { |
|
2725
775e3e14ca46
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2676
diff
changeset
|
1440 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1441 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_0233_TOWN_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1442 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 148, 159, 0, 13, 0x0, STR_STICKY_BUTTON}, |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1443 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 159, 14, 94, 0x0, STR_NULL}, |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1444 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 16, 27, STR_0234_NEW_TOWN, STR_0235_CONSTRUCT_NEW_TOWN}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1445 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 29, 40, STR_023D_RANDOM_TOWN, STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1446 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 42, 53, STR_MANY_RANDOM_TOWNS, STR_RANDOM_TOWNS_TIP}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1447 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 53, 68, 79, STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1448 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 54, 105, 68, 79, STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE}, |
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1449 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 106, 157, 68, 79, STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE}, |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1450 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 81, 92, STR_SCENARIO_EDITOR_CITY, STR_02A4_SELECT_TOWN_SIZE}, |
4345
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
1451 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 54, 67, STR_02A5_TOWN_SIZE, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1452 |
{ WIDGETS_END}, |
0 | 1453 |
}; |
1454 |
||
1455 |
static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) |
|
1456 |
{ |
|
2639 | 1457 |
switch (e->event) { |
0 | 1458 |
case WE_PAINT: |
1459 |
DrawWindowWidgets(w); |
|
1460 |
break; |
|
1461 |
||
3674
d6c991bdcbe1
(svn r4591) -Fix (FS#122) Game no longer errors out when "Many random towns" is selected in the scenario editor.
celestar
parents:
3636
diff
changeset
|
1462 |
case WE_CREATE: |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1463 |
LowerWindowWidget(w, _scengen_town_size + 7); |
3674
d6c991bdcbe1
(svn r4591) -Fix (FS#122) Game no longer errors out when "Many random towns" is selected in the scenario editor.
celestar
parents:
3636
diff
changeset
|
1464 |
break; |
d6c991bdcbe1
(svn r4591) -Fix (FS#122) Game no longer errors out when "Many random towns" is selected in the scenario editor.
celestar
parents:
3636
diff
changeset
|
1465 |
|
0 | 1466 |
case WE_CLICK: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1467 |
switch (e->we.click.widget) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1468 |
case 4: // new town |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1469 |
HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, 1, PlaceProc_Town); |
0 | 1470 |
break; |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1471 |
case 5: {// random town |
0 | 1472 |
Town *t; |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1473 |
uint size = min(_scengen_town_size, (int)TSM_CITY); |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1474 |
TownSizeMode mode = _scengen_town_size > TSM_CITY ? TSM_CITY : TSM_FIXED; |
0 | 1475 |
|
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1476 |
HandleButtonClick(w, 5); |
0 | 1477 |
_generating_world = true; |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1478 |
t = CreateRandomTown(20, mode, size); |
0 | 1479 |
_generating_world = false; |
2430
b8bb9d74253b
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
Darkvater
parents:
2429
diff
changeset
|
1480 |
|
b8bb9d74253b
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
Darkvater
parents:
2429
diff
changeset
|
1481 |
if (t == NULL) { |
b8bb9d74253b
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
Darkvater
parents:
2429
diff
changeset
|
1482 |
ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0); |
2639 | 1483 |
} else { |
0 | 1484 |
ScrollMainWindowToTile(t->xy); |
2639 | 1485 |
} |
2430
b8bb9d74253b
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
Darkvater
parents:
2429
diff
changeset
|
1486 |
|
0 | 1487 |
break; |
1488 |
} |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1489 |
case 6: {// many random towns |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1490 |
HandleButtonClick(w, 6); |
2430
b8bb9d74253b
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
Darkvater
parents:
2429
diff
changeset
|
1491 |
|
0 | 1492 |
_generating_world = true; |
3674
d6c991bdcbe1
(svn r4591) -Fix (FS#122) Game no longer errors out when "Many random towns" is selected in the scenario editor.
celestar
parents:
3636
diff
changeset
|
1493 |
if (!GenerateTowns()) ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0); |
0 | 1494 |
_generating_world = false; |
1495 |
break; |
|
1496 |
} |
|
1497 |
||
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1498 |
case 7: case 8: case 9: case 10: |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1499 |
RaiseWindowWidget(w, _scengen_town_size + 7); |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1500 |
_scengen_town_size = e->we.click.widget - 7; |
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1501 |
LowerWindowWidget(w, _scengen_town_size + 7); |
0 | 1502 |
SetWindowDirty(w); |
1503 |
break; |
|
1504 |
} |
|
1505 |
break; |
|
1506 |
||
1507 |
case WE_TIMEOUT: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1508 |
RaiseWindowWidget(w, 5); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1509 |
RaiseWindowWidget(w, 6); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1510 |
SetWindowDirty(w); |
0 | 1511 |
break; |
1512 |
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:
4548
diff
changeset
|
1513 |
_place_proc(e->we.place.tile); |
0 | 1514 |
break; |
1515 |
case WE_ABORT_PLACE_OBJ: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1516 |
RaiseWindowButtons(w); |
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1517 |
LowerWindowWidget(w, _scengen_town_size + 7); |
0 | 1518 |
SetWindowDirty(w); |
1519 |
break; |
|
1520 |
} |
|
1521 |
} |
|
1522 |
||
1523 |
static const WindowDesc _scen_edit_town_gen_desc = { |
|
6486
7d2ae0a167fb
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros
parents:
6481
diff
changeset
|
1524 |
WDP_AUTO, WDP_AUTO, 160, 95, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1525 |
WC_SCEN_TOWN_GEN, WC_NONE, |
1632
10c391e108b7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1526 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1527 |
_scen_edit_town_gen_widgets, |
1528 |
ScenEditTownGenWndProc, |
|
1529 |
}; |
|
1530 |
||
1531 |
static void ToolbarScenGenTown(Window *w) |
|
1532 |
{ |
|
1533 |
HandleButtonClick(w, 12); |
|
541 | 1534 |
SndPlayFx(SND_15_BEEP); |
0 | 1535 |
|
1536 |
AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0); |
|
1537 |
} |
|
1538 |
||
1539 |
||
1540 |
static const Widget _scenedit_industry_normal_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:
4337
diff
changeset
|
1541 |
{ 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:
4337
diff
changeset
|
1542 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1543 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
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:
4337
diff
changeset
|
1544 |
|
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:
4337
diff
changeset
|
1545 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_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:
4337
diff
changeset
|
1546 |
|
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:
4337
diff
changeset
|
1547 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
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:
4337
diff
changeset
|
1548 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_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:
4337
diff
changeset
|
1549 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL}, |
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:
4337
diff
changeset
|
1550 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
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:
4337
diff
changeset
|
1551 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
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:
4337
diff
changeset
|
1552 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0245_OIL_RIG, STR_0267_CONSTRUCT_OIL_RIG_CAN_ONLY}, |
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:
4337
diff
changeset
|
1553 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
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:
4337
diff
changeset
|
1554 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL}, |
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:
4337
diff
changeset
|
1555 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
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:
4337
diff
changeset
|
1556 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0249_IRON_ORE_MINE, STR_026B_CONSTRUCT_IRON_ORE_MINE}, |
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:
4337
diff
changeset
|
1557 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
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:
4337
diff
changeset
|
1558 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 185, 196, STR_024B_BANK, STR_026D_CONSTRUCT_BANK_CAN_ONLY}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1559 |
{ WIDGETS_END}, |
0 | 1560 |
}; |
1561 |
||
1562 |
||
1563 |
static const Widget _scenedit_industry_hilly_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:
4337
diff
changeset
|
1564 |
{ 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:
4337
diff
changeset
|
1565 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1566 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
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:
4337
diff
changeset
|
1567 |
|
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:
4337
diff
changeset
|
1568 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_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:
4337
diff
changeset
|
1569 |
|
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:
4337
diff
changeset
|
1570 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
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:
4337
diff
changeset
|
1571 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_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:
4337
diff
changeset
|
1572 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL}, |
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:
4337
diff
changeset
|
1573 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
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:
4337
diff
changeset
|
1574 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
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:
4337
diff
changeset
|
1575 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
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:
4337
diff
changeset
|
1576 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS}, |
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:
4337
diff
changeset
|
1577 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_024F_GOLD_MINE, STR_0271_CONSTRUCT_GOLD_MINE}, |
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:
4337
diff
changeset
|
1578 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
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:
4337
diff
changeset
|
1579 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
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:
4337
diff
changeset
|
1580 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1581 |
{ WIDGETS_END}, |
0 | 1582 |
}; |
1583 |
||
1584 |
static const Widget _scenedit_industry_desert_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:
4337
diff
changeset
|
1585 |
{ 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:
4337
diff
changeset
|
1586 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1587 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
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:
4337
diff
changeset
|
1588 |
|
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:
4337
diff
changeset
|
1589 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_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:
4337
diff
changeset
|
1590 |
|
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:
4337
diff
changeset
|
1591 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO}, |
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:
4337
diff
changeset
|
1592 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0251_FRUIT_PLANTATION, STR_0274_PLANT_FRUIT_PLANTATION}, |
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:
4337
diff
changeset
|
1593 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0252_RUBBER_PLANTATION, STR_0275_PLANT_RUBBER_PLANTATION}, |
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:
4337
diff
changeset
|
1594 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
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:
4337
diff
changeset
|
1595 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
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:
4337
diff
changeset
|
1596 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
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:
4337
diff
changeset
|
1597 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0253_WATER_SUPPLY, STR_0276_CONSTRUCT_WATER_SUPPLY}, |
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:
4337
diff
changeset
|
1598 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
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:
4337
diff
changeset
|
1599 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN}, |
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:
4337
diff
changeset
|
1600 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
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:
4337
diff
changeset
|
1601 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
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:
4337
diff
changeset
|
1602 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 185, 196, STR_0255_DIAMOND_MINE, STR_0278_CONSTRUCT_DIAMOND_MINE}, |
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:
4337
diff
changeset
|
1603 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 198, 209, STR_0256_COPPER_ORE_MINE, STR_0279_CONSTRUCT_COPPER_ORE_MINE}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1604 |
{ WIDGETS_END}, |
0 | 1605 |
}; |
1606 |
||
1607 |
static const Widget _scenedit_industry_candy_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:
4337
diff
changeset
|
1608 |
{ 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:
4337
diff
changeset
|
1609 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1610 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
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:
4337
diff
changeset
|
1611 |
|
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:
4337
diff
changeset
|
1612 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_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:
4337
diff
changeset
|
1613 |
|
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:
4337
diff
changeset
|
1614 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0257_COTTON_CANDY_FOREST, STR_027A_PLANT_COTTON_CANDY_FOREST}, |
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:
4337
diff
changeset
|
1615 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY}, |
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:
4337
diff
changeset
|
1616 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0259_BATTERY_FARM, STR_027C_CONSTRUCT_BATTERY_FARM}, |
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:
4337
diff
changeset
|
1617 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_025A_COLA_WELLS, STR_027D_CONSTRUCT_COLA_WELLS}, |
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:
4337
diff
changeset
|
1618 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP}, |
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:
4337
diff
changeset
|
1619 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY}, |
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:
4337
diff
changeset
|
1620 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_025D_PLASTIC_FOUNTAINS, STR_0280_CONSTRUCT_PLASTIC_FOUNTAINS}, |
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:
4337
diff
changeset
|
1621 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY}, |
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:
4337
diff
changeset
|
1622 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_025F_BUBBLE_GENERATOR, STR_0282_CONSTRUCT_BUBBLE_GENERATOR}, |
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:
4337
diff
changeset
|
1623 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0260_TOFFEE_QUARRY, STR_0283_CONSTRUCT_TOFFEE_QUARRY}, |
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:
4337
diff
changeset
|
1624 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_0261_SUGAR_MINE, STR_0284_CONSTRUCT_SUGAR_MINE}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1625 |
{ WIDGETS_END}, |
0 | 1626 |
}; |
1627 |
||
1628 |
||
6247 | 1629 |
static bool AnyTownExists() |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
1630 |
{ |
4171 | 1631 |
const Town *t; |
2630 | 1632 |
|
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4345
diff
changeset
|
1633 |
FOR_ALL_TOWNS(t) return true; |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4345
diff
changeset
|
1634 |
|
0 | 1635 |
return false; |
1636 |
} |
|
1637 |
||
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1638 |
extern Industry *CreateNewIndustry(TileIndex tile, IndustryType type); |
0 | 1639 |
|
5118
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1640 |
/** |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1641 |
* Search callback function for TryBuildIndustry |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1642 |
* @param tile to test |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1643 |
* @param data that is passed by the caller. In this case, the type of industry been tested |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1644 |
* @return the success (or not) of the operation |
5118
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1645 |
*/ |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1646 |
static bool SearchTileForIndustry(TileIndex tile, uint32 data) |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1647 |
{ |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1648 |
return CreateNewIndustry(tile, data) != NULL; |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1649 |
} |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1650 |
|
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1651 |
/** |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1652 |
* Perform a 9*9 tiles circular search around a tile |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1653 |
* in order to find a suitable zone to create the desired industry |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1654 |
* @param tile to start search for |
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1655 |
* @param type of the desired industry |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1656 |
* @return the success (or not) of the operation |
5118
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1657 |
*/ |
0 | 1658 |
static bool TryBuildIndustry(TileIndex tile, int type) |
1659 |
{ |
|
5118
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
5116
diff
changeset
|
1660 |
return CircularTileSearch(tile, 9, SearchTileForIndustry, type); |
0 | 1661 |
} |
1662 |
||
1663 |
||
1664 |
static const byte _industry_type_list[4][16] = { |
|
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:
4337
diff
changeset
|
1665 |
{ 0, 1, 2, 3, 4, 5, 6, 8, 9, 18, 11, 12}, |
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:
4337
diff
changeset
|
1666 |
{ 0, 1, 14, 3, 4, 13, 7, 15, 9, 16, 11, 12}, |
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:
4337
diff
changeset
|
1667 |
{25, 19, 20, 4, 13, 23, 21, 24, 22, 11, 16, 17, 10}, |
0 | 1668 |
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}, |
1669 |
}; |
|
1670 |
||
2630 | 1671 |
static int _industry_type_to_place; |
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1672 |
bool _ignore_restrictions; |
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1673 |
|
0 | 1674 |
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e) |
1675 |
{ |
|
1676 |
int button; |
|
1677 |
||
2952 | 1678 |
switch (e->event) { |
0 | 1679 |
case WE_PAINT: |
1680 |
DrawWindowWidgets(w); |
|
1681 |
break; |
|
1682 |
||
1683 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1684 |
if (e->we.click.widget == 3) { |
0 | 1685 |
HandleButtonClick(w, 3); |
1686 |
||
2639 | 1687 |
if (!AnyTownExists()) { |
1688 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_CAN_T_GENERATE_INDUSTRIES, 0, 0); |
|
1689 |
return; |
|
1690 |
} |
|
0 | 1691 |
|
1692 |
_generating_world = true; |
|
1693 |
GenerateIndustries(); |
|
1694 |
_generating_world = false; |
|
1695 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1696 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1697 |
if ((button=e->we.click.widget) >= 4) { |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
1698 |
if (HandlePlacePushButton(w, button, SPR_CURSOR_INDUSTRY, 1, NULL)) |
0 | 1699 |
_industry_type_to_place = _industry_type_list[_opt.landscape][button - 4]; |
1700 |
} |
|
1701 |
break; |
|
1702 |
case WE_PLACE_OBJ: { |
|
1703 |
int type; |
|
1704 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1705 |
/* Show error if no town exists at all */ |
0 | 1706 |
type = _industry_type_to_place; |
1707 |
if (!AnyTownExists()) { |
|
4942
7fb6c39eb421
(svn r6930) -Codechange: Move industry name into IndustrySpec
belugas
parents:
4938
diff
changeset
|
1708 |
SetDParam(0, GetIndustrySpec(type)->name); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1709 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
0 | 1710 |
return; |
1711 |
} |
|
1712 |
||
1713 |
_current_player = OWNER_NONE; |
|
1714 |
_generating_world = true; |
|
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1715 |
_ignore_restrictions = true; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1716 |
if (!TryBuildIndustry(e->we.place.tile,type)) { |
4942
7fb6c39eb421
(svn r6930) -Codechange: Move industry name into IndustrySpec
belugas
parents:
4938
diff
changeset
|
1717 |
SetDParam(0, GetIndustrySpec(type)->name); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1718 |
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->we.place.pt.x, e->we.place.pt.y); |
0 | 1719 |
} |
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1720 |
_ignore_restrictions = false; |
0 | 1721 |
_generating_world = false; |
1722 |
break; |
|
1723 |
} |
|
1724 |
case WE_ABORT_PLACE_OBJ: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1725 |
RaiseWindowButtons(w); |
0 | 1726 |
SetWindowDirty(w); |
1727 |
break; |
|
1728 |
case WE_TIMEOUT: |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1729 |
RaiseWindowWidget(w, 3); |
5354
a48fc9a710f5
(svn r7525) -Fix (r6631): Invalidate the widget of 'many random industries' when it is raised (Maedhros)
Darkvater
parents:
5352
diff
changeset
|
1730 |
InvalidateWidget(w, 3); |
0 | 1731 |
break; |
1732 |
} |
|
1733 |
} |
|
1734 |
||
1735 |
static const WindowDesc _scenedit_industry_normal_desc = { |
|
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5064
diff
changeset
|
1736 |
WDP_AUTO, WDP_AUTO, 170, 225, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1737 |
WC_SCEN_INDUSTRY, WC_NONE, |
0 | 1738 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1739 |
_scenedit_industry_normal_widgets, |
|
1740 |
ScenEditIndustryWndProc, |
|
1741 |
}; |
|
1742 |
||
1743 |
static const WindowDesc _scenedit_industry_hilly_desc = { |
|
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5064
diff
changeset
|
1744 |
WDP_AUTO, WDP_AUTO, 170, 225, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1745 |
WC_SCEN_INDUSTRY, WC_NONE, |
0 | 1746 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1747 |
_scenedit_industry_hilly_widgets, |
|
1748 |
ScenEditIndustryWndProc, |
|
1749 |
}; |
|
1750 |
||
1751 |
static const WindowDesc _scenedit_industry_desert_desc = { |
|
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5064
diff
changeset
|
1752 |
WDP_AUTO, WDP_AUTO, 170, 225, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1753 |
WC_SCEN_INDUSTRY, WC_NONE, |
0 | 1754 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1755 |
_scenedit_industry_desert_widgets, |
|
1756 |
ScenEditIndustryWndProc, |
|
1757 |
}; |
|
1758 |
||
1759 |
static const WindowDesc _scenedit_industry_candy_desc = { |
|
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5064
diff
changeset
|
1760 |
WDP_AUTO, WDP_AUTO, 170, 225, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1761 |
WC_SCEN_INDUSTRY, WC_NONE, |
0 | 1762 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1763 |
_scenedit_industry_candy_widgets, |
|
1764 |
ScenEditIndustryWndProc, |
|
1765 |
}; |
|
1766 |
||
1767 |
static const WindowDesc * const _scenedit_industry_descs[] = { |
|
1768 |
&_scenedit_industry_normal_desc, |
|
1769 |
&_scenedit_industry_hilly_desc, |
|
1770 |
&_scenedit_industry_desert_desc, |
|
1771 |
&_scenedit_industry_candy_desc, |
|
1772 |
}; |
|
1773 |
||
1774 |
||
1775 |
static void ToolbarScenGenIndustry(Window *w) |
|
1776 |
{ |
|
1777 |
HandleButtonClick(w, 13); |
|
541 | 1778 |
SndPlayFx(SND_15_BEEP); |
0 | 1779 |
AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0); |
1780 |
} |
|
1781 |
||
1782 |
static void ToolbarScenBuildRoad(Window *w) |
|
1783 |
{ |
|
1784 |
HandleButtonClick(w, 14); |
|
541 | 1785 |
SndPlayFx(SND_15_BEEP); |
0 | 1786 |
ShowBuildRoadScenToolbar(); |
1787 |
} |
|
1788 |
||
1789 |
static void ToolbarScenPlantTrees(Window *w) |
|
1790 |
{ |
|
1791 |
HandleButtonClick(w, 15); |
|
541 | 1792 |
SndPlayFx(SND_15_BEEP); |
0 | 1793 |
ShowBuildTreesScenToolbar(); |
1794 |
} |
|
1795 |
||
1796 |
static void ToolbarScenPlaceSign(Window *w) |
|
1797 |
{ |
|
1798 |
HandleButtonClick(w, 16); |
|
541 | 1799 |
SndPlayFx(SND_15_BEEP); |
0 | 1800 |
SelectSignTool(); |
1801 |
} |
|
1802 |
||
1803 |
static void ToolbarBtn_NULL(Window *w) |
|
1804 |
{ |
|
1805 |
} |
|
1806 |
||
2639 | 1807 |
|
1808 |
typedef void ToolbarButtonProc(Window *w); |
|
1809 |
||
4171 | 1810 |
static ToolbarButtonProc * const _toolbar_button_procs[] = { |
0 | 1811 |
ToolbarPauseClick, |
1812 |
ToolbarFastForwardClick, |
|
1813 |
ToolbarOptionsClick, |
|
1814 |
ToolbarSaveClick, |
|
1815 |
ToolbarMapClick, |
|
1816 |
ToolbarTownClick, |
|
1817 |
ToolbarSubsidiesClick, |
|
1818 |
ToolbarStationsClick, |
|
1819 |
ToolbarMoneyClick, |
|
1820 |
ToolbarPlayersClick, |
|
1821 |
ToolbarGraphsClick, |
|
1822 |
ToolbarLeagueClick, |
|
1823 |
ToolbarIndustryClick, |
|
1824 |
ToolbarTrainClick, |
|
1825 |
ToolbarRoadClick, |
|
1826 |
ToolbarShipClick, |
|
1827 |
ToolbarAirClick, |
|
1828 |
ToolbarZoomInClick, |
|
1829 |
ToolbarZoomOutClick, |
|
1830 |
ToolbarBuildRailClick, |
|
1831 |
ToolbarBuildRoadClick, |
|
1832 |
ToolbarBuildWaterClick, |
|
1833 |
ToolbarBuildAirClick, |
|
1834 |
ToolbarForestClick, |
|
1835 |
ToolbarMusicClick, |
|
1836 |
ToolbarNewspaperClick, |
|
1837 |
ToolbarHelpClick, |
|
1838 |
}; |
|
1839 |
||
1840 |
static void MainToolbarWndProc(Window *w, WindowEvent *e) |
|
1841 |
{ |
|
2952 | 1842 |
switch (e->event) { |
4781
3e0c04509b05
(svn r6695) -Fix FS#356: disable main toolbar buttons showing company list drop downs when there are no companies
glx
parents:
4748
diff
changeset
|
1843 |
case WE_PAINT: |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
1844 |
/* Draw brown-red toolbar bg. */ |
0 | 1845 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
1846 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
0 | 1847 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
1848 |
/* If spectator, disable all construction buttons |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
1849 |
* ie : Build road, rail, ships, airports and landscaping |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
1850 |
* Since enabled state is the default, just disable when needed */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1851 |
SetWindowWidgetsDisabledState(w, _current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END); |
4781
3e0c04509b05
(svn r6695) -Fix FS#356: disable main toolbar buttons showing company list drop downs when there are no companies
glx
parents:
4748
diff
changeset
|
1852 |
/* disable company list drop downs, if there are no companies */ |
3e0c04509b05
(svn r6695) -Fix FS#356: disable main toolbar buttons showing company list drop downs when there are no companies
glx
parents:
4748
diff
changeset
|
1853 |
SetWindowWidgetsDisabledState(w, ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END); |
0 | 1854 |
|
1855 |
DrawWindowWidgets(w); |
|
1856 |
break; |
|
1857 |
||
1858 |
case WE_CLICK: { |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
1859 |
if (_game_mode != GM_MENU && !IsWindowWidgetDisabled(w, e->we.click.widget)) |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1860 |
_toolbar_button_procs[e->we.click.widget](w); |
0 | 1861 |
} break; |
1862 |
||
1863 |
case WE_KEYPRESS: { |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1864 |
switch (e->we.keypress.keycode) { |
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
1865 |
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(w); break; |
0 | 1866 |
case WKC_F2: ShowGameOptions(); break; |
1867 |
case WKC_F3: MenuClickSaveLoad(0); break; |
|
1868 |
case WKC_F4: ShowSmallMap(); break; |
|
1869 |
case WKC_F5: ShowTownDirectory(); break; |
|
1870 |
case WKC_F6: ShowSubsidiesList(); break; |
|
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
1871 |
case WKC_F7: ShowPlayerStations(_local_player); break; |
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
1872 |
case WKC_F8: ShowPlayerFinances(_local_player); break; |
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
1873 |
case WKC_F9: ShowPlayerCompany(_local_player); break; |
0 | 1874 |
case WKC_F10:ShowOperatingProfitGraph(); break; |
1875 |
case WKC_F11: ShowCompanyLeagueTable(); break; |
|
1876 |
case WKC_F12: ShowBuildIndustryWindow(); break; |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
1877 |
case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_TRAIN); break; |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
1878 |
case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_ROAD); break; |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
1879 |
case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_SHIP); break; |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
1880 |
case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_AIRCRAFT); break; |
0 | 1881 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break; |
1882 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break; |
|
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4994
diff
changeset
|
1883 |
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype, -1); break; |
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
1884 |
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(_last_built_roadtype); break; |
0 | 1885 |
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; |
1886 |
case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break; |
|
1887 |
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; |
|
1888 |
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; |
|
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
1889 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4171
diff
changeset
|
1890 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1891 |
case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break; |
1636
060fc7b40cb8
(svn r2140) - Fix: [ 1175726 ] Allows rails in scenario editor. Moved both 'A' autorail and 'L' Terraform toolbar to their REAL places instead of the global window.
Darkvater
parents:
1633
diff
changeset
|
1892 |
case 'A': ShowBuildRailToolbar(_last_built_railtype, 4); break; /* Invoke Autorail */ |
060fc7b40cb8
(svn r2140) - Fix: [ 1175726 ] Allows rails in scenario editor. Moved both 'A' autorail and 'L' Terraform toolbar to their REAL places instead of the global window.
Darkvater
parents:
1633
diff
changeset
|
1893 |
case 'L': ShowTerraformToolbar(); break; |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1894 |
default: return; |
1637
ee2049729147
(svn r2141) - Fix: Keys now hopefully only activate the right windows. If console/querybox/chatbox is open, all input goes there, if closed to game itself.
Darkvater
parents:
1636
diff
changeset
|
1895 |
} |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
1896 |
e->we.keypress.cont = false; |
0 | 1897 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1898 |
|
0 | 1899 |
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:
4548
diff
changeset
|
1900 |
_place_proc(e->we.place.tile); |
0 | 1901 |
} break; |
1902 |
||
1903 |
case WE_ABORT_PLACE_OBJ: { |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1904 |
RaiseWindowWidget(w, 25); |
0 | 1905 |
SetWindowDirty(w); |
1906 |
} break; |
|
1907 |
||
1908 |
case WE_MOUSELOOP: |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
1909 |
if (IsWindowWidgetLowered(w, 0) != !!_pause_game) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1910 |
ToggleWidgetLoweredState(w, 0); |
5413 | 1911 |
InvalidateWidget(w, 0); |
0 | 1912 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1913 |
|
4748
8a928d86a56c
(svn r6660) -Fix(r6631): Prevent the fast-foward button to toggle up and down when pressing shift.
belugas
parents:
4719
diff
changeset
|
1914 |
if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1915 |
ToggleWidgetLoweredState(w, 1); |
5413 | 1916 |
InvalidateWidget(w, 1); |
0 | 1917 |
} |
1918 |
break; |
|
1919 |
||
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1920 |
case WE_TIMEOUT: { |
5235
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5214
diff
changeset
|
1921 |
uint i; |
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5214
diff
changeset
|
1922 |
for (i = 2; i < w->widget_count; i++) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1923 |
if (IsWindowWidgetLowered(w, i)) { |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1924 |
RaiseWindowWidget(w, i); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1925 |
InvalidateWidget(w, i); |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1926 |
} |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1927 |
} |
0 | 1928 |
break; |
1929 |
} |
|
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
1930 |
|
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
1931 |
case WE_MESSAGE: |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
1932 |
HandleZoomMessage(w, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, 17, 18); |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
1933 |
break; |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1934 |
} |
0 | 1935 |
} |
1936 |
||
1937 |
static const Widget _toolb_normal_widgets[] = { |
|
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1938 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 21, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1939 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1940 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 44, 65, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1941 |
{ WWT_IMGBTN_2, RESIZE_NONE, 14, 66, 87, 0, 21, SPR_IMG_SAVE, STR_0172_SAVE_GAME_ABANDON_GAME}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1942 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1943 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 96, 117, 0, 21, SPR_IMG_SMALLMAP, STR_0174_DISPLAY_MAP}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1944 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 118, 139, 0, 21, SPR_IMG_TOWN, STR_0176_DISPLAY_TOWN_DIRECTORY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1945 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 140, 161, 0, 21, SPR_IMG_SUBSIDIES, STR_02DC_DISPLAY_SUBSIDIES}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1946 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 162, 183, 0, 21, SPR_IMG_COMPANY_LIST, STR_0173_DISPLAY_LIST_OF_COMPANY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1947 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1948 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 191, 212, 0, 21, SPR_IMG_COMPANY_FINANCE, STR_0177_DISPLAY_COMPANY_FINANCES}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1949 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 213, 235, 0, 21, SPR_IMG_COMPANY_GENERAL, STR_0178_DISPLAY_COMPANY_GENERAL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1950 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 236, 257, 0, 21, SPR_IMG_GRAPHS, STR_0179_DISPLAY_GRAPHS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1951 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 258, 279, 0, 21, SPR_IMG_COMPANY_LEAGUE, STR_017A_DISPLAY_COMPANY_LEAGUE}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1952 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 280, 301, 0, 21, SPR_IMG_INDUSTRY, STR_0312_FUND_CONSTRUCTION_OF_NEW}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1953 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1954 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 310, 331, 0, 21, SPR_IMG_TRAINLIST, STR_017B_DISPLAY_LIST_OF_COMPANY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1955 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 332, 353, 0, 21, SPR_IMG_TRUCKLIST, STR_017C_DISPLAY_LIST_OF_COMPANY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1956 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 354, 375, 0, 21, SPR_IMG_SHIPLIST, STR_017D_DISPLAY_LIST_OF_COMPANY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1957 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 376, 397, 0, 21, SPR_IMG_AIRPLANESLIST, STR_017E_DISPLAY_LIST_OF_COMPANY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1958 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1959 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 406, 427, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1960 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 428, 449, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1961 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1962 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 457, 478, 0, 21, SPR_IMG_BUILDRAIL, STR_0181_BUILD_RAILROAD_TRACK}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1963 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 479, 500, 0, 21, SPR_IMG_BUILDROAD, STR_0182_BUILD_ROADS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1964 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 501, 522, 0, 21, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1965 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 523, 544, 0, 21, SPR_IMG_BUILDAIR, STR_0184_BUILD_AIRPORTS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1966 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 545, 566, 0, 21, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, // tree icon is 0x2E6 |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1967 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1968 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 574, 595, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1969 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 596, 617, 0, 21, SPR_IMG_MESSAGES, STR_0203_SHOW_LAST_MESSAGE_NEWS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1970 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 618, 639, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1971 |
{ WIDGETS_END}, |
0 | 1972 |
}; |
1973 |
||
1974 |
static const WindowDesc _toolb_normal_desc = { |
|
1975 |
0, 0, 640, 22, |
|
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
1976 |
WC_MAIN_TOOLBAR, WC_NONE, |
0 | 1977 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
1978 |
_toolb_normal_widgets, |
|
1979 |
MainToolbarWndProc |
|
1980 |
}; |
|
1981 |
||
1982 |
||
1983 |
static const Widget _toolb_scen_widgets[] = { |
|
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1984 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 21, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1985 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1986 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 44, 65, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1987 |
{WWT_IMGBTN_2, RESIZE_NONE, 14, 66, 87, 0, 21, SPR_IMG_SAVE, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1988 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1989 |
{ WWT_PANEL, RESIZE_NONE, 14, 96, 225, 0, 21, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1990 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1991 |
{ WWT_PANEL, RESIZE_NONE, 14, 233, 362, 0, 21, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1992 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 236, 247, 5, 16, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1993 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 347, 358, 5, 16, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1994 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1995 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 371, 392, 0, 21, SPR_IMG_SMALLMAP, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1996 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1997 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 400, 421, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1998 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 422, 443, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1999 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2000 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 452, 473, 0, 21, SPR_IMG_LANDSCAPING, STR_022E_LANDSCAPE_GENERATION}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2001 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 474, 495, 0, 21, SPR_IMG_TOWN, STR_022F_TOWN_GENERATION}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2002 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 496, 517, 0, 21, SPR_IMG_INDUSTRY, STR_0230_INDUSTRY_GENERATION}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2003 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 518, 539, 0, 21, SPR_IMG_BUILDROAD, STR_0231_ROAD_CONSTRUCTION}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2004 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 540, 561, 0, 21, SPR_IMG_PLANTTREES, STR_0288_PLANT_TREES}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2005 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 562, 583, 0, 21, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2006 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2007 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2008 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2009 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2010 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2011 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2012 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2013 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2014 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 596, 617, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2015 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2016 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 618, 639, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
3248
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2017 |
{WIDGETS_END}, |
0 | 2018 |
}; |
2019 |
||
4171 | 2020 |
static ToolbarButtonProc * const _scen_toolbar_button_procs[] = { |
0 | 2021 |
ToolbarPauseClick, |
2022 |
ToolbarFastForwardClick, |
|
2023 |
ToolbarOptionsClick, |
|
2024 |
ToolbarScenSaveOrLoad, |
|
2025 |
ToolbarBtn_NULL, |
|
2026 |
ToolbarBtn_NULL, |
|
2027 |
ToolbarScenDateBackward, |
|
2028 |
ToolbarScenDateForward, |
|
2029 |
ToolbarScenMapTownDir, |
|
2030 |
ToolbarScenZoomIn, |
|
2031 |
ToolbarScenZoomOut, |
|
2032 |
ToolbarScenGenLand, |
|
2033 |
ToolbarScenGenTown, |
|
2034 |
ToolbarScenGenIndustry, |
|
2035 |
ToolbarScenBuildRoad, |
|
2036 |
ToolbarScenPlantTrees, |
|
2037 |
ToolbarScenPlaceSign, |
|
2038 |
NULL, |
|
2039 |
NULL, |
|
2040 |
NULL, |
|
2041 |
NULL, |
|
2042 |
NULL, |
|
2043 |
NULL, |
|
2044 |
NULL, |
|
2045 |
ToolbarMusicClick, |
|
2046 |
NULL, |
|
2047 |
ToolbarHelpClick, |
|
2048 |
}; |
|
2049 |
||
2050 |
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) |
|
2051 |
{ |
|
2952 | 2052 |
switch (e->event) { |
0 | 2053 |
case WE_PAINT: |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
2054 |
SetWindowWidgetDisabledState(w, 6, _patches_newgame.starting_year <= MIN_YEAR); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
2055 |
SetWindowWidgetDisabledState(w, 7, _patches_newgame.starting_year >= MAX_YEAR); |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2056 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2057 |
/* Draw brown-red toolbar bg. */ |
0 | 2058 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2059 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
0 | 2060 |
|
2061 |
DrawWindowWidgets(w); |
|
2062 |
||
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2063 |
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
0 | 2064 |
DrawStringCentered(298, 6, STR_00AF, 0); |
2065 |
||
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2066 |
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
74
d23a80ef6361
(svn r75) -Add proper crediting to graphics artists to about box.
darkvater
parents:
68
diff
changeset
|
2067 |
DrawStringCentered(161, 1, STR_0221_OPENTTD, 0); |
0 | 2068 |
DrawStringCentered(161, 11,STR_0222_SCENARIO_EDITOR, 0); |
2069 |
||
2070 |
break; |
|
2071 |
||
2072 |
case WE_CLICK: { |
|
2639 | 2073 |
if (_game_mode == GM_MENU) return; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2074 |
_scen_toolbar_button_procs[e->we.click.widget](w); |
0 | 2075 |
} break; |
2076 |
||
2755
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2077 |
case WE_KEYPRESS: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2078 |
switch (e->we.keypress.keycode) { |
5006
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2079 |
case WKC_F1: ToolbarPauseClick(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2080 |
case WKC_F2: ShowGameOptions(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2081 |
case WKC_F3: MenuClickSaveLoad(0); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2082 |
case WKC_F4: ToolbarScenGenLand(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2083 |
case WKC_F5: ToolbarScenGenTown(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2084 |
case WKC_F6: ToolbarScenGenIndustry(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2085 |
case WKC_F7: ToolbarScenBuildRoad(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2086 |
case WKC_F8: ToolbarScenPlantTrees(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2087 |
case WKC_F9: ToolbarScenPlaceSign(w); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2088 |
case WKC_F10: ShowMusicWindow(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2089 |
case WKC_F11: PlaceLandBlockInfo(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2090 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2091 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2092 |
case 'L': ShowEditorTerraformToolBar(); break; |
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2093 |
default: return; |
2755
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2094 |
} |
5006
390d6334da67
(svn r7023) -Fix: Pressing F1 in scenario editor did not work because the keypress event was sent
Darkvater
parents:
5005
diff
changeset
|
2095 |
e->we.keypress.cont = false; |
2755
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2096 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2097 |
|
0 | 2098 |
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:
4548
diff
changeset
|
2099 |
_place_proc(e->we.place.tile); |
0 | 2100 |
} break; |
2101 |
||
2102 |
case WE_ABORT_PLACE_OBJ: { |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
2103 |
RaiseWindowWidget(w, 25); |
0 | 2104 |
SetWindowDirty(w); |
2105 |
} break; |
|
2106 |
||
2107 |
case WE_MOUSELOOP: |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
2108 |
if (IsWindowWidgetLowered(w, 0) != !!_pause_game) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
2109 |
ToggleWidgetLoweredState(w, 0); |
24 | 2110 |
SetWindowDirty(w); |
2111 |
} |
|
2112 |
||
4748
8a928d86a56c
(svn r6660) -Fix(r6631): Prevent the fast-foward button to toggle up and down when pressing shift.
belugas
parents:
4719
diff
changeset
|
2113 |
if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
2114 |
ToggleWidgetLoweredState(w, 1); |
0 | 2115 |
SetWindowDirty(w); |
2116 |
} |
|
2117 |
break; |
|
2118 |
||
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2119 |
case WE_MESSAGE: |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2120 |
HandleZoomMessage(w, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, 9, 10); |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2121 |
break; |
0 | 2122 |
} |
2123 |
} |
|
2124 |
||
2125 |
static const WindowDesc _toolb_scen_desc = { |
|
2126 |
0, 0, 640, 22, |
|
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
2127 |
WC_MAIN_TOOLBAR, WC_NONE, |
0 | 2128 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
2129 |
_toolb_scen_widgets, |
|
2130 |
ScenEditToolbarWndProc |
|
2131 |
}; |
|
2132 |
||
2133 |
extern GetNewsStringCallbackProc * const _get_news_string_callback[]; |
|
2134 |
||
2135 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2432
diff
changeset
|
2136 |
static bool DrawScrollingStatusText(const NewsItem *ni, int pos) |
0 | 2137 |
{ |
1336
69391734ce23
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2138 |
char buf[512]; |
0 | 2139 |
StringID str; |
1329 | 2140 |
const char *s; |
2141 |
char *d; |
|
0 | 2142 |
DrawPixelInfo tmp_dpi, *old_dpi; |
2143 |
int x; |
|
1329 | 2144 |
char buffer[256]; |
0 | 2145 |
|
2146 |
if (ni->display_mode == 3) { |
|
2147 |
str = _get_news_string_callback[ni->callback](ni); |
|
2148 |
} else { |
|
2149 |
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2150 |
str = ni->string_id; |
0 | 2151 |
} |
2152 |
||
4912
0f51b47cb983
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4907
diff
changeset
|
2153 |
GetString(buf, str, lastof(buf)); |
0 | 2154 |
|
1336
69391734ce23
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2155 |
s = buf; |
0 | 2156 |
d = buffer; |
2157 |
||
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
2158 |
for (;;) { |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
2159 |
WChar c = Utf8Consume(&s); |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
2160 |
if (c == 0) { |
2639 | 2161 |
*d = '\0'; |
0 | 2162 |
break; |
2163 |
} else if (*s == 0x0D) { |
|
2164 |
d[0] = d[1] = d[2] = d[3] = ' '; |
|
2639 | 2165 |
d += 4; |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
2166 |
} else if (IsPrintable(c)) { |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
2167 |
d += Utf8Encode(d, c); |
0 | 2168 |
} |
2169 |
} |
|
2170 |
||
4429
b4eb6d97996f
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
tron
parents:
4349
diff
changeset
|
2171 |
if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, 358, 11)) return true; |
0 | 2172 |
|
2173 |
old_dpi = _cur_dpi; |
|
2174 |
_cur_dpi = &tmp_dpi; |
|
2175 |
||
2176 |
x = DoDrawString(buffer, pos, 0, 13); |
|
2177 |
_cur_dpi = old_dpi; |
|
2178 |
||
2179 |
return x > 0; |
|
2180 |
} |
|
2181 |
||
410 | 2182 |
static void StatusBarWndProc(Window *w, WindowEvent *e) |
0 | 2183 |
{ |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2184 |
switch (e->event) { |
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2185 |
case WE_PAINT: { |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
2186 |
const Player *p = (_local_player == PLAYER_SPECTATOR) ? NULL : GetPlayer(_local_player); |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2187 |
|
0 | 2188 |
DrawWindowWidgets(w); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2189 |
SetDParam(0, _date); |
2639 | 2190 |
DrawStringCentered( |
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
2191 |
70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, 0 |
2639 | 2192 |
); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2193 |
|
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2194 |
if (p != NULL) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2195 |
/* Draw player money */ |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2196 |
SetDParam64(0, p->money64); |
0 | 2197 |
DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0); |
2198 |
} |
|
2199 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2200 |
/* Draw status bar */ |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2201 |
if (w->message.msg) { // true when saving is active |
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2202 |
DrawStringCentered(320, 1, STR_SAVING_GAME, 0); |
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2203 |
} else if (_do_autosave) { |
2951 | 2204 |
DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0); |
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
2205 |
} else if (_pause_game) { |
2951 | 2206 |
DrawStringCentered(320, 1, STR_0319_PAUSED, 0); |
0 | 2207 |
} else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2208 |
/* Draw the scrolling news text */ |
0 | 2209 |
if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1)) |
2210 |
WP(w,def_d).data_1 = -1280; |
|
2211 |
} else { |
|
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2212 |
if (p != NULL) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2213 |
/* This is the default text */ |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2214 |
SetDParam(0, p->name_1); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2215 |
SetDParam(1, p->name_2); |
2951 | 2216 |
DrawStringCentered(320, 1, STR_02BA, 0); |
0 | 2217 |
} |
2218 |
} |
|
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2219 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2220 |
if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT, PALETTE_TO_RED, 489, 2); |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2221 |
} break; |
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2222 |
|
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2223 |
case WE_MESSAGE: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2224 |
w->message.msg = e->we.message.msg; |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2225 |
SetWindowDirty(w); |
0 | 2226 |
break; |
2227 |
||
2228 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2229 |
switch (e->we.click.widget) { |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2230 |
case 1: ShowLastNewsMessage(); break; |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
2231 |
case 2: if (_local_player != PLAYER_SPECTATOR) ShowPlayerFinances(_local_player); break; |
1885
aef601001f5e
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2232 |
default: ResetObjectToPlace(); |
0 | 2233 |
} |
2234 |
break; |
|
2235 |
||
2236 |
case WE_TICK: { |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
2237 |
if (_pause_game) return; |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2238 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2239 |
if (WP(w, def_d).data_1 > -1280) { // Scrolling text |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2240 |
WP(w, def_d).data_1 -= 2; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2241 |
InvalidateWidget(w, 1); |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2242 |
} |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2243 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2244 |
if (WP(w, def_d).data_2 > 0) { // Red blot to show there are new unread newsmessages |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2245 |
WP(w, def_d).data_2 -= 2; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2246 |
} else if (WP(w, def_d).data_2 < 0) { |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2247 |
WP(w, def_d).data_2 = 0; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2248 |
InvalidateWidget(w, 1); |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2249 |
} |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2250 |
|
0 | 2251 |
break; |
2252 |
} |
|
2253 |
} |
|
2254 |
} |
|
2255 |
||
2256 |
static const Widget _main_status_widgets[] = { |
|
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2257 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 139, 0, 11, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2258 |
{ WWT_PUSHBTN, RESIZE_NONE, 14, 140, 499, 0, 11, 0x0, STR_02B7_SHOW_LAST_MESSAGE_OR_NEWS}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
2259 |
{ WWT_PUSHBTN, RESIZE_NONE, 14, 500, 639, 0, 11, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
2260 |
{ WIDGETS_END}, |
0 | 2261 |
}; |
2262 |
||
2263 |
static WindowDesc _main_status_desc = { |
|
2264 |
WDP_CENTER, 0, 640, 12, |
|
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5890
diff
changeset
|
2265 |
WC_STATUS_BAR, WC_NONE, |
0 | 2266 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
2267 |
_main_status_widgets, |
|
2268 |
StatusBarWndProc |
|
2269 |
}; |
|
2270 |
||
6247 | 2271 |
extern void UpdateAllStationVirtCoord(); |
0 | 2272 |
|
4171 | 2273 |
static void MainWindowWndProc(Window *w, WindowEvent *e) |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
2274 |
{ |
0 | 2275 |
int off_x; |
2276 |
||
2952 | 2277 |
switch (e->event) { |
0 | 2278 |
case WE_PAINT: |
2279 |
DrawWindowViewport(w); |
|
2280 |
if (_game_mode == GM_MENU) { |
|
581
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2281 |
off_x = _screen.width / 2; |
0 | 2282 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2283 |
DrawSprite(SPR_OTTD_O, PAL_NONE, off_x - 120, 50); |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2284 |
DrawSprite(SPR_OTTD_P, PAL_NONE, off_x - 86, 50); |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2285 |
DrawSprite(SPR_OTTD_E, PAL_NONE, off_x - 53, 50); |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2286 |
DrawSprite(SPR_OTTD_N, PAL_NONE, off_x - 22, 50); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2287 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2288 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 34, 50); |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2289 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 65, 50); |
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2290 |
DrawSprite(SPR_OTTD_D, PAL_NONE, off_x + 96, 50); |
670
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2291 |
|
581
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2292 |
/* |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2293 |
DrawSprite(SPR_OTTD_R, off_x + 119, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2294 |
DrawSprite(SPR_OTTD_A, off_x + 148, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2295 |
DrawSprite(SPR_OTTD_N, off_x + 181, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2296 |
DrawSprite(SPR_OTTD_S, off_x + 215, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2297 |
DrawSprite(SPR_OTTD_P, off_x + 246, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2298 |
DrawSprite(SPR_OTTD_O, off_x + 275, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2299 |
DrawSprite(SPR_OTTD_R, off_x + 307, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2300 |
DrawSprite(SPR_OTTD_T, off_x + 337, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2301 |
|
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2302 |
DrawSprite(SPR_OTTD_T, off_x + 390, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2303 |
DrawSprite(SPR_OTTD_Y, off_x + 417, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2304 |
DrawSprite(SPR_OTTD_C, off_x + 447, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2305 |
DrawSprite(SPR_OTTD_O, off_x + 478, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2306 |
DrawSprite(SPR_OTTD_O, off_x + 509, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2307 |
DrawSprite(SPR_OTTD_N, off_x + 541, 50); |
3e83b468ee56
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2308 |
*/ |
0 | 2309 |
} |
2310 |
break; |
|
2311 |
||
2312 |
case WE_KEYPRESS: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2313 |
switch (e->we.keypress.keycode) { |
2639 | 2314 |
case 'Q' | WKC_CTRL: |
2315 |
case 'Q' | WKC_META: |
|
4548
6165e12570bf
(svn r6380) -Codechange: unify all ways to quit OTTD.
rubidium
parents:
4536
diff
changeset
|
2316 |
HandleExitGameRequest(); |
2639 | 2317 |
break; |
2501
8d13d08b9232
(svn r3027) -Feature: [OSX] command+q now works in main menu (Tobin)
bjarni
parents:
2469
diff
changeset
|
2318 |
} |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2319 |
|
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2320 |
/* Disable all key shortcuts, except quit shortcuts when |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2321 |
* generating the world, otherwise they create threading |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2322 |
* problem during the generating, resulting in random |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2323 |
* assertions that are hard to trigger and debug */ |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2324 |
if (IsGeneratingWorld()) break; |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2325 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2326 |
if (e->we.keypress.keycode == WKC_BACKQUOTE) { |
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2327 |
IConsoleSwitch(); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2328 |
e->we.keypress.cont = false; |
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2329 |
break; |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2330 |
} |
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2331 |
|
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
2332 |
if (_game_mode == GM_MENU) break; |
0 | 2333 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2334 |
switch (e->we.keypress.keycode) { |
2639 | 2335 |
case 'C': |
2336 |
case 'Z': { |
|
2337 |
Point pt = GetTileBelowCursor(); |
|
2338 |
if (pt.x != -1) { |
|
2339 |
ScrollMainWindowTo(pt.x, pt.y); |
|
5046
d2c53a73b580
(svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents:
5045
diff
changeset
|
2340 |
if (e->we.keypress.keycode == 'Z') MaxZoomInOut(ZOOM_IN, w); |
2639 | 2341 |
} |
2342 |
break; |
|
0 | 2343 |
} |
2639 | 2344 |
|
2345 |
case WKC_ESC: ResetObjectToPlace(); break; |
|
2346 |
case WKC_DELETE: DeleteNonVitalWindows(); break; |
|
2347 |
case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break; |
|
2348 |
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break; |
|
2349 |
||
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2350 |
#if defined(_DEBUG) |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2351 |
case '0' | WKC_ALT: // Crash the game |
2639 | 2352 |
*(byte*)0 = 0; |
2353 |
break; |
|
2354 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2355 |
case '1' | WKC_ALT: // Gimme money |
2639 | 2356 |
/* Server can not cheat in advertise mode either! */ |
2357 |
if (!_networking || !_network_server || !_network_advertise) |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
2358 |
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT); |
2639 | 2359 |
break; |
2360 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2361 |
case '2' | WKC_ALT: // Update the coordinates of all station signs |
2639 | 2362 |
UpdateAllStationVirtCoord(); |
2363 |
break; |
|
2364 |
#endif |
|
2365 |
||
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2366 |
case '1' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2367 |
case '2' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2368 |
case '3' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2369 |
case '4' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2370 |
case '5' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2371 |
case '6' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2372 |
case '7' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2373 |
/* Transparency toggle hot keys */ |
6447
aa9fd2e33a1e
(svn r9595) -Fix (r9563): Transparency hotkeys didn't work
peter1138
parents:
6427
diff
changeset
|
2374 |
TOGGLEBIT(_transparent_opt, e->we.keypress.keycode - ('1' | WKC_CTRL)); |
2639 | 2375 |
MarkWholeScreenDirty(); |
2376 |
break; |
|
0 | 2377 |
|
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2378 |
case 'X' | WKC_CTRL: |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2379 |
ShowTransparencyToolbar(); |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2380 |
break; |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2381 |
|
6494
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
2382 |
case 'X': |
b41e51f3c9ef
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
peter1138
parents:
6492
diff
changeset
|
2383 |
ToggleTransparency(); |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2384 |
break; |
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
2385 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
2386 |
#ifdef ENABLE_NETWORK |
5107
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2387 |
case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all |
4887
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2388 |
if (_networking) { |
5107
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2389 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2390 |
bool teamchat = false; |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2391 |
|
5672
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2392 |
if (cio == NULL) break; |
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2393 |
|
5107
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2394 |
/* Only players actually playing can speak to team. Eg spectators cannot */ |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2395 |
if (_patches.prefer_teamchat && IsValidPlayer(cio->client_playas)) { |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2396 |
const NetworkClientInfo *ci; |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2397 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2398 |
if (ci->client_playas == cio->client_playas && ci != cio) { |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2399 |
teamchat = true; |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2400 |
break; |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2401 |
} |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2402 |
} |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2403 |
} |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2404 |
|
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
2405 |
ShowNetworkChatQueryWindow(teamchat ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas); |
4887
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2406 |
} |
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2407 |
break; |
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2408 |
|
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2409 |
case WKC_SHIFT | WKC_RETURN: case WKC_SHIFT | 'T': // send text message to all players |
2639 | 2410 |
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
2411 |
break; |
|
4887
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2412 |
|
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2413 |
case WKC_CTRL | WKC_RETURN: case WKC_CTRL | 'T': // send text to all team mates |
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2414 |
if (_networking) { |
5672
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2415 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2416 |
if (cio == NULL) break; |
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2417 |
|
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
2418 |
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, cio->client_playas); |
4887
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2419 |
} |
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
2420 |
break; |
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2421 |
#endif |
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2422 |
|
2639 | 2423 |
default: return; |
0 | 2424 |
} |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2425 |
e->we.keypress.cont = false; |
0 | 2426 |
break; |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2427 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2428 |
case WE_SCROLL: { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2429 |
ViewPort *vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y); |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2430 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2431 |
if (vp == NULL) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2432 |
_cursor.fix_at = false; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2433 |
_scrolling_viewport = false; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2434 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2435 |
|
6654
31d17823506f
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
truelight
parents:
6626
diff
changeset
|
2436 |
WP(w, vp_d).scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom); |
31d17823506f
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
truelight
parents:
6626
diff
changeset
|
2437 |
WP(w, vp_d).scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom); |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
2438 |
} break; |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
2439 |
|
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
2440 |
case WE_MOUSEWHEEL: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
2441 |
ZoomInOrOutToCursorWindow(e->we.wheel.wheel < 0, w); |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
2442 |
break; |
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2443 |
|
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2444 |
case WE_MESSAGE: |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2445 |
/* Forward the message to the appropiate toolbar (ingame or scenario editor) */ |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2446 |
SendWindowMessage(WC_MAIN_TOOLBAR, 0, e->we.message.msg, e->we.message.wparam, e->we.message.lparam); |
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
2447 |
break; |
0 | 2448 |
} |
2449 |
} |
|
2450 |
||
2451 |
||
6247 | 2452 |
void ShowSelectGameWindow(); |
2453 |
||
2454 |
void SetupColorsAndInitialWindow() |
|
0 | 2455 |
{ |
2639 | 2456 |
uint i; |
0 | 2457 |
Window *w; |
5413 | 2458 |
int width, height; |
0 | 2459 |
|
2639 | 2460 |
for (i = 0; i != 16; i++) { |
4171 | 2461 |
const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i); |
1357 | 2462 |
|
0 | 2463 |
assert(b); |
4444
8d40844e6755
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4434
diff
changeset
|
2464 |
memcpy(_colour_gradient[i], b + 0xC6, sizeof(_colour_gradient[i])); |
0 | 2465 |
} |
2466 |
||
2467 |
width = _screen.width; |
|
2468 |
height = _screen.height; |
|
2469 |
||
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2470 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
6624
880e29b1f25e
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6591
diff
changeset
|
2471 |
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), ZOOM_LVL_VIEWPORT); |
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2472 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
2473 |
/* XXX: these are not done */ |
2639 | 2474 |
switch (_game_mode) { |
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2475 |
default: NOT_REACHED(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2476 |
case GM_MENU: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2477 |
ShowSelectGameWindow(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2478 |
break; |
0 | 2479 |
|
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2480 |
case GM_NORMAL: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2481 |
case GM_EDITOR: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2482 |
ShowVitalWindows(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
2483 |
break; |
0 | 2484 |
} |
2485 |
} |
|
2486 |
||
6247 | 2487 |
void ShowVitalWindows() |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2488 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2489 |
Window *w; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2490 |
|
5048
b784951def0a
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
2491 |
w = AllocateWindowDesc((_game_mode != GM_EDITOR) ? &_toolb_normal_desc : &_toolb_scen_desc); |
b784951def0a
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
2492 |
DoZoomInOutWindow(ZOOM_NONE, w); |
b784951def0a
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
2493 |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2494 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2495 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
2496 |
SetWindowWidgetDisabledState(w, 0, _networking && !_network_server); // if not server, disable pause button |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
2497 |
SetWindowWidgetDisabledState(w, 1, _networking); // if networking, disable fast-forward button |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1015
diff
changeset
|
2498 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2499 |
/* 'w' is for sure a WC_MAIN_TOOLBAR */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2500 |
PositionMainToolbar(w); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2501 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2502 |
/* Status bad only for normal games */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
2503 |
if (_game_mode == GM_EDITOR) return; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2504 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2505 |
_main_status_desc.top = _screen.height - 12; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2506 |
w = AllocateWindowDesc(&_main_status_desc); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2507 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2508 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2509 |
WP(w,def_d).data_1 = -1280; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2510 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
2511 |
|
6247 | 2512 |
void GameSizeChanged() |
0 | 2513 |
{ |
2429
5e5b66fb8420
(svn r2955) Fix: make ottd start with the last resolution you had set (custom) (win32)
Darkvater
parents:
2361
diff
changeset
|
2514 |
_cur_resolution[0] = _screen.width; |
5e5b66fb8420
(svn r2955) Fix: make ottd start with the last resolution you had set (custom) (win32)
Darkvater
parents:
2361
diff
changeset
|
2515 |
_cur_resolution[1] = _screen.height; |
0 | 2516 |
RelocateAllWindows(_screen.width, _screen.height); |
2517 |
ScreenSizeChanged(); |
|
2518 |
MarkWholeScreenDirty(); |
|
2519 |
} |
|
3622
730fd3cd0050
(svn r4520) -Fix: Did last commit in the wrong branch. Repair and shame on me.
celestar
parents:
3469
diff
changeset
|
2520 |
|
6247 | 2521 |
void InitializeMainGui() |
3622
730fd3cd0050
(svn r4520) -Fix: Did last commit in the wrong branch. Repair and shame on me.
celestar
parents:
3469
diff
changeset
|
2522 |
{ |
730fd3cd0050
(svn r4520) -Fix: Did last commit in the wrong branch. Repair and shame on me.
celestar
parents:
3469
diff
changeset
|
2523 |
/* Clean old GUI values */ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
2524 |
_last_built_railtype = RAILTYPE_RAIL; |
6666
41ceafa4c85e
(svn r9897) -Codechange: prepare the toolbar for more road types.
rubidium
parents:
6654
diff
changeset
|
2525 |
_last_built_roadtype = ROADTYPE_ROAD; |
3622
730fd3cd0050
(svn r4520) -Fix: Did last commit in the wrong branch. Repair and shame on me.
celestar
parents:
3469
diff
changeset
|
2526 |
} |
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5108
diff
changeset
|
2527 |
|
5237
4fce3ea379c2
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
5235
diff
changeset
|
2528 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
2529 |