author | tron |
Fri, 07 Apr 2006 08:27:43 +0000 | |
changeset 3464 | 6e01708de019 |
parent 3422 | a6eba3443452 |
child 3465 | a7ee131a9114 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1885
diff
changeset
|
4 |
#include "openttd.h" |
2292 | 5 |
#include "currency.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#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
|
7 |
#include "spritecache.h" |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
8 |
#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
|
9 |
#include "strings.h" |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1362
diff
changeset
|
10 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
497
diff
changeset
|
11 |
#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
|
12 |
#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
|
13 |
#include "tile.h" |
0 | 14 |
#include "window.h" |
15 |
#include "gui.h" |
|
16 |
#include "viewport.h" |
|
17 |
#include "gfx.h" |
|
18 |
#include "player.h" |
|
19 |
#include "command.h" |
|
20 |
#include "news.h" |
|
21 |
#include "town.h" |
|
130
b593afdae262
(svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik
parents:
126
diff
changeset
|
22 |
#include "vehicle.h" |
126 | 23 |
#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
|
24 |
#include "sound.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
25 |
#include "network.h" |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
26 |
#include "signs.h" |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
27 |
#include "waypoint.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2150
diff
changeset
|
28 |
#include "variables.h" |
2676
59b65b4fb480
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2652
diff
changeset
|
29 |
#include "train.h" |
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
30 |
#include "unmovable_map.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
31 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
32 |
#include "network_data.h" |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
33 |
#include "network_client.h" |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
34 |
#include "network_server.h" |
0 | 35 |
|
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
36 |
/* Min/Max date for scenario editor */ |
970
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
926
diff
changeset
|
37 |
static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL) |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
38 |
static const uint MaxDate = 29220; // 2000-01-01 |
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
39 |
|
0 | 40 |
static int _rename_id; |
41 |
static int _rename_what; |
|
42 |
||
43 |
static byte _terraform_size = 1; |
|
2520
8a52362c4ada
(svn r3049) Replace byte/int/uint by RailType where appropriate
tron
parents:
2501
diff
changeset
|
44 |
static RailType _last_built_railtype; |
2051 | 45 |
extern void GenerateWorld(int mode, uint size_x, uint size_y); |
0 | 46 |
|
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
|
47 |
extern void GenerateIndustries(void); |
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
|
48 |
extern bool GenerateTowns(void); |
0 | 49 |
|
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
|
50 |
void HandleOnEditTextCancel(void) |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
51 |
{ |
2639 | 52 |
switch (_rename_what) { |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
53 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
54 |
case 4: |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
55 |
NetworkDisconnect(); |
611
d40b84670b02
(svn r1035) Fix: Added a line that I accidentally deleted in r1033
dominik
parents:
609
diff
changeset
|
56 |
ShowNetworkGameWindow(); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
57 |
break; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
58 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
59 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
60 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
61 |
|
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 |
void HandleOnEditText(WindowEvent *e) |
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
|
63 |
{ |
1323
bac2e38e8b60
(svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents:
1309
diff
changeset
|
64 |
const char *b = e->edittext.str; |
0 | 65 |
int id; |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1799
diff
changeset
|
66 |
|
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1799
diff
changeset
|
67 |
_cmd_text = b; |
0 | 68 |
|
69 |
id = _rename_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
70 |
|
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
|
71 |
switch (_rename_what) { |
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
|
72 |
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
|
73 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME)); |
0 | 74 |
break; |
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
|
75 |
case 1: /* Rename a waypoint */ |
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2520
diff
changeset
|
76 |
if (*b == '\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
|
77 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME)); |
0 | 78 |
break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
79 |
#ifdef ENABLE_NETWORK |
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
|
80 |
case 2: /* Speak to.. */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
81 |
if (!_network_server) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
82 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
83 |
else |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
84 |
NetworkServer_HandleChat(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str, NETWORK_SERVER_INDEX); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
85 |
break; |
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 |
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
|
87 |
const Player *p = GetPlayer(_current_player); |
2468
9ea52370a093
(svn r2994) Another small hack regarding currencies: add a #define to emulate a variable, that holds the current currency; again this should increase readability
tron
parents:
2466
diff
changeset
|
88 |
int32 money = min(p->money64 - p->current_loan, atoi(e->edittext.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
|
89 |
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
|
90 |
|
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
|
91 |
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
|
92 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
93 |
// 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
|
94 |
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
|
95 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
96 |
// 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
|
97 |
snprintf(msg, sizeof(msg), "%d", money); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
98 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
99 |
if (!_network_server) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
100 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
101 |
else |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
102 |
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg, NETWORK_SERVER_INDEX); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
103 |
break; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
104 |
} |
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
|
105 |
case 4: /* Game-Password and Company-Password */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
106 |
SEND_COMMAND(PACKET_CLIENT_PASSWORD)(id, e->edittext.str); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
107 |
break; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
108 |
#endif /* ENABLE_NETWORK */ |
0 | 109 |
} |
110 |
} |
|
111 |
||
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
112 |
/** |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
113 |
* This code is shared for the majority of the pushbuttons. |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
114 |
* 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
|
115 |
* |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
116 |
* @param w Window which called the function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
117 |
* @param widget ID of the widget (=button) that called this function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
118 |
* @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
|
119 |
* @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
|
120 |
* @param placeproc Procedure which will be called when someone clicks on the map |
1109
ecb98f43ba2c
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
121 |
|
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
122 |
* @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
|
123 |
*/ |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
124 |
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc) |
0 | 125 |
{ |
126 |
uint32 mask = 1 << widget; |
|
127 |
||
2639 | 128 |
if (w->disabled_state & mask) return false; |
0 | 129 |
|
2621
2bacc2e9c68f
(svn r3159) Remove the read-only variable _no_button_sound
tron
parents:
2615
diff
changeset
|
130 |
SndPlayFx(SND_15_BEEP); |
0 | 131 |
SetWindowDirty(w); |
132 |
||
133 |
if (w->click_state & mask) { |
|
134 |
ResetObjectToPlace(); |
|
135 |
return false; |
|
136 |
} |
|
137 |
||
138 |
SetObjectToPlace(cursor, mode, w->window_class, w->window_number); |
|
139 |
w->click_state |= mask; |
|
140 |
_place_proc = placeproc; |
|
141 |
return true; |
|
142 |
} |
|
143 |
||
144 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
145 |
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 146 |
{ |
541 | 147 |
if (success) SndPlayTileFx(SND_12_EXPLOSION, tile); |
0 | 148 |
} |
149 |
||
150 |
||
151 |
static void ToolbarPauseClick(Window *w) |
|
152 |
{ |
|
2549 | 153 |
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
|
154 |
|
2639 | 155 |
if (DoCommandP(0, _pause ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP); |
0 | 156 |
} |
157 |
||
158 |
static void ToolbarFastForwardClick(Window *w) |
|
159 |
{ |
|
160 |
_fast_forward ^= true; |
|
541 | 161 |
SndPlayFx(SND_15_BEEP); |
0 | 162 |
} |
163 |
||
164 |
||
410 | 165 |
static void MenuClickSettings(int index) |
0 | 166 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
167 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
168 |
case 0: ShowGameOptions(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
169 |
case 1: ShowGameDifficulty(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
170 |
case 2: ShowPatchesSelection(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
171 |
case 3: ShowNewgrf(); return; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
172 |
|
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
173 |
case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
174 |
case 6: _display_opt ^= DO_SHOW_STATION_NAMES; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
175 |
case 7: _display_opt ^= DO_SHOW_SIGNS; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
176 |
case 8: _display_opt ^= DO_WAYPOINTS; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
177 |
case 9: _display_opt ^= DO_FULL_ANIMATION; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
178 |
case 10: _display_opt ^= DO_FULL_DETAIL; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
179 |
case 11: _display_opt ^= DO_TRANS_BUILDINGS; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
180 |
case 12: _display_opt ^= DO_TRANS_SIGNS; break; |
0 | 181 |
} |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
182 |
MarkWholeScreenDirty(); |
0 | 183 |
} |
184 |
||
410 | 185 |
static void MenuClickSaveLoad(int index) |
0 | 186 |
{ |
187 |
if (_game_mode == GM_EDITOR) { |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
188 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
189 |
case 0: ShowSaveLoadDialog(SLD_SAVE_SCENARIO); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
190 |
case 1: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
191 |
case 2: AskExitToGameMenu(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
192 |
case 4: AskExitGame(); break; |
0 | 193 |
} |
194 |
} else { |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
195 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
196 |
case 0: ShowSaveLoadDialog(SLD_SAVE_GAME); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
197 |
case 1: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
198 |
case 2: AskExitToGameMenu(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
199 |
case 3: AskExitGame(); break; |
0 | 200 |
} |
201 |
} |
|
202 |
} |
|
203 |
||
410 | 204 |
static void MenuClickMap(int index) |
0 | 205 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
206 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
207 |
case 0: ShowSmallMap(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
208 |
case 1: ShowExtraViewPortWindow(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
209 |
case 2: ShowSignList(); break; |
0 | 210 |
} |
211 |
} |
|
212 |
||
410 | 213 |
static void MenuClickTown(int index) |
0 | 214 |
{ |
215 |
ShowTownDirectory(); |
|
216 |
} |
|
217 |
||
410 | 218 |
static void MenuClickScenMap(int index) |
0 | 219 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
220 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
221 |
case 0: ShowSmallMap(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
222 |
case 1: ShowExtraViewPortWindow(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
223 |
case 2: ShowSignList(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
224 |
case 3: ShowTownDirectory(); break; |
0 | 225 |
} |
226 |
} |
|
227 |
||
410 | 228 |
static void MenuClickSubsidies(int index) |
0 | 229 |
{ |
230 |
ShowSubsidiesList(); |
|
231 |
} |
|
232 |
||
410 | 233 |
static void MenuClickStations(int index) |
0 | 234 |
{ |
235 |
ShowPlayerStations(index); |
|
236 |
} |
|
237 |
||
410 | 238 |
static void MenuClickFinances(int index) |
0 | 239 |
{ |
240 |
ShowPlayerFinances(index); |
|
241 |
} |
|
242 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
243 |
#ifdef ENABLE_NETWORK |
1003
5a1516385ad5
(svn r1502) -Fix: [1101889] Crash under windows... stupid typo in player_gui.c ^ should've been &
darkvater
parents:
999
diff
changeset
|
244 |
extern void ShowClientList(void); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
245 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
246 |
|
410 | 247 |
static void MenuClickCompany(int index) |
0 | 248 |
{ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
249 |
if (_networking && index == 0) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
250 |
#ifdef ENABLE_NETWORK |
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 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
253 |
} else { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
254 |
if (_networking) index--; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
255 |
ShowPlayerCompany(index); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
256 |
} |
0 | 257 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
258 |
|
0 | 259 |
|
410 | 260 |
static void MenuClickGraphs(int index) |
0 | 261 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
262 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
263 |
case 0: ShowOperatingProfitGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
264 |
case 1: ShowIncomeGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
265 |
case 2: ShowDeliveredCargoGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
266 |
case 3: ShowPerformanceHistoryGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
267 |
case 4: ShowCompanyValueGraph(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
268 |
case 5: ShowCargoPaymentRates(); break; |
0 | 269 |
} |
270 |
} |
|
271 |
||
410 | 272 |
static void MenuClickLeague(int index) |
0 | 273 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
274 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
275 |
case 0: ShowCompanyLeagueTable(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
276 |
case 1: ShowPerformanceRatingDetail(); break; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
277 |
} |
0 | 278 |
} |
279 |
||
410 | 280 |
static void MenuClickIndustry(int index) |
0 | 281 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
282 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
283 |
case 0: ShowIndustryDirectory(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
284 |
case 1: ShowBuildIndustryWindow(); break; |
0 | 285 |
} |
286 |
} |
|
287 |
||
410 | 288 |
static void MenuClickShowTrains(int index) |
0 | 289 |
{ |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
290 |
ShowPlayerTrains(index, INVALID_STATION); |
0 | 291 |
} |
292 |
||
410 | 293 |
static void MenuClickShowRoad(int index) |
0 | 294 |
{ |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
295 |
ShowPlayerRoadVehicles(index, INVALID_STATION); |
0 | 296 |
} |
297 |
||
410 | 298 |
static void MenuClickShowShips(int index) |
0 | 299 |
{ |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
300 |
ShowPlayerShips(index, INVALID_STATION); |
0 | 301 |
} |
302 |
||
410 | 303 |
static void MenuClickShowAir(int index) |
0 | 304 |
{ |
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
305 |
ShowPlayerAircraft(index, INVALID_STATION); |
0 | 306 |
} |
307 |
||
410 | 308 |
static void MenuClickBuildRail(int index) |
0 | 309 |
{ |
2147
eb6ba42fd216
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
2116
diff
changeset
|
310 |
_last_built_railtype = index; |
0 | 311 |
ShowBuildRailToolbar(_last_built_railtype, -1); |
312 |
} |
|
313 |
||
410 | 314 |
static void MenuClickBuildRoad(int index) |
0 | 315 |
{ |
316 |
ShowBuildRoadToolbar(); |
|
317 |
} |
|
318 |
||
410 | 319 |
static void MenuClickBuildWater(int index) |
0 | 320 |
{ |
321 |
ShowBuildDocksToolbar(); |
|
322 |
} |
|
323 |
||
410 | 324 |
static void MenuClickBuildAir(int index) |
0 | 325 |
{ |
326 |
ShowBuildAirToolbar(); |
|
327 |
} |
|
328 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
329 |
#ifdef ENABLE_NETWORK |
649 | 330 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
331 |
void ShowNetworkChatQueryWindow(byte desttype, byte dest) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
332 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
333 |
_rename_id = desttype + (dest << 8); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
334 |
_rename_what = 2; |
3464
6e01708de019
(svn r4309) The initial string of the chat box is always the empty string, so don't jump through hoops to check if nothing was entered and simplify the code
tron
parents:
3422
diff
changeset
|
335 |
ShowChatWindow(STR_NETWORK_CHAT_QUERY_CAPTION, 150, 338, 1, 0); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
336 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
337 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
338 |
void ShowNetworkGiveMoneyWindow(byte player) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
339 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
340 |
_rename_id = player; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
341 |
_rename_what = 3; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
342 |
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, 1, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
343 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
344 |
|
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
|
345 |
void ShowNetworkNeedGamePassword(void) |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
346 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
347 |
_rename_id = NETWORK_GAME_PASSWORD; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
348 |
_rename_what = 4; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
349 |
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_GAME_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
350 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
351 |
|
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
|
352 |
void ShowNetworkNeedCompanyPassword(void) |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
353 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
354 |
_rename_id = NETWORK_COMPANY_PASSWORD; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
355 |
_rename_what = 4; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
356 |
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
357 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
358 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
359 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
360 |
|
2116 | 361 |
void ShowRenameSignWindow(const SignStruct *ss) |
0 | 362 |
{ |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
363 |
_rename_id = ss->index; |
0 | 364 |
_rename_what = 0; |
365 |
ShowQueryString(ss->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, 1, 0); |
|
366 |
} |
|
367 |
||
2116 | 368 |
void ShowRenameWaypointWindow(const Waypoint *wp) |
0 | 369 |
{ |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
370 |
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
|
371 |
|
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
372 |
/* 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
|
373 |
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
|
374 |
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
|
375 |
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
|
376 |
return; |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
377 |
} |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
378 |
|
0 | 379 |
_rename_id = id; |
380 |
_rename_what = 1; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
381 |
SetDParam(0, id); |
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
|
382 |
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0); |
0 | 383 |
} |
384 |
||
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
|
385 |
static void SelectSignTool(void) |
0 | 386 |
{ |
2639 | 387 |
if (_cursor.sprite == SPR_CURSOR_SIGN) { |
0 | 388 |
ResetObjectToPlace(); |
2639 | 389 |
} else { |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
390 |
SetObjectToPlace(SPR_CURSOR_SIGN, 1, 1, 0); |
0 | 391 |
_place_proc = PlaceProc_Sign; |
392 |
} |
|
393 |
} |
|
394 |
||
410 | 395 |
static void MenuClickForest(int index) |
0 | 396 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
397 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
398 |
case 0: ShowTerraformToolbar(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
399 |
case 1: ShowBuildTreesToolbar(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
400 |
case 2: SelectSignTool(); break; |
0 | 401 |
} |
402 |
} |
|
403 |
||
410 | 404 |
static void MenuClickMusicWindow(int index) |
0 | 405 |
{ |
406 |
ShowMusicWindow(); |
|
407 |
} |
|
408 |
||
410 | 409 |
static void MenuClickNewspaper(int index) |
0 | 410 |
{ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
411 |
switch (index) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
412 |
case 0: ShowLastNewsMessage(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
413 |
case 1: ShowMessageOptions(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
414 |
case 2: ShowMessageHistory(); break; |
0 | 415 |
} |
416 |
} |
|
417 |
||
410 | 418 |
static void MenuClickHelp(int index) |
0 | 419 |
{ |
2432
c48585a8b05f
(svn r2958) - Feature: [ 1258971 ] Menu option to toggle console. Mainly for MacOS's or PDA's. (toholio)
Darkvater
parents:
2430
diff
changeset
|
420 |
switch (index) { |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
421 |
case 0: PlaceLandBlockInfo(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
422 |
case 2: IConsoleSwitch(); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
423 |
case 3: _make_screenshot = 1; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
424 |
case 4: _make_screenshot = 2; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
425 |
case 5: ShowAboutWindow(); break; |
0 | 426 |
} |
427 |
} |
|
428 |
||
2639 | 429 |
|
430 |
typedef void MenuClickedProc(int index); |
|
431 |
||
0 | 432 |
static MenuClickedProc * const _menu_clicked_procs[] = { |
433 |
NULL, /* 0 */ |
|
434 |
NULL, /* 1 */ |
|
435 |
MenuClickSettings, /* 2 */ |
|
436 |
MenuClickSaveLoad, /* 3 */ |
|
437 |
MenuClickMap, /* 4 */ |
|
438 |
MenuClickTown, /* 5 */ |
|
439 |
MenuClickSubsidies, /* 6 */ |
|
440 |
MenuClickStations, /* 7 */ |
|
441 |
MenuClickFinances, /* 8 */ |
|
442 |
MenuClickCompany, /* 9 */ |
|
443 |
MenuClickGraphs, /* 10 */ |
|
444 |
MenuClickLeague, /* 11 */ |
|
445 |
MenuClickIndustry, /* 12 */ |
|
446 |
MenuClickShowTrains, /* 13 */ |
|
447 |
MenuClickShowRoad, /* 14 */ |
|
448 |
MenuClickShowShips, /* 15 */ |
|
449 |
MenuClickShowAir, /* 16 */ |
|
450 |
MenuClickScenMap, /* 17 */ |
|
451 |
NULL, /* 18 */ |
|
452 |
MenuClickBuildRail, /* 19 */ |
|
453 |
MenuClickBuildRoad, /* 20 */ |
|
454 |
MenuClickBuildWater, /* 21 */ |
|
455 |
MenuClickBuildAir, /* 22 */ |
|
456 |
MenuClickForest, /* 23 */ |
|
457 |
MenuClickMusicWindow, /* 24 */ |
|
458 |
MenuClickNewspaper, /* 25 */ |
|
459 |
MenuClickHelp, /* 26 */ |
|
460 |
}; |
|
461 |
||
462 |
static void MenuWndProc(Window *w, WindowEvent *e) |
|
463 |
{ |
|
2639 | 464 |
switch (e->event) { |
0 | 465 |
case WE_PAINT: { |
466 |
int count,sel; |
|
467 |
int x,y; |
|
468 |
uint16 chk; |
|
469 |
StringID string; |
|
470 |
int eo; |
|
471 |
int inc; |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
472 |
byte color; |
0 | 473 |
|
474 |
DrawWindowWidgets(w); |
|
475 |
||
476 |
count = WP(w,menu_d).item_count; |
|
477 |
sel = WP(w,menu_d).sel_index; |
|
478 |
chk = WP(w,menu_d).checked_items; |
|
479 |
string = WP(w,menu_d).string_id; |
|
480 |
||
481 |
x = 1; |
|
482 |
y = 1; |
|
483 |
||
484 |
eo = 157; |
|
485 |
||
486 |
inc = (chk != 0) ? 2 : 1; |
|
487 |
||
488 |
do { |
|
489 |
if (sel== 0) GfxFillRect(x, y, x + eo, y+9, 0); |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
490 |
color = sel == 0 ? 0xC : 0x10; |
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
491 |
if (HASBIT(WP(w,menu_d).disabled_items, (string - WP(w, menu_d).string_id))) color = 0xE; |
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
492 |
DrawString(x + 2, y, string + (chk & 1), color); |
0 | 493 |
y += 10; |
494 |
string += inc; |
|
495 |
chk >>= 1; |
|
496 |
} while (--sel,--count); |
|
497 |
} break; |
|
498 |
||
499 |
case WE_DESTROY: { |
|
500 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
501 |
v->click_state &= ~(1 << WP(w,menu_d).main_button); |
|
502 |
SetWindowDirty(v); |
|
503 |
return; |
|
504 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
505 |
|
0 | 506 |
case WE_POPUPMENU_SELECT: { |
507 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
|
508 |
int action_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
509 |
|
0 | 510 |
|
511 |
if (index < 0) { |
|
512 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
513 |
if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
|
514 |
index = WP(w,menu_d).sel_index; |
|
515 |
} |
|
516 |
||
517 |
action_id = WP(w,menu_d).action_id; |
|
518 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
519 |
|
2639 | 520 |
if (index >= 0) _menu_clicked_procs[action_id](index); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
521 |
|
0 | 522 |
break; |
523 |
} |
|
2639 | 524 |
|
0 | 525 |
case WE_POPUPMENU_OVER: { |
526 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
|
527 |
||
2639 | 528 |
if (index == -1 || index == WP(w,menu_d).sel_index) return; |
0 | 529 |
|
530 |
WP(w,menu_d).sel_index = index; |
|
531 |
SetWindowDirty(w); |
|
532 |
return; |
|
533 |
} |
|
534 |
} |
|
535 |
} |
|
536 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
537 |
static const Widget _menu_widgets[] = { |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
538 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 159, 0, 65535, 0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
539 |
{ WIDGETS_END}, |
0 | 540 |
}; |
541 |
||
542 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
543 |
static const Widget _player_menu_widgets[] = { |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
544 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 240, 0, 81, 0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
545 |
{ WIDGETS_END}, |
0 | 546 |
}; |
547 |
||
548 |
||
549 |
static int GetPlayerIndexFromMenu(int index) |
|
550 |
{ |
|
551 |
if (index >= 0) { |
|
2630 | 552 |
const Player* p; |
553 |
||
0 | 554 |
FOR_ALL_PLAYERS(p) { |
2639 | 555 |
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
|
556 |
} |
0 | 557 |
} |
558 |
return -1; |
|
559 |
} |
|
560 |
||
561 |
static void UpdatePlayerMenuHeight(Window *w) |
|
562 |
{ |
|
2639 | 563 |
uint num = 0; |
2630 | 564 |
const Player* p; |
0 | 565 |
|
566 |
FOR_ALL_PLAYERS(p) { |
|
2639 | 567 |
if (p->is_active) num++; |
0 | 568 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
569 |
|
2639 | 570 |
// Increase one to fit in PlayerList in the menu when in network |
571 |
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
|
572 |
|
0 | 573 |
if (WP(w,menu_d).item_count != num) { |
574 |
WP(w,menu_d).item_count = num; |
|
575 |
SetWindowDirty(w); |
|
576 |
num = num * 10 + 2; |
|
577 |
w->height = num; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
578 |
w->widget[0].bottom = w->widget[0].top + num - 1; |
0 | 579 |
SetWindowDirty(w); |
580 |
} |
|
581 |
} |
|
582 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
583 |
extern void DrawPlayerIcon(int p, int x, int y); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
584 |
|
0 | 585 |
static void PlayerMenuWndProc(Window *w, WindowEvent *e) |
586 |
{ |
|
2639 | 587 |
switch (e->event) { |
0 | 588 |
case WE_PAINT: { |
589 |
int x,y; |
|
590 |
byte sel, color; |
|
591 |
Player *p; |
|
592 |
uint16 chk; |
|
593 |
||
594 |
UpdatePlayerMenuHeight(w); |
|
595 |
DrawWindowWidgets(w); |
|
596 |
||
597 |
x = 1; |
|
598 |
y = 1; |
|
599 |
sel = WP(w,menu_d).sel_index; |
|
600 |
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
|
601 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
602 |
// 9 = playerlist |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
603 |
if (_networking && WP(w,menu_d).main_button == 9) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
604 |
if (sel == 0) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
605 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
606 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
607 |
DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, 0x0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
608 |
y += 10; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
609 |
sel--; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
610 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
611 |
|
0 | 612 |
FOR_ALL_PLAYERS(p) { |
613 |
if (p->is_active) { |
|
614 |
if (p->index == sel) { |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
615 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
0 | 616 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
617 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
618 |
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
|
619 |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
620 |
SetDParam(0, p->name_1); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
621 |
SetDParam(1, p->name_2); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
622 |
SetDParam(2, GetPlayerNameString(p->index, 3)); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
623 |
|
2150
f710b959b1c4
(svn r2660) Get rid of some more shifting/anding/casting
tron
parents:
2147
diff
changeset
|
624 |
color = (p->index == sel) ? 0xC : 0x10; |
0 | 625 |
if (chk&1) color = 14; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
626 |
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
|
627 |
|
0 | 628 |
y += 10; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
629 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
630 |
chk >>= 1; |
0 | 631 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
632 |
|
0 | 633 |
break; |
634 |
} |
|
635 |
||
636 |
case WE_DESTROY: { |
|
637 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
638 |
v->click_state &= ~(1 << WP(w,menu_d).main_button); |
|
639 |
SetWindowDirty(v); |
|
640 |
return; |
|
641 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
642 |
|
0 | 643 |
case WE_POPUPMENU_SELECT: { |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
644 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
0 | 645 |
int action_id = WP(w,menu_d).action_id; |
646 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
647 |
// We have a new entry at the top of the list of menu 9 when networking |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
648 |
// 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
|
649 |
if (_networking && WP(w,menu_d).main_button == 9) { |
2639 | 650 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
651 |
} else { |
|
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
652 |
index = GetPlayerIndexFromMenu(index); |
2639 | 653 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
654 |
|
0 | 655 |
if (index < 0) { |
656 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
657 |
if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
|
658 |
index = WP(w,menu_d).sel_index; |
|
659 |
} |
|
660 |
||
661 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
662 |
|
0 | 663 |
if (index >= 0) { |
664 |
assert(index >= 0 && index < 30); |
|
665 |
_menu_clicked_procs[action_id](index); |
|
666 |
} |
|
667 |
break; |
|
668 |
} |
|
669 |
case WE_POPUPMENU_OVER: { |
|
670 |
int index; |
|
671 |
UpdatePlayerMenuHeight(w); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
672 |
index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
673 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
674 |
// We have a new entry at the top of the list of menu 9 when networking |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
675 |
// 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
|
676 |
if (_networking && WP(w,menu_d).main_button == 9) { |
2639 | 677 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
678 |
} else { |
|
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
679 |
index = GetPlayerIndexFromMenu(index); |
2639 | 680 |
} |
681 |
||
682 |
if (index == -1 || index == WP(w,menu_d).sel_index) return; |
|
0 | 683 |
|
684 |
WP(w,menu_d).sel_index = index; |
|
685 |
SetWindowDirty(w); |
|
686 |
return; |
|
687 |
} |
|
688 |
} |
|
689 |
} |
|
690 |
||
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
691 |
static Window *PopupMainToolbMenu(Window *w, int x, int main_button, StringID base_string, int item_count, byte disabled_mask) |
0 | 692 |
{ |
693 |
x += w->left; |
|
694 |
||
695 |
SETBIT(w->click_state, (byte)main_button); |
|
696 |
InvalidateWidget(w, (byte)main_button); |
|
697 |
||
698 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
699 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
700 |
w = AllocateWindow(x, 0x16, 0xA0, item_count * 10 + 2, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets); |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
701 |
w->widget[0].bottom = item_count * 10 + 1; |
0 | 702 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
703 |
|
0 | 704 |
WP(w,menu_d).item_count = item_count; |
705 |
WP(w,menu_d).sel_index = 0; |
|
706 |
WP(w,menu_d).main_button = main_button; |
|
707 |
WP(w,menu_d).action_id = (main_button >> 8) ? (main_button >> 8) : main_button; |
|
708 |
WP(w,menu_d).string_id = base_string; |
|
709 |
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
|
710 |
WP(w,menu_d).disabled_items = disabled_mask; |
0 | 711 |
|
712 |
_popup_menu_active = true; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
713 |
|
541 | 714 |
SndPlayFx(SND_15_BEEP); |
0 | 715 |
|
716 |
return w; |
|
717 |
} |
|
718 |
||
719 |
static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
|
720 |
{ |
|
721 |
x += w->left; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
722 |
|
0 | 723 |
SETBIT(w->click_state, main_button); |
724 |
InvalidateWidget(w, main_button); |
|
725 |
||
726 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
727 |
w = AllocateWindow(x, 0x16, 0xF1, 0x52, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets); |
|
728 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
|
729 |
WP(w,menu_d).item_count = 0; |
|
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
730 |
WP(w,menu_d).sel_index = (_local_player != OWNER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0); |
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
731 |
if (_networking && main_button == 9) { |
2639 | 732 |
if (_local_player != OWNER_SPECTATOR) { |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
733 |
WP(w,menu_d).sel_index++; |
2639 | 734 |
} else { |
724
a73dec475b53
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
735 |
/* 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
|
736 |
WP(w,menu_d).sel_index = 0; |
2639 | 737 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
738 |
} |
0 | 739 |
WP(w,menu_d).action_id = main_button; |
740 |
WP(w,menu_d).main_button = main_button; |
|
741 |
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
|
742 |
WP(w,menu_d).disabled_items = 0; |
0 | 743 |
_popup_menu_active = true; |
541 | 744 |
SndPlayFx(SND_15_BEEP); |
0 | 745 |
return w; |
746 |
} |
|
747 |
||
748 |
static void ToolbarSaveClick(Window *w) |
|
749 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
750 |
PopupMainToolbMenu(w, 66, 3, STR_015C_SAVE_GAME, 4, 0); |
0 | 751 |
} |
752 |
||
753 |
static void ToolbarMapClick(Window *w) |
|
754 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
755 |
PopupMainToolbMenu(w, 96, 4, STR_02DE_MAP_OF_WORLD, 3, 0); |
0 | 756 |
} |
757 |
||
758 |
static void ToolbarTownClick(Window *w) |
|
759 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
760 |
PopupMainToolbMenu(w, 118, 5, STR_02BB_TOWN_DIRECTORY, 1, 0); |
0 | 761 |
} |
762 |
||
763 |
static void ToolbarSubsidiesClick(Window *w) |
|
764 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
765 |
PopupMainToolbMenu(w, 140, 6, STR_02DD_SUBSIDIES, 1, 0); |
0 | 766 |
} |
767 |
||
768 |
static void ToolbarStationsClick(Window *w) |
|
769 |
{ |
|
770 |
PopupMainPlayerToolbMenu(w, 162, 7, 0); |
|
771 |
} |
|
772 |
||
773 |
static void ToolbarMoneyClick(Window *w) |
|
774 |
{ |
|
775 |
PopupMainPlayerToolbMenu(w, 191, 8, 0); |
|
776 |
} |
|
777 |
||
778 |
static void ToolbarPlayersClick(Window *w) |
|
779 |
{ |
|
780 |
PopupMainPlayerToolbMenu(w, 213, 9, 0); |
|
781 |
} |
|
782 |
||
783 |
static void ToolbarGraphsClick(Window *w) |
|
784 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
785 |
PopupMainToolbMenu(w, 236, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6, 0); |
0 | 786 |
} |
787 |
||
788 |
static void ToolbarLeagueClick(Window *w) |
|
789 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
790 |
PopupMainToolbMenu(w, 258, 11, STR_015A_COMPANY_LEAGUE_TABLE, 2, 0); |
0 | 791 |
} |
792 |
||
793 |
static void ToolbarIndustryClick(Window *w) |
|
794 |
{ |
|
2866
23cf6ec995b1
(svn r3414) - Fix: Disable the Fund New Industry menu item and window when connected to a server as a spectator.
peter1138
parents:
2828
diff
changeset
|
795 |
int dis = _current_player == OWNER_SPECTATOR ? 2 : 0; |
23cf6ec995b1
(svn r3414) - Fix: Disable the Fund New Industry menu item and window when connected to a server as a spectator.
peter1138
parents:
2828
diff
changeset
|
796 |
PopupMainToolbMenu(w, 280, 12, STR_INDUSTRY_DIR, 2, dis); |
0 | 797 |
} |
798 |
||
799 |
static void ToolbarTrainClick(Window *w) |
|
800 |
{ |
|
2630 | 801 |
const Vehicle* v; |
0 | 802 |
int dis = -1; |
2639 | 803 |
|
804 |
FOR_ALL_VEHICLES(v) { |
|
2676
59b65b4fb480
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2652
diff
changeset
|
805 |
if (v->type == VEH_Train && IsFrontEngine(v)) CLRBIT(dis, v->owner); |
2639 | 806 |
} |
0 | 807 |
PopupMainPlayerToolbMenu(w, 310, 13, dis); |
808 |
} |
|
809 |
||
810 |
static void ToolbarRoadClick(Window *w) |
|
811 |
{ |
|
2630 | 812 |
const Vehicle* v; |
0 | 813 |
int dis = -1; |
2639 | 814 |
|
815 |
FOR_ALL_VEHICLES(v) { |
|
0 | 816 |
if (v->type == VEH_Road) CLRBIT(dis, v->owner); |
2639 | 817 |
} |
0 | 818 |
PopupMainPlayerToolbMenu(w, 332, 14, dis); |
819 |
} |
|
820 |
||
821 |
static void ToolbarShipClick(Window *w) |
|
822 |
{ |
|
2630 | 823 |
const Vehicle* v; |
0 | 824 |
int dis = -1; |
2639 | 825 |
|
826 |
FOR_ALL_VEHICLES(v) { |
|
0 | 827 |
if (v->type == VEH_Ship) CLRBIT(dis, v->owner); |
2639 | 828 |
} |
0 | 829 |
PopupMainPlayerToolbMenu(w, 354, 15, dis); |
830 |
} |
|
831 |
||
832 |
static void ToolbarAirClick(Window *w) |
|
833 |
{ |
|
2630 | 834 |
const Vehicle* v; |
0 | 835 |
int dis = -1; |
2639 | 836 |
|
837 |
FOR_ALL_VEHICLES(v) { |
|
0 | 838 |
if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner); |
2639 | 839 |
} |
0 | 840 |
PopupMainPlayerToolbMenu(w, 376, 16, dis); |
841 |
} |
|
842 |
||
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
|
843 |
/* 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
|
844 |
/* 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
|
845 |
bool DoZoomInOutWindow(int how, Window *w) |
0 | 846 |
{ |
847 |
ViewPort *vp; |
|
848 |
int button; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
849 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
850 |
switch (_game_mode) { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
851 |
case GM_EDITOR: button = 9; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
852 |
case GM_NORMAL: button = 17; break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
853 |
default: return false; |
0 | 854 |
} |
855 |
||
856 |
assert(w); |
|
857 |
vp = w->viewport; |
|
858 |
||
859 |
if (how == ZOOM_IN) { |
|
860 |
if (vp->zoom == 0) return false; |
|
861 |
vp->zoom--; |
|
862 |
vp->virtual_width >>= 1; |
|
863 |
vp->virtual_height >>= 1; |
|
864 |
||
865 |
WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1; |
|
866 |
WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1; |
|
867 |
||
868 |
SetWindowDirty(w); |
|
869 |
} else if (how == ZOOM_OUT) { |
|
870 |
if (vp->zoom == 2) return false; |
|
871 |
vp->zoom++; |
|
872 |
||
873 |
WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1; |
|
874 |
WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1; |
|
875 |
||
876 |
vp->virtual_width <<= 1; |
|
877 |
vp->virtual_height <<= 1; |
|
878 |
||
879 |
SetWindowDirty(w); |
|
880 |
} |
|
881 |
||
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
|
882 |
// routine to disable/enable the zoom buttons. Didn't know where to place these otherwise |
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
|
883 |
{ |
2639 | 884 |
Window* wt = NULL; |
885 |
||
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
|
886 |
switch (w->window_class) { |
2639 | 887 |
case WC_MAIN_WINDOW: |
888 |
wt = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
889 |
break; |
|
890 |
||
891 |
case WC_EXTRA_VIEW_PORT: |
|
892 |
wt = FindWindowById(WC_EXTRA_VIEW_PORT, w->window_number); |
|
893 |
button = 5; |
|
894 |
break; |
|
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
|
895 |
} |
0 | 896 |
|
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
|
897 |
assert(wt); |
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
|
898 |
|
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
|
899 |
// update the toolbar button too |
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
|
900 |
CLRBIT(wt->disabled_state, button); |
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
|
901 |
CLRBIT(wt->disabled_state, button + 1); |
2549 | 902 |
switch (vp->zoom) { |
903 |
case 0: SETBIT(wt->disabled_state, button); break; |
|
904 |
case 2: SETBIT(wt->disabled_state, button + 1); break; |
|
905 |
} |
|
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
|
906 |
SetWindowDirty(wt); |
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
|
907 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
908 |
|
0 | 909 |
return true; |
910 |
} |
|
911 |
||
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
|
912 |
static void MaxZoomIn(void) |
0 | 913 |
{ |
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
|
914 |
while (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0) ) ) {} |
0 | 915 |
} |
916 |
||
917 |
static void ToolbarZoomInClick(Window *w) |
|
918 |
{ |
|
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
|
919 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 920 |
HandleButtonClick(w, 17); |
541 | 921 |
SndPlayFx(SND_15_BEEP); |
0 | 922 |
} |
923 |
} |
|
924 |
||
925 |
static void ToolbarZoomOutClick(Window *w) |
|
926 |
{ |
|
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
|
927 |
if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 928 |
HandleButtonClick(w, 18); |
541 | 929 |
SndPlayFx(SND_15_BEEP); |
0 | 930 |
} |
931 |
} |
|
932 |
||
933 |
static void ToolbarBuildRailClick(Window *w) |
|
934 |
{ |
|
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2520
diff
changeset
|
935 |
const Player* p = GetPlayer(_local_player); |
0 | 936 |
Window *w2; |
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
937 |
w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes); |
0 | 938 |
WP(w2,menu_d).sel_index = _last_built_railtype; |
939 |
} |
|
940 |
||
941 |
static void ToolbarBuildRoadClick(Window *w) |
|
942 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
943 |
PopupMainToolbMenu(w, 479, 20, STR_180A_ROAD_CONSTRUCTION, 1, 0); |
0 | 944 |
} |
945 |
||
946 |
static void ToolbarBuildWaterClick(Window *w) |
|
947 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
948 |
PopupMainToolbMenu(w, 501, 21, STR_9800_DOCK_CONSTRUCTION, 1, 0); |
0 | 949 |
} |
950 |
||
951 |
static void ToolbarBuildAirClick(Window *w) |
|
952 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
953 |
PopupMainToolbMenu(w, 0x1E0, 22, STR_A01D_AIRPORT_CONSTRUCTION, 1, 0); |
0 | 954 |
} |
955 |
||
956 |
static void ToolbarForestClick(Window *w) |
|
957 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
958 |
PopupMainToolbMenu(w, 0x1E0, 23, STR_LANDSCAPING, 3, 0); |
0 | 959 |
} |
960 |
||
961 |
static void ToolbarMusicClick(Window *w) |
|
962 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
963 |
PopupMainToolbMenu(w, 0x1E0, 24, STR_01D3_SOUND_MUSIC, 1, 0); |
0 | 964 |
} |
965 |
||
966 |
static void ToolbarNewspaperClick(Window *w) |
|
967 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
968 |
PopupMainToolbMenu(w, 0x1E0, 25, STR_0200_LAST_MESSAGE_NEWS_REPORT, 3, 0); |
0 | 969 |
} |
970 |
||
971 |
static void ToolbarHelpClick(Window *w) |
|
972 |
{ |
|
2432
c48585a8b05f
(svn r2958) - Feature: [ 1258971 ] Menu option to toggle console. Mainly for MacOS's or PDA's. (toholio)
Darkvater
parents:
2430
diff
changeset
|
973 |
PopupMainToolbMenu(w, 0x1E0, 26, STR_02D5_LAND_BLOCK_INFO, 6, 0); |
0 | 974 |
} |
975 |
||
976 |
static void ToolbarOptionsClick(Window *w) |
|
977 |
{ |
|
978 |
uint16 x; |
|
979 |
||
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
980 |
w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 13, 0); |
0 | 981 |
|
982 |
x = (uint16)-1; |
|
2635 | 983 |
if (_display_opt & DO_SHOW_TOWN_NAMES) CLRBIT(x, 5); |
984 |
if (_display_opt & DO_SHOW_STATION_NAMES) CLRBIT(x, 6); |
|
985 |
if (_display_opt & DO_SHOW_SIGNS) CLRBIT(x, 7); |
|
986 |
if (_display_opt & DO_WAYPOINTS) CLRBIT(x, 8); |
|
987 |
if (_display_opt & DO_FULL_ANIMATION) CLRBIT(x, 9); |
|
988 |
if (_display_opt & DO_FULL_DETAIL) CLRBIT(x, 10); |
|
989 |
if (_display_opt & DO_TRANS_BUILDINGS) CLRBIT(x, 11); |
|
990 |
if (_display_opt & DO_TRANS_SIGNS) CLRBIT(x, 12); |
|
0 | 991 |
WP(w,menu_d).checked_items = x; |
992 |
} |
|
993 |
||
994 |
||
995 |
static void ToolbarScenSaveOrLoad(Window *w) |
|
996 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
997 |
PopupMainToolbMenu(w, 0x2C, 3, STR_0292_SAVE_SCENARIO, 5, 0); |
0 | 998 |
} |
999 |
||
1000 |
static void ToolbarScenDateBackward(Window *w) |
|
1001 |
{ |
|
1002 |
// don't allow too fast scrolling |
|
1003 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
|
1004 |
HandleButtonClick(w, 6); |
|
1005 |
InvalidateWidget(w, 5); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1006 |
|
2639 | 1007 |
if (_date > MinDate) SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1)); |
0 | 1008 |
} |
1009 |
_left_button_clicked = false; |
|
1010 |
} |
|
1011 |
||
1012 |
static void ToolbarScenDateForward(Window *w) |
|
1013 |
{ |
|
1014 |
// don't allow too fast scrolling |
|
1015 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
|
1016 |
HandleButtonClick(w, 7); |
|
1017 |
InvalidateWidget(w, 5); |
|
1018 |
||
2639 | 1019 |
if (_date < MaxDate) SetDate(ConvertYMDToDay(_cur_year + 1, 0, 1)); |
0 | 1020 |
} |
1021 |
_left_button_clicked = false; |
|
1022 |
} |
|
1023 |
||
1024 |
static void ToolbarScenMapTownDir(Window *w) |
|
1025 |
{ |
|
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2204
diff
changeset
|
1026 |
PopupMainToolbMenu(w, 0x16A, 8 | (17<<8), STR_02DE_MAP_OF_WORLD, 4, 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 |
{ |
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
|
1047 |
ViewPort * vp; |
0 | 1048 |
Point pt; |
1049 |
||
1050 |
assert(w != 0); |
|
1051 |
||
1052 |
vp = w->viewport; |
|
1053 |
||
1054 |
if (_game_mode != GM_MENU) { |
|
1055 |
if ((in && vp->zoom == 0) || (!in && vp->zoom == 2)) |
|
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 |
||
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
|
1067 |
static void ResetLandscape(void) |
0 | 1068 |
{ |
206 | 1069 |
_random_seeds[0][0] = InteractiveRandom(); |
1070 |
_random_seeds[0][1] = InteractiveRandom(); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1071 |
|
2828
342f02f7c0d4
(svn r3376) -Codechange: made enums for GenerateWorld and InitializeGame 'mode'
truelight
parents:
2755
diff
changeset
|
1072 |
GenerateWorld(GW_EMPTY, 1 << _patches.map_x, 1 << _patches.map_y); |
0 | 1073 |
MarkWholeScreenDirty(); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1074 |
} |
0 | 1075 |
|
1076 |
static const Widget _ask_reset_landscape_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
|
1077 |
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1078 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_022C_RESET_LANDSCAPE, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1079 |
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1080 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1081 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1082 |
{ WIDGETS_END}, |
0 | 1083 |
}; |
1084 |
||
1085 |
// Ask first to reset landscape or to make a random landscape |
|
1086 |
static void AskResetLandscapeWndProc(Window *w, WindowEvent *e) |
|
1087 |
{ |
|
1088 |
uint mode = w->window_number; |
|
1089 |
||
2639 | 1090 |
switch (e->event) { |
0 | 1091 |
case WE_PAINT: |
1092 |
DrawWindowWidgets(w); |
|
2639 | 1093 |
DrawStringMultiCenter( |
1094 |
90, 38, |
|
1095 |
mode ? STR_022D_ARE_YOU_SURE_YOU_WANT_TO : STR_GENERATE_RANDOM_LANDSCAPE, |
|
1096 |
168 |
|
1097 |
); |
|
1571
9afc220894dd
(svn r2075) -Fix: added missing breaks in switches
truelight
parents:
1542
diff
changeset
|
1098 |
break; |
0 | 1099 |
case WE_CLICK: |
2639 | 1100 |
switch (e->click.widget) { |
0 | 1101 |
case 3: |
1102 |
DeleteWindow(w); |
|
1103 |
break; |
|
1104 |
case 4: |
|
1105 |
DeleteWindow(w); |
|
999
647f65adeb9e
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents:
989
diff
changeset
|
1106 |
DeleteWindowByClass(WC_INDUSTRY_VIEW); |
647f65adeb9e
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents:
989
diff
changeset
|
1107 |
DeleteWindowByClass(WC_TOWN_VIEW); |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1015
diff
changeset
|
1108 |
DeleteWindowByClass(WC_LAND_INFO); |
999
647f65adeb9e
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents:
989
diff
changeset
|
1109 |
|
647f65adeb9e
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents:
989
diff
changeset
|
1110 |
if (mode) { // reset landscape |
0 | 1111 |
ResetLandscape(); |
999
647f65adeb9e
(svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents:
989
diff
changeset
|
1112 |
} else { // make random landscape |
541 | 1113 |
SndPlayFx(SND_15_BEEP); |
0 | 1114 |
_switch_mode = SM_GENRANDLAND; |
1115 |
} |
|
1116 |
break; |
|
1117 |
} |
|
1571
9afc220894dd
(svn r2075) -Fix: added missing breaks in switches
truelight
parents:
1542
diff
changeset
|
1118 |
break; |
0 | 1119 |
} |
1120 |
} |
|
1121 |
||
1122 |
static const WindowDesc _ask_reset_landscape_desc = { |
|
1123 |
230,205, 180, 92, |
|
1124 |
WC_ASK_RESET_LANDSCAPE,0, |
|
1125 |
WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1126 |
_ask_reset_landscape_widgets, |
|
1127 |
AskResetLandscapeWndProc, |
|
1128 |
}; |
|
1129 |
||
1130 |
static void AskResetLandscape(uint mode) |
|
1131 |
{ |
|
1132 |
AllocateWindowDescFront(&_ask_reset_landscape_desc, mode); |
|
1133 |
} |
|
1134 |
||
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
|
1135 |
// TODO - Incorporate into game itself to allow for ingame raising/lowering of |
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
|
1136 |
// larger chunks at the same time OR remove altogether, as we have 'level 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
|
1137 |
/** |
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
|
1138 |
* 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
|
1139 |
* 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
|
1140 |
* tiles in the selection to that height. |
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
|
1141 |
* @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
|
1142 |
* @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
|
1143 |
*/ |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1144 |
static void CommonRaiseLowerBigLand(TileIndex tile, int mode) |
0 | 1145 |
{ |
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1146 |
int sizex, sizey; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1147 |
byte h; |
0 | 1148 |
|
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
|
1149 |
_generating_world = true; // used to create green terraformed land |
0 | 1150 |
|
1151 |
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
|
1152 |
StringID msg = |
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1153 |
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
|
1154 |
|
0cec126ca9a9
(svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron
parents:
3134
diff
changeset
|
1155 |
DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(msg)); |
0 | 1156 |
} else { |
541 | 1157 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1158 |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1159 |
assert(_terraform_size != 0); |
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1160 |
// check out for map overflows |
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1161 |
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
|
1162 |
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
|
1163 |
|
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1164 |
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
|
1165 |
|
0 | 1166 |
if (mode != 0) { |
1167 |
/* 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
|
1168 |
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
|
1169 |
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
|
1170 |
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
|
1171 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1172 |
} else { |
1173 |
/* Lower land */ |
|
1174 |
h = 0; |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1175 |
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
|
1176 |
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
|
1177 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1178 |
} |
1179 |
||
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1180 |
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
|
1181 |
if (TileHeight(tile2) == h) { |
0 | 1182 |
DoCommandP(tile2, 8, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO); |
1183 |
} |
|
1697
95e9612b851d
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1184 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1185 |
} |
1186 |
||
1187 |
_generating_world = false; |
|
1188 |
} |
|
1189 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1190 |
static void PlaceProc_RaiseBigLand(TileIndex tile) |
0 | 1191 |
{ |
1192 |
CommonRaiseLowerBigLand(tile, 1); |
|
1193 |
} |
|
1194 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1195 |
static void PlaceProc_LowerBigLand(TileIndex tile) |
0 | 1196 |
{ |
1197 |
CommonRaiseLowerBigLand(tile, 0); |
|
1198 |
} |
|
1199 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1200 |
static void PlaceProc_RockyArea(TileIndex tile) |
0 | 1201 |
{ |
2615
e97a3034eef4
(svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
Darkvater
parents:
2571
diff
changeset
|
1202 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_RockyArea); |
0 | 1203 |
} |
1204 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1205 |
static void PlaceProc_LightHouse(TileIndex tile) |
0 | 1206 |
{ |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1207 |
if (!IsTileType(tile, MP_CLEAR) || IsSteepTileh(GetTileSlope(tile, NULL))) { |
0 | 1208 |
return; |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1209 |
} |
0 | 1210 |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1211 |
MakeLighthouse(tile); |
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1212 |
MarkTileDirtyByTile(tile); |
541 | 1213 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1214 |
} |
1215 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1216 |
static void PlaceProc_Transmitter(TileIndex tile) |
0 | 1217 |
{ |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1218 |
if (!IsTileType(tile, MP_CLEAR) || IsSteepTileh(GetTileSlope(tile, NULL))) { |
0 | 1219 |
return; |
2652
733e6877ccb1
(svn r3194) Don't use FindLandscapeHeightByTile() when it's overkill
tron
parents:
2643
diff
changeset
|
1220 |
} |
0 | 1221 |
|
3310
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1222 |
MakeTransmitter(tile); |
a19f247b75b6
(svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
3248
diff
changeset
|
1223 |
MarkTileDirtyByTile(tile); |
541 | 1224 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1225 |
} |
1226 |
||
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
|
1227 |
static void PlaceProc_DesertArea(TileIndex tile) |
0 | 1228 |
{ |
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
|
1229 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DesertArea); |
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 |
|
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 |
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
|
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 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_WaterArea); |
0 | 1235 |
} |
1236 |
||
1237 |
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
|
1238 |
{ 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
|
1239 |
{ 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
|
1240 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 170, 181, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 181, 14, 101, STR_NULL, STR_NULL}, |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 23, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
3134
e4f6fc217a29
(svn r3749) -Fix: [FS#61] The tooltips for raising and lowering land buttons in the scenario editor are interchanged (Reported and fixed by lc)
tron
parents:
2952
diff
changeset
|
1244 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 24, 45, 14, 35, SPR_IMG_TERRAFORM_DOWN, STR_018E_LOWER_A_CORNER_OF_LAND}, |
e4f6fc217a29
(svn r3749) -Fix: [FS#61] The tooltips for raising and lowering land buttons in the scenario editor are interchanged (Reported and fixed by lc)
tron
parents:
2952
diff
changeset
|
1245 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 46, 67, 14, 35, SPR_IMG_TERRAFORM_UP, STR_018F_RAISE_A_CORNER_OF_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
|
1246 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 68, 89, 14, 35, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 90, 111, 14, 35, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE}, |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 112, 134, 14, 35, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 135, 157, 14, 35, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // XXX - dynamic |
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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 158, 179, 14, 35, SPR_IMG_TRANSMITTER, STR_028E_PLACE_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
|
1251 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 43, 54, STR_0224, STR_0228_INCREASE_SIZE_OF_LAND_AREA}, |
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 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 56, 67, STR_0225, STR_0229_DECREASE_SIZE_OF_LAND_AREA}, |
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 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 149, 75, 86, STR_0226_RANDOM_LAND, STR_022A_GENERATE_RANDOM_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
|
1254 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 149, 88, 99, STR_0227_RESET_LAND, STR_022B_RESET_LANDSCAPE}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1255 |
{ WIDGETS_END}, |
0 | 1256 |
}; |
1257 |
||
1258 |
static const int8 _multi_terraform_coords[][2] = { |
|
1259 |
{ 0, -2}, |
|
1260 |
{ 4, 0},{ -4, 0},{ 0, 2}, |
|
1261 |
{ -8, 2},{ -4, 4},{ 0, 6},{ 4, 4},{ 8, 2}, |
|
1262 |
{-12, 0},{ -8, -2},{ -4, -4},{ 0, -6},{ 4, -4},{ 8, -2},{ 12, 0}, |
|
1263 |
{-16, 2},{-12, 4},{ -8, 6},{ -4, 8},{ 0, 10},{ 4, 8},{ 8, 6},{ 12, 4},{ 16, 2}, |
|
1264 |
{-20, 0},{-16, -2},{-12, -4},{ -8, -6},{ -4, -8},{ 0,-10},{ 4, -8},{ 8, -6},{ 12, -4},{ 16, -2},{ 20, 0}, |
|
1265 |
{-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}, |
|
1266 |
{-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}, |
|
1267 |
}; |
|
1268 |
||
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
|
1269 |
// TODO - Merge with terraform_gui.c (move there) after I have cooled down at its braindeadness |
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
|
1270 |
// and changed OnButtonClick to include the widget as well in the function decleration. Post 0.4.0 - Darkvater |
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
|
1271 |
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
|
1272 |
{ |
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
|
1273 |
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
|
1274 |
} |
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
|
1275 |
|
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
|
1276 |
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
|
1277 |
{ |
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
|
1278 |
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
|
1279 |
} |
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
|
1280 |
|
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
|
1281 |
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
|
1282 |
{ |
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
|
1283 |
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
|
1284 |
} |
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
|
1285 |
|
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
|
1286 |
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
|
1287 |
{ |
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
|
1288 |
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
|
1289 |
} |
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
|
1290 |
|
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
|
1291 |
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
|
1292 |
{ |
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
|
1293 |
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
|
1294 |
} |
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
|
1295 |
|
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
|
1296 |
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
|
1297 |
{ |
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 |
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
|
1299 |
} |
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
|
1300 |
|
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
|
1301 |
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
|
1302 |
{ |
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 |
HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_DESERT) ? PlaceProc_DesertArea : PlaceProc_LightHouse); |
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
|
1304 |
} |
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
|
1305 |
|
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
|
1306 |
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
|
1307 |
{ |
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
|
1308 |
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
|
1309 |
} |
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
|
1310 |
|
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
|
1311 |
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
|
1312 |
'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
|
1313 |
'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
|
1314 |
'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
|
1315 |
'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
|
1316 |
'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
|
1317 |
'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
|
1318 |
'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
|
1319 |
'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
|
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 |
|
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 |
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
|
1323 |
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
|
1324 |
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
|
1325 |
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
|
1326 |
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
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
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
|
1332 |
}; |
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 |
|
0 | 1334 |
static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) |
1335 |
{ |
|
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
|
1336 |
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
|
1337 |
case WE_CREATE: |
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
|
1338 |
// XXX - lighthouse button is widget 10!! Don't forget when changing |
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
|
1339 |
w->widget[10].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE; |
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
|
1340 |
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
|
1341 |
|
0 | 1342 |
case WE_PAINT: |
1343 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1344 |
|
0 | 1345 |
{ |
1346 |
int n = _terraform_size * _terraform_size; |
|
1347 |
const int8 *coords = &_multi_terraform_coords[0][0]; |
|
1348 |
||
1349 |
assert(n != 0); |
|
1350 |
do { |
|
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
|
1351 |
DrawSprite(SPR_WHITE_POINT, 77 + coords[0], 55 + coords[1]); |
0 | 1352 |
coords += 2; |
1353 |
} while (--n); |
|
1354 |
} |
|
1355 |
||
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
|
1356 |
if (w->click_state & ( 1 << 5 | 1 << 6)) // change area-size if raise/lower corner is selected |
0 | 1357 |
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
|
1358 |
|
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
|
1359 |
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
|
1360 |
|
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
|
1361 |
case WE_KEYPRESS: { |
2639 | 1362 |
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
|
1363 |
|
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 |
for (i = 0; i != lengthof(_editor_terraform_keycodes); i++) { |
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
|
1365 |
if (e->keypress.keycode == _editor_terraform_keycodes[i]) { |
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
|
1366 |
e->keypress.cont = false; |
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
|
1367 |
_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
|
1368 |
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
|
1369 |
} |
0 | 1370 |
} |
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
|
1371 |
} 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
|
1372 |
|
0 | 1373 |
case WE_CLICK: |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1374 |
switch (e->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
|
1375 |
case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
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
|
1376 |
_editor_terraform_button_proc[e->click.widget - 4](w); |
0 | 1377 |
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
|
1378 |
case 12: case 13: { /* Increase/Decrease terraform 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
|
1379 |
int size = (e->click.widget == 12) ? 1 : -1; |
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
|
1380 |
HandleButtonClick(w, e->click.widget); |
0 | 1381 |
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
|
1382 |
|
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
|
1383 |
if (!IS_INT_INSIDE(size, 1, 8 + 1)) return; |
0 | 1384 |
_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
|
1385 |
|
541 | 1386 |
SndPlayFx(SND_15_BEEP); |
0 | 1387 |
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
|
1388 |
} 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
|
1389 |
case 14: /* gen random 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
|
1390 |
HandleButtonClick(w, 14); |
0 | 1391 |
AskResetLandscape(0); |
1392 |
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
|
1393 |
case 15: /* reset landscape */ |
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
|
1394 |
HandleButtonClick(w,15); |
0 | 1395 |
AskResetLandscape(1); |
1396 |
break; |
|
1397 |
} |
|
1398 |
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
|
1399 |
|
0 | 1400 |
case WE_TIMEOUT: |
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
|
1401 |
UnclickSomeWindowButtons(w, ~(1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<10 | 1<<11)); |
0 | 1402 |
break; |
1403 |
case WE_PLACE_OBJ: |
|
1404 |
_place_proc(e->place.tile); |
|
1405 |
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
|
1406 |
case WE_PLACE_DRAG: |
0 | 1407 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata & 0xF); |
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
|
1408 |
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
|
1409 |
|
0 | 1410 |
case WE_PLACE_MOUSEUP: |
1411 |
if (e->click.pt.x != -1) { |
|
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
|
1412 |
if ((e->place.userdata & 0xF) == VPM_X_AND_Y) // dragged actions |
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 |
GUIPlaceProcDragXY(e); |
0 | 1414 |
} |
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
|
1415 |
break; |
0 | 1416 |
|
1417 |
case WE_ABORT_PLACE_OBJ: |
|
1418 |
w->click_state = 0; |
|
1419 |
SetWindowDirty(w); |
|
1420 |
break; |
|
1421 |
} |
|
1422 |
} |
|
1423 |
||
1424 |
static const WindowDesc _scen_edit_land_gen_desc = { |
|
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
|
1425 |
-1,-1, 182, 102, |
0 | 1426 |
WC_SCEN_LAND_GEN,0, |
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
|
1427 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1428 |
_scen_edit_land_gen_widgets, |
1429 |
ScenEditLandGenWndProc, |
|
1430 |
}; |
|
1431 |
||
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
|
1432 |
static inline void ShowEditorTerraformToolBar(void) |
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
|
1433 |
{ |
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
|
1434 |
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
|
1435 |
} |
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
|
1436 |
|
0 | 1437 |
static void ToolbarScenGenLand(Window *w) |
1438 |
{ |
|
1439 |
HandleButtonClick(w, 11); |
|
541 | 1440 |
SndPlayFx(SND_15_BEEP); |
0 | 1441 |
|
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
|
1442 |
ShowEditorTerraformToolBar(); |
0 | 1443 |
} |
1444 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1445 |
void CcBuildTown(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 1446 |
{ |
1447 |
if (success) { |
|
541 | 1448 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1449 |
ResetObjectToPlace(); |
1450 |
} |
|
1451 |
} |
|
1452 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1453 |
static void PlaceProc_Town(TileIndex tile) |
0 | 1454 |
{ |
1455 |
DoCommandP(tile, 0, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE)); |
|
1456 |
} |
|
1457 |
||
1458 |
||
1459 |
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
|
1460 |
{ 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
|
1461 |
{ 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
|
1462 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 148, 159, 0, 13, 0x0, STR_STICKY_BUTTON}, |
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
|
1463 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 159, 14, 81, 0x0, STR_NULL}, |
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
|
1464 |
{ 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
|
1465 |
{ 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
|
1466 |
{ 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
|
1467 |
{ 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
|
1468 |
{ 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
|
1469 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 106, 157, 68, 79, STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1470 |
{ WIDGETS_END}, |
0 | 1471 |
}; |
1472 |
||
1473 |
static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) |
|
1474 |
{ |
|
2639 | 1475 |
switch (e->event) { |
0 | 1476 |
case WE_PAINT: |
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
|
1477 |
w->click_state = (w->click_state & ~(1<<7 | 1<<8 | 1<<9) ) | (1 << (_new_town_size + 7)); |
0 | 1478 |
DrawWindowWidgets(w); |
1479 |
DrawStringCentered(80, 56, STR_02A5_TOWN_SIZE, 0); |
|
1480 |
break; |
|
1481 |
||
1482 |
case WE_CLICK: |
|
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
|
1483 |
switch (e->click.widget) { |
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
|
1484 |
case 4: /* 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
|
1485 |
HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, 1, PlaceProc_Town); |
0 | 1486 |
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
|
1487 |
case 5: {/* random town */ |
0 | 1488 |
Town *t; |
1489 |
||
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, 5); |
0 | 1491 |
_generating_world = true; |
1362
bceb3c57353d
(svn r1866) -Fix: Intercepted generated maps with 0 towns on it. Currently just an
celestar
parents:
1357
diff
changeset
|
1492 |
t = CreateRandomTown(20); |
0 | 1493 |
_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
|
1494 |
|
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
|
1495 |
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
|
1496 |
ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0); |
2639 | 1497 |
} else { |
0 | 1498 |
ScrollMainWindowToTile(t->xy); |
2639 | 1499 |
} |
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
|
1500 |
|
0 | 1501 |
break; |
1502 |
} |
|
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
|
1503 |
case 6: {/* many random towns */ |
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
|
1504 |
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
|
1505 |
|
0 | 1506 |
_generating_world = true; |
1507 |
_game_mode = GM_NORMAL; // little hack to avoid towns of the same size |
|
2639 | 1508 |
if (!GenerateTowns()) { |
1509 |
ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0); |
|
1510 |
} |
|
0 | 1511 |
_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
|
1512 |
|
0 | 1513 |
_game_mode = GM_EDITOR; |
1514 |
break; |
|
1515 |
} |
|
1516 |
||
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
|
1517 |
case 7: case 8: case 9: |
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
|
1518 |
_new_town_size = e->click.widget - 7; |
0 | 1519 |
SetWindowDirty(w); |
1520 |
break; |
|
1521 |
} |
|
1522 |
break; |
|
1523 |
||
1524 |
case WE_TIMEOUT: |
|
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
|
1525 |
UnclickSomeWindowButtons(w, 1<<5 | 1<<6); |
0 | 1526 |
break; |
1527 |
case WE_PLACE_OBJ: |
|
1528 |
_place_proc(e->place.tile); |
|
1529 |
break; |
|
1530 |
case WE_ABORT_PLACE_OBJ: |
|
1531 |
w->click_state = 0; |
|
1532 |
SetWindowDirty(w); |
|
1533 |
break; |
|
1534 |
} |
|
1535 |
} |
|
1536 |
||
1537 |
static const WindowDesc _scen_edit_town_gen_desc = { |
|
1538 |
-1,-1, 160, 82, |
|
1539 |
WC_SCEN_TOWN_GEN,0, |
|
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
|
1540 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1541 |
_scen_edit_town_gen_widgets, |
1542 |
ScenEditTownGenWndProc, |
|
1543 |
}; |
|
1544 |
||
1545 |
static void ToolbarScenGenTown(Window *w) |
|
1546 |
{ |
|
1547 |
HandleButtonClick(w, 12); |
|
541 | 1548 |
SndPlayFx(SND_15_BEEP); |
0 | 1549 |
|
1550 |
AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0); |
|
1551 |
} |
|
1552 |
||
1553 |
||
1554 |
static const Widget _scenedit_industry_normal_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
|
1555 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1556 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1557 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1558 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1559 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1560 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1561 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1562 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1563 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1564 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1565 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1566 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0245_OIL_RIG, STR_0267_CONSTRUCT_OIL_RIG_CAN_ONLY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1567 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1568 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1569 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1570 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0249_IRON_ORE_MINE, STR_026B_CONSTRUCT_IRON_ORE_MINE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1571 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1572 |
{ 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
|
1573 |
{ WIDGETS_END}, |
0 | 1574 |
}; |
1575 |
||
1576 |
||
1577 |
static const Widget _scenedit_industry_hilly_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
|
1578 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1579 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1580 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1581 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1582 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1583 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1584 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1585 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1586 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1587 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1588 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1589 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1590 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1591 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_024F_GOLD_MINE, STR_0271_CONSTRUCT_GOLD_MINE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1592 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1593 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1594 |
{ 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
|
1595 |
{ WIDGETS_END}, |
0 | 1596 |
}; |
1597 |
||
1598 |
static const Widget _scenedit_industry_desert_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
|
1599 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1600 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1601 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1602 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1603 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1604 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1605 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1606 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0251_FRUIT_PLANTATION, STR_0274_PLANT_FRUIT_PLANTATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1607 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0252_RUBBER_PLANTATION,STR_0275_PLANT_RUBBER_PLANTATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1608 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1609 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1610 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1611 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0253_WATER_SUPPLY, STR_0276_CONSTRUCT_WATER_SUPPLY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1612 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1613 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1614 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1615 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1616 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 185, 196, STR_0255_DIAMOND_MINE, STR_0278_CONSTRUCT_DIAMOND_MINE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1617 |
{ 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
|
1618 |
{ WIDGETS_END}, |
0 | 1619 |
}; |
1620 |
||
1621 |
static const Widget _scenedit_industry_candy_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
|
1622 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1623 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION,STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1624 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
1625 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1626 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1627 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1628 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0257_COTTON_CANDY_FOREST,STR_027A_PLANT_COTTON_CANDY_FOREST}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1629 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1630 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0259_BATTERY_FARM, STR_027C_CONSTRUCT_BATTERY_FARM}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1631 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_025A_COLA_WELLS, STR_027D_CONSTRUCT_COLA_WELLS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1632 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1633 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1634 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_025D_PLASTIC_FOUNTAINS, STR_0280_CONSTRUCT_PLASTIC_FOUNTAINS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1635 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_025E_FIZZY_DRINK_FACTORY,STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1636 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_025F_BUBBLE_GENERATOR, STR_0282_CONSTRUCT_BUBBLE_GENERATOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1637 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0260_TOFFEE_QUARRY, STR_0283_CONSTRUCT_TOFFEE_QUARRY}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1638 |
{ 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
|
1639 |
{ WIDGETS_END}, |
0 | 1640 |
}; |
1641 |
||
1642 |
||
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
|
1643 |
static bool AnyTownExists(void) |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
1644 |
{ |
2630 | 1645 |
const Town* t; |
1646 |
||
0 | 1647 |
FOR_ALL_TOWNS(t) { |
2639 | 1648 |
if (t->xy != 0) return true; |
0 | 1649 |
} |
1650 |
return false; |
|
1651 |
} |
|
1652 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1653 |
extern Industry *CreateNewIndustry(TileIndex tile, int type); |
0 | 1654 |
|
1655 |
static bool TryBuildIndustry(TileIndex tile, int type) |
|
1656 |
{ |
|
1657 |
int n; |
|
1658 |
||
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1659 |
if (CreateNewIndustry(tile, type)) return true; |
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1660 |
|
0 | 1661 |
n = 100; |
1662 |
do { |
|
1663 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true; |
|
1664 |
} while (--n); |
|
1665 |
||
1666 |
n = 200; |
|
1667 |
do { |
|
1668 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 2), type)) return true; |
|
1669 |
} while (--n); |
|
1670 |
||
1671 |
n = 700; |
|
1672 |
do { |
|
1673 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 4), type)) return true; |
|
1674 |
} while (--n); |
|
1675 |
||
1676 |
return false; |
|
1677 |
} |
|
1678 |
||
1679 |
||
1680 |
static const byte _industry_type_list[4][16] = { |
|
1681 |
{0, 1, 2, 3, 4, 5, 6, 8, 9, 18, 11, 12}, |
|
1682 |
{0, 1, 14, 3, 4, 13, 7, 15, 9, 16, 11, 12}, |
|
1683 |
{25, 19, 20, 4, 13, 23, 21, 24, 22, 11, 16, 17, 10}, |
|
1684 |
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}, |
|
1685 |
}; |
|
1686 |
||
2630 | 1687 |
static int _industry_type_to_place; |
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1688 |
bool _ignore_restrictions; |
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1689 |
|
0 | 1690 |
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e) |
1691 |
{ |
|
1692 |
int button; |
|
1693 |
||
2952 | 1694 |
switch (e->event) { |
0 | 1695 |
case WE_PAINT: |
1696 |
DrawWindowWidgets(w); |
|
1697 |
break; |
|
1698 |
||
1699 |
case WE_CLICK: |
|
2639 | 1700 |
if (e->click.widget == 3) { |
0 | 1701 |
HandleButtonClick(w, 3); |
1702 |
||
2639 | 1703 |
if (!AnyTownExists()) { |
1704 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_CAN_T_GENERATE_INDUSTRIES, 0, 0); |
|
1705 |
return; |
|
1706 |
} |
|
0 | 1707 |
|
1708 |
_generating_world = true; |
|
1709 |
GenerateIndustries(); |
|
1710 |
_generating_world = false; |
|
1711 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1712 |
|
0 | 1713 |
if ((button=e->click.widget) >= 4) { |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
1714 |
if (HandlePlacePushButton(w, button, SPR_CURSOR_INDUSTRY, 1, NULL)) |
0 | 1715 |
_industry_type_to_place = _industry_type_list[_opt.landscape][button - 4]; |
1716 |
} |
|
1717 |
break; |
|
1718 |
case WE_PLACE_OBJ: { |
|
1719 |
int type; |
|
1720 |
||
1721 |
// Show error if no town exists at all |
|
1722 |
type = _industry_type_to_place; |
|
1723 |
if (!AnyTownExists()) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1724 |
SetDParam(0, type + STR_4802_COAL_MINE); |
0 | 1725 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST,STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y); |
1726 |
return; |
|
1727 |
} |
|
1728 |
||
1729 |
_current_player = OWNER_NONE; |
|
1730 |
_generating_world = true; |
|
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1731 |
_ignore_restrictions = true; |
0 | 1732 |
if (!TryBuildIndustry(e->place.tile,type)) { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1733 |
SetDParam(0, type + STR_4802_COAL_MINE); |
2639 | 1734 |
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE, e->place.pt.x, e->place.pt.y); |
0 | 1735 |
} |
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1736 |
_ignore_restrictions = false; |
0 | 1737 |
_generating_world = false; |
1738 |
break; |
|
1739 |
} |
|
1740 |
case WE_ABORT_PLACE_OBJ: |
|
1741 |
w->click_state = 0; |
|
1742 |
SetWindowDirty(w); |
|
1743 |
break; |
|
1744 |
case WE_TIMEOUT: |
|
1745 |
UnclickSomeWindowButtons(w, 1<<3); |
|
1746 |
break; |
|
1747 |
} |
|
1748 |
} |
|
1749 |
||
1750 |
static const WindowDesc _scenedit_industry_normal_desc = { |
|
1751 |
-1,-1, 170, 225, |
|
1752 |
WC_SCEN_INDUSTRY,0, |
|
1753 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1754 |
_scenedit_industry_normal_widgets, |
|
1755 |
ScenEditIndustryWndProc, |
|
1756 |
}; |
|
1757 |
||
1758 |
static const WindowDesc _scenedit_industry_hilly_desc = { |
|
1759 |
-1,-1, 170, 225, |
|
1760 |
WC_SCEN_INDUSTRY,0, |
|
1761 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1762 |
_scenedit_industry_hilly_widgets, |
|
1763 |
ScenEditIndustryWndProc, |
|
1764 |
}; |
|
1765 |
||
1766 |
static const WindowDesc _scenedit_industry_desert_desc = { |
|
1767 |
-1,-1, 170, 225, |
|
1768 |
WC_SCEN_INDUSTRY,0, |
|
1769 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1770 |
_scenedit_industry_desert_widgets, |
|
1771 |
ScenEditIndustryWndProc, |
|
1772 |
}; |
|
1773 |
||
1774 |
static const WindowDesc _scenedit_industry_candy_desc = { |
|
1775 |
-1,-1, 170, 225, |
|
1776 |
WC_SCEN_INDUSTRY,0, |
|
1777 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1778 |
_scenedit_industry_candy_widgets, |
|
1779 |
ScenEditIndustryWndProc, |
|
1780 |
}; |
|
1781 |
||
1782 |
static const WindowDesc * const _scenedit_industry_descs[] = { |
|
1783 |
&_scenedit_industry_normal_desc, |
|
1784 |
&_scenedit_industry_hilly_desc, |
|
1785 |
&_scenedit_industry_desert_desc, |
|
1786 |
&_scenedit_industry_candy_desc, |
|
1787 |
}; |
|
1788 |
||
1789 |
||
1790 |
static void ToolbarScenGenIndustry(Window *w) |
|
1791 |
{ |
|
1792 |
HandleButtonClick(w, 13); |
|
541 | 1793 |
SndPlayFx(SND_15_BEEP); |
0 | 1794 |
AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0); |
1795 |
} |
|
1796 |
||
1797 |
static void ToolbarScenBuildRoad(Window *w) |
|
1798 |
{ |
|
1799 |
HandleButtonClick(w, 14); |
|
541 | 1800 |
SndPlayFx(SND_15_BEEP); |
0 | 1801 |
ShowBuildRoadScenToolbar(); |
1802 |
} |
|
1803 |
||
1804 |
static void ToolbarScenPlantTrees(Window *w) |
|
1805 |
{ |
|
1806 |
HandleButtonClick(w, 15); |
|
541 | 1807 |
SndPlayFx(SND_15_BEEP); |
0 | 1808 |
ShowBuildTreesScenToolbar(); |
1809 |
} |
|
1810 |
||
1811 |
static void ToolbarScenPlaceSign(Window *w) |
|
1812 |
{ |
|
1813 |
HandleButtonClick(w, 16); |
|
541 | 1814 |
SndPlayFx(SND_15_BEEP); |
0 | 1815 |
SelectSignTool(); |
1816 |
} |
|
1817 |
||
1818 |
static void ToolbarBtn_NULL(Window *w) |
|
1819 |
{ |
|
1820 |
} |
|
1821 |
||
2639 | 1822 |
|
1823 |
typedef void ToolbarButtonProc(Window *w); |
|
1824 |
||
0 | 1825 |
static ToolbarButtonProc* const _toolbar_button_procs[] = { |
1826 |
ToolbarPauseClick, |
|
1827 |
ToolbarFastForwardClick, |
|
1828 |
ToolbarOptionsClick, |
|
1829 |
ToolbarSaveClick, |
|
1830 |
ToolbarMapClick, |
|
1831 |
ToolbarTownClick, |
|
1832 |
ToolbarSubsidiesClick, |
|
1833 |
ToolbarStationsClick, |
|
1834 |
ToolbarMoneyClick, |
|
1835 |
ToolbarPlayersClick, |
|
1836 |
ToolbarGraphsClick, |
|
1837 |
ToolbarLeagueClick, |
|
1838 |
ToolbarIndustryClick, |
|
1839 |
ToolbarTrainClick, |
|
1840 |
ToolbarRoadClick, |
|
1841 |
ToolbarShipClick, |
|
1842 |
ToolbarAirClick, |
|
1843 |
ToolbarZoomInClick, |
|
1844 |
ToolbarZoomOutClick, |
|
1845 |
ToolbarBuildRailClick, |
|
1846 |
ToolbarBuildRoadClick, |
|
1847 |
ToolbarBuildWaterClick, |
|
1848 |
ToolbarBuildAirClick, |
|
1849 |
ToolbarForestClick, |
|
1850 |
ToolbarMusicClick, |
|
1851 |
ToolbarNewspaperClick, |
|
1852 |
ToolbarHelpClick, |
|
1853 |
}; |
|
1854 |
||
1855 |
static void MainToolbarWndProc(Window *w, WindowEvent *e) |
|
1856 |
{ |
|
2952 | 1857 |
switch (e->event) { |
0 | 1858 |
case WE_PAINT: { |
1859 |
||
1860 |
// Draw brown-red toolbar bg. |
|
1861 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
|
2218
2132596a35c0
(svn r2736) -Codechange: De-mystified GfxDrawFillRect a bit, and used enums from table/sprites.h. You can now change the number of bits used for sprites and switches in the SpriteSetup enum and the rest should work automagically. Can be used to increase the number of active sprites to 2^19 in case there are no colortables (recolor sprites) in any newgrf. We should possibly move the the colortables to an own list, but how to detect them in a newgrf.
celestar
parents:
2216
diff
changeset
|
1862 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT); |
0 | 1863 |
|
1864 |
// if spectator, disable things |
|
1 | 1865 |
if (_current_player == OWNER_SPECTATOR){ |
213
770e504a6e51
(svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater
parents:
206
diff
changeset
|
1866 |
w->disabled_state |= (1 << 19) | (1<<20) | (1<<21) | (1<<22) | (1<<23); |
0 | 1867 |
} else { |
213
770e504a6e51
(svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater
parents:
206
diff
changeset
|
1868 |
w->disabled_state &= ~((1 << 19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)); |
0 | 1869 |
} |
1870 |
||
1871 |
DrawWindowWidgets(w); |
|
1872 |
break; |
|
1873 |
} |
|
1874 |
||
1875 |
case WE_CLICK: { |
|
1876 |
if (_game_mode != GM_MENU && !HASBIT(w->disabled_state, e->click.widget)) |
|
1877 |
_toolbar_button_procs[e->click.widget](w); |
|
1878 |
} break; |
|
1879 |
||
1880 |
case WE_KEYPRESS: { |
|
2469
59a0073914d8
(svn r2995) Replace 0xFF/0xFFFF with CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate
tron
parents:
2468
diff
changeset
|
1881 |
PlayerID local = (_local_player != OWNER_SPECTATOR) ? _local_player : 0; |
0 | 1882 |
|
2639 | 1883 |
switch (e->keypress.keycode) { |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1884 |
case WKC_F1: case WKC_PAUSE: |
424
a3095d8c1c6a
(svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron
parents:
410
diff
changeset
|
1885 |
ToolbarPauseClick(w); |
a3095d8c1c6a
(svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron
parents:
410
diff
changeset
|
1886 |
break; |
0 | 1887 |
case WKC_F2: ShowGameOptions(); break; |
1888 |
case WKC_F3: MenuClickSaveLoad(0); break; |
|
1889 |
case WKC_F4: ShowSmallMap(); break; |
|
1890 |
case WKC_F5: ShowTownDirectory(); break; |
|
1891 |
case WKC_F6: ShowSubsidiesList(); break; |
|
1892 |
case WKC_F7: ShowPlayerStations(local); break; |
|
1893 |
case WKC_F8: ShowPlayerFinances(local); break; |
|
1894 |
case WKC_F9: ShowPlayerCompany(local); break; |
|
1895 |
case WKC_F10:ShowOperatingProfitGraph(); break; |
|
1896 |
case WKC_F11: ShowCompanyLeagueTable(); break; |
|
1897 |
case WKC_F12: ShowBuildIndustryWindow(); break; |
|
2466
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
1898 |
case WKC_SHIFT | WKC_F1: ShowPlayerTrains(local, INVALID_STATION); break; |
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
1899 |
case WKC_SHIFT | WKC_F2: ShowPlayerRoadVehicles(local, INVALID_STATION); break; |
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
1900 |
case WKC_SHIFT | WKC_F3: ShowPlayerShips(local, INVALID_STATION); break; |
1aa260b43faa
(svn r2992) Use PlayerID, StationID and INVALID_STATION instead of int, int and -1
tron
parents:
2436
diff
changeset
|
1901 |
case WKC_SHIFT | WKC_F4: ShowPlayerAircraft(local, INVALID_STATION); break; |
0 | 1902 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break; |
1903 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break; |
|
1904 |
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype,-1); break; |
|
1905 |
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(); break; |
|
1906 |
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; |
|
1907 |
case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break; |
|
1908 |
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; |
|
1909 |
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; |
|
1910 |
case WKC_CTRL | 'S': _make_screenshot = 1; break; |
|
130
b593afdae262
(svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik
parents:
126
diff
changeset
|
1911 |
case WKC_CTRL | 'G': _make_screenshot = 2; break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1912 |
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
|
1913 |
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
|
1914 |
case 'L': ShowTerraformToolbar(); break; |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1915 |
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
|
1916 |
} |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1917 |
e->keypress.cont = false; |
0 | 1918 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1919 |
|
0 | 1920 |
case WE_PLACE_OBJ: { |
1921 |
_place_proc(e->place.tile); |
|
1922 |
} break; |
|
1923 |
||
1924 |
case WE_ABORT_PLACE_OBJ: { |
|
1925 |
w->click_state &= ~(1<<25); |
|
1926 |
SetWindowDirty(w); |
|
1927 |
} break; |
|
1928 |
||
1929 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
|
1930 |
||
1931 |
case WE_MOUSELOOP: |
|
1932 |
if (((w->click_state) & 1) != (uint)!!_pause) { |
|
1933 |
w->click_state ^= (1 << 0); |
|
1934 |
SetWindowDirty(w); |
|
1935 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1936 |
|
0 | 1937 |
if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) { |
1938 |
w->click_state ^= (1 << 1); |
|
1939 |
SetWindowDirty(w); |
|
1940 |
} |
|
1941 |
break; |
|
1942 |
||
1943 |
case WE_TIMEOUT: |
|
1944 |
UnclickSomeWindowButtons(w, ~(1<<0 | 1<<1)); |
|
1945 |
break; |
|
1946 |
} |
|
1947 |
} |
|
1948 |
||
1949 |
static const Widget _toolb_normal_widgets[] = { |
|
3248
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1950 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
2571
550a7d323ced
(svn r3108) Confine the use of SPR_OPENTTD_BASE to table/sprites.h by adding/using some sprite enums
tron
parents:
2557
diff
changeset
|
1951 |
{ WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
3248
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1952 |
{ WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1953 |
{ WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, SPR_IMG_SAVE, STR_0172_SAVE_GAME_ABANDON_GAME}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1954 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1955 |
{ WWT_PANEL, RESIZE_NONE, 14, 96, 117, 0, 21, SPR_IMG_SMALLMAP, STR_0174_DISPLAY_MAP}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1956 |
{ WWT_PANEL, RESIZE_NONE, 14, 118, 139, 0, 21, SPR_IMG_TOWN, STR_0176_DISPLAY_TOWN_DIRECTORY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1957 |
{ WWT_PANEL, RESIZE_NONE, 14, 140, 161, 0, 21, SPR_IMG_SUBSIDIES, STR_02DC_DISPLAY_SUBSIDIES}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1958 |
{ WWT_PANEL, RESIZE_NONE, 14, 162, 183, 0, 21, SPR_IMG_COMPANY_LIST, STR_0173_DISPLAY_LIST_OF_COMPANY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1959 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1960 |
{ WWT_PANEL, RESIZE_NONE, 14, 191, 212, 0, 21, SPR_IMG_COMPANY_FINANCE, STR_0177_DISPLAY_COMPANY_FINANCES}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1961 |
{ WWT_PANEL, RESIZE_NONE, 14, 213, 235, 0, 21, SPR_IMG_COMPANY_GENERAL, STR_0178_DISPLAY_COMPANY_GENERAL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1962 |
{ WWT_PANEL, RESIZE_NONE, 14, 236, 257, 0, 21, SPR_IMG_GRAPHS, STR_0179_DISPLAY_GRAPHS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1963 |
{ WWT_PANEL, RESIZE_NONE, 14, 258, 279, 0, 21, SPR_IMG_COMPANY_LEAGUE, STR_017A_DISPLAY_COMPANY_LEAGUE}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1964 |
{ WWT_PANEL, RESIZE_NONE, 14, 280, 301, 0, 21, SPR_IMG_INDUSTRY, STR_0312_FUND_CONSTRUCTION_OF_NEW}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1965 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1966 |
{ WWT_PANEL, RESIZE_NONE, 14, 310, 331, 0, 21, SPR_IMG_TRAINLIST, STR_017B_DISPLAY_LIST_OF_COMPANY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1967 |
{ WWT_PANEL, RESIZE_NONE, 14, 332, 353, 0, 21, SPR_IMG_TRUCKLIST, STR_017C_DISPLAY_LIST_OF_COMPANY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1968 |
{ WWT_PANEL, RESIZE_NONE, 14, 354, 375, 0, 21, SPR_IMG_SHIPLIST, STR_017D_DISPLAY_LIST_OF_COMPANY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1969 |
{ WWT_PANEL, RESIZE_NONE, 14, 376, 397, 0, 21, SPR_IMG_AIRPLANESLIST, STR_017E_DISPLAY_LIST_OF_COMPANY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1970 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1971 |
{ WWT_PANEL, RESIZE_NONE, 14, 406, 427, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1972 |
{ WWT_PANEL, RESIZE_NONE, 14, 428, 449, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1973 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1974 |
{ WWT_PANEL, RESIZE_NONE, 14, 457, 478, 0, 21, SPR_IMG_BUILDRAIL, STR_0181_BUILD_RAILROAD_TRACK}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1975 |
{ WWT_PANEL, RESIZE_NONE, 14, 479, 500, 0, 21, SPR_IMG_BUILDROAD, STR_0182_BUILD_ROADS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1976 |
{ WWT_PANEL, RESIZE_NONE, 14, 501, 522, 0, 21, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1977 |
{ WWT_PANEL, RESIZE_NONE, 14, 523, 544, 0, 21, SPR_IMG_BUILDAIR, STR_0184_BUILD_AIRPORTS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1978 |
{ WWT_PANEL, RESIZE_NONE, 14, 545, 566, 0, 21, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, // tree icon is 0x2E6 |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1979 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1980 |
{ WWT_PANEL, RESIZE_NONE, 14, 574, 595, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1981 |
{ WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, SPR_IMG_MESSAGES, STR_0203_SHOW_LAST_MESSAGE_NEWS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1982 |
{ WWT_PANEL, 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
|
1983 |
{ WIDGETS_END}, |
0 | 1984 |
}; |
1985 |
||
1986 |
static const WindowDesc _toolb_normal_desc = { |
|
1987 |
0, 0, 640, 22, |
|
1988 |
WC_MAIN_TOOLBAR,0, |
|
1989 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
|
1990 |
_toolb_normal_widgets, |
|
1991 |
MainToolbarWndProc |
|
1992 |
}; |
|
1993 |
||
1994 |
||
1995 |
static const Widget _toolb_scen_widgets[] = { |
|
3248
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1996 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1997 |
{ WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1998 |
{ WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
1999 |
{WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, SPR_IMG_SAVE, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2000 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2001 |
{ WWT_PANEL, RESIZE_NONE, 14, 96, 225, 0, 21, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2002 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2003 |
{ WWT_PANEL, RESIZE_NONE, 14, 233, 362, 0, 21, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2004 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 236, 247, 5, 16, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2005 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 347, 358, 5, 16, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2006 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2007 |
{ WWT_PANEL, RESIZE_NONE, 14, 371, 392, 0, 21, SPR_IMG_SMALLMAP, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2008 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2009 |
{ WWT_PANEL, RESIZE_NONE, 14, 400, 421, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2010 |
{ WWT_PANEL, RESIZE_NONE, 14, 422, 443, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2011 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2012 |
{ WWT_PANEL, RESIZE_NONE, 14, 452, 473, 0, 21, SPR_IMG_LANDSCAPING, STR_022E_LANDSCAPE_GENERATION}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2013 |
{ WWT_PANEL, RESIZE_NONE, 14, 474, 495, 0, 21, SPR_IMG_TOWN, STR_022F_TOWN_GENERATION}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2014 |
{ WWT_PANEL, RESIZE_NONE, 14, 496, 517, 0, 21, SPR_IMG_INDUSTRY, STR_0230_INDUSTRY_GENERATION}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2015 |
{ WWT_PANEL, RESIZE_NONE, 14, 518, 539, 0, 21, SPR_IMG_BUILDROAD, STR_0231_ROAD_CONSTRUCTION}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2016 |
{ WWT_PANEL, RESIZE_NONE, 14, 540, 561, 0, 21, SPR_IMG_PLANTTREES, STR_0288_PLANT_TREES}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2017 |
{ WWT_PANEL, RESIZE_NONE, 14, 562, 583, 0, 21, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2018 |
|
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2019 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2020 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2021 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2022 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2023 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2024 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2025 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2026 |
{ WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2027 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2028 |
{ WWT_PANEL, RESIZE_NONE, 14, 618, 639, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2029 |
{WIDGETS_END}, |
0 | 2030 |
}; |
2031 |
||
2032 |
static ToolbarButtonProc* const _scen_toolbar_button_procs[] = { |
|
2033 |
ToolbarPauseClick, |
|
2034 |
ToolbarFastForwardClick, |
|
2035 |
ToolbarOptionsClick, |
|
2036 |
ToolbarScenSaveOrLoad, |
|
2037 |
ToolbarBtn_NULL, |
|
2038 |
ToolbarBtn_NULL, |
|
2039 |
ToolbarScenDateBackward, |
|
2040 |
ToolbarScenDateForward, |
|
2041 |
ToolbarScenMapTownDir, |
|
2042 |
ToolbarScenZoomIn, |
|
2043 |
ToolbarScenZoomOut, |
|
2044 |
ToolbarScenGenLand, |
|
2045 |
ToolbarScenGenTown, |
|
2046 |
ToolbarScenGenIndustry, |
|
2047 |
ToolbarScenBuildRoad, |
|
2048 |
ToolbarScenPlantTrees, |
|
2049 |
ToolbarScenPlaceSign, |
|
2050 |
NULL, |
|
2051 |
NULL, |
|
2052 |
NULL, |
|
2053 |
NULL, |
|
2054 |
NULL, |
|
2055 |
NULL, |
|
2056 |
NULL, |
|
2057 |
ToolbarMusicClick, |
|
2058 |
NULL, |
|
2059 |
ToolbarHelpClick, |
|
2060 |
}; |
|
2061 |
||
2062 |
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) |
|
2063 |
{ |
|
2952 | 2064 |
switch (e->event) { |
0 | 2065 |
case WE_PAINT: |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2066 |
/* XXX look for better place for these */ |
2639 | 2067 |
if (_date <= MinDate) { |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2068 |
SETBIT(w->disabled_state, 6); |
2639 | 2069 |
} else { |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2070 |
CLRBIT(w->disabled_state, 6); |
2639 | 2071 |
} |
2072 |
if (_date >= MaxDate) { |
|
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2073 |
SETBIT(w->disabled_state, 7); |
2639 | 2074 |
} else { |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2075 |
CLRBIT(w->disabled_state, 7); |
2639 | 2076 |
} |
349
518d84a83723
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2077 |
|
0 | 2078 |
// Draw brown-red toolbar bg. |
2079 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
|
2218
2132596a35c0
(svn r2736) -Codechange: De-mystified GfxDrawFillRect a bit, and used enums from table/sprites.h. You can now change the number of bits used for sprites and switches in the SpriteSetup enum and the rest should work automagically. Can be used to increase the number of active sprites to 2^19 in case there are no colortables (recolor sprites) in any newgrf. We should possibly move the the colortables to an own list, but how to detect them in a newgrf.
celestar
parents:
2216
diff
changeset
|
2080 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT); |
0 | 2081 |
|
2082 |
DrawWindowWidgets(w); |
|
2083 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2084 |
SetDParam(0, _date); |
0 | 2085 |
DrawStringCentered(298, 6, STR_00AF, 0); |
2086 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2087 |
SetDParam(0, _date); |
74
d23a80ef6361
(svn r75) -Add proper crediting to graphics artists to about box.
darkvater
parents:
68
diff
changeset
|
2088 |
DrawStringCentered(161, 1, STR_0221_OPENTTD, 0); |
0 | 2089 |
DrawStringCentered(161, 11,STR_0222_SCENARIO_EDITOR, 0); |
2090 |
||
2091 |
break; |
|
2092 |
||
2093 |
case WE_CLICK: { |
|
2639 | 2094 |
if (_game_mode == GM_MENU) return; |
0 | 2095 |
_scen_toolbar_button_procs[e->click.widget](w); |
2096 |
} break; |
|
2097 |
||
2755
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2098 |
case WE_KEYPRESS: |
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
|
2099 |
switch (e->keypress.keycode) { |
0 | 2100 |
case WKC_F1: ToolbarPauseClick(w); break; |
2101 |
case WKC_F2: ShowGameOptions(); break; |
|
2102 |
case WKC_F3: MenuClickSaveLoad(0); break; |
|
2103 |
case WKC_F4: ToolbarScenGenLand(w); break; |
|
2104 |
case WKC_F5: ToolbarScenGenTown(w); break; |
|
2105 |
case WKC_F6: ToolbarScenGenIndustry(w); break; |
|
2106 |
case WKC_F7: ToolbarScenBuildRoad(w); break; |
|
2107 |
case WKC_F8: ToolbarScenPlantTrees(w); break; |
|
2108 |
case WKC_F9: ToolbarScenPlaceSign(w); break; |
|
2109 |
case WKC_F10: ShowMusicWindow(); break; |
|
2110 |
case WKC_F11: PlaceLandBlockInfo(); break; |
|
2639 | 2111 |
case WKC_CTRL | 'S': _make_screenshot = 1; break; |
2112 |
case WKC_CTRL | 'G': _make_screenshot = 2; 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
|
2113 |
case 'L': ShowEditorTerraformToolBar(); break; |
2755
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2114 |
} |
ba133949851b
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2753
diff
changeset
|
2115 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2116 |
|
0 | 2117 |
case WE_PLACE_OBJ: { |
2118 |
_place_proc(e->place.tile); |
|
2119 |
} break; |
|
2120 |
||
2121 |
case WE_ABORT_PLACE_OBJ: { |
|
2122 |
w->click_state &= ~(1<<25); |
|
2123 |
SetWindowDirty(w); |
|
2124 |
} break; |
|
2125 |
||
2126 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
|
2127 |
||
2128 |
case WE_MOUSELOOP: |
|
24 | 2129 |
if (((w->click_state) & 1) != (uint)!!_pause) { |
2130 |
w->click_state ^= (1 << 0); |
|
2131 |
SetWindowDirty(w); |
|
2132 |
} |
|
2133 |
||
0 | 2134 |
if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) { |
2135 |
w->click_state ^= (1 << 1); |
|
2136 |
SetWindowDirty(w); |
|
2137 |
} |
|
2138 |
break; |
|
2139 |
||
2140 |
} |
|
2141 |
} |
|
2142 |
||
2143 |
static const WindowDesc _toolb_scen_desc = { |
|
2144 |
0, 0, 640, 22, |
|
2145 |
WC_MAIN_TOOLBAR,0, |
|
2146 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
2147 |
_toolb_scen_widgets, |
|
2148 |
ScenEditToolbarWndProc |
|
2149 |
}; |
|
2150 |
||
2151 |
extern GetNewsStringCallbackProc * const _get_news_string_callback[]; |
|
2152 |
||
2153 |
||
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
|
2154 |
static bool DrawScrollingStatusText(const NewsItem *ni, int pos) |
0 | 2155 |
{ |
1336
69391734ce23
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2156 |
char buf[512]; |
0 | 2157 |
StringID str; |
1329 | 2158 |
const char *s; |
2159 |
char *d; |
|
0 | 2160 |
DrawPixelInfo tmp_dpi, *old_dpi; |
2161 |
int x; |
|
1329 | 2162 |
char buffer[256]; |
0 | 2163 |
|
2164 |
if (ni->display_mode == 3) { |
|
2165 |
str = _get_news_string_callback[ni->callback](ni); |
|
2166 |
} else { |
|
2167 |
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
|
2168 |
str = ni->string_id; |
0 | 2169 |
} |
2170 |
||
1336
69391734ce23
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2171 |
GetString(buf, str); |
0 | 2172 |
|
1336
69391734ce23
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2173 |
s = buf; |
0 | 2174 |
d = buffer; |
2175 |
||
2639 | 2176 |
for (;; s++) { |
2177 |
if (*s == '\0') { |
|
2178 |
*d = '\0'; |
|
0 | 2179 |
break; |
2180 |
} else if (*s == 0x0D) { |
|
2181 |
d[0] = d[1] = d[2] = d[3] = ' '; |
|
2639 | 2182 |
d += 4; |
1329 | 2183 |
} else if ((byte)*s >= ' ' && ((byte)*s < 0x88 || (byte)*s >= 0x99)) { |
0 | 2184 |
*d++ = *s; |
2185 |
} |
|
2186 |
} |
|
2187 |
||
2639 | 2188 |
if (!FillDrawPixelInfo(&tmp_dpi, NULL, 141, 1, 358, 11)) return true; |
0 | 2189 |
|
2190 |
old_dpi = _cur_dpi; |
|
2191 |
_cur_dpi = &tmp_dpi; |
|
2192 |
||
2193 |
x = DoDrawString(buffer, pos, 0, 13); |
|
2194 |
_cur_dpi = old_dpi; |
|
2195 |
||
2196 |
return x > 0; |
|
2197 |
} |
|
2198 |
||
410 | 2199 |
static void StatusBarWndProc(Window *w, WindowEvent *e) |
0 | 2200 |
{ |
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 |
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
|
2202 |
case WE_PAINT: { |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
2203 |
const Player *p = (_local_player == OWNER_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
|
2204 |
|
0 | 2205 |
DrawWindowWidgets(w); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2206 |
SetDParam(0, _date); |
2639 | 2207 |
DrawStringCentered( |
2208 |
70, 1, (_pause || _patches.status_long_date) ? STR_00AF : STR_00AE, 0 |
|
2209 |
); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2210 |
|
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
|
2211 |
if (p != NULL) { |
0 | 2212 |
// Draw player money |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2213 |
SetDParam64(0, p->money64); |
0 | 2214 |
DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0); |
2215 |
} |
|
2216 |
||
2217 |
// 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
|
2218 |
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
|
2219 |
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
|
2220 |
} else if (_do_autosave) { |
2951 | 2221 |
DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0); |
0 | 2222 |
} else if (_pause) { |
2951 | 2223 |
DrawStringCentered(320, 1, STR_0319_PAUSED, 0); |
0 | 2224 |
} else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) { |
2225 |
// Draw the scrolling news text |
|
2226 |
if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1)) |
|
2227 |
WP(w,def_d).data_1 = -1280; |
|
2228 |
} else { |
|
2639 | 2229 |
if (p != NULL) { |
0 | 2230 |
// 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
|
2231 |
SetDParam(0, p->name_1); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2232 |
SetDParam(1, p->name_2); |
2951 | 2233 |
DrawStringCentered(320, 1, STR_02BA, 0); |
0 | 2234 |
} |
2235 |
} |
|
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
|
2236 |
|
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
|
2237 |
if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT | PALETTE_TO_RED, 489, 2); |
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
|
2238 |
} 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
|
2239 |
|
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
|
2240 |
case WE_MESSAGE: |
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
|
2241 |
w->message.msg = e->message.msg; |
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
|
2242 |
SetWindowDirty(w); |
0 | 2243 |
break; |
2244 |
||
2245 |
case WE_CLICK: |
|
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
|
2246 |
switch (e->click.widget) { |
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
|
2247 |
case 1: ShowLastNewsMessage(); 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
|
2248 |
case 2: if (_local_player != OWNER_SPECTATOR) ShowPlayerFinances(_local_player); 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
|
2249 |
default: ResetObjectToPlace(); |
0 | 2250 |
} |
2251 |
break; |
|
2252 |
||
2253 |
case WE_TICK: { |
|
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
|
2254 |
if (_pause) return; |
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
|
2255 |
|
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
|
2256 |
if (WP(w, def_d).data_1 > -1280) { /* Scrolling text */ |
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
|
2257 |
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
|
2258 |
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
|
2259 |
} |
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
|
2260 |
|
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
|
2261 |
if (WP(w, def_d).data_2 > 0) { /* Red blot to show there are new unread newsmessages */ |
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
|
2262 |
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
|
2263 |
} 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
|
2264 |
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
|
2265 |
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
|
2266 |
} |
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
|
2267 |
|
0 | 2268 |
break; |
2269 |
} |
|
2270 |
} |
|
2271 |
} |
|
2272 |
||
2273 |
static const Widget _main_status_widgets[] = { |
|
3248
adb982de0b02
(svn r3931) - [ 1451726 ] Use sprite names in main_gui.c instead of numbers (matthewwalton)
Darkvater
parents:
3182
diff
changeset
|
2274 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 139, 0, 11, 0x0, STR_NULL}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2275 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 140, 499, 0, 11, 0x0, STR_02B7_SHOW_LAST_MESSAGE_OR_NEWS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2276 |
{ WWT_PUSHIMGBTN, 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
|
2277 |
{ WIDGETS_END}, |
0 | 2278 |
}; |
2279 |
||
2280 |
static WindowDesc _main_status_desc = { |
|
2281 |
WDP_CENTER, 0, 640, 12, |
|
2282 |
WC_STATUS_BAR,0, |
|
2283 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
2284 |
_main_status_widgets, |
|
2285 |
StatusBarWndProc |
|
2286 |
}; |
|
2287 |
||
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2288 |
extern void UpdateAllStationVirtCoord(void); |
0 | 2289 |
|
2290 |
static void MainWindowWndProc(Window *w, WindowEvent *e) { |
|
2291 |
int off_x; |
|
2292 |
||
2952 | 2293 |
switch (e->event) { |
0 | 2294 |
case WE_PAINT: |
2295 |
DrawWindowViewport(w); |
|
2296 |
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
|
2297 |
off_x = _screen.width / 2; |
0 | 2298 |
|
582
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2299 |
DrawSprite(SPR_OTTD_O, off_x - 120, 50); |
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2300 |
DrawSprite(SPR_OTTD_P, off_x - 86, 50); |
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2301 |
DrawSprite(SPR_OTTD_E, off_x - 53, 50); |
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2302 |
DrawSprite(SPR_OTTD_N, off_x - 22, 50); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2303 |
|
582
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2304 |
DrawSprite(SPR_OTTD_T, off_x + 34, 50); |
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2305 |
DrawSprite(SPR_OTTD_T, off_x + 65, 50); |
c49fcdc4241b
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2306 |
DrawSprite(SPR_OTTD_D, off_x + 96, 50); |
670
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2307 |
|
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
|
2308 |
/* |
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
|
2309 |
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
|
2310 |
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
|
2311 |
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
|
2312 |
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
|
2313 |
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
|
2314 |
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
|
2315 |
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
|
2316 |
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
|
2317 |
|
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
|
2318 |
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
|
2319 |
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
|
2320 |
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
|
2321 |
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
|
2322 |
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
|
2323 |
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
|
2324 |
*/ |
0 | 2325 |
} |
2326 |
break; |
|
2327 |
||
2328 |
case WE_KEYPRESS: |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2329 |
if (e->keypress.keycode == WKC_BACKQUOTE) { |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2330 |
IConsoleSwitch(); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2331 |
e->keypress.cont = false; |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2332 |
break; |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2333 |
} |
2552
5b586a545665
(svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
bjarni
parents:
2549
diff
changeset
|
2334 |
|
2639 | 2335 |
switch (e->keypress.keycode) { |
2336 |
case 'Q' | WKC_CTRL: |
|
2337 |
case 'Q' | WKC_META: |
|
2338 |
AskExitGame(); |
|
2339 |
break; |
|
2501
8d13d08b9232
(svn r3027) -Feature: [OSX] command+q now works in main menu (Tobin)
bjarni
parents:
2469
diff
changeset
|
2340 |
} |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2341 |
|
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2342 |
if (_game_mode == GM_MENU) break; |
0 | 2343 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2344 |
switch (e->keypress.keycode) { |
2639 | 2345 |
case 'C': |
2346 |
case 'Z': { |
|
2347 |
Point pt = GetTileBelowCursor(); |
|
2348 |
if (pt.x != -1) { |
|
2349 |
ScrollMainWindowTo(pt.x, pt.y); |
|
2350 |
if (e->keypress.keycode == 'Z') MaxZoomIn(); |
|
2351 |
} |
|
2352 |
break; |
|
0 | 2353 |
} |
2639 | 2354 |
|
2355 |
case WKC_ESC: ResetObjectToPlace(); break; |
|
2356 |
case WKC_DELETE: DeleteNonVitalWindows(); break; |
|
2357 |
case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break; |
|
2358 |
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break; |
|
2359 |
||
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2360 |
#if defined(_DEBUG) |
2639 | 2361 |
case '0' | WKC_ALT: /* Crash the game */ |
2362 |
*(byte*)0 = 0; |
|
2363 |
break; |
|
2364 |
||
2365 |
case '1' | WKC_ALT: /* Gimme money */ |
|
2366 |
/* Server can not cheat in advertise mode either! */ |
|
2367 |
#ifdef ENABLE_NETWORK |
|
2368 |
if (!_networking || !_network_server || !_network_advertise) |
|
0 | 2369 |
#endif |
2639 | 2370 |
DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT); |
2371 |
break; |
|
2372 |
||
2373 |
case '2' | WKC_ALT: /* Update the coordinates of all station signs */ |
|
2374 |
UpdateAllStationVirtCoord(); |
|
2375 |
break; |
|
2376 |
#endif |
|
2377 |
||
2378 |
case 'X': |
|
2379 |
_display_opt ^= DO_TRANS_BUILDINGS; |
|
2380 |
MarkWholeScreenDirty(); |
|
2381 |
break; |
|
0 | 2382 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
2383 |
#ifdef ENABLE_NETWORK |
2639 | 2384 |
case WKC_RETURN: case 'T' | WKC_SHIFT: |
2385 |
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
|
2386 |
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
|
2387 |
#endif |
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2388 |
|
2639 | 2389 |
default: return; |
0 | 2390 |
} |
2391 |
e->keypress.cont = false; |
|
2392 |
break; |
|
2393 |
} |
|
2394 |
} |
|
2395 |
||
2396 |
||
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
|
2397 |
void ShowSelectGameWindow(void); |
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
763
diff
changeset
|
2398 |
extern void ShowJoinStatusWindowAfterJoin(void); |
0 | 2399 |
|
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
|
2400 |
void SetupColorsAndInitialWindow(void) |
0 | 2401 |
{ |
2639 | 2402 |
uint i; |
0 | 2403 |
Window *w; |
2404 |
int width,height; |
|
2405 |
||
2639 | 2406 |
for (i = 0; i != 16; i++) { |
3326
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
3310
diff
changeset
|
2407 |
const byte* b = GetNonSprite(PALETTE_RECOLOR_START + i); |
1357 | 2408 |
|
0 | 2409 |
assert(b); |
2643 | 2410 |
_color_list[i] = *(const ColorList*)(b + 0xC6); |
0 | 2411 |
} |
2412 |
||
2413 |
width = _screen.width; |
|
2414 |
height = _screen.height; |
|
2415 |
||
2416 |
// XXX: these are not done |
|
2639 | 2417 |
switch (_game_mode) { |
0 | 2418 |
case GM_MENU: |
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
|
2419 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
1981 | 2420 |
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), 0); |
0 | 2421 |
ShowSelectGameWindow(); |
2422 |
break; |
|
2423 |
case GM_NORMAL: |
|
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
|
2424 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
1981 | 2425 |
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), 0); |
0 | 2426 |
|
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
|
2427 |
ShowVitalWindows(); |
0 | 2428 |
|
670
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2429 |
/* Bring joining GUI to front till the client is really joined */ |
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2430 |
if (_networking && !_network_server) |
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2431 |
ShowJoinStatusWindowAfterJoin(); |
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2432 |
|
0 | 2433 |
break; |
2434 |
case GM_EDITOR: |
|
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
|
2435 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
0 | 2436 |
AssignWindowViewport(w, 0, 0, width, height, 0, 0); |
2437 |
||
2438 |
w = AllocateWindowDesc(&_toolb_scen_desc); |
|
2439 |
w->disabled_state = 1 << 9; |
|
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
|
2440 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2441 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
24
diff
changeset
|
2442 |
PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_scen_desc) |
0 | 2443 |
break; |
2444 |
default: |
|
2445 |
NOT_REACHED(); |
|
2446 |
} |
|
2447 |
} |
|
2448 |
||
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
|
2449 |
void ShowVitalWindows(void) |
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
|
2450 |
{ |
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
|
2451 |
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
|
2452 |
|
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
|
2453 |
w = AllocateWindowDesc(&_toolb_normal_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
|
2454 |
w->disabled_state = 1 << 17; // disable zoom-in button (by default game is zoomed in) |
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
|
2455 |
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
|
2456 |
|
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
|
2457 |
if (_networking) { // if networking, disable fast-forward button |
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
|
2458 |
SETBIT(w->disabled_state, 1); |
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
|
2459 |
if (!_network_server) // if not server, disable pause button |
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
|
2460 |
SETBIT(w->disabled_state, 0); |
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
|
2461 |
} |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1015
diff
changeset
|
2462 |
|
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
|
2463 |
PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_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
|
2464 |
|
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
|
2465 |
_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
|
2466 |
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
|
2467 |
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
|
2468 |
|
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
|
2469 |
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
|
2470 |
} |
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
|
2471 |
|
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
|
2472 |
void GameSizeChanged(void) |
0 | 2473 |
{ |
2429
5e5b66fb8420
(svn r2955) Fix: make ottd start with the last resolution you had set (custom) (win32)
Darkvater
parents:
2361
diff
changeset
|
2474 |
_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
|
2475 |
_cur_resolution[1] = _screen.height; |
0 | 2476 |
RelocateAllWindows(_screen.width, _screen.height); |
2477 |
ScreenSizeChanged(); |
|
2478 |
MarkWholeScreenDirty(); |
|
2479 |
} |