author | celestar |
Wed, 20 Jul 2005 22:02:58 +0000 | |
changeset 2147 | 42efdf5020d1 |
parent 2116 | cdfc27b696b7 |
child 2150 | 010d923a81a9 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1885
diff
changeset
|
2 |
#include "openttd.h" |
1349
07514c2cc6d1
(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
|
3 |
#include "spritecache.h" |
1309
dab90d4cbf2d
(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
|
4 |
#include "strings.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1362
diff
changeset
|
5 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
497
diff
changeset
|
6 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
670
diff
changeset
|
7 |
#include "map.h" |
1209
a1ac96655b79
(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
|
8 |
#include "tile.h" |
0 | 9 |
#include "window.h" |
10 |
#include "gui.h" |
|
11 |
#include "viewport.h" |
|
12 |
#include "gfx.h" |
|
13 |
#include "player.h" |
|
14 |
#include "command.h" |
|
15 |
#include "news.h" |
|
16 |
#include "town.h" |
|
130
b593afdae262
(svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik
parents:
126
diff
changeset
|
17 |
#include "vehicle.h" |
126 | 18 |
#include "console.h" |
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
222
diff
changeset
|
19 |
#include "sound.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
20 |
#include "network.h" |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
21 |
#include "signs.h" |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
22 |
#include "waypoint.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
23 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
24 |
#include "network_data.h" |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
25 |
#include "network_client.h" |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
26 |
#include "network_server.h" |
0 | 27 |
|
28 |
#include "table/animcursors.h" |
|
29 |
||
30 |
||
349
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
31 |
/* Min/Max date for scenario editor */ |
970
492ca84ecc6c
(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
|
32 |
static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL) |
349
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
33 |
static const uint MaxDate = 29220; // 2000-01-01 |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
34 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
35 |
extern void DoTestSave(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
36 |
extern void DoTestLoad(void); |
0 | 37 |
|
38 |
static int _rename_id; |
|
39 |
static int _rename_what; |
|
40 |
||
41 |
static byte _terraform_size = 1; |
|
42 |
static byte _last_built_railtype; |
|
2051 | 43 |
extern void GenerateWorld(int mode, uint size_x, uint size_y); |
0 | 44 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
45 |
extern void GenerateIndustries(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
46 |
extern void GenerateTowns(void); |
0 | 47 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
48 |
void HandleOnEditTextCancel(void) |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
49 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
50 |
switch(_rename_what) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
51 |
#ifdef ENABLE_NETWORK |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
52 |
case 4: |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
53 |
NetworkDisconnect(); |
611
2d4d7e3a94b8
(svn r1035) Fix: Added a line that I accidentally deleted in r1033
dominik
parents:
609
diff
changeset
|
54 |
ShowNetworkGameWindow(); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
55 |
break; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
56 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
57 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
58 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
59 |
|
1799
05d56d2d0fea
(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
|
60 |
void HandleOnEditText(WindowEvent *e) |
05d56d2d0fea
(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
|
61 |
{ |
1323
41397685320a
(svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents:
1309
diff
changeset
|
62 |
const char *b = e->edittext.str; |
0 | 63 |
int id; |
1820
9b6458526480
(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
|
64 |
|
9b6458526480
(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
|
65 |
_cmd_text = b; |
0 | 66 |
|
67 |
id = _rename_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
68 |
|
1799
05d56d2d0fea
(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
|
69 |
switch (_rename_what) { |
05d56d2d0fea
(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
|
70 |
case 0: /* Rename a s sign, if string is empty, delete sign */ |
1793
8ac8a8c9ec0f
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1772
diff
changeset
|
71 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME)); |
0 | 72 |
break; |
1799
05d56d2d0fea
(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
|
73 |
case 1: /* Rename a waypoint */ |
05d56d2d0fea
(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
|
74 |
if (*b == 0) return; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
355
diff
changeset
|
75 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME)); |
0 | 76 |
break; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
77 |
#ifdef ENABLE_NETWORK |
1799
05d56d2d0fea
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
78 |
case 2: /* Speak to.. */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
79 |
if (!_network_server) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
80 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
81 |
else |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
82 |
NetworkServer_HandleChat(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str, NETWORK_SERVER_INDEX); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
83 |
break; |
1799
05d56d2d0fea
(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
|
84 |
case 3: { /* Give money, you can only give money in excess of loan */ |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
85 |
const Player *p = GetPlayer(_current_player); |
1799
05d56d2d0fea
(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 |
int32 money = min(p->money64 - p->current_loan, atoi(e->edittext.str) / GetCurrentCurrencyRate()); |
05d56d2d0fea
(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
|
87 |
char msg[20]; |
05d56d2d0fea
(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
|
88 |
|
05d56d2d0fea
(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 |
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0 |
813
90d6adb8d4ad
(svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight
parents:
793
diff
changeset
|
90 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
91 |
// Give 'id' the money, and substract it from ourself |
1799
05d56d2d0fea
(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
|
92 |
if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS))) break; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
93 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
94 |
// Inform the player of this action |
1799
05d56d2d0fea
(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
|
95 |
snprintf(msg, sizeof(msg), "%d", money); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
96 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
97 |
if (!_network_server) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
98 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
99 |
else |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
100 |
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg, NETWORK_SERVER_INDEX); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
101 |
break; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
102 |
} |
1799
05d56d2d0fea
(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
|
103 |
case 4: /* Game-Password and Company-Password */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
104 |
SEND_COMMAND(PACKET_CLIENT_PASSWORD)(id, e->edittext.str); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
105 |
break; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
106 |
#endif /* ENABLE_NETWORK */ |
0 | 107 |
} |
108 |
} |
|
109 |
||
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
110 |
/** |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
111 |
* This code is shared for the majority of the pushbuttons. |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
112 |
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
113 |
* |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
114 |
* @param w Window which called the function |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
115 |
* @param widget ID of the widget (=button) that called this function |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
116 |
* @param cursor How should the cursor image change? E.g. cursor with depot image in it |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
117 |
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
118 |
* @param placeproc Procedure which will be called when someone clicks on the map |
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
119 |
|
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
120 |
* @return true if the button is clicked, false if it's unclicked |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
121 |
*/ |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
122 |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
123 |
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc) |
0 | 124 |
{ |
125 |
uint32 mask = 1 << widget; |
|
126 |
||
127 |
if (w->disabled_state & mask) |
|
128 |
return false; |
|
129 |
||
541 | 130 |
if (!_no_button_sound) 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
4392ae3d8e31
(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 |
typedef void ToolbarButtonProc(Window *w); |
|
152 |
||
153 |
static void ToolbarPauseClick(Window *w) |
|
154 |
{ |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
155 |
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
|
156 |
|
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1109
diff
changeset
|
157 |
if (DoCommandP(0, _pause ? 0 : 1, 0, NULL, CMD_PAUSE)) |
541 | 158 |
SndPlayFx(SND_15_BEEP); |
0 | 159 |
} |
160 |
||
161 |
static void ToolbarFastForwardClick(Window *w) |
|
162 |
{ |
|
163 |
_fast_forward ^= true; |
|
541 | 164 |
SndPlayFx(SND_15_BEEP); |
0 | 165 |
} |
166 |
||
167 |
typedef void MenuClickedProc(int index); |
|
168 |
||
169 |
||
410 | 170 |
static void MenuClickSettings(int index) |
0 | 171 |
{ |
172 |
switch(index) { |
|
173 |
case 0: ShowGameOptions(); return; |
|
174 |
case 1: ShowGameDifficulty(); return; |
|
175 |
case 2: ShowPatchesSelection(); return; |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
424
diff
changeset
|
176 |
case 3: ShowNewgrf(); return; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
177 |
|
1015
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
178 |
case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
179 |
case 6: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
180 |
case 7: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
181 |
case 8: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
182 |
case 9: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
183 |
case 10: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return; |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
184 |
case 11: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return; |
1932
275d72f700e2
(svn r2438) - Feature: New display option, 'transparent station signs', makes station signs transparent instead of using a solid bar to draw text on (peter1138)
hackykid
parents:
1914
diff
changeset
|
185 |
case 12: _display_opt ^= DO_TRANS_SIGNS; MarkWholeScreenDirty(); return; |
0 | 186 |
} |
187 |
} |
|
188 |
||
410 | 189 |
static void MenuClickSaveLoad(int index) |
0 | 190 |
{ |
191 |
if (_game_mode == GM_EDITOR) { |
|
192 |
switch(index) { |
|
193 |
case 0: |
|
194 |
ShowSaveLoadDialog(SLD_SAVE_SCENARIO); |
|
195 |
break; |
|
196 |
case 1: |
|
197 |
ShowSaveLoadDialog(SLD_LOAD_SCENARIO); |
|
198 |
break; |
|
199 |
case 2: |
|
200 |
AskExitToGameMenu(); |
|
201 |
break; |
|
202 |
case 4: |
|
203 |
AskExitGame(); |
|
204 |
break; |
|
205 |
} |
|
206 |
} else { |
|
207 |
switch(index) { |
|
208 |
case 0: |
|
209 |
ShowSaveLoadDialog(SLD_SAVE_GAME); |
|
210 |
break; |
|
211 |
case 1: |
|
212 |
ShowSaveLoadDialog(SLD_LOAD_GAME); |
|
213 |
break; |
|
214 |
case 2: |
|
215 |
AskExitToGameMenu(); |
|
216 |
break; |
|
217 |
case 3: |
|
218 |
AskExitGame(); |
|
219 |
break; |
|
220 |
} |
|
221 |
} |
|
222 |
} |
|
223 |
||
410 | 224 |
static void MenuClickMap(int index) |
0 | 225 |
{ |
226 |
switch(index) { |
|
227 |
case 0: ShowSmallMap(); 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
|
228 |
case 1: ShowExtraViewPortWindow(); break; |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1571
diff
changeset
|
229 |
case 2: ShowSignList(); break; |
0 | 230 |
} |
231 |
} |
|
232 |
||
410 | 233 |
static void MenuClickTown(int index) |
0 | 234 |
{ |
235 |
ShowTownDirectory(); |
|
236 |
} |
|
237 |
||
410 | 238 |
static void MenuClickScenMap(int index) |
0 | 239 |
{ |
240 |
switch(index) { |
|
241 |
case 0: ShowSmallMap(); break; |
|
355
19a08ced3274
(svn r543) -Fix: [ 1064742 ] Editor Map-Menu wrong String
tron
parents:
349
diff
changeset
|
242 |
case 1: ShowExtraViewPortWindow(); break; |
1610 | 243 |
case 2: ShowSignList(); break; |
244 |
case 3: ShowTownDirectory(); break; |
|
0 | 245 |
} |
246 |
} |
|
247 |
||
410 | 248 |
static void MenuClickSubsidies(int index) |
0 | 249 |
{ |
250 |
ShowSubsidiesList(); |
|
251 |
} |
|
252 |
||
410 | 253 |
static void MenuClickStations(int index) |
0 | 254 |
{ |
255 |
ShowPlayerStations(index); |
|
256 |
} |
|
257 |
||
410 | 258 |
static void MenuClickFinances(int index) |
0 | 259 |
{ |
260 |
ShowPlayerFinances(index); |
|
261 |
} |
|
262 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
263 |
#ifdef ENABLE_NETWORK |
1003
5ce43e332bab
(svn r1502) -Fix: [1101889] Crash under windows... stupid typo in player_gui.c ^ should've been &
darkvater
parents:
999
diff
changeset
|
264 |
extern void ShowClientList(void); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
265 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
266 |
|
410 | 267 |
static void MenuClickCompany(int index) |
0 | 268 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
269 |
if (_networking && index == 0) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
270 |
#ifdef ENABLE_NETWORK |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
271 |
ShowClientList(); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
272 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
273 |
} else { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
274 |
if (_networking) index--; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
275 |
ShowPlayerCompany(index); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
276 |
} |
0 | 277 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
278 |
|
0 | 279 |
|
410 | 280 |
static void MenuClickGraphs(int index) |
0 | 281 |
{ |
282 |
switch(index) { |
|
283 |
case 0: ShowOperatingProfitGraph(); return; |
|
284 |
case 1: ShowIncomeGraph(); return; |
|
285 |
case 2: ShowDeliveredCargoGraph(); return; |
|
286 |
case 3: ShowPerformanceHistoryGraph(); return; |
|
287 |
case 4: ShowCompanyValueGraph(); return; |
|
288 |
case 5: ShowCargoPaymentRates(); return; |
|
289 |
} |
|
290 |
} |
|
291 |
||
410 | 292 |
static void MenuClickLeague(int index) |
0 | 293 |
{ |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
294 |
switch(index) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
295 |
case 0: ShowCompanyLeagueTable(); return; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
296 |
case 1: ShowPerformanceRatingDetail(); return; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
297 |
} |
0 | 298 |
} |
299 |
||
410 | 300 |
static void MenuClickIndustry(int index) |
0 | 301 |
{ |
302 |
switch(index) { |
|
197
25749afe81ef
(svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater
parents:
196
diff
changeset
|
303 |
case 0: ShowIndustryDirectory(); break; |
25749afe81ef
(svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater
parents:
196
diff
changeset
|
304 |
case 1: ShowBuildIndustryWindow(); break; |
0 | 305 |
} |
306 |
} |
|
307 |
||
410 | 308 |
static void MenuClickShowTrains(int index) |
0 | 309 |
{ |
588 | 310 |
ShowPlayerTrains(index, -1); |
0 | 311 |
} |
312 |
||
410 | 313 |
static void MenuClickShowRoad(int index) |
0 | 314 |
{ |
588 | 315 |
ShowPlayerRoadVehicles(index, -1); |
0 | 316 |
} |
317 |
||
410 | 318 |
static void MenuClickShowShips(int index) |
0 | 319 |
{ |
588 | 320 |
ShowPlayerShips(index, -1); |
0 | 321 |
} |
322 |
||
410 | 323 |
static void MenuClickShowAir(int index) |
0 | 324 |
{ |
588 | 325 |
ShowPlayerAircraft(index, -1); |
0 | 326 |
} |
327 |
||
410 | 328 |
static void MenuClickBuildRail(int index) |
0 | 329 |
{ |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
2116
diff
changeset
|
330 |
_last_built_railtype = index; |
0 | 331 |
ShowBuildRailToolbar(_last_built_railtype, -1); |
332 |
} |
|
333 |
||
410 | 334 |
static void MenuClickBuildRoad(int index) |
0 | 335 |
{ |
336 |
ShowBuildRoadToolbar(); |
|
337 |
} |
|
338 |
||
410 | 339 |
static void MenuClickBuildWater(int index) |
0 | 340 |
{ |
341 |
ShowBuildDocksToolbar(); |
|
342 |
} |
|
343 |
||
410 | 344 |
static void MenuClickBuildAir(int index) |
0 | 345 |
{ |
346 |
ShowBuildAirToolbar(); |
|
347 |
} |
|
348 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
349 |
#ifdef ENABLE_NETWORK |
649 | 350 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
351 |
void ShowNetworkChatQueryWindow(byte desttype, byte dest) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
352 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
353 |
_rename_id = desttype + (dest << 8); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
354 |
_rename_what = 2; |
793
0fbdcb357a2c
(svn r1263) -Fix: [Network] Client-names are limited (serverside) to 25 chars
truelight
parents:
774
diff
changeset
|
355 |
ShowChatWindow(STR_EMPTY, STR_NETWORK_CHAT_QUERY_CAPTION, 150, 338, 1, 0); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
356 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
357 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
358 |
void ShowNetworkGiveMoneyWindow(byte player) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
359 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
360 |
_rename_id = player; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
361 |
_rename_what = 3; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
362 |
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, 1, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
363 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
364 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
365 |
void ShowNetworkNeedGamePassword(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
366 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
367 |
_rename_id = NETWORK_GAME_PASSWORD; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
368 |
_rename_what = 4; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
369 |
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_GAME_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
370 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
371 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
372 |
void ShowNetworkNeedCompanyPassword(void) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
373 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
374 |
_rename_id = NETWORK_COMPANY_PASSWORD; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
375 |
_rename_what = 4; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
376 |
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
377 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
378 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
379 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
380 |
|
2116 | 381 |
void ShowRenameSignWindow(const SignStruct *ss) |
0 | 382 |
{ |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
383 |
_rename_id = ss->index; |
0 | 384 |
_rename_what = 0; |
385 |
ShowQueryString(ss->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, 1, 0); |
|
386 |
} |
|
387 |
||
2116 | 388 |
void ShowRenameWaypointWindow(const Waypoint *wp) |
0 | 389 |
{ |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
390 |
int id = wp->index; |
697
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
391 |
|
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
392 |
/* Are we allowed to change the name of the waypoint? */ |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
393 |
if (!CheckTileOwnership(wp->xy)) { |
926
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
872
diff
changeset
|
394 |
ShowErrorMessage(_error_message, STR_CANT_CHANGE_WAYPOINT_NAME, |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
395 |
TileX(wp->xy) * 16, TileY(wp->xy) * 16); |
697
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
396 |
return; |
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
397 |
} |
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
398 |
|
0 | 399 |
_rename_id = id; |
400 |
_rename_what = 1; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
401 |
SetDParam(0, id); |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
355
diff
changeset
|
402 |
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0); |
0 | 403 |
} |
404 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
405 |
static void SelectSignTool(void) |
0 | 406 |
{ |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
407 |
if (_cursor.sprite == SPR_CURSOR_SIGN) |
0 | 408 |
ResetObjectToPlace(); |
409 |
else { |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
410 |
SetObjectToPlace(SPR_CURSOR_SIGN, 1, 1, 0); |
0 | 411 |
_place_proc = PlaceProc_Sign; |
412 |
} |
|
413 |
} |
|
414 |
||
410 | 415 |
static void MenuClickForest(int index) |
0 | 416 |
{ |
417 |
switch(index) { |
|
418 |
case 0: ShowTerraformToolbar(); break; |
|
419 |
case 1: ShowBuildTreesToolbar(); break; |
|
420 |
case 2: SelectSignTool(); break; |
|
421 |
} |
|
422 |
} |
|
423 |
||
410 | 424 |
static void MenuClickMusicWindow(int index) |
0 | 425 |
{ |
426 |
ShowMusicWindow(); |
|
427 |
} |
|
428 |
||
410 | 429 |
static void MenuClickNewspaper(int index) |
0 | 430 |
{ |
431 |
switch(index) { |
|
432 |
case 0: ShowLastNewsMessage(); break; |
|
433 |
case 1: ShowMessageOptions(); break; |
|
434 |
case 2: ShowMessageHistory(); break; |
|
435 |
} |
|
436 |
} |
|
437 |
||
410 | 438 |
static void MenuClickHelp(int index) |
0 | 439 |
{ |
440 |
switch(index) { |
|
441 |
case 0: PlaceLandBlockInfo(); break; |
|
442 |
case 2: _make_screenshot = 1; break; |
|
443 |
case 3: _make_screenshot = 2; break; |
|
444 |
case 4: ShowAboutWindow(); break; |
|
445 |
} |
|
446 |
} |
|
447 |
||
448 |
static MenuClickedProc * const _menu_clicked_procs[] = { |
|
449 |
NULL, /* 0 */ |
|
450 |
NULL, /* 1 */ |
|
451 |
MenuClickSettings, /* 2 */ |
|
452 |
MenuClickSaveLoad, /* 3 */ |
|
453 |
MenuClickMap, /* 4 */ |
|
454 |
MenuClickTown, /* 5 */ |
|
455 |
MenuClickSubsidies, /* 6 */ |
|
456 |
MenuClickStations, /* 7 */ |
|
457 |
MenuClickFinances, /* 8 */ |
|
458 |
MenuClickCompany, /* 9 */ |
|
459 |
MenuClickGraphs, /* 10 */ |
|
460 |
MenuClickLeague, /* 11 */ |
|
461 |
MenuClickIndustry, /* 12 */ |
|
462 |
MenuClickShowTrains, /* 13 */ |
|
463 |
MenuClickShowRoad, /* 14 */ |
|
464 |
MenuClickShowShips, /* 15 */ |
|
465 |
MenuClickShowAir, /* 16 */ |
|
466 |
MenuClickScenMap, /* 17 */ |
|
467 |
NULL, /* 18 */ |
|
468 |
MenuClickBuildRail, /* 19 */ |
|
469 |
MenuClickBuildRoad, /* 20 */ |
|
470 |
MenuClickBuildWater, /* 21 */ |
|
471 |
MenuClickBuildAir, /* 22 */ |
|
472 |
MenuClickForest, /* 23 */ |
|
473 |
MenuClickMusicWindow, /* 24 */ |
|
474 |
MenuClickNewspaper, /* 25 */ |
|
475 |
MenuClickHelp, /* 26 */ |
|
476 |
}; |
|
477 |
||
478 |
static void MenuWndProc(Window *w, WindowEvent *e) |
|
479 |
{ |
|
480 |
switch(e->event) { |
|
481 |
case WE_PAINT: { |
|
482 |
int count,sel; |
|
483 |
int x,y; |
|
484 |
uint16 chk; |
|
485 |
StringID string; |
|
486 |
int eo; |
|
487 |
int inc; |
|
488 |
||
489 |
DrawWindowWidgets(w); |
|
490 |
||
491 |
count = WP(w,menu_d).item_count; |
|
492 |
sel = WP(w,menu_d).sel_index; |
|
493 |
chk = WP(w,menu_d).checked_items; |
|
494 |
string = WP(w,menu_d).string_id; |
|
495 |
||
496 |
x = 1; |
|
497 |
y = 1; |
|
498 |
||
499 |
eo = 157; |
|
500 |
||
501 |
inc = (chk != 0) ? 2 : 1; |
|
502 |
||
503 |
do { |
|
504 |
if (sel== 0) GfxFillRect(x, y, x + eo, y+9, 0); |
|
505 |
DrawString(x + 2, y, (StringID)(string + (chk&1)), (byte)(sel==0?(byte)0xC:(byte)0x10)); |
|
506 |
y += 10; |
|
507 |
string += inc; |
|
508 |
chk >>= 1; |
|
509 |
} while (--sel,--count); |
|
510 |
} break; |
|
511 |
||
512 |
case WE_DESTROY: { |
|
513 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
514 |
v->click_state &= ~(1 << WP(w,menu_d).main_button); |
|
515 |
SetWindowDirty(v); |
|
516 |
return; |
|
517 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
518 |
|
0 | 519 |
case WE_POPUPMENU_SELECT: { |
520 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
|
521 |
int action_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
522 |
|
0 | 523 |
|
524 |
if (index < 0) { |
|
525 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
526 |
if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
|
527 |
index = WP(w,menu_d).sel_index; |
|
528 |
} |
|
529 |
||
530 |
action_id = WP(w,menu_d).action_id; |
|
531 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
532 |
|
0 | 533 |
if (index >= 0) |
534 |
_menu_clicked_procs[action_id](index); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
535 |
|
0 | 536 |
break; |
537 |
} |
|
538 |
case WE_POPUPMENU_OVER: { |
|
539 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
|
540 |
||
541 |
if (index == -1 || index == WP(w,menu_d).sel_index) |
|
542 |
return; |
|
543 |
||
544 |
WP(w,menu_d).sel_index = index; |
|
545 |
SetWindowDirty(w); |
|
546 |
return; |
|
547 |
} |
|
548 |
} |
|
549 |
} |
|
550 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
551 |
static const Widget _menu_widgets[] = { |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
552 |
{ 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
|
553 |
{ WIDGETS_END}, |
0 | 554 |
}; |
555 |
||
556 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
557 |
static const Widget _player_menu_widgets[] = { |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
558 |
{ 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
|
559 |
{ WIDGETS_END}, |
0 | 560 |
}; |
561 |
||
562 |
||
563 |
static int GetPlayerIndexFromMenu(int index) |
|
564 |
{ |
|
565 |
Player *p; |
|
566 |
||
567 |
if (index >= 0) { |
|
568 |
FOR_ALL_PLAYERS(p) { |
|
569 |
if (p->is_active) { |
|
570 |
if (--index < 0) |
|
571 |
return p->index; |
|
572 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
573 |
} |
0 | 574 |
} |
575 |
return -1; |
|
576 |
} |
|
577 |
||
578 |
static void UpdatePlayerMenuHeight(Window *w) |
|
579 |
{ |
|
580 |
int num = 0; |
|
581 |
Player *p; |
|
582 |
||
583 |
FOR_ALL_PLAYERS(p) { |
|
584 |
if (p->is_active) |
|
585 |
num++; |
|
586 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
587 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
588 |
// Increase one to fit in PlayerList in the menu when |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
589 |
// in network |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
590 |
if (_networking && WP(w,menu_d).main_button == 9) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
591 |
num++; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
592 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
593 |
|
0 | 594 |
if (WP(w,menu_d).item_count != num) { |
595 |
WP(w,menu_d).item_count = num; |
|
596 |
SetWindowDirty(w); |
|
597 |
num = num * 10 + 2; |
|
598 |
w->height = num; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
599 |
w->widget[0].bottom = w->widget[0].top + num - 1; |
0 | 600 |
SetWindowDirty(w); |
601 |
} |
|
602 |
} |
|
603 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
604 |
extern void DrawPlayerIcon(int p, int x, int y); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
605 |
|
0 | 606 |
static void PlayerMenuWndProc(Window *w, WindowEvent *e) |
607 |
{ |
|
608 |
switch(e->event) { |
|
609 |
case WE_PAINT: { |
|
610 |
int x,y; |
|
611 |
byte sel, color; |
|
612 |
Player *p; |
|
613 |
uint16 chk; |
|
614 |
||
615 |
UpdatePlayerMenuHeight(w); |
|
616 |
DrawWindowWidgets(w); |
|
617 |
||
618 |
x = 1; |
|
619 |
y = 1; |
|
620 |
sel = WP(w,menu_d).sel_index; |
|
621 |
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
|
622 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
623 |
// 9 = playerlist |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
624 |
if (_networking && WP(w,menu_d).main_button == 9) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
625 |
if (sel == 0) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
626 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
627 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
628 |
DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, 0x0); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
629 |
y += 10; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
630 |
sel--; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
631 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
632 |
|
0 | 633 |
FOR_ALL_PLAYERS(p) { |
634 |
if (p->is_active) { |
|
635 |
if (p->index == sel) { |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
636 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
0 | 637 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
638 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
639 |
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
|
640 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
641 |
SetDParam(0, p->name_1); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
642 |
SetDParam(1, p->name_2); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
643 |
SetDParam(2, GetPlayerNameString(p->index, 3)); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
644 |
|
0 | 645 |
color = (byte)((p->index==sel) ? 0xC : 0x10); |
646 |
if (chk&1) color = 14; |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
647 |
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
|
648 |
|
0 | 649 |
y += 10; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
650 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
651 |
chk >>= 1; |
0 | 652 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
653 |
|
0 | 654 |
break; |
655 |
} |
|
656 |
||
657 |
case WE_DESTROY: { |
|
658 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
|
659 |
v->click_state &= ~(1 << WP(w,menu_d).main_button); |
|
660 |
SetWindowDirty(v); |
|
661 |
return; |
|
662 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
663 |
|
0 | 664 |
case WE_POPUPMENU_SELECT: { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
665 |
int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
0 | 666 |
int action_id = WP(w,menu_d).action_id; |
667 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
668 |
// We have a new entry at the top of the list of menu 9 when networking |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
669 |
// so keep that in count |
724
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
670 |
if (_networking && WP(w,menu_d).main_button == 9) { |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
671 |
if (index > 0) |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
672 |
index = GetPlayerIndexFromMenu(index - 1) + 1; |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
673 |
} else |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
674 |
index = GetPlayerIndexFromMenu(index); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
675 |
|
0 | 676 |
if (index < 0) { |
677 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
|
678 |
if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button) |
|
679 |
index = WP(w,menu_d).sel_index; |
|
680 |
} |
|
681 |
||
682 |
DeleteWindow(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
683 |
|
0 | 684 |
if (index >= 0) { |
685 |
assert(index >= 0 && index < 30); |
|
686 |
_menu_clicked_procs[action_id](index); |
|
687 |
} |
|
688 |
break; |
|
689 |
} |
|
690 |
case WE_POPUPMENU_OVER: { |
|
691 |
int index; |
|
692 |
UpdatePlayerMenuHeight(w); |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
693 |
index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
694 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
695 |
// We have a new entry at the top of the list of menu 9 when networking |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
696 |
// so keep that in count |
724
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
697 |
if (_networking && WP(w,menu_d).main_button == 9) { |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
698 |
if (index > 0) |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
699 |
index = GetPlayerIndexFromMenu(index - 1) + 1; |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
700 |
} else |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
701 |
index = GetPlayerIndexFromMenu(index); |
0 | 702 |
|
703 |
if (index == -1 || index == WP(w,menu_d).sel_index) |
|
704 |
return; |
|
705 |
||
706 |
WP(w,menu_d).sel_index = index; |
|
707 |
SetWindowDirty(w); |
|
708 |
return; |
|
709 |
} |
|
710 |
} |
|
711 |
} |
|
712 |
||
713 |
static Window *PopupMainToolbMenu(Window *w, int x, int main_button, StringID base_string, int item_count) |
|
714 |
{ |
|
715 |
x += w->left; |
|
716 |
||
717 |
SETBIT(w->click_state, (byte)main_button); |
|
718 |
InvalidateWidget(w, (byte)main_button); |
|
719 |
||
720 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
721 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
722 |
w = AllocateWindow(x, 0x16, 0xA0, item_count * 10 + 2, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets); |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
723 |
w->widget[0].bottom = item_count * 10 + 1; |
0 | 724 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
725 |
|
0 | 726 |
WP(w,menu_d).item_count = item_count; |
727 |
WP(w,menu_d).sel_index = 0; |
|
728 |
WP(w,menu_d).main_button = main_button; |
|
729 |
WP(w,menu_d).action_id = (main_button >> 8) ? (main_button >> 8) : main_button; |
|
730 |
WP(w,menu_d).string_id = base_string; |
|
731 |
WP(w,menu_d).checked_items = 0; |
|
732 |
||
733 |
_popup_menu_active = true; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
734 |
|
541 | 735 |
SndPlayFx(SND_15_BEEP); |
0 | 736 |
|
737 |
return w; |
|
738 |
} |
|
739 |
||
740 |
static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
|
741 |
{ |
|
742 |
x += w->left; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
743 |
|
0 | 744 |
SETBIT(w->click_state, main_button); |
745 |
InvalidateWidget(w, main_button); |
|
746 |
||
747 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
|
748 |
w = AllocateWindow(x, 0x16, 0xF1, 0x52, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets); |
|
749 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
|
750 |
WP(w,menu_d).item_count = 0; |
|
724
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
751 |
WP(w,menu_d).sel_index = (_local_player != OWNER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0); |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
752 |
if (_networking && main_button == 9) { |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
753 |
if (_local_player != OWNER_SPECTATOR) |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
754 |
WP(w,menu_d).sel_index++; |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
755 |
else |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
756 |
/* Select client list by default for spectators */ |
082993b2adaa
(svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight
parents:
722
diff
changeset
|
757 |
WP(w,menu_d).sel_index = 0; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
758 |
} |
0 | 759 |
WP(w,menu_d).action_id = main_button; |
760 |
WP(w,menu_d).main_button = main_button; |
|
761 |
WP(w,menu_d).checked_items = gray; |
|
762 |
_popup_menu_active = true; |
|
541 | 763 |
SndPlayFx(SND_15_BEEP); |
0 | 764 |
return w; |
765 |
} |
|
766 |
||
767 |
static void ToolbarSaveClick(Window *w) |
|
768 |
{ |
|
769 |
PopupMainToolbMenu(w, 66, 3, STR_015C_SAVE_GAME, 4); |
|
770 |
} |
|
771 |
||
772 |
static void ToolbarMapClick(Window *w) |
|
773 |
{ |
|
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1571
diff
changeset
|
774 |
PopupMainToolbMenu(w, 96, 4, STR_02DE_MAP_OF_WORLD, 3); |
0 | 775 |
} |
776 |
||
777 |
static void ToolbarTownClick(Window *w) |
|
778 |
{ |
|
779 |
PopupMainToolbMenu(w, 118, 5, STR_02BB_TOWN_DIRECTORY, 1); |
|
780 |
} |
|
781 |
||
782 |
static void ToolbarSubsidiesClick(Window *w) |
|
783 |
{ |
|
784 |
PopupMainToolbMenu(w, 140, 6, STR_02DD_SUBSIDIES, 1); |
|
785 |
} |
|
786 |
||
787 |
static void ToolbarStationsClick(Window *w) |
|
788 |
{ |
|
789 |
PopupMainPlayerToolbMenu(w, 162, 7, 0); |
|
790 |
} |
|
791 |
||
792 |
static void ToolbarMoneyClick(Window *w) |
|
793 |
{ |
|
794 |
PopupMainPlayerToolbMenu(w, 191, 8, 0); |
|
795 |
} |
|
796 |
||
797 |
static void ToolbarPlayersClick(Window *w) |
|
798 |
{ |
|
799 |
PopupMainPlayerToolbMenu(w, 213, 9, 0); |
|
800 |
} |
|
801 |
||
802 |
static void ToolbarGraphsClick(Window *w) |
|
803 |
{ |
|
804 |
PopupMainToolbMenu(w, 236, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6); |
|
805 |
} |
|
806 |
||
807 |
static void ToolbarLeagueClick(Window *w) |
|
808 |
{ |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
74
diff
changeset
|
809 |
PopupMainToolbMenu(w, 258, 11, STR_015A_COMPANY_LEAGUE_TABLE, 2); |
0 | 810 |
} |
811 |
||
812 |
static void ToolbarIndustryClick(Window *w) |
|
813 |
{ |
|
197
25749afe81ef
(svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater
parents:
196
diff
changeset
|
814 |
PopupMainToolbMenu(w, 280, 12, STR_INDUSTRY_DIR, 2); |
0 | 815 |
} |
816 |
||
817 |
static void ToolbarTrainClick(Window *w) |
|
818 |
{ |
|
819 |
Vehicle *v; |
|
820 |
int dis = -1; |
|
821 |
FOR_ALL_VEHICLES(v) |
|
1067
a083a6dd1419
(svn r1568) made an enum of train subtypes to make the code more readable
bjarni
parents:
1044
diff
changeset
|
822 |
if (v->type == VEH_Train && v->subtype == TS_Front_Engine) CLRBIT(dis, v->owner); |
0 | 823 |
PopupMainPlayerToolbMenu(w, 310, 13, dis); |
824 |
} |
|
825 |
||
826 |
static void ToolbarRoadClick(Window *w) |
|
827 |
{ |
|
828 |
Vehicle *v; |
|
829 |
int dis = -1; |
|
830 |
FOR_ALL_VEHICLES(v) |
|
831 |
if (v->type == VEH_Road) CLRBIT(dis, v->owner); |
|
832 |
PopupMainPlayerToolbMenu(w, 332, 14, dis); |
|
833 |
} |
|
834 |
||
835 |
static void ToolbarShipClick(Window *w) |
|
836 |
{ |
|
837 |
Vehicle *v; |
|
838 |
int dis = -1; |
|
839 |
FOR_ALL_VEHICLES(v) |
|
840 |
if (v->type == VEH_Ship) CLRBIT(dis, v->owner); |
|
841 |
PopupMainPlayerToolbMenu(w, 354, 15, dis); |
|
842 |
} |
|
843 |
||
844 |
static void ToolbarAirClick(Window *w) |
|
845 |
{ |
|
846 |
Vehicle *v; |
|
847 |
int dis = -1; |
|
848 |
FOR_ALL_VEHICLES(v) |
|
849 |
if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner); |
|
850 |
PopupMainPlayerToolbMenu(w, 376, 16, dis); |
|
851 |
} |
|
852 |
||
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
|
853 |
/* 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
|
854 |
/* 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
|
855 |
bool DoZoomInOutWindow(int how, Window *w) |
0 | 856 |
{ |
857 |
ViewPort *vp; |
|
858 |
int button; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
859 |
|
0 | 860 |
switch(_game_mode) { |
861 |
case GM_EDITOR: button = 9; break; |
|
862 |
case GM_NORMAL: button = 17; break; |
|
863 |
default: return false; |
|
864 |
} |
|
865 |
||
866 |
assert(w); |
|
867 |
vp = w->viewport; |
|
868 |
||
869 |
if (how == ZOOM_IN) { |
|
870 |
if (vp->zoom == 0) return false; |
|
871 |
vp->zoom--; |
|
872 |
vp->virtual_width >>= 1; |
|
873 |
vp->virtual_height >>= 1; |
|
874 |
||
875 |
WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1; |
|
876 |
WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1; |
|
877 |
||
878 |
SetWindowDirty(w); |
|
879 |
} else if (how == ZOOM_OUT) { |
|
880 |
if (vp->zoom == 2) return false; |
|
881 |
vp->zoom++; |
|
882 |
||
883 |
WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1; |
|
884 |
WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1; |
|
885 |
||
886 |
vp->virtual_width <<= 1; |
|
887 |
vp->virtual_height <<= 1; |
|
888 |
||
889 |
SetWindowDirty(w); |
|
890 |
} |
|
891 |
||
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
|
892 |
// 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
|
893 |
{ |
168
79f9ed5b23e6
(svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents:
152
diff
changeset
|
894 |
Window *wt = NULL; |
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 |
switch (w->window_class) { |
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
|
896 |
case WC_MAIN_WINDOW: |
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 |
wt = FindWindowById(WC_MAIN_TOOLBAR, 0); |
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 |
break; |
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 |
case WC_EXTRA_VIEW_PORT: |
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 |
wt = FindWindowById(WC_EXTRA_VIEW_PORT, w->window_number); |
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
901 |
button = 5; |
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
|
902 |
break; |
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
|
903 |
} |
0 | 904 |
|
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
|
905 |
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
|
906 |
|
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 |
// 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
|
908 |
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
|
909 |
CLRBIT(wt->disabled_state, button + 1); |
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
|
910 |
if (vp->zoom == 0) SETBIT(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
|
911 |
else if (vp->zoom == 2) SETBIT(wt->disabled_state, button + 1); |
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
|
912 |
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
|
913 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
914 |
|
0 | 915 |
return true; |
916 |
} |
|
917 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
918 |
static void MaxZoomIn(void) |
0 | 919 |
{ |
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
|
920 |
while (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0) ) ) {} |
0 | 921 |
} |
922 |
||
923 |
static void ToolbarZoomInClick(Window *w) |
|
924 |
{ |
|
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
|
925 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 926 |
HandleButtonClick(w, 17); |
541 | 927 |
SndPlayFx(SND_15_BEEP); |
0 | 928 |
} |
929 |
} |
|
930 |
||
931 |
static void ToolbarZoomOutClick(Window *w) |
|
932 |
{ |
|
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
|
933 |
if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 934 |
HandleButtonClick(w, 18); |
541 | 935 |
SndPlayFx(SND_15_BEEP); |
0 | 936 |
} |
937 |
} |
|
938 |
||
939 |
static void ToolbarBuildRailClick(Window *w) |
|
940 |
{ |
|
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
941 |
Player *p = GetPlayer(_local_player); |
0 | 942 |
Window *w2; |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
2116
diff
changeset
|
943 |
w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, GetNumRailtypes(p)); |
0 | 944 |
WP(w2,menu_d).sel_index = _last_built_railtype; |
945 |
} |
|
946 |
||
947 |
static void ToolbarBuildRoadClick(Window *w) |
|
948 |
{ |
|
949 |
PopupMainToolbMenu(w, 479, 20, STR_180A_ROAD_CONSTRUCTION, 1); |
|
950 |
} |
|
951 |
||
952 |
static void ToolbarBuildWaterClick(Window *w) |
|
953 |
{ |
|
954 |
PopupMainToolbMenu(w, 501, 21, STR_9800_DOCK_CONSTRUCTION, 1); |
|
955 |
} |
|
956 |
||
957 |
static void ToolbarBuildAirClick(Window *w) |
|
958 |
{ |
|
959 |
PopupMainToolbMenu(w, 0x1E0, 22, STR_A01D_AIRPORT_CONSTRUCTION, 1); |
|
960 |
} |
|
961 |
||
962 |
static void ToolbarForestClick(Window *w) |
|
963 |
{ |
|
964 |
PopupMainToolbMenu(w, 0x1E0, 23, STR_LANDSCAPING, 3); |
|
965 |
} |
|
966 |
||
967 |
static void ToolbarMusicClick(Window *w) |
|
968 |
{ |
|
969 |
PopupMainToolbMenu(w, 0x1E0, 24, STR_01D3_SOUND_MUSIC, 1); |
|
970 |
} |
|
971 |
||
972 |
static void ToolbarNewspaperClick(Window *w) |
|
973 |
{ |
|
1705
e29432c6971f
(svn r2209) - CodeChange: [ 1184348 ] Remove unused _newspaper_flag that was supposed to be some ugly hack for chatting (gonewacko)
Darkvater
parents:
1697
diff
changeset
|
974 |
PopupMainToolbMenu(w, 0x1E0, 25, STR_0200_LAST_MESSAGE_NEWS_REPORT, 3); |
0 | 975 |
} |
976 |
||
977 |
static void ToolbarHelpClick(Window *w) |
|
978 |
{ |
|
979 |
PopupMainToolbMenu(w, 0x1E0, 26, STR_02D5_LAND_BLOCK_INFO, 5); |
|
980 |
} |
|
981 |
||
982 |
static void ToolbarOptionsClick(Window *w) |
|
983 |
{ |
|
984 |
uint16 x; |
|
985 |
||
1932
275d72f700e2
(svn r2438) - Feature: New display option, 'transparent station signs', makes station signs transparent instead of using a solid bar to draw text on (peter1138)
hackykid
parents:
1914
diff
changeset
|
986 |
w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 13); |
0 | 987 |
|
988 |
x = (uint16)-1; |
|
1015
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
989 |
if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<5); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
990 |
if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<6); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
991 |
if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<7); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
992 |
if (_display_opt & DO_WAYPOINTS) x &= ~(1<<8); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
993 |
if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<9); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
994 |
if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<10); |
bc0d6949d458
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
1014
diff
changeset
|
995 |
if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<11); |
1932
275d72f700e2
(svn r2438) - Feature: New display option, 'transparent station signs', makes station signs transparent instead of using a solid bar to draw text on (peter1138)
hackykid
parents:
1914
diff
changeset
|
996 |
if (_display_opt & DO_TRANS_SIGNS) x &= ~(1<<12); |
0 | 997 |
WP(w,menu_d).checked_items = x; |
998 |
} |
|
999 |
||
1000 |
||
1001 |
static void ToolbarScenSaveOrLoad(Window *w) |
|
1002 |
{ |
|
1003 |
PopupMainToolbMenu(w, 0x2C, 3, STR_0292_SAVE_SCENARIO, 5); |
|
1004 |
} |
|
1005 |
||
1006 |
static void ToolbarScenDateBackward(Window *w) |
|
1007 |
{ |
|
1008 |
// don't allow too fast scrolling |
|
1009 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
|
1010 |
HandleButtonClick(w, 6); |
|
1011 |
InvalidateWidget(w, 5); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1012 |
|
349
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
1013 |
if (_date > MinDate) |
0 | 1014 |
SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1)); |
1015 |
} |
|
1016 |
_left_button_clicked = false; |
|
1017 |
} |
|
1018 |
||
1019 |
static void ToolbarScenDateForward(Window *w) |
|
1020 |
{ |
|
1021 |
// don't allow too fast scrolling |
|
1022 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
|
1023 |
HandleButtonClick(w, 7); |
|
1024 |
InvalidateWidget(w, 5); |
|
1025 |
||
349
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
1026 |
if (_date < MaxDate) |
0 | 1027 |
SetDate(ConvertYMDToDay(_cur_year + 1, 0, 1)); |
1028 |
} |
|
1029 |
_left_button_clicked = false; |
|
1030 |
} |
|
1031 |
||
1032 |
static void ToolbarScenMapTownDir(Window *w) |
|
1033 |
{ |
|
1610 | 1034 |
PopupMainToolbMenu(w, 0x16A, 8 | (17<<8), STR_02DE_MAP_OF_WORLD, 4); |
0 | 1035 |
} |
1036 |
||
1037 |
static void ToolbarScenZoomIn(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_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 1040 |
HandleButtonClick(w, 9); |
541 | 1041 |
SndPlayFx(SND_15_BEEP); |
0 | 1042 |
} |
1043 |
} |
|
1044 |
||
1045 |
static void ToolbarScenZoomOut(Window *w) |
|
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 |
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
0 | 1048 |
HandleButtonClick(w, 10); |
541 | 1049 |
SndPlayFx(SND_15_BEEP); |
0 | 1050 |
} |
1051 |
} |
|
1052 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1053 |
void ZoomInOrOutToCursorWindow(bool in, Window *w) |
0 | 1054 |
{ |
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
|
1055 |
ViewPort * vp; |
0 | 1056 |
Point pt; |
1057 |
||
1058 |
assert(w != 0); |
|
1059 |
||
1060 |
vp = w->viewport; |
|
1061 |
||
1062 |
if (_game_mode != GM_MENU) { |
|
1063 |
if ((in && vp->zoom == 0) || (!in && vp->zoom == 2)) |
|
1064 |
return; |
|
1065 |
||
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
|
1066 |
pt = GetTileZoomCenterWindow(in,w); |
0 | 1067 |
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
|
1068 |
ScrollWindowTo(pt.x, pt.y, w); |
0 | 1069 |
|
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
|
1070 |
DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w); |
0 | 1071 |
} |
1072 |
} |
|
1073 |
} |
|
1074 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
1075 |
static void ResetLandscape(void) |
0 | 1076 |
{ |
206 | 1077 |
_random_seeds[0][0] = InteractiveRandom(); |
1078 |
_random_seeds[0][1] = InteractiveRandom(); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1079 |
|
2051 | 1080 |
GenerateWorld(1, 1<<_patches.map_x, 1<<_patches.map_y); |
0 | 1081 |
MarkWholeScreenDirty(); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1082 |
} |
0 | 1083 |
|
1084 |
static const Widget _ask_reset_landscape_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1085 |
{ WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1086 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_022C_RESET_LANDSCAPE, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1087 |
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1088 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1089 |
{ 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
|
1090 |
{ WIDGETS_END}, |
0 | 1091 |
}; |
1092 |
||
1093 |
// Ask first to reset landscape or to make a random landscape |
|
1094 |
static void AskResetLandscapeWndProc(Window *w, WindowEvent *e) |
|
1095 |
{ |
|
1096 |
uint mode = w->window_number; |
|
1097 |
||
1098 |
switch(e->event) { |
|
1099 |
case WE_PAINT: |
|
1100 |
DrawWindowWidgets(w); |
|
1101 |
DrawStringMultiCenter(90, 38, mode?STR_022D_ARE_YOU_SURE_YOU_WANT_TO:STR_GENERATE_RANDOM_LANDSCAPE , 168); |
|
1571
2324eb301f5d
(svn r2075) -Fix: added missing breaks in switches
truelight
parents:
1542
diff
changeset
|
1102 |
break; |
0 | 1103 |
case WE_CLICK: |
1104 |
switch(e->click.widget) { |
|
1105 |
case 3: |
|
1106 |
DeleteWindow(w); |
|
1107 |
break; |
|
1108 |
case 4: |
|
1109 |
DeleteWindow(w); |
|
999
8b2a34061963
(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 |
DeleteWindowByClass(WC_INDUSTRY_VIEW); |
8b2a34061963
(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
|
1111 |
DeleteWindowByClass(WC_TOWN_VIEW); |
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1015
diff
changeset
|
1112 |
DeleteWindowByClass(WC_LAND_INFO); |
999
8b2a34061963
(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
|
1113 |
|
8b2a34061963
(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
|
1114 |
if (mode) { // reset landscape |
0 | 1115 |
ResetLandscape(); |
999
8b2a34061963
(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
|
1116 |
} else { // make random landscape |
541 | 1117 |
SndPlayFx(SND_15_BEEP); |
0 | 1118 |
_switch_mode = SM_GENRANDLAND; |
1119 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1120 |
|
0 | 1121 |
break; |
1122 |
} |
|
1571
2324eb301f5d
(svn r2075) -Fix: added missing breaks in switches
truelight
parents:
1542
diff
changeset
|
1123 |
break; |
0 | 1124 |
} |
1125 |
} |
|
1126 |
||
1127 |
static const WindowDesc _ask_reset_landscape_desc = { |
|
1128 |
230,205, 180, 92, |
|
1129 |
WC_ASK_RESET_LANDSCAPE,0, |
|
1130 |
WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1131 |
_ask_reset_landscape_widgets, |
|
1132 |
AskResetLandscapeWndProc, |
|
1133 |
}; |
|
1134 |
||
1135 |
static void AskResetLandscape(uint mode) |
|
1136 |
{ |
|
1137 |
AllocateWindowDescFront(&_ask_reset_landscape_desc, mode); |
|
1138 |
} |
|
1139 |
||
1632
c4ae19bfebf7
(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 |
// TODO - Incorporate into game itself to allow for ingame raising/lowering of |
c4ae19bfebf7
(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 |
// larger chunks at the same time OR remove altogether, as we have 'level land' ? |
c4ae19bfebf7
(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 |
/** |
c4ae19bfebf7
(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 |
* Raise/Lower a bigger chunk of land at the same time in the editor. When |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1144 |
* raising get the lowest point, when lowering the highest point, and set all |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1145 |
* tiles in the selection to that height. |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1146 |
* @param tile The top-left tile where the terraforming will start |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1147 |
* @param mode 1 for raising, 0 for lowering land |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1148 |
*/ |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1149 |
static void CommonRaiseLowerBigLand(TileIndex tile, int mode) |
0 | 1150 |
{ |
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1151 |
int sizex, sizey; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1152 |
byte h; |
0 | 1153 |
|
1154 |
_error_message_2 = mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE; |
|
1155 |
||
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1156 |
_generating_world = true; // used to create green terraformed land |
0 | 1157 |
|
1158 |
if (_terraform_size == 1) { |
|
1014
c669eeb097c6
(svn r1514) -Fix: [1092474] little red box in scenario editor (Celestar). Error box is also shown in scenario editor for terraforming, thus solving the eternally-pulsating-tile problem.
darkvater
parents:
1003
diff
changeset
|
1159 |
DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(_error_message_2)); |
0 | 1160 |
} else { |
541 | 1161 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1162 |
|
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1163 |
assert(_terraform_size != 0); |
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1164 |
// check out for map overflows |
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1165 |
sizex = min(MapSizeX() - TileX(tile) - 1, _terraform_size); |
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1166 |
sizey = min(MapSizeY() - TileY(tile) - 1, _terraform_size); |
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1167 |
|
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1168 |
if (sizex == 0 || sizey == 0) return; |
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1169 |
|
0 | 1170 |
if (mode != 0) { |
1171 |
/* Raise land */ |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1172 |
h = 15; // XXX - max height |
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1173 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
9b73df700a7c
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1174 |
h = min(h, TileHeight(tile2)); |
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1175 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1176 |
} else { |
1177 |
/* Lower land */ |
|
1178 |
h = 0; |
|
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1179 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
9b73df700a7c
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1180 |
h = max(h, TileHeight(tile2)); |
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1181 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1182 |
} |
1183 |
||
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1184 |
BEGIN_TILE_LOOP(tile2, sizex, sizey, tile) { |
1044
9b73df700a7c
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron
parents:
1035
diff
changeset
|
1185 |
if (TileHeight(tile2) == h) { |
0 | 1186 |
DoCommandP(tile2, 8, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO); |
1187 |
} |
|
1697
be3b6806cbb4
(svn r2201) - Fix: Crash in scenario-editor with terraforming out-of-map bounds.
Darkvater
parents:
1688
diff
changeset
|
1188 |
} END_TILE_LOOP(tile2, sizex, sizey, tile) |
0 | 1189 |
} |
1190 |
||
1191 |
_generating_world = false; |
|
1192 |
} |
|
1193 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1194 |
static void PlaceProc_RaiseBigLand(TileIndex tile) |
0 | 1195 |
{ |
1196 |
CommonRaiseLowerBigLand(tile, 1); |
|
1197 |
} |
|
1198 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1199 |
static void PlaceProc_LowerBigLand(TileIndex tile) |
0 | 1200 |
{ |
1201 |
CommonRaiseLowerBigLand(tile, 0); |
|
1202 |
} |
|
1203 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1204 |
static void PlaceProc_RockyArea(TileIndex tile) |
0 | 1205 |
{ |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1019
diff
changeset
|
1206 |
if (!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) |
0 | 1207 |
return; |
1208 |
||
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
1209 |
ModifyTile(tile, MP_SETTYPE(MP_CLEAR) | MP_MAP5, (_m[tile].m5 & ~0x1C) | 0xB); |
541 | 1210 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1211 |
} |
1212 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1213 |
static void PlaceProc_LightHouse(TileIndex tile) |
0 | 1214 |
{ |
1215 |
TileInfo ti; |
|
1216 |
||
1217 |
FindLandscapeHeightByTile(&ti, tile); |
|
2085
ae9e92ffe168
(svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
celestar
parents:
2051
diff
changeset
|
1218 |
if (IsTileType(tile, MP_CLEAR) || IsSteepTileh(ti.tileh)) |
0 | 1219 |
return; |
1220 |
||
1221 |
ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1); |
|
541 | 1222 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1223 |
} |
1224 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1225 |
static void PlaceProc_Transmitter(TileIndex tile) |
0 | 1226 |
{ |
1227 |
TileInfo ti; |
|
1228 |
||
1229 |
FindLandscapeHeightByTile(&ti, tile); |
|
2085
ae9e92ffe168
(svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
celestar
parents:
2051
diff
changeset
|
1230 |
if (IsTileType(tile, MP_CLEAR) || IsSteepTileh(ti.tileh)) |
0 | 1231 |
return; |
1232 |
||
1233 |
ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0); |
|
541 | 1234 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1235 |
} |
1236 |
||
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1237 |
static void PlaceProc_DesertArea(TileIndex tile) |
0 | 1238 |
{ |
1632
c4ae19bfebf7
(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 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DesertArea); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 |
static void PlaceProc_WaterArea(TileIndex tile) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1244 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_WaterArea); |
0 | 1245 |
} |
1246 |
||
1247 |
static const Widget _scen_edit_land_gen_widgets[] = { |
|
1632
c4ae19bfebf7
(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_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
c4ae19bfebf7
(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_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0223_LAND_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
c4ae19bfebf7
(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_STICKYBOX, RESIZE_NONE, 7, 170, 181, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
c4ae19bfebf7
(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_IMGBTN, RESIZE_NONE, 7, 0, 181, 14, 101, STR_NULL, STR_NULL}, |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_IMGBTN, RESIZE_NONE, 14, 2, 23, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
1639
5c4956d8b2c2
(svn r2143) - Fix: [ 1175748 ] Wrong Button-Images in scenario-editors landscape-tool (thanks chrishuebsch)
Darkvater
parents:
1637
diff
changeset
|
1254 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 24, 45, 14, 35, SPR_IMG_TERRAFORM_DOWN, STR_018F_RAISE_A_CORNER_OF_LAND}, |
5c4956d8b2c2
(svn r2143) - Fix: [ 1175748 ] Wrong Button-Images in scenario-editors landscape-tool (thanks chrishuebsch)
Darkvater
parents:
1637
diff
changeset
|
1255 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 46, 67, 14, 35, SPR_IMG_TERRAFORM_UP, STR_018E_LOWER_A_CORNER_OF_LAND}, |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1256 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 68, 89, 14, 35, SPR_IMG_LEVEL_LAND, STR_LEVEL_LAND_TOOLTIP}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1257 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 90, 111, 14, 35, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1258 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 112, 134, 14, 35, SPR_IMG_ROCKS, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1259 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 135, 157, 14, 35, SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL}, // XXX - dynamic |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1260 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 158, 179, 14, 35, SPR_IMG_TRANSMITTER, STR_028E_PLACE_TRANSMITTER}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1261 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 43, 54, STR_0224, STR_0228_INCREASE_SIZE_OF_LAND_AREA}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1262 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 139, 149, 56, 67, STR_0225, STR_0229_DECREASE_SIZE_OF_LAND_AREA}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1263 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 34, 149, 75, 86, STR_0226_RANDOM_LAND, STR_022A_GENERATE_RANDOM_LAND}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1264 |
{ 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
|
1265 |
{ WIDGETS_END}, |
0 | 1266 |
}; |
1267 |
||
1268 |
static const int8 _multi_terraform_coords[][2] = { |
|
1269 |
{ 0, -2}, |
|
1270 |
{ 4, 0},{ -4, 0},{ 0, 2}, |
|
1271 |
{ -8, 2},{ -4, 4},{ 0, 6},{ 4, 4},{ 8, 2}, |
|
1272 |
{-12, 0},{ -8, -2},{ -4, -4},{ 0, -6},{ 4, -4},{ 8, -2},{ 12, 0}, |
|
1273 |
{-16, 2},{-12, 4},{ -8, 6},{ -4, 8},{ 0, 10},{ 4, 8},{ 8, 6},{ 12, 4},{ 16, 2}, |
|
1274 |
{-20, 0},{-16, -2},{-12, -4},{ -8, -6},{ -4, -8},{ 0,-10},{ 4, -8},{ 8, -6},{ 12, -4},{ 16, -2},{ 20, 0}, |
|
1275 |
{-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}, |
|
1276 |
{-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}, |
|
1277 |
}; |
|
1278 |
||
1632
c4ae19bfebf7
(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 |
// TODO - Merge with terraform_gui.c (move there) after I have cooled down at its braindeadness |
c4ae19bfebf7
(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 |
// and changed OnButtonClick to include the widget as well in the function decleration. Post 0.4.0 - Darkvater |
c4ae19bfebf7
(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_Dynamite(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 4, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_LowerBigLand(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 5, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerBigLand); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_RaiseBigLand(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 6, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseBigLand); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_LevelLand(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 7, SPR_CURSOR_LEVEL_LAND, 2, PlaceProc_LevelLand); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_WaterArea(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 8, SPR_CURSOR_CANAL, 1, PlaceProc_WaterArea); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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_RockyArea(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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, 9, SPR_CURSOR_ROCKY_AREA, 1, PlaceProc_RockyArea); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 void EditorTerraformClick_DesertLightHouse(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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 |
HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_DESERT) ? PlaceProc_DesertArea : PlaceProc_LightHouse); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 |
static void EditorTerraformClick_Transmitter(Window *w) |
c4ae19bfebf7
(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 |
{ |
c4ae19bfebf7
(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 |
HandlePlacePushButton(w, 11, SPR_CURSOR_TRANSMITTER, 1, PlaceProc_Transmitter); |
c4ae19bfebf7
(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 |
} |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 |
static const uint16 _editor_terraform_keycodes[] = { |
c4ae19bfebf7
(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 |
'D', |
c4ae19bfebf7
(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 |
'Q', |
c4ae19bfebf7
(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 |
'W', |
c4ae19bfebf7
(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 |
'E', |
c4ae19bfebf7
(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 |
'R', |
c4ae19bfebf7
(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 |
'T', |
c4ae19bfebf7
(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 |
'Y', |
c4ae19bfebf7
(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 |
'U' |
c4ae19bfebf7
(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 |
}; |
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 |
typedef void OnButtonClick(Window *w); |
c4ae19bfebf7
(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 |
static OnButtonClick * const _editor_terraform_button_proc[] = { |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1334 |
EditorTerraformClick_Dynamite, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1335 |
EditorTerraformClick_LowerBigLand, |
c4ae19bfebf7
(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 |
EditorTerraformClick_RaiseBigLand, |
c4ae19bfebf7
(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 |
EditorTerraformClick_LevelLand, |
c4ae19bfebf7
(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 |
EditorTerraformClick_WaterArea, |
c4ae19bfebf7
(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 |
EditorTerraformClick_RockyArea, |
c4ae19bfebf7
(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 |
EditorTerraformClick_DesertLightHouse, |
c4ae19bfebf7
(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 |
EditorTerraformClick_Transmitter |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1342 |
}; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1343 |
|
0 | 1344 |
static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) |
1345 |
{ |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1346 |
switch (e->event) { |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1347 |
case WE_CREATE: |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1348 |
// XXX - lighthouse button is widget 10!! Don't forget when changing |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1349 |
w->widget[10].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1350 |
break; |
c4ae19bfebf7
(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 |
|
0 | 1352 |
case WE_PAINT: |
1353 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1354 |
|
0 | 1355 |
{ |
1356 |
int n = _terraform_size * _terraform_size; |
|
1357 |
const int8 *coords = &_multi_terraform_coords[0][0]; |
|
1358 |
||
1359 |
assert(n != 0); |
|
1360 |
do { |
|
1632
c4ae19bfebf7
(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 |
DrawSprite(SPR_WHITE_POINT, 77 + coords[0], 55 + coords[1]); |
0 | 1362 |
coords += 2; |
1363 |
} while (--n); |
|
1364 |
} |
|
1365 |
||
1632
c4ae19bfebf7
(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 |
if (w->click_state & ( 1 << 5 | 1 << 6)) // change area-size if raise/lower corner is selected |
0 | 1367 |
SetTileSelectSize(_terraform_size, _terraform_size); |
1632
c4ae19bfebf7
(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 |
|
c4ae19bfebf7
(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 |
break; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1370 |
|
c4ae19bfebf7
(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 |
case WE_KEYPRESS: { |
c4ae19bfebf7
(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 |
int i; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1373 |
|
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1374 |
for (i = 0; i != lengthof(_editor_terraform_keycodes); i++) { |
c4ae19bfebf7
(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 |
if (e->keypress.keycode == _editor_terraform_keycodes[i]) { |
c4ae19bfebf7
(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 |
e->keypress.cont = false; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1377 |
_editor_terraform_button_proc[i](w); |
c4ae19bfebf7
(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 |
break; |
c4ae19bfebf7
(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 |
} |
0 | 1380 |
} |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1381 |
} break; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1382 |
|
0 | 1383 |
case WE_CLICK: |
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1384 |
switch (e->click.widget) { |
1632
c4ae19bfebf7
(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 |
case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1386 |
_editor_terraform_button_proc[e->click.widget - 4](w); |
0 | 1387 |
break; |
1632
c4ae19bfebf7
(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 |
case 12: case 13: { /* Increase/Decrease terraform size */ |
c4ae19bfebf7
(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 |
int size = (e->click.widget == 12) ? 1 : -1; |
c4ae19bfebf7
(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, e->click.widget); |
0 | 1391 |
size += _terraform_size; |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1392 |
|
c4ae19bfebf7
(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 |
if (!IS_INT_INSIDE(size, 1, 8 + 1)) return; |
0 | 1394 |
_terraform_size = size; |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1395 |
|
541 | 1396 |
SndPlayFx(SND_15_BEEP); |
0 | 1397 |
SetWindowDirty(w); |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1398 |
} break; |
c4ae19bfebf7
(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 |
case 14: /* gen random land */ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1400 |
HandleButtonClick(w, 14); |
0 | 1401 |
AskResetLandscape(0); |
1402 |
break; |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1403 |
case 15: /* reset landscape */ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1404 |
HandleButtonClick(w,15); |
0 | 1405 |
AskResetLandscape(1); |
1406 |
break; |
|
1407 |
} |
|
1408 |
break; |
|
1632
c4ae19bfebf7
(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_TIMEOUT: |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1411 |
UnclickSomeWindowButtons(w, ~(1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<10 | 1<<11)); |
0 | 1412 |
break; |
1413 |
case WE_PLACE_OBJ: |
|
1414 |
_place_proc(e->place.tile); |
|
1415 |
break; |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1416 |
case WE_PLACE_DRAG: |
0 | 1417 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata & 0xF); |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1418 |
break; |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1419 |
|
0 | 1420 |
case WE_PLACE_MOUSEUP: |
1421 |
if (e->click.pt.x != -1) { |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1422 |
if ((e->place.userdata & 0xF) == VPM_X_AND_Y) // dragged actions |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1423 |
GUIPlaceProcDragXY(e); |
0 | 1424 |
} |
1632
c4ae19bfebf7
(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 |
break; |
0 | 1426 |
|
1427 |
case WE_ABORT_PLACE_OBJ: |
|
1428 |
w->click_state = 0; |
|
1429 |
SetWindowDirty(w); |
|
1430 |
break; |
|
1431 |
} |
|
1432 |
} |
|
1433 |
||
1434 |
static const WindowDesc _scen_edit_land_gen_desc = { |
|
1632
c4ae19bfebf7
(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 |
-1,-1, 182, 102, |
0 | 1436 |
WC_SCEN_LAND_GEN,0, |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1437 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1438 |
_scen_edit_land_gen_widgets, |
1439 |
ScenEditLandGenWndProc, |
|
1440 |
}; |
|
1441 |
||
1632
c4ae19bfebf7
(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 |
static inline void ShowEditorTerraformToolBar(void) |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1443 |
{ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1444 |
AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0); |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1445 |
} |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1446 |
|
0 | 1447 |
static void ToolbarScenGenLand(Window *w) |
1448 |
{ |
|
1449 |
HandleButtonClick(w, 11); |
|
541 | 1450 |
SndPlayFx(SND_15_BEEP); |
0 | 1451 |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1452 |
ShowEditorTerraformToolBar(); |
0 | 1453 |
} |
1454 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1455 |
void CcBuildTown(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 1456 |
{ |
1457 |
if (success) { |
|
541 | 1458 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 1459 |
ResetObjectToPlace(); |
1460 |
} |
|
1461 |
} |
|
1462 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1463 |
static void PlaceProc_Town(TileIndex tile) |
0 | 1464 |
{ |
1465 |
DoCommandP(tile, 0, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE)); |
|
1466 |
} |
|
1467 |
||
1468 |
||
1469 |
static const Widget _scen_edit_town_gen_widgets[] = { |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1470 |
{ WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1471 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_0233_TOWN_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1472 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 148, 159, 0, 13, 0x0, STR_STICKY_BUTTON}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1473 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 159, 14, 81, 0x0, STR_NULL}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1474 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 16, 27, STR_0234_NEW_TOWN, STR_0235_CONSTRUCT_NEW_TOWN}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1475 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 29, 40, STR_023D_RANDOM_TOWN, STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1476 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 42, 53, STR_MANY_RANDOM_TOWNS, STR_RANDOM_TOWNS_TIP}, |
c4ae19bfebf7
(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 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 53, 68, 79, STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1478 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 54, 105, 68, 79, STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE}, |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1479 |
{ 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
|
1480 |
{ WIDGETS_END}, |
0 | 1481 |
}; |
1482 |
||
1483 |
static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) |
|
1484 |
{ |
|
1485 |
switch(e->event) { |
|
1486 |
case WE_PAINT: |
|
1632
c4ae19bfebf7
(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 |
w->click_state = (w->click_state & ~(1<<7 | 1<<8 | 1<<9) ) | (1 << (_new_town_size + 7)); |
0 | 1488 |
DrawWindowWidgets(w); |
1489 |
DrawStringCentered(80, 56, STR_02A5_TOWN_SIZE, 0); |
|
1490 |
break; |
|
1491 |
||
1492 |
case WE_CLICK: |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1493 |
switch (e->click.widget) { |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1494 |
case 4: /* new town */ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1495 |
HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, 1, PlaceProc_Town); |
0 | 1496 |
break; |
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1497 |
case 5: {/* random town */ |
0 | 1498 |
Town *t; |
1499 |
||
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1500 |
HandleButtonClick(w, 5); |
0 | 1501 |
_generating_world = true; |
1362
adfd229bdc01
(svn r1866) -Fix: Intercepted generated maps with 0 towns on it. Currently just an
celestar
parents:
1357
diff
changeset
|
1502 |
t = CreateRandomTown(20); |
0 | 1503 |
_generating_world = false; |
1504 |
if (t != NULL) |
|
1505 |
ScrollMainWindowToTile(t->xy); |
|
1506 |
break; |
|
1507 |
} |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1508 |
case 6: {/* many random towns */ |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1509 |
HandleButtonClick(w, 6); |
0 | 1510 |
_generating_world = true; |
1511 |
_game_mode = GM_NORMAL; // little hack to avoid towns of the same size |
|
1512 |
GenerateTowns(); |
|
1513 |
_generating_world = false; |
|
1514 |
_game_mode = GM_EDITOR; |
|
1515 |
break; |
|
1516 |
} |
|
1517 |
||
1632
c4ae19bfebf7
(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 |
case 7: case 8: case 9: |
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1519 |
_new_town_size = e->click.widget - 7; |
0 | 1520 |
SetWindowDirty(w); |
1521 |
break; |
|
1522 |
} |
|
1523 |
break; |
|
1524 |
||
1525 |
case WE_TIMEOUT: |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1526 |
UnclickSomeWindowButtons(w, 1<<5 | 1<<6); |
0 | 1527 |
break; |
1528 |
case WE_PLACE_OBJ: |
|
1529 |
_place_proc(e->place.tile); |
|
1530 |
break; |
|
1531 |
case WE_ABORT_PLACE_OBJ: |
|
1532 |
w->click_state = 0; |
|
1533 |
SetWindowDirty(w); |
|
1534 |
break; |
|
1535 |
} |
|
1536 |
} |
|
1537 |
||
1538 |
static const WindowDesc _scen_edit_town_gen_desc = { |
|
1539 |
-1,-1, 160, 82, |
|
1540 |
WC_SCEN_TOWN_GEN,0, |
|
1632
c4ae19bfebf7
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
Darkvater
parents:
1610
diff
changeset
|
1541 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 1542 |
_scen_edit_town_gen_widgets, |
1543 |
ScenEditTownGenWndProc, |
|
1544 |
}; |
|
1545 |
||
1546 |
static void ToolbarScenGenTown(Window *w) |
|
1547 |
{ |
|
1548 |
HandleButtonClick(w, 12); |
|
541 | 1549 |
SndPlayFx(SND_15_BEEP); |
0 | 1550 |
|
1551 |
AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0); |
|
1552 |
} |
|
1553 |
||
1554 |
||
1555 |
static const Widget _scenedit_industry_normal_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1556 |
{ WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1557 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1558 |
{ 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
|
1559 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1560 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1561 |
|
581154a08a78
(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, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
581154a08a78
(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, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
581154a08a78
(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, 68, 79, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL}, |
581154a08a78
(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, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
581154a08a78
(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, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
581154a08a78
(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, 107, 118, STR_0245_OIL_RIG, STR_0267_CONSTRUCT_OIL_RIG_CAN_ONLY}, |
581154a08a78
(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, 120, 131, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
581154a08a78
(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, 133, 144, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL}, |
581154a08a78
(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, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
581154a08a78
(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, 159, 170, STR_0249_IRON_ORE_MINE, STR_026B_CONSTRUCT_IRON_ORE_MINE}, |
581154a08a78
(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, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1573 |
{ 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
|
1574 |
{ WIDGETS_END}, |
0 | 1575 |
}; |
1576 |
||
1577 |
||
1578 |
static const Widget _scenedit_industry_hilly_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1579 |
{ WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1580 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1581 |
{ 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
|
1582 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1583 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1584 |
|
581154a08a78
(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, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE}, |
581154a08a78
(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, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
581154a08a78
(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, 68, 79, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL}, |
581154a08a78
(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, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST}, |
581154a08a78
(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, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
581154a08a78
(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, 107, 118, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
581154a08a78
(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, 120, 131, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS}, |
581154a08a78
(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, 133, 144, STR_024F_GOLD_MINE, STR_0271_CONSTRUCT_GOLD_MINE}, |
581154a08a78
(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, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
581154a08a78
(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, 159, 170, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1595 |
{ 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
|
1596 |
{ WIDGETS_END}, |
0 | 1597 |
}; |
1598 |
||
1599 |
static const Widget _scenedit_industry_desert_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1600 |
{ WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1601 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1602 |
{ 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
|
1603 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1604 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1605 |
|
581154a08a78
(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, 42, 53, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO}, |
581154a08a78
(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, 55, 66, STR_0251_FRUIT_PLANTATION, STR_0274_PLANT_FRUIT_PLANTATION}, |
581154a08a78
(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, 68, 79, STR_0252_RUBBER_PLANTATION,STR_0275_PLANT_RUBBER_PLANTATION}, |
581154a08a78
(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, 81, 92, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
581154a08a78
(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, 94, 105, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
581154a08a78
(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, 107, 118, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
581154a08a78
(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, 120, 131, STR_0253_WATER_SUPPLY, STR_0276_CONSTRUCT_WATER_SUPPLY}, |
581154a08a78
(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, 133, 144, STR_0248_FARM, STR_026A_CONSTRUCT_FARM}, |
581154a08a78
(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, 146, 157, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN}, |
581154a08a78
(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, 159, 170, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS}, |
581154a08a78
(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, 172, 183, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY}, |
581154a08a78
(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, 185, 196, STR_0255_DIAMOND_MINE, STR_0278_CONSTRUCT_DIAMOND_MINE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1618 |
{ 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
|
1619 |
{ WIDGETS_END}, |
0 | 1620 |
}; |
1621 |
||
1622 |
static const Widget _scenedit_industry_candy_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1623 |
{ WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1624 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION,STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1625 |
{ 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
|
1626 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1627 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1628 |
|
581154a08a78
(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, 42, 53, STR_0257_COTTON_CANDY_FOREST,STR_027A_PLANT_COTTON_CANDY_FOREST}, |
581154a08a78
(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, 55, 66, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY}, |
581154a08a78
(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, 68, 79, STR_0259_BATTERY_FARM, STR_027C_CONSTRUCT_BATTERY_FARM}, |
581154a08a78
(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, 81, 92, STR_025A_COLA_WELLS, STR_027D_CONSTRUCT_COLA_WELLS}, |
581154a08a78
(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, 94, 105, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP}, |
581154a08a78
(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, 107, 118, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY}, |
581154a08a78
(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, 120, 131, STR_025D_PLASTIC_FOUNTAINS, STR_0280_CONSTRUCT_PLASTIC_FOUNTAINS}, |
581154a08a78
(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, 133, 144, STR_025E_FIZZY_DRINK_FACTORY,STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY}, |
581154a08a78
(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, 146, 157, STR_025F_BUBBLE_GENERATOR, STR_0282_CONSTRUCT_BUBBLE_GENERATOR}, |
581154a08a78
(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, 159, 170, STR_0260_TOFFEE_QUARRY, STR_0283_CONSTRUCT_TOFFEE_QUARRY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1639 |
{ 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
|
1640 |
{ WIDGETS_END}, |
0 | 1641 |
}; |
1642 |
||
1643 |
int _industry_type_to_place; |
|
1644 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
1645 |
static bool AnyTownExists(void) |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
1646 |
{ |
0 | 1647 |
Town *t; |
1648 |
FOR_ALL_TOWNS(t) { |
|
1649 |
if (t->xy) |
|
1650 |
return true; |
|
1651 |
} |
|
1652 |
return false; |
|
1653 |
} |
|
1654 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
1655 |
extern Industry *CreateNewIndustry(TileIndex tile, int type); |
0 | 1656 |
|
1657 |
static bool TryBuildIndustry(TileIndex tile, int type) |
|
1658 |
{ |
|
1659 |
int n; |
|
1660 |
||
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1661 |
if (CreateNewIndustry(tile, type)) return true; |
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1662 |
|
0 | 1663 |
n = 100; |
1664 |
do { |
|
1665 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true; |
|
1666 |
} while (--n); |
|
1667 |
||
1668 |
n = 200; |
|
1669 |
do { |
|
1670 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 2), type)) return true; |
|
1671 |
} while (--n); |
|
1672 |
||
1673 |
n = 700; |
|
1674 |
do { |
|
1675 |
if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 4), type)) return true; |
|
1676 |
} while (--n); |
|
1677 |
||
1678 |
return false; |
|
1679 |
} |
|
1680 |
||
1681 |
||
1682 |
static const byte _industry_type_list[4][16] = { |
|
1683 |
{0, 1, 2, 3, 4, 5, 6, 8, 9, 18, 11, 12}, |
|
1684 |
{0, 1, 14, 3, 4, 13, 7, 15, 9, 16, 11, 12}, |
|
1685 |
{25, 19, 20, 4, 13, 23, 21, 24, 22, 11, 16, 17, 10}, |
|
1686 |
{26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}, |
|
1687 |
}; |
|
1688 |
||
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1689 |
bool _ignore_restrictions; |
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1690 |
|
0 | 1691 |
static void ScenEditIndustryWndProc(Window *w, WindowEvent *e) |
1692 |
{ |
|
1693 |
int button; |
|
1694 |
||
1695 |
switch(e->event) { |
|
1696 |
case WE_PAINT: |
|
1697 |
DrawWindowWidgets(w); |
|
1698 |
break; |
|
1699 |
||
1700 |
case WE_CLICK: |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1701 |
if ((button=e->click.widget) == 3) { |
0 | 1702 |
HandleButtonClick(w, 3); |
1703 |
||
1704 |
if (!AnyTownExists()) { |
|
1705 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_CAN_T_GENERATE_INDUSTRIES, 0, 0); |
|
1706 |
return; |
|
1707 |
} |
|
1708 |
||
1709 |
_generating_world = true; |
|
1710 |
GenerateIndustries(); |
|
1711 |
_generating_world = false; |
|
1712 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1713 |
|
0 | 1714 |
if ((button=e->click.widget) >= 4) { |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
1715 |
if (HandlePlacePushButton(w, button, SPR_CURSOR_INDUSTRY, 1, NULL)) |
0 | 1716 |
_industry_type_to_place = _industry_type_list[_opt.landscape][button - 4]; |
1717 |
} |
|
1718 |
break; |
|
1719 |
case WE_PLACE_OBJ: { |
|
1720 |
int type; |
|
1721 |
||
1722 |
// Show error if no town exists at all |
|
1723 |
type = _industry_type_to_place; |
|
1724 |
if (!AnyTownExists()) { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1725 |
SetDParam(0, type + STR_4802_COAL_MINE); |
0 | 1726 |
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST,STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y); |
1727 |
return; |
|
1728 |
} |
|
1729 |
||
1730 |
_current_player = OWNER_NONE; |
|
1731 |
_generating_world = true; |
|
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1732 |
_ignore_restrictions = true; |
0 | 1733 |
if (!TryBuildIndustry(e->place.tile,type)) { |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1734 |
SetDParam(0, type + STR_4802_COAL_MINE); |
0 | 1735 |
ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y); |
1736 |
} |
|
7
f2e623faa778
(svn r8) Fix: Automatic oil refinery generation in editor
dominik
parents:
2
diff
changeset
|
1737 |
_ignore_restrictions = false; |
0 | 1738 |
_generating_world = false; |
1739 |
break; |
|
1740 |
} |
|
1741 |
case WE_ABORT_PLACE_OBJ: |
|
1742 |
w->click_state = 0; |
|
1743 |
SetWindowDirty(w); |
|
1744 |
break; |
|
1745 |
case WE_TIMEOUT: |
|
1746 |
UnclickSomeWindowButtons(w, 1<<3); |
|
1747 |
break; |
|
1748 |
} |
|
1749 |
} |
|
1750 |
||
1751 |
static const WindowDesc _scenedit_industry_normal_desc = { |
|
1752 |
-1,-1, 170, 225, |
|
1753 |
WC_SCEN_INDUSTRY,0, |
|
1754 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1755 |
_scenedit_industry_normal_widgets, |
|
1756 |
ScenEditIndustryWndProc, |
|
1757 |
}; |
|
1758 |
||
1759 |
static const WindowDesc _scenedit_industry_hilly_desc = { |
|
1760 |
-1,-1, 170, 225, |
|
1761 |
WC_SCEN_INDUSTRY,0, |
|
1762 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1763 |
_scenedit_industry_hilly_widgets, |
|
1764 |
ScenEditIndustryWndProc, |
|
1765 |
}; |
|
1766 |
||
1767 |
static const WindowDesc _scenedit_industry_desert_desc = { |
|
1768 |
-1,-1, 170, 225, |
|
1769 |
WC_SCEN_INDUSTRY,0, |
|
1770 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1771 |
_scenedit_industry_desert_widgets, |
|
1772 |
ScenEditIndustryWndProc, |
|
1773 |
}; |
|
1774 |
||
1775 |
static const WindowDesc _scenedit_industry_candy_desc = { |
|
1776 |
-1,-1, 170, 225, |
|
1777 |
WC_SCEN_INDUSTRY,0, |
|
1778 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1779 |
_scenedit_industry_candy_widgets, |
|
1780 |
ScenEditIndustryWndProc, |
|
1781 |
}; |
|
1782 |
||
1783 |
static const WindowDesc * const _scenedit_industry_descs[] = { |
|
1784 |
&_scenedit_industry_normal_desc, |
|
1785 |
&_scenedit_industry_hilly_desc, |
|
1786 |
&_scenedit_industry_desert_desc, |
|
1787 |
&_scenedit_industry_candy_desc, |
|
1788 |
}; |
|
1789 |
||
1790 |
||
1791 |
static void ToolbarScenGenIndustry(Window *w) |
|
1792 |
{ |
|
1793 |
HandleButtonClick(w, 13); |
|
541 | 1794 |
SndPlayFx(SND_15_BEEP); |
0 | 1795 |
AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0); |
1796 |
} |
|
1797 |
||
1798 |
static void ToolbarScenBuildRoad(Window *w) |
|
1799 |
{ |
|
1800 |
HandleButtonClick(w, 14); |
|
541 | 1801 |
SndPlayFx(SND_15_BEEP); |
0 | 1802 |
ShowBuildRoadScenToolbar(); |
1803 |
} |
|
1804 |
||
1805 |
static void ToolbarScenPlantTrees(Window *w) |
|
1806 |
{ |
|
1807 |
HandleButtonClick(w, 15); |
|
541 | 1808 |
SndPlayFx(SND_15_BEEP); |
0 | 1809 |
ShowBuildTreesScenToolbar(); |
1810 |
} |
|
1811 |
||
1812 |
static void ToolbarScenPlaceSign(Window *w) |
|
1813 |
{ |
|
1814 |
HandleButtonClick(w, 16); |
|
541 | 1815 |
SndPlayFx(SND_15_BEEP); |
0 | 1816 |
SelectSignTool(); |
1817 |
} |
|
1818 |
||
1819 |
static void ToolbarBtn_NULL(Window *w) |
|
1820 |
{ |
|
1821 |
} |
|
1822 |
||
1823 |
static ToolbarButtonProc* const _toolbar_button_procs[] = { |
|
1824 |
ToolbarPauseClick, |
|
1825 |
ToolbarFastForwardClick, |
|
1826 |
ToolbarOptionsClick, |
|
1827 |
ToolbarSaveClick, |
|
1828 |
ToolbarMapClick, |
|
1829 |
ToolbarTownClick, |
|
1830 |
ToolbarSubsidiesClick, |
|
1831 |
ToolbarStationsClick, |
|
1832 |
ToolbarMoneyClick, |
|
1833 |
ToolbarPlayersClick, |
|
1834 |
ToolbarGraphsClick, |
|
1835 |
ToolbarLeagueClick, |
|
1836 |
ToolbarIndustryClick, |
|
1837 |
ToolbarTrainClick, |
|
1838 |
ToolbarRoadClick, |
|
1839 |
ToolbarShipClick, |
|
1840 |
ToolbarAirClick, |
|
1841 |
ToolbarZoomInClick, |
|
1842 |
ToolbarZoomOutClick, |
|
1843 |
ToolbarBuildRailClick, |
|
1844 |
ToolbarBuildRoadClick, |
|
1845 |
ToolbarBuildWaterClick, |
|
1846 |
ToolbarBuildAirClick, |
|
1847 |
ToolbarForestClick, |
|
1848 |
ToolbarMusicClick, |
|
1849 |
ToolbarNewspaperClick, |
|
1850 |
ToolbarHelpClick, |
|
1851 |
}; |
|
1852 |
||
1853 |
static void MainToolbarWndProc(Window *w, WindowEvent *e) |
|
1854 |
{ |
|
1855 |
switch(e->event) { |
|
1856 |
case WE_PAINT: { |
|
1857 |
||
1858 |
// Draw brown-red toolbar bg. |
|
1859 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
|
1860 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0x80B4); |
|
1861 |
||
1862 |
// if spectator, disable things |
|
1 | 1863 |
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
|
1864 |
w->disabled_state |= (1 << 19) | (1<<20) | (1<<21) | (1<<22) | (1<<23); |
0 | 1865 |
} else { |
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 |
} |
1868 |
||
1869 |
DrawWindowWidgets(w); |
|
1870 |
break; |
|
1871 |
} |
|
1872 |
||
1873 |
case WE_CLICK: { |
|
1874 |
if (_game_mode != GM_MENU && !HASBIT(w->disabled_state, e->click.widget)) |
|
1875 |
_toolbar_button_procs[e->click.widget](w); |
|
1876 |
} break; |
|
1877 |
||
1878 |
case WE_KEYPRESS: { |
|
1879 |
int local = _local_player; |
|
1880 |
if (local == 0xff) local = 0; // spectator |
|
1881 |
||
1882 |
switch(e->keypress.keycode) { |
|
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1883 |
case WKC_F1: case WKC_PAUSE: |
424
4c7808af7526
(svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron
parents:
410
diff
changeset
|
1884 |
ToolbarPauseClick(w); |
4c7808af7526
(svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron
parents:
410
diff
changeset
|
1885 |
break; |
0 | 1886 |
case WKC_F2: ShowGameOptions(); break; |
1887 |
case WKC_F3: MenuClickSaveLoad(0); break; |
|
1888 |
case WKC_F4: ShowSmallMap(); break; |
|
1889 |
case WKC_F5: ShowTownDirectory(); break; |
|
1890 |
case WKC_F6: ShowSubsidiesList(); break; |
|
1891 |
case WKC_F7: ShowPlayerStations(local); break; |
|
1892 |
case WKC_F8: ShowPlayerFinances(local); break; |
|
1893 |
case WKC_F9: ShowPlayerCompany(local); break; |
|
1894 |
case WKC_F10:ShowOperatingProfitGraph(); break; |
|
1895 |
case WKC_F11: ShowCompanyLeagueTable(); break; |
|
1896 |
case WKC_F12: ShowBuildIndustryWindow(); break; |
|
588 | 1897 |
case WKC_SHIFT | WKC_F1: ShowPlayerTrains(local, -1); break; |
1898 |
case WKC_SHIFT | WKC_F2: ShowPlayerRoadVehicles(local, -1); break; |
|
1899 |
case WKC_SHIFT | WKC_F3: ShowPlayerShips(local, -1); break; |
|
1900 |
case WKC_SHIFT | WKC_F4: ShowPlayerAircraft(local, -1); break; |
|
0 | 1901 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break; |
1902 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break; |
|
1903 |
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype,-1); break; |
|
1904 |
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(); break; |
|
1905 |
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; |
|
1906 |
case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break; |
|
1907 |
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; |
|
1908 |
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; |
|
1909 |
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
|
1910 |
case WKC_CTRL | 'G': _make_screenshot = 2; break; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1911 |
case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break; |
1636
eb2a69d8ba5c
(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
|
1912 |
case 'A': ShowBuildRailToolbar(_last_built_railtype, 4); break; /* Invoke Autorail */ |
eb2a69d8ba5c
(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 'L': ShowTerraformToolbar(); break; |
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1914 |
default: return; |
1637
5a51ba5fb8b7
(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
|
1915 |
} |
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
1916 |
e->keypress.cont = false; |
0 | 1917 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1918 |
|
0 | 1919 |
case WE_PLACE_OBJ: { |
1920 |
_place_proc(e->place.tile); |
|
1921 |
} break; |
|
1922 |
||
1923 |
case WE_ABORT_PLACE_OBJ: { |
|
1924 |
w->click_state &= ~(1<<25); |
|
1925 |
SetWindowDirty(w); |
|
1926 |
} break; |
|
1927 |
||
1928 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
|
1929 |
||
1930 |
case WE_MOUSELOOP: |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1931 |
|
0 | 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[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1950 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1951 |
{ WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_OPENTTD_BASE + 57, STR_FAST_FORWARD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1952 |
{ WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, 0x2EF, STR_0187_OPTIONS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1953 |
{ WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, 0x2D4, STR_0172_SAVE_GAME_ABANDON_GAME}, |
0 | 1954 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1955 |
{ WWT_PANEL, RESIZE_NONE, 14, 96, 117, 0, 21, 0x2C4, STR_0174_DISPLAY_MAP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1956 |
{ WWT_PANEL, RESIZE_NONE, 14, 118, 139, 0, 21, 0xFED, STR_0176_DISPLAY_TOWN_DIRECTORY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1957 |
{ WWT_PANEL, RESIZE_NONE, 14, 140, 161, 0, 21, 0x2A7, STR_02DC_DISPLAY_SUBSIDIES}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1958 |
{ WWT_PANEL, RESIZE_NONE, 14, 162, 183, 0, 21, 0x513, STR_0173_DISPLAY_LIST_OF_COMPANY}, |
0 | 1959 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1960 |
{ WWT_PANEL, RESIZE_NONE, 14, 191, 212, 0, 21, 0x2E1, STR_0177_DISPLAY_COMPANY_FINANCES}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1961 |
{ WWT_PANEL, RESIZE_NONE, 14, 213, 235, 0, 21, 0x2E7, STR_0178_DISPLAY_COMPANY_GENERAL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1962 |
{ WWT_PANEL, RESIZE_NONE, 14, 236, 257, 0, 21, 0x2E9, STR_0179_DISPLAY_GRAPHS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1963 |
{ WWT_PANEL, RESIZE_NONE, 14, 258, 279, 0, 21, 0x2AC, STR_017A_DISPLAY_COMPANY_LEAGUE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1964 |
{ WWT_PANEL, RESIZE_NONE, 14, 280, 301, 0, 21, 0x2E5, STR_0312_FUND_CONSTRUCTION_OF_NEW}, |
0 | 1965 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1966 |
{ WWT_PANEL, RESIZE_NONE, 14, 310, 331, 0, 21, 0x2DB, STR_017B_DISPLAY_LIST_OF_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1967 |
{ WWT_PANEL, RESIZE_NONE, 14, 332, 353, 0, 21, 0x2DC, STR_017C_DISPLAY_LIST_OF_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1968 |
{ WWT_PANEL, RESIZE_NONE, 14, 354, 375, 0, 21, 0x2DD, STR_017D_DISPLAY_LIST_OF_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1969 |
{ WWT_PANEL, RESIZE_NONE, 14, 376, 397, 0, 21, 0x2DE, STR_017E_DISPLAY_LIST_OF_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1970 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1971 |
{ WWT_PANEL, RESIZE_NONE, 14, 406, 427, 0, 21, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1972 |
{ WWT_PANEL, RESIZE_NONE, 14, 428, 449, 0, 21, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1973 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1974 |
{ WWT_PANEL, RESIZE_NONE, 14, 457, 478, 0, 21, 0x2D7, STR_0181_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1975 |
{ WWT_PANEL, RESIZE_NONE, 14, 479, 500, 0, 21, 0x2D8, STR_0182_BUILD_ROADS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1976 |
{ WWT_PANEL, RESIZE_NONE, 14, 501, 522, 0, 21, 0x2D9, STR_0183_BUILD_SHIP_DOCKS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1977 |
{ WWT_PANEL, RESIZE_NONE, 14, 523, 544, 0, 21, 0x2DA, STR_0184_BUILD_AIRPORTS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1978 |
{ WWT_PANEL, RESIZE_NONE, 14, 545, 566, 0, 21, 0xFF3, STR_LANDSCAPING_TOOLBAR_TIP}, // tree icon is 0x2E6 |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1979 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1980 |
{ WWT_PANEL, RESIZE_NONE, 14, 574, 595, 0, 21, 0x2C9, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1981 |
{ WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, 0x2A8, STR_0203_SHOW_LAST_MESSAGE_NEWS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
1982 |
{ WWT_PANEL, RESIZE_NONE, 14, 618, 639, 0, 21, 0x2D3, 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 |
static const WindowDesc _toolb_intro_desc = { |
|
1995 |
0, -22, 640, 22, |
|
1996 |
WC_MAIN_TOOLBAR,0, |
|
1997 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
|
1998 |
_toolb_normal_widgets, |
|
1999 |
MainToolbarWndProc |
|
2000 |
}; |
|
2001 |
||
2002 |
||
2003 |
static const Widget _toolb_scen_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2004 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2005 |
{ WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_OPENTTD_BASE + 57, STR_FAST_FORWARD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2006 |
{ WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, 0x2EF, STR_0187_OPTIONS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2007 |
{ WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, 0x2D4, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
2008 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2009 |
{ WWT_PANEL, RESIZE_NONE, 14, 96, 225, 0, 21, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
168
diff
changeset
|
2010 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2011 |
{ WWT_PANEL, RESIZE_NONE, 14, 233, 362, 0, 21, 0x0, STR_NULL}, |
1657
eb57fee328fb
(svn r2161) - Fix: When resizing a window, the button is also visibly depressed
Darkvater
parents:
1639
diff
changeset
|
2012 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 236, 247, 5, 16, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
eb57fee328fb
(svn r2161) - Fix: When resizing a window, the button is also visibly depressed
Darkvater
parents:
1639
diff
changeset
|
2013 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 347, 358, 5, 16, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2014 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2015 |
{ WWT_PANEL, RESIZE_NONE, 14, 371, 392, 0, 21, 0x2C4, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2016 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2017 |
{ WWT_PANEL, RESIZE_NONE, 14, 400, 421, 0, 21, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2018 |
{ WWT_PANEL, RESIZE_NONE, 14, 422, 443, 0, 21, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2019 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2020 |
{ WWT_PANEL, RESIZE_NONE, 14, 452, 473, 0, 21, 0xFF3, STR_022E_LANDSCAPE_GENERATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2021 |
{ WWT_PANEL, RESIZE_NONE, 14, 474, 495, 0, 21, 0xFED, STR_022F_TOWN_GENERATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2022 |
{ WWT_PANEL, RESIZE_NONE, 14, 496, 517, 0, 21, 0x2E5, STR_0230_INDUSTRY_GENERATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2023 |
{ WWT_PANEL, RESIZE_NONE, 14, 518, 539, 0, 21, 0x2D8, STR_0231_ROAD_CONSTRUCTION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2024 |
{ WWT_PANEL, RESIZE_NONE, 14, 540, 561, 0, 21, 0x2E6, STR_0288_PLANT_TREES}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2025 |
{ WWT_PANEL, RESIZE_NONE, 14, 562, 583, 0, 21, 0xFF2, STR_0289_PLACE_SIGN}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2026 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2027 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2028 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2029 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2030 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2031 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2032 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2033 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2034 |
{ WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, 0x2C9, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2035 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2036 |
{ WWT_PANEL, RESIZE_NONE, 14, 618, 639, 0, 21, 0x2D3, 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
|
2037 |
{ WIDGETS_END}, |
0 | 2038 |
}; |
2039 |
||
2040 |
static ToolbarButtonProc* const _scen_toolbar_button_procs[] = { |
|
2041 |
ToolbarPauseClick, |
|
2042 |
ToolbarFastForwardClick, |
|
2043 |
ToolbarOptionsClick, |
|
2044 |
ToolbarScenSaveOrLoad, |
|
2045 |
ToolbarBtn_NULL, |
|
2046 |
ToolbarBtn_NULL, |
|
2047 |
ToolbarScenDateBackward, |
|
2048 |
ToolbarScenDateForward, |
|
2049 |
ToolbarScenMapTownDir, |
|
2050 |
ToolbarScenZoomIn, |
|
2051 |
ToolbarScenZoomOut, |
|
2052 |
ToolbarScenGenLand, |
|
2053 |
ToolbarScenGenTown, |
|
2054 |
ToolbarScenGenIndustry, |
|
2055 |
ToolbarScenBuildRoad, |
|
2056 |
ToolbarScenPlantTrees, |
|
2057 |
ToolbarScenPlaceSign, |
|
2058 |
NULL, |
|
2059 |
NULL, |
|
2060 |
NULL, |
|
2061 |
NULL, |
|
2062 |
NULL, |
|
2063 |
NULL, |
|
2064 |
NULL, |
|
2065 |
ToolbarMusicClick, |
|
2066 |
NULL, |
|
2067 |
ToolbarHelpClick, |
|
2068 |
}; |
|
2069 |
||
2070 |
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) |
|
2071 |
{ |
|
2072 |
switch(e->event) { |
|
2073 |
case WE_PAINT: |
|
349
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2074 |
/* XXX look for better place for these */ |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2075 |
if (_date <= MinDate) |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2076 |
SETBIT(w->disabled_state, 6); |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2077 |
else |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2078 |
CLRBIT(w->disabled_state, 6); |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2079 |
if (_date >= MaxDate) |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2080 |
SETBIT(w->disabled_state, 7); |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2081 |
else |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2082 |
CLRBIT(w->disabled_state, 7); |
47cdc8ab9cf7
(svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron
parents:
337
diff
changeset
|
2083 |
|
0 | 2084 |
// Draw brown-red toolbar bg. |
2085 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2); |
|
2086 |
GfxFillRect(0, 0, w->width-1, w->height-1, 0x80B4); |
|
2087 |
||
2088 |
DrawWindowWidgets(w); |
|
2089 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2090 |
SetDParam(0, _date); |
0 | 2091 |
DrawStringCentered(298, 6, STR_00AF, 0); |
2092 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2093 |
SetDParam(0, _date); |
74
d23a80ef6361
(svn r75) -Add proper crediting to graphics artists to about box.
darkvater
parents:
68
diff
changeset
|
2094 |
DrawStringCentered(161, 1, STR_0221_OPENTTD, 0); |
0 | 2095 |
DrawStringCentered(161, 11,STR_0222_SCENARIO_EDITOR, 0); |
2096 |
||
2097 |
break; |
|
2098 |
||
2099 |
case WE_CLICK: { |
|
2100 |
if (_game_mode == GM_MENU) |
|
2101 |
return; |
|
2102 |
_scen_toolbar_button_procs[e->click.widget](w); |
|
2103 |
} break; |
|
2104 |
||
2105 |
case WE_KEYPRESS: { |
|
1636
eb2a69d8ba5c
(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
|
2106 |
switch (e->keypress.keycode) { |
0 | 2107 |
case WKC_F1: ToolbarPauseClick(w); break; |
2108 |
case WKC_F2: ShowGameOptions(); break; |
|
2109 |
case WKC_F3: MenuClickSaveLoad(0); break; |
|
2110 |
case WKC_F4: ToolbarScenGenLand(w); break; |
|
2111 |
case WKC_F5: ToolbarScenGenTown(w); break; |
|
2112 |
case WKC_F6: ToolbarScenGenIndustry(w); break; |
|
2113 |
case WKC_F7: ToolbarScenBuildRoad(w); break; |
|
2114 |
case WKC_F8: ToolbarScenPlantTrees(w); break; |
|
2115 |
case WKC_F9: ToolbarScenPlaceSign(w); break; |
|
2116 |
case WKC_F10: ShowMusicWindow(); break; |
|
2117 |
case WKC_F11: PlaceLandBlockInfo(); break; |
|
2118 |
case WKC_CTRL | 'S': _make_screenshot = 1; break; |
|
2119 |
case WKC_CTRL | 'G': _make_screenshot = 2; break; |
|
1636
eb2a69d8ba5c
(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
|
2120 |
case 'L': ShowEditorTerraformToolBar(); break; |
eb2a69d8ba5c
(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
|
2121 |
} break; |
eb2a69d8ba5c
(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
|
2122 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2123 |
|
0 | 2124 |
case WE_PLACE_OBJ: { |
2125 |
_place_proc(e->place.tile); |
|
2126 |
} break; |
|
2127 |
||
2128 |
case WE_ABORT_PLACE_OBJ: { |
|
2129 |
w->click_state &= ~(1<<25); |
|
2130 |
SetWindowDirty(w); |
|
2131 |
} break; |
|
2132 |
||
2133 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
|
2134 |
||
2135 |
case WE_MOUSELOOP: |
|
24 | 2136 |
if (((w->click_state) & 1) != (uint)!!_pause) { |
2137 |
w->click_state ^= (1 << 0); |
|
2138 |
SetWindowDirty(w); |
|
2139 |
} |
|
2140 |
||
0 | 2141 |
if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) { |
2142 |
w->click_state ^= (1 << 1); |
|
2143 |
SetWindowDirty(w); |
|
2144 |
} |
|
2145 |
break; |
|
2146 |
||
2147 |
} |
|
2148 |
} |
|
2149 |
||
2150 |
static const WindowDesc _toolb_scen_desc = { |
|
2151 |
0, 0, 640, 22, |
|
2152 |
WC_MAIN_TOOLBAR,0, |
|
2153 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
2154 |
_toolb_scen_widgets, |
|
2155 |
ScenEditToolbarWndProc |
|
2156 |
}; |
|
2157 |
||
2158 |
extern GetNewsStringCallbackProc * const _get_news_string_callback[]; |
|
2159 |
||
2160 |
||
2161 |
static bool DrawScrollingStatusText(NewsItem *ni, int pos) |
|
2162 |
{ |
|
1336
c9e6b766bf21
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2163 |
char buf[512]; |
0 | 2164 |
StringID str; |
1329 | 2165 |
const char *s; |
2166 |
char *d; |
|
0 | 2167 |
DrawPixelInfo tmp_dpi, *old_dpi; |
2168 |
int x; |
|
1329 | 2169 |
char buffer[256]; |
0 | 2170 |
|
2171 |
if (ni->display_mode == 3) { |
|
2172 |
str = _get_news_string_callback[ni->callback](ni); |
|
2173 |
} else { |
|
2174 |
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
|
2175 |
str = ni->string_id; |
0 | 2176 |
} |
2177 |
||
1336
c9e6b766bf21
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2178 |
GetString(buf, str); |
0 | 2179 |
|
1336
c9e6b766bf21
(svn r1840) Repel str_buffr and use local buffers where possible
tron
parents:
1329
diff
changeset
|
2180 |
s = buf; |
0 | 2181 |
d = buffer; |
2182 |
||
2183 |
for(;;s++) { |
|
2184 |
if (*s == 0) { |
|
2185 |
*d = 0; |
|
2186 |
break; |
|
2187 |
} else if (*s == 0x0D) { |
|
2188 |
d[0] = d[1] = d[2] = d[3] = ' '; |
|
2189 |
d+=4; |
|
1329 | 2190 |
} else if ((byte)*s >= ' ' && ((byte)*s < 0x88 || (byte)*s >= 0x99)) { |
0 | 2191 |
*d++ = *s; |
2192 |
} |
|
2193 |
} |
|
2194 |
||
2195 |
if (!FillDrawPixelInfo(&tmp_dpi, NULL, 141, 1, 358, 11)) |
|
2196 |
return true; |
|
2197 |
||
2198 |
old_dpi = _cur_dpi; |
|
2199 |
_cur_dpi = &tmp_dpi; |
|
2200 |
||
2201 |
x = DoDrawString(buffer, pos, 0, 13); |
|
2202 |
_cur_dpi = old_dpi; |
|
2203 |
||
2204 |
return x > 0; |
|
2205 |
} |
|
2206 |
||
410 | 2207 |
static void StatusBarWndProc(Window *w, WindowEvent *e) |
0 | 2208 |
{ |
1885
4ce583a5275b
(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
|
2209 |
switch (e->event) { |
4ce583a5275b
(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
|
2210 |
case WE_PAINT: { |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
2211 |
const Player *p = (_local_player == OWNER_SPECTATOR) ? NULL : GetPlayer(_local_player); |
1885
4ce583a5275b
(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
|
2212 |
|
0 | 2213 |
DrawWindowWidgets(w); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2214 |
SetDParam(0, _date); |
0 | 2215 |
DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2216 |
|
1885
4ce583a5275b
(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
|
2217 |
if (p != NULL) { |
0 | 2218 |
// Draw player money |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2219 |
SetDParam64(0, p->money64); |
0 | 2220 |
DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0); |
2221 |
} |
|
2222 |
||
2223 |
// Draw status bar |
|
1885
4ce583a5275b
(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
|
2224 |
if (w->message.msg) { // true when saving is active |
4ce583a5275b
(svn r2391) - Feature: saving games happen in a seperate thread so you no longer will have to wait such a long time (especially handy on bigger maps and multiplayer games). The mouse also changes into the 'ZZZ' state :P. The thread on windows is currently given a little-bit-less-than-normal priority so it should not interfere that much with the gameplay; it will take a bit longer though. Upon the exit of the game any pending saves are waited upon.
Darkvater
parents:
1820
diff
changeset
|
2225 |
DrawStringCentered(320, 1, STR_SAVING_GAME, 0); |
4ce583a5275b
(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
|
2226 |
} else if (_do_autosave) { |
0 | 2227 |
DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0); |
2228 |
} else if (_pause) { |
|
2229 |
DrawStringCentered(320, 1, STR_0319_PAUSED, 0); |
|
2230 |
} else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) { |
|
2231 |
// Draw the scrolling news text |
|
2232 |
if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1)) |
|
2233 |
WP(w,def_d).data_1 = -1280; |
|
2234 |
} else { |
|
2235 |
if (p) { |
|
2236 |
// This is the default text |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2237 |
SetDParam(0, p->name_1); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
2238 |
SetDParam(1, p->name_2); |
0 | 2239 |
DrawStringCentered(320, 1, STR_02BA, 0); |
2240 |
} |
|
2241 |
} |
|
1688
787400219027
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1657
diff
changeset
|
2242 |
|
1885
4ce583a5275b
(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
|
2243 |
if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT | PALETTE_TO_RED, 489, 2); |
4ce583a5275b
(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
|
2244 |
} break; |
4ce583a5275b
(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
|
2245 |
|
4ce583a5275b
(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 |
case WE_MESSAGE: |
4ce583a5275b
(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 |
w->message.msg = e->message.msg; |
4ce583a5275b
(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 |
SetWindowDirty(w); |
0 | 2249 |
break; |
2250 |
||
2251 |
case WE_CLICK: |
|
1885
4ce583a5275b
(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
|
2252 |
switch (e->click.widget) { |
4ce583a5275b
(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
|
2253 |
case 1: ShowLastNewsMessage(); break; |
4ce583a5275b
(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
|
2254 |
case 2: if (_local_player != OWNER_SPECTATOR) ShowPlayerFinances(_local_player); break; |
4ce583a5275b
(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
|
2255 |
default: ResetObjectToPlace(); |
0 | 2256 |
} |
2257 |
break; |
|
2258 |
||
2259 |
case WE_TICK: { |
|
1688
787400219027
(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 |
if (_pause) return; |
787400219027
(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 |
|
787400219027
(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 |
if (WP(w, def_d).data_1 > -1280) { /* Scrolling text */ |
787400219027
(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 |
WP(w, def_d).data_1 -= 2; |
787400219027
(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 |
InvalidateWidget(w, 1); |
787400219027
(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 |
} |
787400219027
(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 |
|
787400219027
(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 |
if (WP(w, def_d).data_2 > 0) { /* Red blot to show there are new unread newsmessages */ |
787400219027
(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
|
2268 |
WP(w, def_d).data_2 -= 2; |
787400219027
(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
|
2269 |
} else if (WP(w, def_d).data_2 < 0) { |
787400219027
(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
|
2270 |
WP(w, def_d).data_2 = 0; |
787400219027
(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
|
2271 |
InvalidateWidget(w, 1); |
787400219027
(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
|
2272 |
} |
787400219027
(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
|
2273 |
|
0 | 2274 |
break; |
2275 |
} |
|
2276 |
} |
|
2277 |
} |
|
2278 |
||
2279 |
static const Widget _main_status_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2280 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 139, 0, 11, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2281 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 140, 499, 0, 11, 0x0, STR_02B7_SHOW_LAST_MESSAGE_OR_NEWS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
815
diff
changeset
|
2282 |
{ 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
|
2283 |
{ WIDGETS_END}, |
0 | 2284 |
}; |
2285 |
||
2286 |
static WindowDesc _main_status_desc = { |
|
2287 |
WDP_CENTER, 0, 640, 12, |
|
2288 |
WC_STATUS_BAR,0, |
|
2289 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
2290 |
_main_status_widgets, |
|
2291 |
StatusBarWndProc |
|
2292 |
}; |
|
2293 |
||
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2294 |
extern void UpdateAllStationVirtCoord(void); |
0 | 2295 |
|
2296 |
static void MainWindowWndProc(Window *w, WindowEvent *e) { |
|
2297 |
int off_x; |
|
2298 |
||
2299 |
switch(e->event) { |
|
2300 |
case WE_PAINT: |
|
2301 |
DrawWindowViewport(w); |
|
2302 |
if (_game_mode == GM_MENU) { |
|
581
ee767b9671a7
(svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater
parents:
545
diff
changeset
|
2303 |
off_x = _screen.width / 2; |
0 | 2304 |
|
582
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2305 |
DrawSprite(SPR_OTTD_O, off_x - 120, 50); |
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2306 |
DrawSprite(SPR_OTTD_P, off_x - 86, 50); |
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2307 |
DrawSprite(SPR_OTTD_E, off_x - 53, 50); |
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2308 |
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
|
2309 |
|
582
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2310 |
DrawSprite(SPR_OTTD_T, off_x + 34, 50); |
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2311 |
DrawSprite(SPR_OTTD_T, off_x + 65, 50); |
cc1bd1362c6c
(svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater
parents:
581
diff
changeset
|
2312 |
DrawSprite(SPR_OTTD_D, off_x + 96, 50); |
670
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2313 |
|
581
ee767b9671a7
(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 |
/* |
ee767b9671a7
(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 + 119, 50); |
ee767b9671a7
(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_A, off_x + 148, 50); |
ee767b9671a7
(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 |
DrawSprite(SPR_OTTD_N, off_x + 181, 50); |
ee767b9671a7
(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_S, off_x + 215, 50); |
ee767b9671a7
(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_P, off_x + 246, 50); |
ee767b9671a7
(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_O, off_x + 275, 50); |
ee767b9671a7
(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_R, off_x + 307, 50); |
ee767b9671a7
(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_T, off_x + 337, 50); |
ee767b9671a7
(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 |
|
ee767b9671a7
(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 |
DrawSprite(SPR_OTTD_T, off_x + 390, 50); |
ee767b9671a7
(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
|
2325 |
DrawSprite(SPR_OTTD_Y, off_x + 417, 50); |
ee767b9671a7
(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
|
2326 |
DrawSprite(SPR_OTTD_C, off_x + 447, 50); |
ee767b9671a7
(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
|
2327 |
DrawSprite(SPR_OTTD_O, off_x + 478, 50); |
ee767b9671a7
(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
|
2328 |
DrawSprite(SPR_OTTD_O, off_x + 509, 50); |
ee767b9671a7
(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
|
2329 |
DrawSprite(SPR_OTTD_N, off_x + 541, 50); |
ee767b9671a7
(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
|
2330 |
*/ |
0 | 2331 |
} |
2332 |
break; |
|
2333 |
||
2334 |
case WE_KEYPRESS: |
|
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2335 |
if (e->keypress.keycode == WKC_BACKQUOTE) { |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2336 |
IConsoleSwitch(); |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2337 |
e->keypress.cont = false; |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2338 |
break; |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2339 |
} |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2340 |
|
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2341 |
if (_game_mode == GM_MENU) break; |
0 | 2342 |
|
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2343 |
switch (e->keypress.keycode) { |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2344 |
case 'C': case 'Z': { |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
2345 |
Point pt = GetTileBelowCursor(); |
0 | 2346 |
if (pt.x != -1) { |
2347 |
ScrollMainWindowTo(pt.x, pt.y); |
|
2348 |
if (e->keypress.keycode == 'Z') |
|
2349 |
MaxZoomIn(); |
|
2350 |
} |
|
2351 |
break; |
|
2352 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2353 |
|
0 | 2354 |
case WKC_ESC: ResetObjectToPlace(); break; |
2355 |
case WKC_DELETE: DeleteNonVitalWindows(); break; |
|
763
8ff348acf75e
(svn r1225) -Feature: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
darkvater
parents:
758
diff
changeset
|
2356 |
case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break; |
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2357 |
case 'Q' | WKC_CTRL: case 'Q' | WKC_META: AskExitGame(); break; // this enables command + Q on mac |
0 | 2358 |
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break; |
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2359 |
#if defined(_DEBUG) |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2360 |
case '0' | WKC_ALT: /* Crash the game */ |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2361 |
*(byte*)0 = 0; |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2362 |
break; |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2363 |
case '1' | WKC_ALT: /* Gimme money */ |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2364 |
/* Server can not cheat in advertise mode either! */ |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2365 |
#ifdef ENABLE_NETWORK |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2366 |
if (!_networking || !_network_server || !_network_advertise) |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2367 |
#endif |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2368 |
DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT); |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2369 |
break; |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2370 |
case '2' | WKC_ALT: /* Update the coordinates of all station signs */ |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2371 |
UpdateAllStationVirtCoord(); |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2372 |
break; |
0 | 2373 |
case '3' | WKC_ALT: |
2374 |
case '4' | WKC_ALT: |
|
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2375 |
break; |
0 | 2376 |
#endif |
2377 |
||
2378 |
case 'X': |
|
2379 |
_display_opt ^= DO_TRANS_BUILDINGS; |
|
2380 |
MarkWholeScreenDirty(); |
|
2381 |
break; |
|
2382 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
2383 |
#ifdef ENABLE_NETWORK |
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2384 |
case WKC_RETURN: case 'T' | WKC_SHIFT: |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2385 |
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
2386 |
break; |
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2387 |
#endif |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2388 |
|
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
2389 |
default: return; |
0 | 2390 |
} |
2391 |
e->keypress.cont = false; |
|
2392 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
2393 |
|
0 | 2394 |
} |
2395 |
} |
|
2396 |
||
2397 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
2398 |
void ShowSelectGameWindow(void); |
774
258c11431acb
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
763
diff
changeset
|
2399 |
extern void ShowJoinStatusWindowAfterJoin(void); |
0 | 2400 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
2401 |
void SetupColorsAndInitialWindow(void) |
0 | 2402 |
{ |
2403 |
int i; |
|
2404 |
Window *w; |
|
2405 |
int width,height; |
|
2406 |
||
2407 |
for(i=0; i!=16; i++) { |
|
1357 | 2408 |
const byte* b = GetNonSprite(0x307 + i); |
2409 |
||
0 | 2410 |
assert(b); |
2411 |
_color_list[i] = *(ColorList*)(b + 0xC6); |
|
2412 |
} |
|
2413 |
||
2414 |
width = _screen.width; |
|
2415 |
height = _screen.height; |
|
2416 |
||
2417 |
// XXX: these are not done |
|
2418 |
switch(_game_mode) { |
|
2419 |
case GM_MENU: |
|
1637
5a51ba5fb8b7
(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
|
2420 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
1981 | 2421 |
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), 0); |
0 | 2422 |
// w = AllocateWindowDesc(&_toolb_intro_desc); |
2423 |
// w->flags4 &= ~WF_WHITE_BORDER_MASK; |
|
2424 |
ShowSelectGameWindow(); |
|
2425 |
break; |
|
2426 |
case GM_NORMAL: |
|
1637
5a51ba5fb8b7
(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
|
2427 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
1981 | 2428 |
AssignWindowViewport(w, 0, 0, width, height, TileXY(32, 32), 0); |
0 | 2429 |
|
983
1be852dcdd4c
(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
|
2430 |
ShowVitalWindows(); |
0 | 2431 |
|
670
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2432 |
/* Bring joining GUI to front till the client is really joined */ |
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2433 |
if (_networking && !_network_server) |
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2434 |
ShowJoinStatusWindowAfterJoin(); |
7c58dc46609c
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
658
diff
changeset
|
2435 |
|
0 | 2436 |
break; |
2437 |
case GM_EDITOR: |
|
1637
5a51ba5fb8b7
(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
|
2438 |
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
0 | 2439 |
AssignWindowViewport(w, 0, 0, width, height, 0, 0); |
2440 |
||
2441 |
w = AllocateWindowDesc(&_toolb_scen_desc); |
|
2442 |
w->disabled_state = 1 << 9; |
|
983
1be852dcdd4c
(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
|
2443 |
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
|
2444 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
24
diff
changeset
|
2445 |
PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_scen_desc) |
0 | 2446 |
break; |
2447 |
default: |
|
2448 |
NOT_REACHED(); |
|
2449 |
} |
|
2450 |
} |
|
2451 |
||
983
1be852dcdd4c
(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 |
void ShowVitalWindows(void) |
1be852dcdd4c
(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 |
{ |
1be852dcdd4c
(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 |
Window *w; |
1be852dcdd4c
(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 |
|
1be852dcdd4c
(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 |
w = AllocateWindowDesc(&_toolb_normal_desc); |
1be852dcdd4c
(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 |
w->disabled_state = 1 << 17; // disable zoom-in button (by default game is zoomed in) |
1be852dcdd4c
(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 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
1be852dcdd4c
(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 |
|
1be852dcdd4c
(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 |
if (_networking) { // if networking, disable fast-forward button |
1be852dcdd4c
(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 |
SETBIT(w->disabled_state, 1); |
1be852dcdd4c
(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
|
2462 |
if (!_network_server) // if not server, disable pause button |
1be852dcdd4c
(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 |
SETBIT(w->disabled_state, 0); |
1be852dcdd4c
(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 |
} |
1019
6363b8a4273e
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1015
diff
changeset
|
2465 |
|
983
1be852dcdd4c
(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 |
PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_desc) |
1be852dcdd4c
(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 |
|
1be852dcdd4c
(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 |
_main_status_desc.top = _screen.height - 12; |
1be852dcdd4c
(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 |
w = AllocateWindowDesc(&_main_status_desc); |
1be852dcdd4c
(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 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
1be852dcdd4c
(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 |
|
1be852dcdd4c
(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
|
2472 |
WP(w,def_d).data_1 = -1280; |
1be852dcdd4c
(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
|
2473 |
} |
1be852dcdd4c
(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
|
2474 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1070
diff
changeset
|
2475 |
void GameSizeChanged(void) |
0 | 2476 |
{ |
2477 |
RelocateAllWindows(_screen.width, _screen.height); |
|
2478 |
ScreenSizeChanged(); |
|
2479 |
MarkWholeScreenDirty(); |
|
2480 |
} |