annotate main_gui.c @ 1058:26e926ec95fd draft

(svn r1559) Use IsTileType() instead of bit shifting and comparisons
author tron <tron@openttd.org>
date Tue, 18 Jan 2005 17:19:34 +0000
parents 929116a0af28
children 87bf1ca25049
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1 #include "stdafx.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2 #include "ttd.h"
507
9dcc34b8887e (svn r815) Include strings.h only in the files which need it.
tron <tron@openttd.org>
parents: 497
diff changeset
3 #include "table/strings.h"
679
21e658645b32 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron <tron@openttd.org>
parents: 670
diff changeset
4 #include "map.h"
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
5 #include "window.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
6 #include "gui.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
7 #include "viewport.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
8 #include "gfx.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
9 #include "player.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
10 #include "command.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
11 #include "news.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
12 #include "town.h"
130
c0c8c367b619 (svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik <dominik@openttd.org>
parents: 126
diff changeset
13 #include "vehicle.h"
126
127be480312c (svn r127) New feature: ingame console. (sign_de)
dominik <dominik@openttd.org>
parents: 116
diff changeset
14 #include "console.h"
337
c88b35750799 (svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron <tron@openttd.org>
parents: 222
diff changeset
15 #include "sound.h"
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
16 #include "network.h"
988
fa15528bb00a (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight <truelight@openttd.org>
parents: 983
diff changeset
17 #include "signs.h"
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
18
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
19 #ifdef ENABLE_NETWORK
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
20 #include "network_data.h"
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
21 #include "network_client.h"
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
22 #include "network_server.h"
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
23 #endif /* ENABLE_NETWORK */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
24
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
25 #include "table/animcursors.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
26
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
27
349
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
28 /* Min/Max date for scenario editor */
970
66a15eb5cdba (svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater <darkvater@openttd.org>
parents: 926
diff changeset
29 static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL)
349
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
30 static const uint MaxDate = 29220; // 2000-01-01
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
31
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
32 extern void DoTestSave();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
33 extern void DoTestLoad();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
34
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
35 extern bool disable_computer;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
36
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
37 static int _rename_id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
38 static int _rename_what;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
39
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
40 static byte _terraform_size = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
41 static byte _last_built_railtype;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
42 extern void GenerateWorld(int mode);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
43
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
44 extern void GenerateIndustries();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
45 extern void GenerateTowns();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
46
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
47 extern uint GetCurrentCurrencyRate();
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
48
545
94bdf1cb4f85 (svn r945) -Fix: [Network] Terraform callback went wrong in merge
truelight <truelight@openttd.org>
parents: 543
diff changeset
49 extern void CcTerraform(bool success, uint tile, uint32 p1, uint32 p2);
94bdf1cb4f85 (svn r945) -Fix: [Network] Terraform callback went wrong in merge
truelight <truelight@openttd.org>
parents: 543
diff changeset
50
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
51 void HandleOnEditTextCancel() {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
52 switch(_rename_what) {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
53 #ifdef ENABLE_NETWORK
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
54 case 4:
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
55 NetworkDisconnect();
611
7320292d0fcb (svn r1035) Fix: Added a line that I accidentally deleted in r1033
dominik <dominik@openttd.org>
parents: 609
diff changeset
56 ShowNetworkGameWindow();
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
57 break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
58 #endif /* ENABLE_NETWORK */
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
59 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
60 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
61
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
62 void HandleOnEditText(WindowEvent *e) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
63 byte *b = e->edittext.str;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
64 int id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
65 memcpy(_decode_parameters, b, 32);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
66
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
67 id = _rename_id;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
68
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
69 switch(_rename_what) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
70 case 0:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
71 // for empty string send "remove sign" parameter
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
72 DoCommandP(0, id, (*b==0)?1:0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
73 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
74 case 1:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
75 if(*b == 0)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
76 return;
395
9566850ffa0d (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 <darkvater@openttd.org>
parents: 355
diff changeset
77 DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
78 break;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
79 #ifdef ENABLE_NETWORK
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
80 case 2:
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
81 // Speak to..
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
82 if (!_network_server)
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
83 SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
84 else
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
85 NetworkServer_HandleChat(NETWORK_ACTION_CHAT + (id & 0xFF), id & 0xFF, (id >> 8) & 0xFF, e->edittext.str, NETWORK_SERVER_INDEX);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
86 break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
87 case 3: {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
88 // Give money
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
89 int32 money = atoi(e->edittext.str) / GetCurrentCurrencyRate();
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
90 char msg[100];
813
4a5849c93d70 (svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight <truelight@openttd.org>
parents: 793
diff changeset
91
815
0cec7ac6bc1a (svn r1286) -Fix: oeps, I clamp'd some numbers wrong :$
truelight <truelight@openttd.org>
parents: 813
diff changeset
92 money = clamp(money, 0, 0xFFFFFF); // Clamp between 16 million and 0
813
4a5849c93d70 (svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight <truelight@openttd.org>
parents: 793
diff changeset
93
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
94 // Give 'id' the money, and substract it from ourself
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
95 if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY)) break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
96
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
97 // Inform the player of this action
722
602699d8d71d (svn r1174) -Fix: [Network] All strings can now be translated (no more hardcoded strings)
truelight <truelight@openttd.org>
parents: 697
diff changeset
98 snprintf(msg, 100, "%d", money);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
99
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
100 if (!_network_server)
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
101 SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
102 else
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
103 NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_PLAYER, id + 1, msg, NETWORK_SERVER_INDEX);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
104 break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
105 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
106 case 4: {// Game-Password and Company-Password
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
107 SEND_COMMAND(PACKET_CLIENT_PASSWORD)(id, e->edittext.str);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
108 break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
109 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
110 #endif /* ENABLE_NETWORK */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
111 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
112 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
113
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
114 // this code is shared for the majority of the pushbuttons
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
115 bool HandlePlacePushButton(Window *w, int widget, uint32 cursor, int mode, PlaceProc *placeproc)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
116 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
117 uint32 mask = 1 << widget;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
118
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
119 if (w->disabled_state & mask)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
120 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
121
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
122 if (!_no_button_sound) SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
123 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
124
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
125 if (w->click_state & mask) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
126 ResetObjectToPlace();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
127 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
128 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
129
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
130 SetObjectToPlace(cursor, mode, w->window_class, w->window_number);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
131 w->click_state |= mask;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
132 _place_proc = placeproc;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
133 return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
134 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
135
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
136
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
137 void CcPlaySound10(bool success, uint tile, uint32 p1, uint32 p2)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
138 {
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
139 if (success) SndPlayTileFx(SND_12_EXPLOSION, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
140 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
141
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
142
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
143 typedef void ToolbarButtonProc(Window *w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
144
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
145 static void ToolbarPauseClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
146 {
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
147 if (_networking && !_network_server) { return;} // only server can pause the game
213
be54ec0c899d (svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater <darkvater@openttd.org>
parents: 206
diff changeset
148
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
149 if (DoCommandP(0, _pause?0:1, 0, NULL, CMD_PAUSE))
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
150 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
151 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
152
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
153 static void ToolbarFastForwardClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
154 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
155 _fast_forward ^= true;
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
156 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
157 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
158
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
159 typedef void MenuClickedProc(int index);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
160
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
161
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
162 static void MenuClickSettings(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
163 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
164 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
165 case 0: ShowGameOptions(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
166 case 1: ShowGameDifficulty(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
167 case 2: ShowPatchesSelection(); return;
478
1bc3826617ac (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 <dominik@openttd.org>
parents: 424
diff changeset
168 case 3: ShowNewgrf(); return;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
169
1015
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
170 case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
171 case 6: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
172 case 7: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
173 case 8: _display_opt ^= DO_WAYPOINTS; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
174 case 9: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
175 case 10: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
176 case 11: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
177 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
178 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
179
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
180 static void MenuClickSaveLoad(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
181 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
182 if (_game_mode == GM_EDITOR) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
183 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
184 case 0:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
185 ShowSaveLoadDialog(SLD_SAVE_SCENARIO);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
186 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
187 case 1:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
188 ShowSaveLoadDialog(SLD_LOAD_SCENARIO);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
189 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
190 case 2:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
191 AskExitToGameMenu();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
192 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
193 case 4:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
194 AskExitGame();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
195 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
196 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
197 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
198 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
199 case 0:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
200 ShowSaveLoadDialog(SLD_SAVE_GAME);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
201 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
202 case 1:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
203 ShowSaveLoadDialog(SLD_LOAD_GAME);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
204 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
205 case 2:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
206 AskExitToGameMenu();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
207 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
208 case 3:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
209 AskExitGame();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
210 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
211 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
212 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
213 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
214
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
215 static void MenuClickMap(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
216 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
217 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
218 case 0: ShowSmallMap(); break;
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
219 case 1: ShowExtraViewPortWindow(); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
220 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
221 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
222
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
223 static void MenuClickTown(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
224 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
225 ShowTownDirectory();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
226 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
227
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
228 static void MenuClickScenMap(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
229 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
230 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
231 case 0: ShowSmallMap(); break;
355
f8405a30ffa6 (svn r543) -Fix: [ 1064742 ] Editor Map-Menu wrong String
tron <tron@openttd.org>
parents: 349
diff changeset
232 case 1: ShowExtraViewPortWindow(); break;
f8405a30ffa6 (svn r543) -Fix: [ 1064742 ] Editor Map-Menu wrong String
tron <tron@openttd.org>
parents: 349
diff changeset
233 case 2: ShowTownDirectory(); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
234 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
235 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
236
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
237 static void MenuClickSubsidies(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
238 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
239 ShowSubsidiesList();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
240 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
241
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
242 static void MenuClickStations(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
243 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
244 ShowPlayerStations(index);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
245 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
246
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
247 static void MenuClickFinances(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
248 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
249 ShowPlayerFinances(index);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
250 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
251
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
252 #ifdef ENABLE_NETWORK
1003
858375d344b6 (svn r1502) -Fix: [1101889] Crash under windows... stupid typo in player_gui.c ^ should've been &
darkvater <darkvater@openttd.org>
parents: 999
diff changeset
253 extern void ShowClientList(void);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
254 #endif /* ENABLE_NETWORK */
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
255
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
256 static void MenuClickCompany(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
257 {
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
258 if (_networking && index == 0) {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
259 #ifdef ENABLE_NETWORK
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
260 ShowClientList();
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
261 #endif /* ENABLE_NETWORK */
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
262 } else {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
263 if (_networking) index--;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
264 ShowPlayerCompany(index);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
265 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
266 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
267
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
268
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
269 static void MenuClickGraphs(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
270 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
271 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
272 case 0: ShowOperatingProfitGraph(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
273 case 1: ShowIncomeGraph(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
274 case 2: ShowDeliveredCargoGraph(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
275 case 3: ShowPerformanceHistoryGraph(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
276 case 4: ShowCompanyValueGraph(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
277 case 5: ShowCargoPaymentRates(); return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
278 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
279 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
280
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
281 static void MenuClickLeague(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
282 {
116
3761257cf350 (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik <dominik@openttd.org>
parents: 74
diff changeset
283 switch(index) {
3761257cf350 (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik <dominik@openttd.org>
parents: 74
diff changeset
284 case 0: ShowCompanyLeagueTable(); return;
3761257cf350 (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik <dominik@openttd.org>
parents: 74
diff changeset
285 case 1: ShowPerformanceRatingDetail(); return;
3761257cf350 (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik <dominik@openttd.org>
parents: 74
diff changeset
286 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
287 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
288
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
289 static void MenuClickIndustry(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
290 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
291 switch(index) {
197
3b8b616d58b6 (svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater <darkvater@openttd.org>
parents: 196
diff changeset
292 case 0: ShowIndustryDirectory(); break;
3b8b616d58b6 (svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater <darkvater@openttd.org>
parents: 196
diff changeset
293 case 1: ShowBuildIndustryWindow(); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
294 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
295 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
296
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
297 static void MenuClickShowTrains(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
298 {
588
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
299 ShowPlayerTrains(index, -1);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
300 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
301
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
302 static void MenuClickShowRoad(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
303 {
588
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
304 ShowPlayerRoadVehicles(index, -1);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
305 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
306
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
307 static void MenuClickShowShips(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
308 {
588
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
309 ShowPlayerShips(index, -1);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
310 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
311
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
312 static void MenuClickShowAir(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
313 {
588
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
314 ShowPlayerAircraft(index, -1);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
315 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
316
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
317 static void MenuClickBuildRail(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
318 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
319 Player *p = DEREF_PLAYER(_local_player);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
320 _last_built_railtype = min(index, p->max_railtype-1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
321 ShowBuildRailToolbar(_last_built_railtype, -1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
322 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
323
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
324 static void MenuClickBuildRoad(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
325 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
326 ShowBuildRoadToolbar();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
327 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
328
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
329 static void MenuClickBuildWater(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
330 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
331 ShowBuildDocksToolbar();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
332 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
333
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
334 static void MenuClickBuildAir(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
335 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
336 ShowBuildAirToolbar();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
337 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
338
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
339 #ifdef ENABLE_NETWORK
649
323b2478d40f (svn r1082) Feature: Chat toolbar
dominik <dominik@openttd.org>
parents: 616
diff changeset
340
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
341 void ShowNetworkChatQueryWindow(byte desttype, byte dest)
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
342 {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
343 _rename_id = desttype + (dest << 8);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
344 _rename_what = 2;
793
1e51cf208ca9 (svn r1263) -Fix: [Network] Client-names are limited (serverside) to 25 chars
truelight <truelight@openttd.org>
parents: 774
diff changeset
345 ShowChatWindow(STR_EMPTY, STR_NETWORK_CHAT_QUERY_CAPTION, 150, 338, 1, 0);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
346 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
347
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
348 void ShowNetworkGiveMoneyWindow(byte player)
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
349 {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
350 _rename_id = player;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
351 _rename_what = 3;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
352 ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, 1, 0);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
353 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
354
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
355 void ShowNetworkNeedGamePassword()
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
356 {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
357 _rename_id = NETWORK_GAME_PASSWORD;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
358 _rename_what = 4;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
359 ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_GAME_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
360 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
361
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
362 void ShowNetworkNeedCompanyPassword()
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
363 {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
364 _rename_id = NETWORK_COMPANY_PASSWORD;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
365 _rename_what = 4;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
366 ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, 20, 180, WC_SELECT_GAME, 0);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
367 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
368
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
369 #endif /* ENABLE_NETWORK */
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
370
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
371 void ShowRenameSignWindow(SignStruct *ss)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
372 {
988
fa15528bb00a (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight <truelight@openttd.org>
parents: 983
diff changeset
373 _rename_id = ss->index;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
374 _rename_what = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
375 ShowQueryString(ss->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, 1, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
376 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
377
395
9566850ffa0d (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 <darkvater@openttd.org>
parents: 355
diff changeset
378 void ShowRenameWaypointWindow(Waypoint *cp)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
379 {
395
9566850ffa0d (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 <darkvater@openttd.org>
parents: 355
diff changeset
380 int id = cp - _waypoints;
697
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
381
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
382 /* Are we allowed to change the name of the waypoint? */
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
383 if (!CheckTileOwnership(cp->xy)) {
926
b1ef952b19f8 (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron <tron@openttd.org>
parents: 872
diff changeset
384 ShowErrorMessage(_error_message, STR_CANT_CHANGE_WAYPOINT_NAME,
b1ef952b19f8 (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron <tron@openttd.org>
parents: 872
diff changeset
385 TileX(cp->xy) * 16, TileY(cp->xy) * 16);
697
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
386 return;
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
387 }
e1617e3e059e (svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight <truelight@openttd.org>
parents: 682
diff changeset
388
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
389 _rename_id = id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
390 _rename_what = 1;
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
391 SetDParam(0, id);
395
9566850ffa0d (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 <darkvater@openttd.org>
parents: 355
diff changeset
392 ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
393 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
394
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
395 static void SelectSignTool()
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
396 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
397 if (_cursor.sprite == 0x2D2)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
398 ResetObjectToPlace();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
399 else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
400 SetObjectToPlace(0x2D2, 1, 1, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
401 _place_proc = PlaceProc_Sign;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
402 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
403 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
404
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
405 static void MenuClickForest(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
406 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
407 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
408 case 0: ShowTerraformToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
409 case 1: ShowBuildTreesToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
410 case 2: SelectSignTool(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
411 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
412 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
413
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
414 static void MenuClickMusicWindow(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
415 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
416 ShowMusicWindow();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
417 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
418
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
419 static void MenuClickNewspaper(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
420 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
421 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
422 case 0: ShowLastNewsMessage(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
423 case 1: ShowMessageOptions(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
424 case 2: ShowMessageHistory(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
425 case 3: ; /* XXX: chat not done */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
426 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
427 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
428
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
429 static void MenuClickHelp(int index)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
430 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
431 switch(index) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
432 case 0: PlaceLandBlockInfo(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
433 case 2: _make_screenshot = 1; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
434 case 3: _make_screenshot = 2; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
435 case 4: ShowAboutWindow(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
436 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
437 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
438
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
439 static MenuClickedProc * const _menu_clicked_procs[] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
440 NULL, /* 0 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
441 NULL, /* 1 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
442 MenuClickSettings, /* 2 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
443 MenuClickSaveLoad, /* 3 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
444 MenuClickMap, /* 4 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
445 MenuClickTown, /* 5 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
446 MenuClickSubsidies, /* 6 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
447 MenuClickStations, /* 7 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
448 MenuClickFinances, /* 8 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
449 MenuClickCompany, /* 9 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
450 MenuClickGraphs, /* 10 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
451 MenuClickLeague, /* 11 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
452 MenuClickIndustry, /* 12 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
453 MenuClickShowTrains, /* 13 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
454 MenuClickShowRoad, /* 14 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
455 MenuClickShowShips, /* 15 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
456 MenuClickShowAir, /* 16 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
457 MenuClickScenMap, /* 17 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
458 NULL, /* 18 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
459 MenuClickBuildRail, /* 19 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
460 MenuClickBuildRoad, /* 20 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
461 MenuClickBuildWater, /* 21 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
462 MenuClickBuildAir, /* 22 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
463 MenuClickForest, /* 23 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
464 MenuClickMusicWindow, /* 24 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
465 MenuClickNewspaper, /* 25 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
466 MenuClickHelp, /* 26 */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
467 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
468
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
469 static void MenuWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
470 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
471 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
472 case WE_PAINT: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
473 int count,sel;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
474 int x,y;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
475 uint16 chk;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
476 StringID string;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
477 int eo;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
478 int inc;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
479
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
480 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
481
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
482 count = WP(w,menu_d).item_count;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
483 sel = WP(w,menu_d).sel_index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
484 chk = WP(w,menu_d).checked_items;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
485 string = WP(w,menu_d).string_id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
486
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
487 x = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
488 y = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
489
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
490 eo = 157;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
491
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
492 inc = (chk != 0) ? 2 : 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
493
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
494 do {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
495 if (sel== 0) GfxFillRect(x, y, x + eo, y+9, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
496 DrawString(x + 2, y, (StringID)(string + (chk&1)), (byte)(sel==0?(byte)0xC:(byte)0x10));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
497 y += 10;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
498 string += inc;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
499 chk >>= 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
500 } while (--sel,--count);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
501 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
502
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
503 case WE_DESTROY: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
504 Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
505 v->click_state &= ~(1 << WP(w,menu_d).main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
506 SetWindowDirty(v);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
507 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
508 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
509
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
510 case WE_POPUPMENU_SELECT: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
511 int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
512 int action_id;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
513
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
514
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
515 if (index < 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
516 Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
517 if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
518 index = WP(w,menu_d).sel_index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
519 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
520
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
521 action_id = WP(w,menu_d).action_id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
522 DeleteWindow(w);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
523
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
524 if (index >= 0)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
525 _menu_clicked_procs[action_id](index);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
526
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
527 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
528 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
529 case WE_POPUPMENU_OVER: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
530 int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
531
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
532 if (index == -1 || index == WP(w,menu_d).sel_index)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
533 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
534
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
535 WP(w,menu_d).sel_index = index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
536 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
537 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
538 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
539 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
540 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
541
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
542 static const Widget _menu_widgets[] = {
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
543 { WWT_PANEL, RESIZE_NONE, 14, 0, 159, 0, 65535, 0, STR_NULL},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
544 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
545 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
546
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
547
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
548 static const Widget _player_menu_widgets[] = {
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
549 { WWT_PANEL, RESIZE_NONE, 14, 0, 240, 0, 81, 0, STR_NULL},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
550 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
551 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
552
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
553
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
554 static int GetPlayerIndexFromMenu(int index)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
555 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
556 Player *p;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
557
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
558 if (index >= 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
559 FOR_ALL_PLAYERS(p) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
560 if (p->is_active) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
561 if (--index < 0)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
562 return p->index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
563 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
564 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
565 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
566 return -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
567 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
568
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
569 static void UpdatePlayerMenuHeight(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
570 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
571 int num = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
572 Player *p;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
573
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
574 FOR_ALL_PLAYERS(p) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
575 if (p->is_active)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
576 num++;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
577 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
578
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
579 // Increase one to fit in PlayerList in the menu when
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
580 // in network
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
581 if (_networking && WP(w,menu_d).main_button == 9) {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
582 num++;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
583 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
584
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
585 if (WP(w,menu_d).item_count != num) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
586 WP(w,menu_d).item_count = num;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
587 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
588 num = num * 10 + 2;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
589 w->height = num;
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
590 w->widget[0].bottom = w->widget[0].top + num - 1;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
591 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
592 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
593 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
594
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
595 extern void DrawPlayerIcon(int p, int x, int y);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
596
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
597 static void PlayerMenuWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
598 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
599 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
600 case WE_PAINT: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
601 int x,y;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
602 byte sel, color;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
603 Player *p;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
604 uint16 chk;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
605
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
606 UpdatePlayerMenuHeight(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
607 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
608
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
609 x = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
610 y = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
611 sel = WP(w,menu_d).sel_index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
612 chk = WP(w,menu_d).checked_items; // let this mean gray items.
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
613
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
614 // 9 = playerlist
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
615 if (_networking && WP(w,menu_d).main_button == 9) {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
616 if (sel == 0) {
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
617 GfxFillRect(x, y, x + 238, y + 9, 0);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
618 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
619 DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, 0x0);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
620 y += 10;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
621 sel--;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
622 }
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
623
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
624 FOR_ALL_PLAYERS(p) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
625 if (p->is_active) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
626 if (p->index == sel) {
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
627 GfxFillRect(x, y, x + 238, y + 9, 0);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
628 }
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
629
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
630 DrawPlayerIcon(p->index, x + 2, y + 1);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
631
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
632 SetDParam(0, p->name_1);
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
633 SetDParam(1, p->name_2);
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
634 SetDParam(2, GetPlayerNameString(p->index, 3));
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
635
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
636 color = (byte)((p->index==sel) ? 0xC : 0x10);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
637 if (chk&1) color = 14;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
638 DrawString(x + 19, y, STR_7021, color);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
639
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
640 y += 10;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
641 }
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
642 chk >>= 1;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
643 }
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
644
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
645 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
646 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
647
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
648 case WE_DESTROY: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
649 Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
650 v->click_state &= ~(1 << WP(w,menu_d).main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
651 SetWindowDirty(v);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
652 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
653 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
654
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
655 case WE_POPUPMENU_SELECT: {
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
656 int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
657 int action_id = WP(w,menu_d).action_id;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
658
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
659 // We have a new entry at the top of the list of menu 9 when networking
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
660 // so keep that in count
724
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
661 if (_networking && WP(w,menu_d).main_button == 9) {
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
662 if (index > 0)
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
663 index = GetPlayerIndexFromMenu(index - 1) + 1;
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
664 } else
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
665 index = GetPlayerIndexFromMenu(index);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
666
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
667 if (index < 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
668 Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
669 if (GetWidgetFromPos(w2, e->popupmenu.pt.x - w2->left, e->popupmenu.pt.y - w2->top) == WP(w,menu_d).main_button)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
670 index = WP(w,menu_d).sel_index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
671 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
672
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
673 DeleteWindow(w);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
674
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
675 if (index >= 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
676 assert(index >= 0 && index < 30);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
677 _menu_clicked_procs[action_id](index);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
678 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
679 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
680 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
681 case WE_POPUPMENU_OVER: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
682 int index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
683 UpdatePlayerMenuHeight(w);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
684 index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y);
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
685
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
686 // We have a new entry at the top of the list of menu 9 when networking
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
687 // so keep that in count
724
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
688 if (_networking && WP(w,menu_d).main_button == 9) {
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
689 if (index > 0)
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
690 index = GetPlayerIndexFromMenu(index - 1) + 1;
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
691 } else
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
692 index = GetPlayerIndexFromMenu(index);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
693
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
694 if (index == -1 || index == WP(w,menu_d).sel_index)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
695 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
696
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
697 WP(w,menu_d).sel_index = index;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
698 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
699 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
700 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
701 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
702 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
703
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
704 static Window *PopupMainToolbMenu(Window *w, int x, int main_button, StringID base_string, int item_count)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
705 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
706 x += w->left;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
707
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
708 SETBIT(w->click_state, (byte)main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
709 InvalidateWidget(w, (byte)main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
710
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
711 DeleteWindowById(WC_TOOLBAR_MENU, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
712
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
713 w = AllocateWindow(x, 0x16, 0xA0, item_count * 10 + 2, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets);
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
714 w->widget[0].bottom = item_count * 10 + 1;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
715 w->flags4 &= ~WF_WHITE_BORDER_MASK;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
716
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
717 WP(w,menu_d).item_count = item_count;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
718 WP(w,menu_d).sel_index = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
719 WP(w,menu_d).main_button = main_button;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
720 WP(w,menu_d).action_id = (main_button >> 8) ? (main_button >> 8) : main_button;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
721 WP(w,menu_d).string_id = base_string;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
722 WP(w,menu_d).checked_items = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
723
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
724 _popup_menu_active = true;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
725
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
726 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
727
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
728 return w;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
729 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
730
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
731 static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
732 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
733 x += w->left;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
734
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
735 SETBIT(w->click_state, main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
736 InvalidateWidget(w, main_button);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
737
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
738 DeleteWindowById(WC_TOOLBAR_MENU, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
739 w = AllocateWindow(x, 0x16, 0xF1, 0x52, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
740 w->flags4 &= ~WF_WHITE_BORDER_MASK;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
741 WP(w,menu_d).item_count = 0;
724
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
742 WP(w,menu_d).sel_index = (_local_player != OWNER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0);
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
743 if (_networking && main_button == 9) {
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
744 if (_local_player != OWNER_SPECTATOR)
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
745 WP(w,menu_d).sel_index++;
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
746 else
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
747 /* Select client list by default for spectators */
a55a4f2f322c (svn r1176) -Fix: [Network] PlayerBasedMenu's caused crashes when a company went bankrupt
truelight <truelight@openttd.org>
parents: 722
diff changeset
748 WP(w,menu_d).sel_index = 0;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
749 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
750 WP(w,menu_d).action_id = main_button;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
751 WP(w,menu_d).main_button = main_button;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
752 WP(w,menu_d).checked_items = gray;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
753 _popup_menu_active = true;
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
754 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
755 return w;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
756 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
757
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
758 static void ToolbarSaveClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
759 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
760 PopupMainToolbMenu(w, 66, 3, STR_015C_SAVE_GAME, 4);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
761 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
762
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
763 static void ToolbarMapClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
764 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
765 PopupMainToolbMenu(w, 96, 4, STR_02DE_MAP_OF_WORLD, 2);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
766 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
767
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
768 static void ToolbarTownClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
769 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
770 PopupMainToolbMenu(w, 118, 5, STR_02BB_TOWN_DIRECTORY, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
771 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
772
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
773 static void ToolbarSubsidiesClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
774 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
775 PopupMainToolbMenu(w, 140, 6, STR_02DD_SUBSIDIES, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
776 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
777
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
778 static void ToolbarStationsClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
779 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
780 PopupMainPlayerToolbMenu(w, 162, 7, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
781 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
782
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
783 static void ToolbarMoneyClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
784 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
785 PopupMainPlayerToolbMenu(w, 191, 8, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
786 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
787
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
788 static void ToolbarPlayersClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
789 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
790 PopupMainPlayerToolbMenu(w, 213, 9, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
791 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
792
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
793 static void ToolbarGraphsClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
794 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
795 PopupMainToolbMenu(w, 236, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
796 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
797
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
798 static void ToolbarLeagueClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
799 {
116
3761257cf350 (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik <dominik@openttd.org>
parents: 74
diff changeset
800 PopupMainToolbMenu(w, 258, 11, STR_015A_COMPANY_LEAGUE_TABLE, 2);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
801 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
802
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
803 static void ToolbarIndustryClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
804 {
197
3b8b616d58b6 (svn r198) -Fix: [1020269] Different production? Wrong production amount was showed in the industry list window
darkvater <darkvater@openttd.org>
parents: 196
diff changeset
805 PopupMainToolbMenu(w, 280, 12, STR_INDUSTRY_DIR, 2);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
806 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
807
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
808 static void ToolbarTrainClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
809 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
810 Vehicle *v;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
811 int dis = -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
812 FOR_ALL_VEHICLES(v)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
813 if (v->type == VEH_Train && v->subtype == 0) CLRBIT(dis, v->owner);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
814 PopupMainPlayerToolbMenu(w, 310, 13, dis);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
815 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
816
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
817 static void ToolbarRoadClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
818 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
819 Vehicle *v;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
820 int dis = -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
821 FOR_ALL_VEHICLES(v)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
822 if (v->type == VEH_Road) CLRBIT(dis, v->owner);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
823 PopupMainPlayerToolbMenu(w, 332, 14, dis);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
824 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
825
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
826 static void ToolbarShipClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
827 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
828 Vehicle *v;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
829 int dis = -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
830 FOR_ALL_VEHICLES(v)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
831 if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
832 PopupMainPlayerToolbMenu(w, 354, 15, dis);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
833 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
834
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
835 static void ToolbarAirClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
836 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
837 Vehicle *v;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
838 int dis = -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
839 FOR_ALL_VEHICLES(v)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
840 if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
841 PopupMainPlayerToolbMenu(w, 376, 16, dis);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
842 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
843
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
844 /* Zooms a viewport in a window in or out */
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
845 /* No button handling or what so ever */
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
846 bool DoZoomInOutWindow(int how, Window *w)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
847 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
848 ViewPort *vp;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
849 int button;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
850
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
851 switch(_game_mode) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
852 case GM_EDITOR: button = 9; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
853 case GM_NORMAL: button = 17; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
854 default: return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
855 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
856
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
857 assert(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
858 vp = w->viewport;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
859
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
860 if (how == ZOOM_IN) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
861 if (vp->zoom == 0) return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
862 vp->zoom--;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
863 vp->virtual_width >>= 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
864 vp->virtual_height >>= 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
865
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
866 WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
867 WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
868
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
869 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
870 } else if (how == ZOOM_OUT) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
871 if (vp->zoom == 2) return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
872 vp->zoom++;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
873
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
874 WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
875 WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
876
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
877 vp->virtual_width <<= 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
878 vp->virtual_height <<= 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
879
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
880 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
881 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
882
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
883 // routine to disable/enable the zoom buttons. Didn't know where to place these otherwise
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
884 {
168
76ede0c80f43 (svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater <darkvater@openttd.org>
parents: 152
diff changeset
885 Window *wt = NULL;
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
886 switch (w->window_class) {
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
887 case WC_MAIN_WINDOW:
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
888 wt = FindWindowById(WC_MAIN_TOOLBAR, 0);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
889 break;
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
890 case WC_EXTRA_VIEW_PORT:
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
891 wt = FindWindowById(WC_EXTRA_VIEW_PORT, w->window_number);
682
81141f0eb921 (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 <darkvater@openttd.org>
parents: 679
diff changeset
892 button = 5;
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
893 break;
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
894 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
895
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
896 assert(wt);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
897
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
898 // update the toolbar button too
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
899 CLRBIT(wt->disabled_state, button);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
900 CLRBIT(wt->disabled_state, button + 1);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
901 if (vp->zoom == 0) SETBIT(wt->disabled_state, button);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
902 else if (vp->zoom == 2) SETBIT(wt->disabled_state, button + 1);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
903 SetWindowDirty(wt);
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
904 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
905
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
906 return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
907 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
908
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
909 static void MaxZoomIn()
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
910 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
911 while (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0) ) ) {}
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
912 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
913
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
914 static void ToolbarZoomInClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
915 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
916 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
917 HandleButtonClick(w, 17);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
918 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
919 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
920 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
921
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
922 static void ToolbarZoomOutClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
923 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
924 if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
925 HandleButtonClick(w, 18);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
926 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
927 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
928 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
929
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
930 static void ToolbarBuildRailClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
931 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
932 Player *p = DEREF_PLAYER(_local_player);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
933 Window *w2;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
934 w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, p->max_railtype);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
935 WP(w2,menu_d).sel_index = _last_built_railtype;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
936 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
937
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
938 static void ToolbarBuildRoadClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
939 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
940 PopupMainToolbMenu(w, 479, 20, STR_180A_ROAD_CONSTRUCTION, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
941 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
942
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
943 static void ToolbarBuildWaterClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
944 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
945 PopupMainToolbMenu(w, 501, 21, STR_9800_DOCK_CONSTRUCTION, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
946 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
947
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
948 static void ToolbarBuildAirClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
949 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
950 PopupMainToolbMenu(w, 0x1E0, 22, STR_A01D_AIRPORT_CONSTRUCTION, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
951 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
952
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
953 static void ToolbarForestClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
954 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
955 PopupMainToolbMenu(w, 0x1E0, 23, STR_LANDSCAPING, 3);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
956 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
957
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
958 static void ToolbarMusicClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
959 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
960 PopupMainToolbMenu(w, 0x1E0, 24, STR_01D3_SOUND_MUSIC, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
961 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
962
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
963 static void ToolbarNewspaperClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
964 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
965 PopupMainToolbMenu(w, 0x1E0, 25, STR_0200_LAST_MESSAGE_NEWS_REPORT, _newspaper_flag != 2 ? 3 : 4);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
966 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
967
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
968 static void ToolbarHelpClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
969 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
970 PopupMainToolbMenu(w, 0x1E0, 26, STR_02D5_LAND_BLOCK_INFO, 5);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
971 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
972
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
973 static void ToolbarOptionsClick(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
974 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
975 uint16 x;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
976
1015
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
977 w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 12);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
978
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
979 x = (uint16)-1;
1015
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
980 if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<5);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
981 if (_display_opt & DO_SHOW_STATION_NAMES) x &= ~(1<<6);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
982 if (_display_opt & DO_SHOW_SIGNS) x &= ~(1<<7);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
983 if (_display_opt & DO_WAYPOINTS) x &= ~(1<<8);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
984 if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<9);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
985 if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<10);
c70f259e2c07 (svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater <darkvater@openttd.org>
parents: 1014
diff changeset
986 if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<11);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
987 WP(w,menu_d).checked_items = x;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
988 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
989
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
990
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
991 static void ToolbarScenSaveOrLoad(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
992 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
993 PopupMainToolbMenu(w, 0x2C, 3, STR_0292_SAVE_SCENARIO, 5);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
994 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
995
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
996 static void ToolbarScenDateBackward(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
997 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
998 // don't allow too fast scrolling
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
999 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1000 HandleButtonClick(w, 6);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1001 InvalidateWidget(w, 5);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1002
349
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
1003 if (_date > MinDate)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1004 SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1005 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1006 _left_button_clicked = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1007 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1008
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1009 static void ToolbarScenDateForward(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1010 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1011 // don't allow too fast scrolling
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1012 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1013 HandleButtonClick(w, 7);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1014 InvalidateWidget(w, 5);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1015
349
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
1016 if (_date < MaxDate)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1017 SetDate(ConvertYMDToDay(_cur_year + 1, 0, 1));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1018 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1019 _left_button_clicked = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1020 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1021
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1022 static void ToolbarScenMapTownDir(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1023 {
355
f8405a30ffa6 (svn r543) -Fix: [ 1064742 ] Editor Map-Menu wrong String
tron <tron@openttd.org>
parents: 349
diff changeset
1024 PopupMainToolbMenu(w, 0x16A, 8 | (17<<8), STR_02DE_MAP_OF_WORLD, 3);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1025 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1026
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1027 static void ToolbarScenZoomIn(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1028 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1029 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1030 HandleButtonClick(w, 9);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1031 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1032 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1033 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1034
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1035 static void ToolbarScenZoomOut(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1036 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1037 if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1038 HandleButtonClick(w, 10);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1039 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1040 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1041 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1042
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1043 void ZoomInOrOutToCursorWindow(bool in, Window *w)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1044 {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1045 ViewPort * vp;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1046 Point pt;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1047
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1048 assert(w != 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1049
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1050 vp = w->viewport;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1051
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1052 if (_game_mode != GM_MENU) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1053 if ((in && vp->zoom == 0) || (!in && vp->zoom == 2))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1054 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1055
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1056 pt = GetTileZoomCenterWindow(in,w);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1057 if (pt.x != -1) {
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1058 ScrollWindowTo(pt.x, pt.y, w);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1059
152
2bc5f40a3dfe (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 <darkvater@openttd.org>
parents: 135
diff changeset
1060 DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1061 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1062 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1063 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1064
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1065 static void ResetLandscape()
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1066 {
206
6dcb7c68f9ae (svn r207) -Codechange: randomizer handling
signde <signde@openttd.org>
parents: 197
diff changeset
1067 _random_seeds[0][0] = InteractiveRandom();
6dcb7c68f9ae (svn r207) -Codechange: randomizer handling
signde <signde@openttd.org>
parents: 197
diff changeset
1068 _random_seeds[0][1] = InteractiveRandom();
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1069
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1070 GenerateWorld(1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1071 MarkWholeScreenDirty();
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1072 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1073
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1074 static const Widget _ask_reset_landscape_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1075 { WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1076 { WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_022C_RESET_LANDSCAPE, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1077 { WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1078 { WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1079 { WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1080 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1081 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1082
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1083 // Ask first to reset landscape or to make a random landscape
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1084 static void AskResetLandscapeWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1085 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1086 uint mode = w->window_number;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1087
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1088 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1089 case WE_PAINT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1090 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1091 DrawStringMultiCenter(90, 38, mode?STR_022D_ARE_YOU_SURE_YOU_WANT_TO:STR_GENERATE_RANDOM_LANDSCAPE , 168);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1092 case WE_CLICK:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1093 switch(e->click.widget) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1094 case 3:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1095 DeleteWindow(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1096 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1097 case 4:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1098 DeleteWindow(w);
999
02633e4d5252 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater <darkvater@openttd.org>
parents: 989
diff changeset
1099 DeleteWindowByClass(WC_INDUSTRY_VIEW);
02633e4d5252 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater <darkvater@openttd.org>
parents: 989
diff changeset
1100 DeleteWindowByClass(WC_TOWN_VIEW);
1019
a825628bb84c (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron <tron@openttd.org>
parents: 1015
diff changeset
1101 DeleteWindowByClass(WC_LAND_INFO);
999
02633e4d5252 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater <darkvater@openttd.org>
parents: 989
diff changeset
1102
02633e4d5252 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater <darkvater@openttd.org>
parents: 989
diff changeset
1103 if (mode) { // reset landscape
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1104 ResetLandscape();
999
02633e4d5252 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater <darkvater@openttd.org>
parents: 989
diff changeset
1105 } else { // make random landscape
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1106 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1107 _switch_mode = SM_GENRANDLAND;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1108 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1109
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1110 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1111 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1112 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1113 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1114
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1115 static const WindowDesc _ask_reset_landscape_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1116 230,205, 180, 92,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1117 WC_ASK_RESET_LANDSCAPE,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1118 WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1119 _ask_reset_landscape_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1120 AskResetLandscapeWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1121 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1122
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1123 static void AskResetLandscape(uint mode)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1124 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1125 AllocateWindowDescFront(&_ask_reset_landscape_desc, mode);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1126 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1127
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1128 static void CommonRaiseLowerBigLand(uint tile, int mode)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1129 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1130 int size;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
1131 byte h;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1132
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1133 _error_message_2 = mode ? STR_0808_CAN_T_RAISE_LAND_HERE : STR_0809_CAN_T_LOWER_LAND_HERE;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1134
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1135 _generating_world = true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1136
926
b1ef952b19f8 (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron <tron@openttd.org>
parents: 872
diff changeset
1137 // tile = TILE_FROM_XY(TileX(tile) * 16 + _tile_fract_coords.x + 8, TileY(tile) * 16 + _tile_fract_coords.y + 8);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1138
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1139 if (_terraform_size == 1) {
1014
b6dc5889223e (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 <darkvater@openttd.org>
parents: 1003
diff changeset
1140 DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(_error_message_2));
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1141 } else {
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1142 SndPlayTileFx(SND_1F_SPLAT, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1143
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1144 size = _terraform_size;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1145 assert(size != 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1146 if (mode != 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1147 /* Raise land */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1148 h = 15;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1149 BEGIN_TILE_LOOP(tile2, size, size, tile)
1044
929116a0af28 (svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron <tron@openttd.org>
parents: 1035
diff changeset
1150 h = min(h, TileHeight(tile2));
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1151 END_TILE_LOOP(tile2, size, size, tile)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1152 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1153 /* Lower land */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1154 h = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1155 BEGIN_TILE_LOOP(tile2, size, size, tile)
1044
929116a0af28 (svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron <tron@openttd.org>
parents: 1035
diff changeset
1156 h = max(h, TileHeight(tile2));
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1157 END_TILE_LOOP(tile2, size, size, tile)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1158 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1159
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1160 BEGIN_TILE_LOOP(tile2, size, size, tile)
1044
929116a0af28 (svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
tron <tron@openttd.org>
parents: 1035
diff changeset
1161 if (TileHeight(tile2) == h) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1162 DoCommandP(tile2, 8, (uint32)mode, NULL, CMD_TERRAFORM_LAND | CMD_AUTO);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1163 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1164 END_TILE_LOOP(tile2, size, size, tile)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1165 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1166
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1167 _generating_world = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1168 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1169
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1170 static void PlaceProc_RaiseBigLand(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1171 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1172 CommonRaiseLowerBigLand(tile, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1173 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1174
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1175 static void PlaceProc_LowerBigLand(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1176 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1177 CommonRaiseLowerBigLand(tile, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1178 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1179
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
1180 //void CcDemolish(bool success, uint tile, uint32 p1, uint32 p2)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1181 //{
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1182 // if (success) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1183 //SndPlayTileFx(0x10, tile);
926
b1ef952b19f8 (svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron <tron@openttd.org>
parents: 872
diff changeset
1184 //CreateEffectVehicleAbove(TileX(tile) * 16 + 8, TileY(tile) * 16 + 8, 2, EV_DEMOLISH);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1185 // }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1186 //}
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1187
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1188 //void PlaceProc_Demolish(uint tile)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1189 //{
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1190 // DoCommandP(tile, 0, 0, CcDemolish, CMD_LANDSCAPE_CLEAR | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1191 //}
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1192
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1193
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1194 static void PlaceProc_RockyArea(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1195 {
1035
3edb35954288 (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron <tron@openttd.org>
parents: 1019
diff changeset
1196 if (!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES))
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1197 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1198
872
4667c9d49076 (svn r1353) -Fix: [1092707] placing rocks in scenario editor. You can place rocks on trees and vice versa
darkvater <darkvater@openttd.org>
parents: 868
diff changeset
1199 ModifyTile(tile, MP_SETTYPE(MP_CLEAR) | MP_MAP5, (_map5[tile] & ~0x1C) | 0xB);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1200 SndPlayTileFx(SND_1F_SPLAT, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1201 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1202
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1203 static void PlaceProc_LightHouse(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1204 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1205 TileInfo ti;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1206
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1207 FindLandscapeHeightByTile(&ti, tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1208 if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1209 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1210
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1211 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1212 SndPlayTileFx(SND_1F_SPLAT, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1213 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1214
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1215 static void PlaceProc_Transmitter(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1216 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1217 TileInfo ti;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1218
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1219 FindLandscapeHeightByTile(&ti, tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1220 if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1221 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1222
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1223 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1224 SndPlayTileFx(SND_1F_SPLAT, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1225 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1226
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1227 static void PlaceProc_Desert(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1228 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1229 SetMapExtraBits(tile, GetMapExtraBits(tile) == 1 ? 0 : 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1230 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1231
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1232 static const Widget _scen_edit_land_gen_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1233 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1234 { WWT_CAPTION, RESIZE_NONE, 7, 11, 153, 0, 13, STR_0223_LAND_GENERATION,STR_018C_WINDOW_TITLE_DRAG_THIS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1235 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 153, 14, 99, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1236 { WWT_IMGBTN, RESIZE_NONE, 14, 22, 43, 14, 35, 0x2B6, STR_018F_RAISE_A_CORNER_OF_LAND},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1237 { WWT_IMGBTN, RESIZE_NONE, 14, 44, 65, 14, 35, 0x2B7, STR_018E_LOWER_A_CORNER_OF_LAND},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1238 { WWT_IMGBTN, RESIZE_NONE, 14, 0, 21, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1239 { WWT_TEXTBTN, RESIZE_NONE, 14, 125, 135, 43, 54, STR_0224, STR_0228_INCREASE_SIZE_OF_LAND_AREA},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1240 { WWT_TEXTBTN, RESIZE_NONE, 14, 125, 135, 56, 67, STR_0225, STR_0229_DECREASE_SIZE_OF_LAND_AREA},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1241 { WWT_TEXTBTN, RESIZE_NONE, 14, 20, 135, 75, 86, STR_0226_RANDOM_LAND, STR_022A_GENERATE_RANDOM_LAND},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1242 { WWT_TEXTBTN, RESIZE_NONE, 14, 20, 135, 88, 99, STR_0227_RESET_LAND, STR_022B_RESET_LANDSCAPE},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1243
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1244 { WWT_IMGBTN, RESIZE_NONE, 14, 88, 109, 14, 35, 0xFF4, STR_028C_PLACE_ROCKY_AREAS_ON_LANDSCAPE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1245 { WWT_IMGBTN, RESIZE_NONE, 14, 110, 131, 14, 35, 0xFF5, STR_028D_PLACE_LIGHTHOUSE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1246 { WWT_IMGBTN, RESIZE_NONE, 14, 132, 153, 14, 35, 0xFF6, STR_028E_PLACE_TRANSMITTER},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1247 { WWT_IMGBTN, RESIZE_NONE, 14, 66, 87, 14, 35, SPR_OPENTTD_BASE+68, STR_LEVEL_LAND_TOOLTIP},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1248 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1249 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1250
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1251 static const int8 _multi_terraform_coords[][2] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1252 { 0, -2},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1253 { 4, 0},{ -4, 0},{ 0, 2},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1254 { -8, 2},{ -4, 4},{ 0, 6},{ 4, 4},{ 8, 2},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1255 {-12, 0},{ -8, -2},{ -4, -4},{ 0, -6},{ 4, -4},{ 8, -2},{ 12, 0},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1256 {-16, 2},{-12, 4},{ -8, 6},{ -4, 8},{ 0, 10},{ 4, 8},{ 8, 6},{ 12, 4},{ 16, 2},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1257 {-20, 0},{-16, -2},{-12, -4},{ -8, -6},{ -4, -8},{ 0,-10},{ 4, -8},{ 8, -6},{ 12, -4},{ 16, -2},{ 20, 0},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1258 {-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},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1259 {-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},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1260 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1261
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1262 static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1263 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1264 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1265 case WE_PAINT:
989
b92aef08f0e6 (svn r1487) -Fix: [1100736] wrong tooltip for place desert button
darkvater <darkvater@openttd.org>
parents: 988
diff changeset
1266 // XXX - lighthouse button is widget 11!! Don't forget when changing
1019
a825628bb84c (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron <tron@openttd.org>
parents: 1015
diff changeset
1267 w->widget[11].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1268 DrawWindowWidgets(w);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1269
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1270 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1271 int n = _terraform_size * _terraform_size;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1272 const int8 *coords = &_multi_terraform_coords[0][0];
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1273
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1274 assert(n != 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1275 do {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1276 DrawSprite(0xFEF, 77 + coords[0], 55 + coords[1]);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1277 coords += 2;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1278 } while (--n);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1279 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1280
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1281 if (_thd.window_class == WC_SCEN_LAND_GEN && (w->click_state&(1<<3|1<<4))) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1282 SetTileSelectSize(_terraform_size, _terraform_size);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1283 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1284 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1285 case WE_CLICK:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1286 switch(e->click.widget) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1287 case 3: /* raise corner */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1288 HandlePlacePushButton(w, 3, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseBigLand);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1289 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1290 case 4: /* lower corner */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1291 HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerBigLand);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1292 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1293 case 5: /* demolish */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1294 HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1295 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1296 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1297 int size;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1298 case 6: /* increase terraform size */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1299 HandleButtonClick(w, 6);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1300 size = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1301 goto terraform_size_common;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1302 case 7: /* decrease terraform size */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1303 HandleButtonClick(w, 7);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1304 size = -1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1305 terraform_size_common:;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1306 size += _terraform_size;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1307 if (!IS_INT_INSIDE(size, 1, 8+1))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1308 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1309 _terraform_size = size;
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1310 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1311 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1312 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1313 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1314
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1315 case 8: /* gen random land */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1316 HandleButtonClick(w, 8);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1317 AskResetLandscape(0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1318 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1319
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1320 case 9: /* reset landscape */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1321 HandleButtonClick(w,9);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1322 AskResetLandscape(1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1323 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1324
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1325 case 10: /* place rocky areas */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1326 HandlePlacePushButton(w, 10, 0xFF7, 1, PlaceProc_RockyArea);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1327 break;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1328
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1329 case 11: /* place lighthouse */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1330 HandlePlacePushButton(w, 11, 0xFF8, 1, _opt.landscape == LT_DESERT ? PlaceProc_Desert : PlaceProc_LightHouse);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1331 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1332
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1333 case 12: /* place transmitter */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1334 HandlePlacePushButton(w, 12, 0xFF9, 1, PlaceProc_Transmitter);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1335 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1336
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1337 case 13: /* level Land */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1338 HandlePlacePushButton(w, 13, SPR_OPENTTD_BASE+69, 2, PlaceProc_LevelLand);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1339 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1340 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1341 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1342 case WE_TIMEOUT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1343 UnclickSomeWindowButtons(w, ~(1<<3 | 1<<4 | 1<<5 | 1<<10|1<<11|1<<12));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1344 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1345 case WE_PLACE_OBJ:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1346 _place_proc(e->place.tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1347 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1348 case WE_PLACE_DRAG: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1349 VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata & 0xF);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1350 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1351 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1352 case WE_PLACE_MOUSEUP:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1353 if (e->click.pt.x != -1) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1354 uint start_tile = e->place.starttile;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1355 uint end_tile = e->place.tile;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1356 if (e->place.userdata == VPM_X_AND_Y) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1357 DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1358 } else if (e->place.userdata == (VPM_X_AND_Y | (2<<4))) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1359 DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1360 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1361 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1362 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1363
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1364 case WE_ABORT_PLACE_OBJ:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1365 w->click_state = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1366 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1367 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1368 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1369 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1370
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1371 static const WindowDesc _scen_edit_land_gen_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1372 -1,-1, 154, 100,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1373 WC_SCEN_LAND_GEN,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1374 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1375 _scen_edit_land_gen_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1376 ScenEditLandGenWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1377 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1378
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1379 static void ToolbarScenGenLand(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1380 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1381 HandleButtonClick(w, 11);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1382 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1383
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1384 AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1385 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1386
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
1387 void CcBuildTown(bool success, uint tile, uint32 p1, uint32 p2)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1388 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1389 if (success) {
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1390 SndPlayTileFx(SND_1F_SPLAT, tile);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1391 ResetObjectToPlace();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1392 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1393 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1394
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
1395 static void PlaceProc_Town(uint tile)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1396 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1397 DoCommandP(tile, 0, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1398 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1399
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1400
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1401 static const Widget _scen_edit_town_gen_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1402 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1403 { WWT_CAPTION, RESIZE_NONE, 7, 11, 159, 0, 13, STR_0233_TOWN_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1404 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 159, 14, 81, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1405 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 16, 27, STR_0234_NEW_TOWN, STR_0235_CONSTRUCT_NEW_TOWN},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1406 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 29, 40, STR_023D_RANDOM_TOWN, STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1407 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 157, 42, 53, STR_MANY_RANDOM_TOWNS, STR_RANDOM_TOWNS_TIP},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1408 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 53, 68, 79, STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1409 { WWT_TEXTBTN, RESIZE_NONE, 14, 54, 105, 68, 79, STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1410 { WWT_TEXTBTN, RESIZE_NONE, 14, 106, 157, 68, 79, STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1411 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1412 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1413
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1414 static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1415 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1416 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1417 case WE_PAINT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1418 w->click_state = (w->click_state & ~(1<<6 | 1<<7 | 1<<8) ) | (1 << (_new_town_size + 6));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1419 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1420 DrawStringCentered(80, 56, STR_02A5_TOWN_SIZE, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1421 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1422
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1423 case WE_CLICK:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1424 switch(e->click.widget) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1425 case 3: /* new town */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1426 HandlePlacePushButton(w, 3, 0xFF0, 1, PlaceProc_Town);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1427 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1428 case 4: {/* random town */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1429 Town *t;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1430
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1431 HandleButtonClick(w, 4);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1432 _generating_world = true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1433 t = CreateRandomTown();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1434 _generating_world = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1435 if (t != NULL)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1436 ScrollMainWindowToTile(t->xy);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1437 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1438 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1439 case 5: {/* many random towns */
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1440 HandleButtonClick(w, 5);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1441 _generating_world = true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1442 _game_mode = GM_NORMAL; // little hack to avoid towns of the same size
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1443 GenerateTowns();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1444 _generating_world = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1445 _game_mode = GM_EDITOR;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1446 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1447 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1448
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1449 case 6: case 7: case 8:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1450 _new_town_size = e->click.widget - 6;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1451 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1452 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1453 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1454 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1455
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1456 case WE_TIMEOUT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1457 UnclickSomeWindowButtons(w, 1<<4 | 1<<5);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1458 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1459 case WE_PLACE_OBJ:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1460 _place_proc(e->place.tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1461 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1462 case WE_ABORT_PLACE_OBJ:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1463 w->click_state = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1464 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1465 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1466 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1467 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1468
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1469 static const WindowDesc _scen_edit_town_gen_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1470 -1,-1, 160, 82,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1471 WC_SCEN_TOWN_GEN,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1472 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1473 _scen_edit_town_gen_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1474 ScenEditTownGenWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1475 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1476
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1477 static void ToolbarScenGenTown(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1478 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1479 HandleButtonClick(w, 12);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1480 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1481
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1482 AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1483 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1484
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1485
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1486 static const Widget _scenedit_industry_normal_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1487 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1488 { WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1489 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1490
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1491 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1492
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1493 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1494 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1495 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1496 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1497 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1498 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0245_OIL_RIG, STR_0267_CONSTRUCT_OIL_RIG_CAN_ONLY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1499 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1500 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1501 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1502 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0249_IRON_ORE_MINE, STR_026B_CONSTRUCT_IRON_ORE_MINE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1503 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1504 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 185, 196, STR_024B_BANK, STR_026D_CONSTRUCT_BANK_CAN_ONLY},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1505 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1506 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1507
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1508
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1509 static const Widget _scenedit_industry_hilly_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1510 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1511 { WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1512 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1513
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1514 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1515
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1516 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0240_COAL_MINE, STR_0262_CONSTRUCT_COAL_MINE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1517 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1518 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1519 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0243_FOREST, STR_0265_PLANT_FOREST},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1520 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1521 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1522 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1523 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_024F_GOLD_MINE, STR_0271_CONSTRUCT_GOLD_MINE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1524 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0248_FARM, STR_026A_CONSTRUCT_FARM},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1525 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1526 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1527 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1528 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1529
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1530 static const Widget _scenedit_industry_desert_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1531 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1532 { WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1533 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1534
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1535 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1536
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1537 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1538 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0251_FRUIT_PLANTATION, STR_0274_PLANT_FRUIT_PLANTATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1539 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0252_RUBBER_PLANTATION,STR_0275_PLANT_RUBBER_PLANTATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1540 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1541 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1542 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1543 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_0253_WATER_SUPPLY, STR_0276_CONSTRUCT_WATER_SUPPLY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1544 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_0248_FARM, STR_026A_CONSTRUCT_FARM},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1545 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1546 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_024A_OIL_WELLS, STR_026C_CONSTRUCT_OIL_WELLS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1547 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_024B_BANK, STR_0272_CONSTRUCT_BANK_CAN_ONLY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1548 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 185, 196, STR_0255_DIAMOND_MINE, STR_0278_CONSTRUCT_DIAMOND_MINE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1549 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 198, 209, STR_0256_COPPER_ORE_MINE, STR_0279_CONSTRUCT_COPPER_ORE_MINE},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1550 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1551 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1552
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1553 static const Widget _scenedit_industry_candy_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1554 { WWT_TEXTBTN, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1555 { WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_023F_INDUSTRY_GENERATION,STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1556 { WWT_IMGBTN, RESIZE_NONE, 7, 0, 169, 14, 224, 0x0, STR_NULL},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1557
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1558 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_MANY_RANDOM_INDUSTRIES, STR_RANDOM_INDUSTRIES_TIP},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1559
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1560 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0257_COTTON_CANDY_FOREST,STR_027A_PLANT_COTTON_CANDY_FOREST},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1561 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1562 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0259_BATTERY_FARM, STR_027C_CONSTRUCT_BATTERY_FARM},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1563 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81, 92, STR_025A_COLA_WELLS, STR_027D_CONSTRUCT_COLA_WELLS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1564 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94, 105, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1565 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107, 118, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1566 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120, 131, STR_025D_PLASTIC_FOUNTAINS, STR_0280_CONSTRUCT_PLASTIC_FOUNTAINS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1567 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133, 144, STR_025E_FIZZY_DRINK_FACTORY,STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1568 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146, 157, STR_025F_BUBBLE_GENERATOR, STR_0282_CONSTRUCT_BUBBLE_GENERATOR},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1569 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159, 170, STR_0260_TOFFEE_QUARRY, STR_0283_CONSTRUCT_TOFFEE_QUARRY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1570 { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 172, 183, STR_0261_SUGAR_MINE, STR_0284_CONSTRUCT_SUGAR_MINE},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1571 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1572 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1573
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1574 int _industry_type_to_place;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1575
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1576 static bool AnyTownExists() {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1577 Town *t;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1578 FOR_ALL_TOWNS(t) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1579 if (t->xy)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1580 return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1581 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1582 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1583 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1584
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1585 extern Industry *CreateNewIndustry(uint tile, int type);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1586
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1587 static bool TryBuildIndustry(TileIndex tile, int type)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1588 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1589 int n;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1590
7
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1591 if (CreateNewIndustry(tile, type)) return true;
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1592
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1593 n = 100;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1594 do {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1595 if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 1), type)) return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1596 } while (--n);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1597
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1598 n = 200;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1599 do {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1600 if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 2), type)) return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1601 } while (--n);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1602
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1603 n = 700;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1604 do {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1605 if (CreateNewIndustry(AdjustTileCoordRandomly(tile, 4), type)) return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1606 } while (--n);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1607
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1608 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1609 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1610
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1611
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1612 static const byte _industry_type_list[4][16] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1613 {0, 1, 2, 3, 4, 5, 6, 8, 9, 18, 11, 12},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1614 {0, 1, 14, 3, 4, 13, 7, 15, 9, 16, 11, 12},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1615 {25, 19, 20, 4, 13, 23, 21, 24, 22, 11, 16, 17, 10},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1616 {26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1617 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1618
7
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1619 bool _ignore_restrictions;
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1620
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1621 static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1622 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1623 int button;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1624
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1625 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1626 case WE_PAINT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1627 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1628 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1629
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1630 case WE_CLICK:
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1631 if ((button=e->click.widget) == 3) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1632 HandleButtonClick(w, 3);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1633
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1634 if (!AnyTownExists()) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1635 ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_CAN_T_GENERATE_INDUSTRIES, 0, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1636 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1637 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1638
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1639 _generating_world = true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1640 GenerateIndustries();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1641 _generating_world = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1642 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1643
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1644 if ((button=e->click.widget) >= 4) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1645 if (HandlePlacePushButton(w, button, 0xFF1, 1, NULL))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1646 _industry_type_to_place = _industry_type_list[_opt.landscape][button - 4];
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1647 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1648 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1649 case WE_PLACE_OBJ: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1650 int type;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1651
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1652 // Show error if no town exists at all
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1653 type = _industry_type_to_place;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1654 if (!AnyTownExists()) {
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
1655 SetDParam(0, type + STR_4802_COAL_MINE);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1656 ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST,STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1657 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1658 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1659
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1660 _current_player = OWNER_NONE;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1661 _generating_world = true;
7
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1662 _ignore_restrictions = true;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1663 if (!TryBuildIndustry(e->place.tile,type)) {
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
1664 SetDParam(0, type + STR_4802_COAL_MINE);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1665 ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1666 }
7
9f574a7877d4 (svn r8) Fix: Automatic oil refinery generation in editor
dominik <dominik@openttd.org>
parents: 2
diff changeset
1667 _ignore_restrictions = false;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1668 _generating_world = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1669 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1670 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1671 case WE_ABORT_PLACE_OBJ:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1672 w->click_state = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1673 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1674 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1675 case WE_TIMEOUT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1676 UnclickSomeWindowButtons(w, 1<<3);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1677 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1678 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1679 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1680
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1681 static const WindowDesc _scenedit_industry_normal_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1682 -1,-1, 170, 225,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1683 WC_SCEN_INDUSTRY,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1684 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1685 _scenedit_industry_normal_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1686 ScenEditIndustryWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1687 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1688
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1689 static const WindowDesc _scenedit_industry_hilly_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1690 -1,-1, 170, 225,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1691 WC_SCEN_INDUSTRY,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1692 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1693 _scenedit_industry_hilly_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1694 ScenEditIndustryWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1695 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1696
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1697 static const WindowDesc _scenedit_industry_desert_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1698 -1,-1, 170, 225,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1699 WC_SCEN_INDUSTRY,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1700 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1701 _scenedit_industry_desert_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1702 ScenEditIndustryWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1703 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1704
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1705 static const WindowDesc _scenedit_industry_candy_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1706 -1,-1, 170, 225,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1707 WC_SCEN_INDUSTRY,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1708 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1709 _scenedit_industry_candy_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1710 ScenEditIndustryWndProc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1711 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1712
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1713 static const WindowDesc * const _scenedit_industry_descs[] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1714 &_scenedit_industry_normal_desc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1715 &_scenedit_industry_hilly_desc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1716 &_scenedit_industry_desert_desc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1717 &_scenedit_industry_candy_desc,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1718 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1719
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1720
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1721 static void ToolbarScenGenIndustry(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1722 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1723 HandleButtonClick(w, 13);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1724 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1725 AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1726 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1727
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1728 static void ToolbarScenBuildRoad(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1729 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1730 HandleButtonClick(w, 14);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1731 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1732 ShowBuildRoadScenToolbar();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1733 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1734
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1735 static void ToolbarScenPlantTrees(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1736 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1737 HandleButtonClick(w, 15);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1738 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1739 ShowBuildTreesScenToolbar();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1740 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1741
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1742 static void ToolbarScenPlaceSign(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1743 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1744 HandleButtonClick(w, 16);
541
facaef10d233 (svn r925) Use sound enums
tron <tron@openttd.org>
parents: 534
diff changeset
1745 SndPlayFx(SND_15_BEEP);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1746 SelectSignTool();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1747 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1748
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1749 static void ToolbarBtn_NULL(Window *w)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1750 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1751 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1752
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1753 static ToolbarButtonProc* const _toolbar_button_procs[] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1754 ToolbarPauseClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1755 ToolbarFastForwardClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1756 ToolbarOptionsClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1757 ToolbarSaveClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1758 ToolbarMapClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1759 ToolbarTownClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1760 ToolbarSubsidiesClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1761 ToolbarStationsClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1762 ToolbarMoneyClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1763 ToolbarPlayersClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1764 ToolbarGraphsClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1765 ToolbarLeagueClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1766 ToolbarIndustryClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1767 ToolbarTrainClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1768 ToolbarRoadClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1769 ToolbarShipClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1770 ToolbarAirClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1771 ToolbarZoomInClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1772 ToolbarZoomOutClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1773 ToolbarBuildRailClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1774 ToolbarBuildRoadClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1775 ToolbarBuildWaterClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1776 ToolbarBuildAirClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1777 ToolbarForestClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1778 ToolbarMusicClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1779 ToolbarNewspaperClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1780 ToolbarHelpClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1781 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1782
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1783 static void MainToolbarWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1784 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1785 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1786 case WE_PAINT: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1787
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1788 // Draw brown-red toolbar bg.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1789 GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1790 GfxFillRect(0, 0, w->width-1, w->height-1, 0x80B4);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1791
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1792 // if spectator, disable things
1
ccd3560f672e (svn r2) -Fix [993829] UDP Fixes (lucaspiller)
darkvater <darkvater@openttd.org>
parents: 0
diff changeset
1793 if (_current_player == OWNER_SPECTATOR){
213
be54ec0c899d (svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater <darkvater@openttd.org>
parents: 206
diff changeset
1794 w->disabled_state |= (1 << 19) | (1<<20) | (1<<21) | (1<<22) | (1<<23);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1795 } else {
213
be54ec0c899d (svn r214) -Feature: CMD_NET_INSTANT [just in time command handling over network] (sign_de)
darkvater <darkvater@openttd.org>
parents: 206
diff changeset
1796 w->disabled_state &= ~((1 << 19) | (1<<20) | (1<<21) | (1<<22) | (1<<23));
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1797 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1798
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1799 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1800 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1801 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1802
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1803 case WE_CLICK: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1804 if (_game_mode != GM_MENU && !HASBIT(w->disabled_state, e->click.widget))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1805 _toolbar_button_procs[e->click.widget](w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1806 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1807
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1808 case WE_KEYPRESS: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1809 int local = _local_player;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1810 if (local == 0xff) local = 0; // spectator
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1811
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1812 switch(e->keypress.keycode) {
424
a7f052896f64 (svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron <tron@openttd.org>
parents: 410
diff changeset
1813 case WKC_F1:
a7f052896f64 (svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron <tron@openttd.org>
parents: 410
diff changeset
1814 case WKC_PAUSE:
a7f052896f64 (svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron <tron@openttd.org>
parents: 410
diff changeset
1815 ToolbarPauseClick(w);
a7f052896f64 (svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron <tron@openttd.org>
parents: 410
diff changeset
1816 break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1817 case WKC_F2: ShowGameOptions(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1818 case WKC_F3: MenuClickSaveLoad(0); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1819 case WKC_F4: ShowSmallMap(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1820 case WKC_F5: ShowTownDirectory(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1821 case WKC_F6: ShowSubsidiesList(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1822 case WKC_F7: ShowPlayerStations(local); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1823 case WKC_F8: ShowPlayerFinances(local); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1824 case WKC_F9: ShowPlayerCompany(local); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1825 case WKC_F10:ShowOperatingProfitGraph(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1826 case WKC_F11: ShowCompanyLeagueTable(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1827 case WKC_F12: ShowBuildIndustryWindow(); break;
588
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
1828 case WKC_SHIFT | WKC_F1: ShowPlayerTrains(local, -1); break;
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
1829 case WKC_SHIFT | WKC_F2: ShowPlayerRoadVehicles(local, -1); break;
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
1830 case WKC_SHIFT | WKC_F3: ShowPlayerShips(local, -1); break;
8efbed92db68 (svn r1009) -Feature: per-station vehicle lists
tron <tron@openttd.org>
parents: 582
diff changeset
1831 case WKC_SHIFT | WKC_F4: ShowPlayerAircraft(local, -1); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1832 case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1833 case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1834 case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype,-1); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1835 case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1836 case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1837 case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1838 case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1839 case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1840 case WKC_CTRL | 'S': _make_screenshot = 1; break;
130
c0c8c367b619 (svn r131) Completely changed hotkey from tab to backquote (not working in Windows yet)
dominik <dominik@openttd.org>
parents: 126
diff changeset
1841 case WKC_CTRL | 'G': _make_screenshot = 2; break;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
1842 case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1843 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1844 } break;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1845
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1846 case WE_PLACE_OBJ: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1847 _place_proc(e->place.tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1848 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1849
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1850 case WE_ABORT_PLACE_OBJ: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1851 w->click_state &= ~(1<<25);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1852 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1853 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1854
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1855 case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1856
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1857 case WE_MOUSELOOP:
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1858
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1859 if (((w->click_state) & 1) != (uint)!!_pause) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1860 w->click_state ^= (1 << 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1861 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1862 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
1863
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1864 if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1865 w->click_state ^= (1 << 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1866 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1867 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1868 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1869
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1870 case WE_TIMEOUT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1871 UnclickSomeWindowButtons(w, ~(1<<0 | 1<<1));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1872 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1873 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1874 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1875
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1876 static const Widget _toolb_normal_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1877 { WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1878 { WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_OPENTTD_BASE + 57, STR_FAST_FORWARD},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1879 { WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, 0x2EF, STR_0187_OPTIONS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1880 { WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, 0x2D4, STR_0172_SAVE_GAME_ABANDON_GAME},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1881
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1882 { WWT_PANEL, RESIZE_NONE, 14, 96, 117, 0, 21, 0x2C4, STR_0174_DISPLAY_MAP},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1883 { WWT_PANEL, RESIZE_NONE, 14, 118, 139, 0, 21, 0xFED, STR_0176_DISPLAY_TOWN_DIRECTORY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1884 { WWT_PANEL, RESIZE_NONE, 14, 140, 161, 0, 21, 0x2A7, STR_02DC_DISPLAY_SUBSIDIES},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1885 { WWT_PANEL, RESIZE_NONE, 14, 162, 183, 0, 21, 0x513, STR_0173_DISPLAY_LIST_OF_COMPANY},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1886
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1887 { WWT_PANEL, RESIZE_NONE, 14, 191, 212, 0, 21, 0x2E1, STR_0177_DISPLAY_COMPANY_FINANCES},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1888 { WWT_PANEL, RESIZE_NONE, 14, 213, 235, 0, 21, 0x2E7, STR_0178_DISPLAY_COMPANY_GENERAL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1889 { WWT_PANEL, RESIZE_NONE, 14, 236, 257, 0, 21, 0x2E9, STR_0179_DISPLAY_GRAPHS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1890 { WWT_PANEL, RESIZE_NONE, 14, 258, 279, 0, 21, 0x2AC, STR_017A_DISPLAY_COMPANY_LEAGUE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1891 { WWT_PANEL, RESIZE_NONE, 14, 280, 301, 0, 21, 0x2E5, STR_0312_FUND_CONSTRUCTION_OF_NEW},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1892
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1893 { WWT_PANEL, RESIZE_NONE, 14, 310, 331, 0, 21, 0x2DB, STR_017B_DISPLAY_LIST_OF_COMPANY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1894 { WWT_PANEL, RESIZE_NONE, 14, 332, 353, 0, 21, 0x2DC, STR_017C_DISPLAY_LIST_OF_COMPANY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1895 { WWT_PANEL, RESIZE_NONE, 14, 354, 375, 0, 21, 0x2DD, STR_017D_DISPLAY_LIST_OF_COMPANY},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1896 { WWT_PANEL, RESIZE_NONE, 14, 376, 397, 0, 21, 0x2DE, STR_017E_DISPLAY_LIST_OF_COMPANY},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1897
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1898 { WWT_PANEL, RESIZE_NONE, 14, 406, 427, 0, 21, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1899 { WWT_PANEL, RESIZE_NONE, 14, 428, 449, 0, 21, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1900
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1901 { WWT_PANEL, RESIZE_NONE, 14, 457, 478, 0, 21, 0x2D7, STR_0181_BUILD_RAILROAD_TRACK},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1902 { WWT_PANEL, RESIZE_NONE, 14, 479, 500, 0, 21, 0x2D8, STR_0182_BUILD_ROADS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1903 { WWT_PANEL, RESIZE_NONE, 14, 501, 522, 0, 21, 0x2D9, STR_0183_BUILD_SHIP_DOCKS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1904 { WWT_PANEL, RESIZE_NONE, 14, 523, 544, 0, 21, 0x2DA, STR_0184_BUILD_AIRPORTS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1905 { WWT_PANEL, RESIZE_NONE, 14, 545, 566, 0, 21, 0xFF3, STR_LANDSCAPING_TOOLBAR_TIP}, // tree icon is 0x2E6
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1906
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1907 { WWT_PANEL, RESIZE_NONE, 14, 574, 595, 0, 21, 0x2C9, STR_01D4_SHOW_SOUND_MUSIC_WINDOW},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1908 { WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, 0x2A8, STR_0203_SHOW_LAST_MESSAGE_NEWS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1909 { WWT_PANEL, RESIZE_NONE, 14, 618, 639, 0, 21, 0x2D3, STR_0186_LAND_BLOCK_INFORMATION},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1910 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1911 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1912
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1913 static const WindowDesc _toolb_normal_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1914 0, 0, 640, 22,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1915 WC_MAIN_TOOLBAR,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1916 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1917 _toolb_normal_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1918 MainToolbarWndProc
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1919 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1920
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1921 static const WindowDesc _toolb_intro_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1922 0, -22, 640, 22,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1923 WC_MAIN_TOOLBAR,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1924 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1925 _toolb_normal_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1926 MainToolbarWndProc
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1927 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1928
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1929
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1930 static const Widget _toolb_scen_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1931 { WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1932 { WWT_PANEL, RESIZE_NONE, 14, 22, 43, 0, 21, SPR_OPENTTD_BASE + 57, STR_FAST_FORWARD},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1933 { WWT_PANEL, RESIZE_NONE, 14, 44, 65, 0, 21, 0x2EF, STR_0187_OPTIONS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1934 { WWT_PANEL_2, RESIZE_NONE, 14, 66, 87, 0, 21, 0x2D4, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1935
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1936 { WWT_PANEL, RESIZE_NONE, 14, 96, 225, 0, 21, 0x0, STR_NULL},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1937
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1938 { WWT_PANEL, RESIZE_NONE, 14, 233, 362, 0, 21, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1939 { WWT_CLOSEBOX, RESIZE_NONE, 14, 236, 246, 5, 16, STR_0225, STR_029E_MOVE_THE_STARTING_DATE},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1940 { WWT_CLOSEBOX, RESIZE_NONE, 14, 347, 357, 5, 16, STR_0224, STR_029F_MOVE_THE_STARTING_DATE},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1941
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1942 { WWT_PANEL, RESIZE_NONE, 14, 371, 392, 0, 21, 0x2C4, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1943
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1944 { WWT_PANEL, RESIZE_NONE, 14, 400, 421, 0, 21, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1945 { WWT_PANEL, RESIZE_NONE, 14, 422, 443, 0, 21, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1946
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1947 { WWT_PANEL, RESIZE_NONE, 14, 452, 473, 0, 21, 0xFF3, STR_022E_LANDSCAPE_GENERATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1948 { WWT_PANEL, RESIZE_NONE, 14, 474, 495, 0, 21, 0xFED, STR_022F_TOWN_GENERATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1949 { WWT_PANEL, RESIZE_NONE, 14, 496, 517, 0, 21, 0x2E5, STR_0230_INDUSTRY_GENERATION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1950 { WWT_PANEL, RESIZE_NONE, 14, 518, 539, 0, 21, 0x2D8, STR_0231_ROAD_CONSTRUCTION},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1951 { WWT_PANEL, RESIZE_NONE, 14, 540, 561, 0, 21, 0x2E6, STR_0288_PLANT_TREES},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1952 { WWT_PANEL, RESIZE_NONE, 14, 562, 583, 0, 21, 0xFF2, STR_0289_PLACE_SIGN},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1953
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1954 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1955 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1956 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1957 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1958 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1959 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1960 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1961 { WWT_PANEL, RESIZE_NONE, 14, 596, 617, 0, 21, 0x2C9, STR_01D4_SHOW_SOUND_MUSIC_WINDOW},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1962 { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
1963 { WWT_PANEL, RESIZE_NONE, 14, 618, 639, 0, 21, 0x2D3, STR_0186_LAND_BLOCK_INFORMATION},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
1964 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1965 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1966
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1967 static ToolbarButtonProc* const _scen_toolbar_button_procs[] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1968 ToolbarPauseClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1969 ToolbarFastForwardClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1970 ToolbarOptionsClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1971 ToolbarScenSaveOrLoad,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1972 ToolbarBtn_NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1973 ToolbarBtn_NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1974 ToolbarScenDateBackward,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1975 ToolbarScenDateForward,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1976 ToolbarScenMapTownDir,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1977 ToolbarScenZoomIn,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1978 ToolbarScenZoomOut,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1979 ToolbarScenGenLand,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1980 ToolbarScenGenTown,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1981 ToolbarScenGenIndustry,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1982 ToolbarScenBuildRoad,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1983 ToolbarScenPlantTrees,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1984 ToolbarScenPlaceSign,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1985 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1986 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1987 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1988 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1989 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1990 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1991 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1992 ToolbarMusicClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1993 NULL,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1994 ToolbarHelpClick,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1995 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1996
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1997 static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1998 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
1999 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2000 case WE_PAINT:
349
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2001 /* XXX look for better place for these */
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2002 if (_date <= MinDate)
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2003 SETBIT(w->disabled_state, 6);
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2004 else
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2005 CLRBIT(w->disabled_state, 6);
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2006 if (_date >= MaxDate)
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2007 SETBIT(w->disabled_state, 7);
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2008 else
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2009 CLRBIT(w->disabled_state, 7);
5272f0b0a42b (svn r532) Disable date change buttons in scenario editor if date limit is reached.
tron <tron@openttd.org>
parents: 337
diff changeset
2010
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2011 // Draw brown-red toolbar bg.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2012 GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2013 GfxFillRect(0, 0, w->width-1, w->height-1, 0x80B4);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2014
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2015 DrawWindowWidgets(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2016
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2017 SetDParam(0, _date);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2018 DrawStringCentered(298, 6, STR_00AF, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2019
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2020 SetDParam(0, _date);
74
ede669f0e0bd (svn r75) -Add proper crediting to graphics artists to about box.
darkvater <darkvater@openttd.org>
parents: 68
diff changeset
2021 DrawStringCentered(161, 1, STR_0221_OPENTTD, 0);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2022 DrawStringCentered(161, 11,STR_0222_SCENARIO_EDITOR, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2023
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2024 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2025
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2026 case WE_CLICK: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2027 if (_game_mode == GM_MENU)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2028 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2029 _scen_toolbar_button_procs[e->click.widget](w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2030 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2031
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2032 case WE_KEYPRESS: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2033 switch(e->keypress.keycode) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2034 case WKC_F1: ToolbarPauseClick(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2035 case WKC_F2: ShowGameOptions(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2036 case WKC_F3: MenuClickSaveLoad(0); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2037 case WKC_F4: ToolbarScenGenLand(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2038 case WKC_F5: ToolbarScenGenTown(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2039 case WKC_F6: ToolbarScenGenIndustry(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2040 case WKC_F7: ToolbarScenBuildRoad(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2041 case WKC_F8: ToolbarScenPlantTrees(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2042 case WKC_F9: ToolbarScenPlaceSign(w); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2043 case WKC_F10: ShowMusicWindow(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2044 case WKC_F11: PlaceLandBlockInfo(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2045 case WKC_CTRL | 'S': _make_screenshot = 1; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2046 case WKC_CTRL | 'G': _make_screenshot = 2; break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2047 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2048 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2049 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2050
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2051 case WE_PLACE_OBJ: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2052 _place_proc(e->place.tile);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2053 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2054
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2055 case WE_ABORT_PLACE_OBJ: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2056 w->click_state &= ~(1<<25);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2057 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2058 } break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2059
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2060 case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2061
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2062 case WE_MOUSELOOP:
24
66fa5b996bba (svn r25) Fix: [ 1007630 ] Scenario editor pause bug
dominik <dominik@openttd.org>
parents: 7
diff changeset
2063 if (((w->click_state) & 1) != (uint)!!_pause) {
66fa5b996bba (svn r25) Fix: [ 1007630 ] Scenario editor pause bug
dominik <dominik@openttd.org>
parents: 7
diff changeset
2064 w->click_state ^= (1 << 0);
66fa5b996bba (svn r25) Fix: [ 1007630 ] Scenario editor pause bug
dominik <dominik@openttd.org>
parents: 7
diff changeset
2065 SetWindowDirty(w);
66fa5b996bba (svn r25) Fix: [ 1007630 ] Scenario editor pause bug
dominik <dominik@openttd.org>
parents: 7
diff changeset
2066 }
66fa5b996bba (svn r25) Fix: [ 1007630 ] Scenario editor pause bug
dominik <dominik@openttd.org>
parents: 7
diff changeset
2067
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2068 if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2069 w->click_state ^= (1 << 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2070 SetWindowDirty(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2071 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2072 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2073
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2074 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2075 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2076
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2077 static const WindowDesc _toolb_scen_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2078 0, 0, 640, 22,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2079 WC_MAIN_TOOLBAR,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2080 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2081 _toolb_scen_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2082 ScenEditToolbarWndProc
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2083 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2084
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2085 extern GetNewsStringCallbackProc * const _get_news_string_callback[];
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2086
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2087
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2088 static bool DrawScrollingStatusText(NewsItem *ni, int pos)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2089 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2090 StringID str;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2091 byte *s, *d;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2092 DrawPixelInfo tmp_dpi, *old_dpi;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2093 int x;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2094 byte buffer[256];
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2095
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2096 if (ni->display_mode == 3) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2097 str = _get_news_string_callback[ni->callback](ni);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2098 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2099 COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2100 str = ni->string_id;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2101 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2102
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2103 GetString(str_buffr, str);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2104 assert(strlen(str_buffr) < sizeof(str_buffr) - 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2105
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2106 s = str_buffr;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2107 d = buffer;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2108
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2109 for(;;s++) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2110 if (*s == 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2111 *d = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2112 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2113 } else if (*s == 0x0D) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2114 d[0] = d[1] = d[2] = d[3] = ' ';
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2115 d+=4;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2116 } else if (*s >= ' ' && (*s < 0x88 || *s >= 0x99)) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2117 *d++ = *s;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2118 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2119 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2120
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2121 if (!FillDrawPixelInfo(&tmp_dpi, NULL, 141, 1, 358, 11))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2122 return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2123
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2124 old_dpi = _cur_dpi;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2125 _cur_dpi = &tmp_dpi;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2126
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2127 x = DoDrawString(buffer, pos, 0, 13);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2128 _cur_dpi = old_dpi;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2129
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2130 return x > 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2131 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2132
410
e165d1275350 (svn r607) -Patch: [ 985102 ] static cleanup
tron <tron@openttd.org>
parents: 395
diff changeset
2133 static void StatusBarWndProc(Window *w, WindowEvent *e)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2134 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2135 Player *p;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2136
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2137 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2138 case WE_PAINT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2139 DrawWindowWidgets(w);
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2140 SetDParam(0, _date);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2141 DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2142
1
ccd3560f672e (svn r2) -Fix [993829] UDP Fixes (lucaspiller)
darkvater <darkvater@openttd.org>
parents: 0
diff changeset
2143 p = _local_player == OWNER_SPECTATOR ? NULL : DEREF_PLAYER(_local_player);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2144
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2145 if (p) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2146 // Draw player money
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2147 SetDParam64(0, p->money64);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2148 DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2149 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2150
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2151 // Draw status bar
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2152 if (_do_autosave) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2153 DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2154 } else if (_pause) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2155 DrawStringCentered(320, 1, STR_0319_PAUSED, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2156 } else if (WP(w,def_d).data_1 > -1280 && FindWindowById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2157 // Draw the scrolling news text
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2158 if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2159 WP(w,def_d).data_1 = -1280;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2160 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2161 if (p) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2162 // This is the default text
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2163 SetDParam(0, p->name_1);
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
2164 SetDParam(1, p->name_2);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2165 DrawStringCentered(320, 1, STR_02BA, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2166 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2167 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2168 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2169
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2170 case WE_CLICK:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2171 if (e->click.widget == 1) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2172 ShowLastNewsMessage();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2173 } else if (e->click.widget == 2) {
1
ccd3560f672e (svn r2) -Fix [993829] UDP Fixes (lucaspiller)
darkvater <darkvater@openttd.org>
parents: 0
diff changeset
2174 if (_local_player != OWNER_SPECTATOR) ShowPlayerFinances(_local_player);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2175 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2176 ResetObjectToPlace();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2177 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2178 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2179
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2180 case WE_TICK: {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2181 if (_pause || WP(w,def_d).data_1 <= -1280)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2182 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2183 WP(w,def_d).data_1 -= 2;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2184 InvalidateWidget(w, 1);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2185 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2186 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2187 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2188 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2189
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2190 static void ScrollMainViewport(int x, int y)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2191 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2192 if (_game_mode != GM_MENU) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2193 Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2194 assert(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2195
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2196 WP(w,vp_d).scrollpos_x += x << w->viewport->zoom;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2197 WP(w,vp_d).scrollpos_y += y << w->viewport->zoom;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2198 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2199 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2200
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2201
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2202 static const Widget _main_status_widgets[] = {
867
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
2203 { WWT_IMGBTN, RESIZE_NONE, 14, 0, 139, 0, 11, 0x0, STR_NULL},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
2204 { WWT_PUSHIMGBTN, RESIZE_NONE, 14, 140, 499, 0, 11, 0x0, STR_02B7_SHOW_LAST_MESSAGE_OR_NEWS},
1aec4e551f7a (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight <truelight@openttd.org>
parents: 815
diff changeset
2205 { WWT_PUSHIMGBTN, RESIZE_NONE, 14, 500, 639, 0, 11, 0x0, STR_NULL},
176
5ff3972188b5 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater <darkvater@openttd.org>
parents: 168
diff changeset
2206 { WIDGETS_END},
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2207 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2208
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2209 static WindowDesc _main_status_desc = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2210 WDP_CENTER, 0, 640, 12,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2211 WC_STATUS_BAR,0,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2212 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2213 _main_status_widgets,
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2214 StatusBarWndProc
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2215 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2216
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2217 extern void DebugProc(int i);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2218
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2219 static void MainWindowWndProc(Window *w, WindowEvent *e) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2220 int off_x;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2221
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2222 switch(e->event) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2223 case WE_PAINT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2224 DrawWindowViewport(w);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2225 if (_game_mode == GM_MENU) {
581
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2226 off_x = _screen.width / 2;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2227
582
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2228 DrawSprite(SPR_OTTD_O, off_x - 120, 50);
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2229 DrawSprite(SPR_OTTD_P, off_x - 86, 50);
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2230 DrawSprite(SPR_OTTD_E, off_x - 53, 50);
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2231 DrawSprite(SPR_OTTD_N, off_x - 22, 50);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2232
582
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2233 DrawSprite(SPR_OTTD_T, off_x + 34, 50);
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2234 DrawSprite(SPR_OTTD_T, off_x + 65, 50);
ee78fee6f0b8 (svn r1002) -Fixed the placement of the OpenTTD logo a bit (thx Jango).
darkvater <darkvater@openttd.org>
parents: 581
diff changeset
2235 DrawSprite(SPR_OTTD_D, off_x + 96, 50);
670
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2236
581
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2237 /*
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2238 DrawSprite(SPR_OTTD_R, off_x + 119, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2239 DrawSprite(SPR_OTTD_A, off_x + 148, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2240 DrawSprite(SPR_OTTD_N, off_x + 181, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2241 DrawSprite(SPR_OTTD_S, off_x + 215, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2242 DrawSprite(SPR_OTTD_P, off_x + 246, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2243 DrawSprite(SPR_OTTD_O, off_x + 275, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2244 DrawSprite(SPR_OTTD_R, off_x + 307, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2245 DrawSprite(SPR_OTTD_T, off_x + 337, 50);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2246
581
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2247 DrawSprite(SPR_OTTD_T, off_x + 390, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2248 DrawSprite(SPR_OTTD_Y, off_x + 417, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2249 DrawSprite(SPR_OTTD_C, off_x + 447, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2250 DrawSprite(SPR_OTTD_O, off_x + 478, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2251 DrawSprite(SPR_OTTD_O, off_x + 509, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2252 DrawSprite(SPR_OTTD_N, off_x + 541, 50);
aaef8287a2b5 (svn r1001) -Changed the title name to OpenTTD. Don't know how this was missed all this time; but is fixed now.
darkvater <darkvater@openttd.org>
parents: 545
diff changeset
2253 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2254 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2255 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2256
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2257 case WE_KEYPRESS:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2258 if (_game_mode == GM_MENU)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2259 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2260
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2261 // this is a hack, but this needs to be called at a constant interval and i found
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2262 // no other window event that was suited for that purpose.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2263 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2264 static const int8 scrollamt[16][2] = {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2265 {0,0},
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2266 {-1,0}, // 1:left
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2267 {0,-1}, // 2:up
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2268 {-1,-1}, // 3:left + up
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2269 {1,0}, // 4:right
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2270 {0,0}, // 5:left + right
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2271 {1,-1}, // 6:right + up
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2272 {0,0}, // 7:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2273 {0,1}, // 8:down
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2274 {-1,1}, // 9:down+left
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2275 {0,0}, // 10:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2276 {0,0}, // 11:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2277 {1,1}, // 12:down+right
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2278 {0,0}, // 13:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2279 {0,0}, // 14:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2280 {0,0}, // 15:impossible
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2281 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2282
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2283 if (_dirkeys) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2284 int factor = _shift_pressed ? 50 : 10;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2285 ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2286 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2287 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2288
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2289 switch(e->keypress.keycode) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2290 case 'C':
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2291 case 'Z': {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2292 Point pt;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2293 pt = GetTileBelowCursor();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2294 if (pt.x != -1) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2295 ScrollMainWindowTo(pt.x, pt.y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2296 if (e->keypress.keycode == 'Z')
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2297 MaxZoomIn();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2298 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2299 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2300 }
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2301
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2302 case WKC_ESC: ResetObjectToPlace(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2303 case WKC_DELETE: DeleteNonVitalWindows(); break;
763
4541b589b440 (svn r1225) -Feature: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
darkvater <darkvater@openttd.org>
parents: 758
diff changeset
2304 case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2305 case 'Q' | WKC_CTRL: AskExitGame(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2306 case 'Q' | WKC_META: AskExitGame(); break; // this enables command + Q on mac
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2307 case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2308 case '0' | WKC_ALT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2309 case '1' | WKC_ALT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2310 case '2' | WKC_ALT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2311 case '3' | WKC_ALT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2312 case '4' | WKC_ALT:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2313 #if defined(_DEBUG)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2314 DebugProc(e->keypress.keycode - ('0' | WKC_ALT));
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2315 #endif
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2316 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2317 case 'A' | WKC_CTRL:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2318 disable_computer^=1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2319 ShowInfoF("Disable Computer: %s", disable_computer?"ON":"OFF");
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2320 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2321 case 'B' | WKC_CTRL:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2322 _local_player^=1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2323 ShowInfoF("Play as computer: %s", _local_player?"ON":"OFF");
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2324 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2325
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2326 // invoke autorail
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2327 case 'A':
658
ddf579d411f5 (svn r1092) Fix: Autorail can be accessed with the 'a' hotkey again
dominik <dominik@openttd.org>
parents: 649
diff changeset
2328 ShowBuildRailToolbar(_last_built_railtype, 4);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2329 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2330
670
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2331 case 'L':
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2332 ShowTerraformToolbar();
616
1d833077cb3e (svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik <dominik@openttd.org>
parents: 611
diff changeset
2333 break;
1d833077cb3e (svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik <dominik@openttd.org>
parents: 611
diff changeset
2334
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2335 case 'X':
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2336 _display_opt ^= DO_TRANS_BUILDINGS;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2337 MarkWholeScreenDirty();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2338 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2339
670
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2340 case WKC_BACKQUOTE:
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2341 IConsoleSwitch();
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2342 e->keypress.cont=false;
616
1d833077cb3e (svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik <dominik@openttd.org>
parents: 611
diff changeset
2343 break;
1d833077cb3e (svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik <dominik@openttd.org>
parents: 611
diff changeset
2344
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
2345 #ifdef ENABLE_NETWORK
649
323b2478d40f (svn r1082) Feature: Chat toolbar
dominik <dominik@openttd.org>
parents: 616
diff changeset
2346 case WKC_RETURN:
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
2347 case 'T' | WKC_SHIFT:
649
323b2478d40f (svn r1082) Feature: Chat toolbar
dominik <dominik@openttd.org>
parents: 616
diff changeset
2348 if(_networking)
323b2478d40f (svn r1082) Feature: Chat toolbar
dominik <dominik@openttd.org>
parents: 616
diff changeset
2349 ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
2350 break;
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
2351 #endif /* ENABLE_NETWORK */
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 541
diff changeset
2352
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2353 default:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2354 return;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2355 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2356 e->keypress.cont = false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2357 break;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2358
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2359 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2360 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2361
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2362
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2363 void ShowSelectGameWindow();
774
d283468242cb (svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater <darkvater@openttd.org>
parents: 763
diff changeset
2364 extern void ShowJoinStatusWindowAfterJoin(void);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2365
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2366 void SetupColorsAndInitialWindow()
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2367 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2368 int i;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2369 byte *b;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2370 Window *w;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2371 int width,height;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2372
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2373 for(i=0; i!=16; i++) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2374 b = GetSpritePtr(0x307 + i);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2375 assert(b);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2376 _color_list[i] = *(ColorList*)(b + 0xC6);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2377 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2378
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2379 width = _screen.width;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2380 height = _screen.height;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2381
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2382 // XXX: these are not done
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2383 switch(_game_mode) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2384 case GM_MENU:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2385 w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2386 AssignWindowViewport(w, 0, 0, width, height, 0x8080, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2387 // w = AllocateWindowDesc(&_toolb_intro_desc);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2388 // w->flags4 &= ~WF_WHITE_BORDER_MASK;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2389 ShowSelectGameWindow();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2390 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2391 case GM_NORMAL:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2392 w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2393 AssignWindowViewport(w, 0, 0, width, height, 0x8080, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2394
983
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2395 ShowVitalWindows();
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2396
670
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2397 /* Bring joining GUI to front till the client is really joined */
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2398 if (_networking && !_network_server)
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2399 ShowJoinStatusWindowAfterJoin();
71f169a75456 (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight <truelight@openttd.org>
parents: 658
diff changeset
2400
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2401 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2402 case GM_EDITOR:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2403 w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2404 AssignWindowViewport(w, 0, 0, width, height, 0, 0);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2405
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2406 w = AllocateWindowDesc(&_toolb_scen_desc);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2407 w->disabled_state = 1 << 9;
983
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2408 CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 176
diff changeset
2409
68
28ff454d9a4f (svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater <darkvater@openttd.org>
parents: 24
diff changeset
2410 PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_scen_desc)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2411 break;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2412 default:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2413 NOT_REACHED();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2414 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2415 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2416
983
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2417 void ShowVitalWindows(void)
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2418 {
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2419 Window *w;
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2420
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2421 w = AllocateWindowDesc(&_toolb_normal_desc);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2422 w->disabled_state = 1 << 17; // disable zoom-in button (by default game is zoomed in)
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2423 CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2424
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2425 if (_networking) { // if networking, disable fast-forward button
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2426 SETBIT(w->disabled_state, 1);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2427 if (!_network_server) // if not server, disable pause button
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2428 SETBIT(w->disabled_state, 0);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2429 }
1019
a825628bb84c (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron <tron@openttd.org>
parents: 1015
diff changeset
2430
983
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2431 PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_desc)
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2432
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2433 _main_status_desc.top = _screen.height - 12;
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2434 w = AllocateWindowDesc(&_main_status_desc);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2435 CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2436
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2437 WP(w,def_d).data_1 = -1280;
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2438 }
e681e8f26bf2 (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater <darkvater@openttd.org>
parents: 970
diff changeset
2439
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2440 void GameSizeChanged()
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2441 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2442 RelocateAllWindows(_screen.width, _screen.height);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2443 ScreenSizeChanged();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2444 MarkWholeScreenDirty();
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
2445 }