author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9652 | 0405e98d8e96 |
child 9913 | d9ce89020cc0 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8994
diff
changeset
|
3 |
/** @file main_gui.cpp Handling of the main viewport. */ |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1885
diff
changeset
|
6 |
#include "openttd.h" |
2292 | 7 |
#include "currency.h" |
1349
15979a2e9001
(svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
1336
diff
changeset
|
8 |
#include "spritecache.h" |
0 | 9 |
#include "gui.h" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
10 |
#include "window_gui.h" |
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
11 |
#include "window_func.h" |
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
12 |
#include "textbuf_gui.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8214
diff
changeset
|
13 |
#include "viewport_func.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
14 |
#include "command_func.h" |
8976
1a8367713b73
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
8975
diff
changeset
|
15 |
#include "news_gui.h" |
9336 | 16 |
#include "console_gui.h" |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
17 |
#include "waypoint.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
18 |
#include "genworld.h" |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
19 |
#include "transparency_gui.h" |
8140
0d0d8c94f84b
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8139
diff
changeset
|
20 |
#include "date_func.h" |
8131
160939e24ed3
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8123
diff
changeset
|
21 |
#include "functions.h" |
8157
1505def01945
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8149
diff
changeset
|
22 |
#include "sound_func.h" |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
7824
diff
changeset
|
23 |
#include "transparency.h" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8111
diff
changeset
|
24 |
#include "strings_func.h" |
8123
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8121
diff
changeset
|
25 |
#include "zoom_func.h" |
8214
971f861d5543
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8208
diff
changeset
|
26 |
#include "string_func.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8224
diff
changeset
|
27 |
#include "player_base.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8224
diff
changeset
|
28 |
#include "player_func.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8224
diff
changeset
|
29 |
#include "player_gui.h" |
8270
e7c342f6b14c
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8264
diff
changeset
|
30 |
#include "settings_type.h" |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
8615
diff
changeset
|
31 |
#include "toolbar_gui.h" |
9248
5c057d6b7e21
(svn r13114) -Codechange: use InvalidateData instead of direct window access to modify the state of the statusbar from outside the statusbar.
rubidium
parents:
9240
diff
changeset
|
32 |
#include "statusbar_gui.h" |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8857
diff
changeset
|
33 |
#include "variables.h" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9116
diff
changeset
|
34 |
#include "tilehighlight_func.h" |
0 | 35 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
36 |
#include "network/network.h" |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9413
diff
changeset
|
37 |
#include "network/network_func.h" |
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
38 |
#include "network/network_gui.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
39 |
|
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
40 |
#include "table/sprites.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
41 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
42 |
|
5413 | 43 |
static int _rename_id = 1; |
44 |
static int _rename_what = -1; |
|
0 | 45 |
|
6847
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
46 |
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2) |
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
47 |
{ |
6898
d23c46e9a6ec
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
6857
diff
changeset
|
48 |
#ifdef ENABLE_NETWORK |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
49 |
if (!success || !_settings_game.economy.give_money) return; |
6847
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
50 |
|
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
51 |
char msg[20]; |
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
52 |
/* Inform the player of this action */ |
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
53 |
snprintf(msg, sizeof(msg), "%d", p1); |
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
54 |
|
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
55 |
if (!_network_server) { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9413
diff
changeset
|
56 |
NetworkClientSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg); |
6847
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
57 |
} else { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9413
diff
changeset
|
58 |
NetworkServerSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX); |
6847
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
59 |
} |
6898
d23c46e9a6ec
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
6857
diff
changeset
|
60 |
#endif /* ENABLE_NETWORK */ |
6847
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
61 |
} |
77facd267574
(svn r10087) -Fix [FS#834]: multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once.
rubidium
parents:
6845
diff
changeset
|
62 |
|
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
63 |
void HandleOnEditText(const char *str) |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
64 |
{ |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
65 |
int id = _rename_id; |
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
66 |
_cmd_text = str; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
67 |
|
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
68 |
switch (_rename_what) { |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
69 |
case 1: // Rename a waypoint |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
70 |
if (*str == '\0') return; |
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
355
diff
changeset
|
71 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME)); |
0 | 72 |
break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
73 |
#ifdef ENABLE_NETWORK |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
74 |
case 3: { // Give money, you can only give money in excess of loan |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
75 |
const Player *p = GetPlayer(_current_player); |
7505
55e7acbf7a69
(svn r11020) -Fix [FS#1174]: One could not give money when (s)he had too much money or rather: when casting the amount of money to an int32 becomes negative.
rubidium
parents:
7480
diff
changeset
|
76 |
Money money = min(p->player_money - p->current_loan, (Money)(atoi(str) / _currency->rate)); |
1799
6d82d202c145
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
77 |
|
7922
a7e266f966d9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
7889
diff
changeset
|
78 |
uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0 |
813
640a517dc129
(svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight
parents:
793
diff
changeset
|
79 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
80 |
/* Give 'id' the money, and substract it from ourself */ |
6990
136a08baf0ed
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
6953
diff
changeset
|
81 |
DoCommandP(0, money_c, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS)); |
6492
286a52449b54
(svn r9673) -Cleanup: remove spaces before tabs and replace non-indenting tabs with spaces.
rubidium
parents:
6486
diff
changeset
|
82 |
} break; |
5413 | 83 |
#endif /* ENABLE_NETWORK */ |
84 |
default: NOT_REACHED(); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
85 |
} |
5413 | 86 |
|
87 |
_rename_id = _rename_what = -1; |
|
0 | 88 |
} |
89 |
||
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
90 |
/** |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
91 |
* This code is shared for the majority of the pushbuttons. |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
92 |
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
93 |
* |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
94 |
* @param w Window which called the function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
95 |
* @param widget ID of the widget (=button) that called this function |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
96 |
* @param cursor How should the cursor image change? E.g. cursor with depot image in it |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
97 |
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
98 |
* @param placeproc Procedure which will be called when someone clicks on the map |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
99 |
* @return true if the button is clicked, false if it's unclicked |
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
100 |
*/ |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7857
diff
changeset
|
101 |
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc) |
0 | 102 |
{ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7954
diff
changeset
|
103 |
if (w->IsWidgetDisabled(widget)) return false; |
0 | 104 |
|
2621
2bacc2e9c68f
(svn r3159) Remove the read-only variable _no_button_sound
tron
parents:
2615
diff
changeset
|
105 |
SndPlayFx(SND_15_BEEP); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9111
diff
changeset
|
106 |
w->SetDirty(); |
0 | 107 |
|
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7954
diff
changeset
|
108 |
if (w->IsWidgetLowered(widget)) { |
0 | 109 |
ResetObjectToPlace(); |
110 |
return false; |
|
111 |
} |
|
112 |
||
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5601
diff
changeset
|
113 |
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7954
diff
changeset
|
114 |
w->LowerWidget(widget); |
0 | 115 |
_place_proc = placeproc; |
116 |
return true; |
|
117 |
} |
|
118 |
||
119 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
120 |
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 121 |
{ |
541 | 122 |
if (success) SndPlayTileFx(SND_12_EXPLOSION, tile); |
0 | 123 |
} |
124 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
125 |
#ifdef ENABLE_NETWORK |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4824
diff
changeset
|
126 |
void ShowNetworkGiveMoneyWindow(PlayerID player) |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
127 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
128 |
_rename_id = player; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
129 |
_rename_what = 3; |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
130 |
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
131 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
132 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
133 |
|
2116 | 134 |
void ShowRenameWaypointWindow(const Waypoint *wp) |
0 | 135 |
{ |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
136 |
int id = wp->index; |
697
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
137 |
|
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
138 |
/* Are we allowed to change the name of the waypoint? */ |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
139 |
if (!CheckTileOwnership(wp->xy)) { |
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
872
diff
changeset
|
140 |
ShowErrorMessage(_error_message, STR_CANT_CHANGE_WAYPOINT_NAME, |
3422
a6eba3443452
(svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty
celestar
parents:
3326
diff
changeset
|
141 |
TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE); |
697
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
142 |
return; |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
143 |
} |
eaada71b7c85
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
144 |
|
0 | 145 |
_rename_id = id; |
146 |
_rename_what = 1; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
147 |
SetDParam(0, id); |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5413
diff
changeset
|
148 |
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL); |
0 | 149 |
} |
150 |
||
151 |
||
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
152 |
/* Zooms a viewport in a window in or out */ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
153 |
/* No button handling or what so ever */ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
154 |
bool DoZoomInOutWindow(int how, Window *w) |
0 | 155 |
{ |
156 |
ViewPort *vp; |
|
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
157 |
|
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
158 |
assert(w != NULL); |
0 | 159 |
vp = w->viewport; |
160 |
||
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
161 |
switch (how) { |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
162 |
case ZOOM_IN: |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
163 |
if (vp->zoom == ZOOM_LVL_MIN) return false; |
8095
f834186120af
(svn r11656) -Codechange: add ZOOM_LVL_BEGIN and postfix operators so ZoomLevel can be used in some iterations
smatz
parents:
8082
diff
changeset
|
164 |
vp->zoom = (ZoomLevel)((int)vp->zoom - 1); |
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
165 |
vp->virtual_width >>= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
166 |
vp->virtual_height >>= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
167 |
|
9184 | 168 |
w->viewport->scrollpos_x += vp->virtual_width >> 1; |
169 |
w->viewport->scrollpos_y += vp->virtual_height >> 1; |
|
170 |
w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x; |
|
171 |
w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y; |
|
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
172 |
break; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
173 |
case ZOOM_OUT: |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
174 |
if (vp->zoom == ZOOM_LVL_MAX) return false; |
8095
f834186120af
(svn r11656) -Codechange: add ZOOM_LVL_BEGIN and postfix operators so ZoomLevel can be used in some iterations
smatz
parents:
8082
diff
changeset
|
175 |
vp->zoom = (ZoomLevel)((int)vp->zoom + 1); |
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
176 |
|
9184 | 177 |
w->viewport->scrollpos_x -= vp->virtual_width >> 1; |
178 |
w->viewport->scrollpos_y -= vp->virtual_height >> 1; |
|
179 |
w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x; |
|
180 |
w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y; |
|
5044
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
181 |
|
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
182 |
vp->virtual_width <<= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
183 |
vp->virtual_height <<= 1; |
e4e5bcdd79c6
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
184 |
break; |
0 | 185 |
} |
5214
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
186 |
if (vp != NULL) { // the vp can be null when how == ZOOM_NONE |
9184 | 187 |
vp->virtual_left = w->viewport->scrollpos_x; |
188 |
vp->virtual_top = w->viewport->scrollpos_y; |
|
5214
62a0325b53c7
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
189 |
} |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9111
diff
changeset
|
190 |
w->SetDirty(); |
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
191 |
/* Update the windows that have zoom-buttons to perhaps disable their buttons */ |
9165
6f26cc347e7a
(svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium
parents:
9142
diff
changeset
|
192 |
InvalidateThisWindowData(w); |
0 | 193 |
return true; |
194 |
} |
|
195 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
196 |
void ZoomInOrOutToCursorWindow(bool in, Window *w) |
0 | 197 |
{ |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
8615
diff
changeset
|
198 |
assert(w != NULL); |
0 | 199 |
|
4536
d532b2611952
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
200 |
if (_game_mode != GM_MENU) { |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
8615
diff
changeset
|
201 |
ViewPort *vp = w->viewport; |
6626
207875b9069a
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6624
diff
changeset
|
202 |
if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX)) |
0 | 203 |
return; |
204 |
||
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
8615
diff
changeset
|
205 |
Point pt = GetTileZoomCenterWindow(in,w); |
0 | 206 |
if (pt.x != -1) { |
6730
9311a208f8f7
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
6691
diff
changeset
|
207 |
ScrollWindowTo(pt.x, pt.y, w, true); |
0 | 208 |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
135
diff
changeset
|
209 |
DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w); |
0 | 210 |
} |
211 |
} |
|
212 |
} |
|
213 |
||
6247 | 214 |
extern void UpdateAllStationVirtCoord(); |
0 | 215 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
216 |
struct MainWindow : Window |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
217 |
{ |
9301
3b20dfb6c4e8
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
9285
diff
changeset
|
218 |
MainWindow(int width, int height) : Window(0, 0, width, height, WC_MAIN_WINDOW, NULL) |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
219 |
{ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
220 |
InitializeWindowViewport(this, 0, 0, width, height, TileXY(32, 32), ZOOM_LVL_VIEWPORT); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
221 |
} |
7643
af32b07bc027
(svn r11174) -Codechange: add possibility to show the bounding boxes of sprites using CTRL-B so one can get a better understanding of the used bounding boxes to fix the glitches that still exist. Patch by frosch.
rubidium
parents:
7521
diff
changeset
|
222 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
223 |
virtual void OnPaint() |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
224 |
{ |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9248
diff
changeset
|
225 |
this->DrawViewport(); |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
226 |
if (_game_mode == GM_MENU) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
227 |
int off_x = _screen.width / 2; |
0 | 228 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
229 |
DrawSprite(SPR_OTTD_O, PAL_NONE, off_x - 120, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
230 |
DrawSprite(SPR_OTTD_P, PAL_NONE, off_x - 86, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
231 |
DrawSprite(SPR_OTTD_E, PAL_NONE, off_x - 53, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
232 |
DrawSprite(SPR_OTTD_N, PAL_NONE, off_x - 22, 50); |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
233 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
234 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 34, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
235 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 65, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
236 |
DrawSprite(SPR_OTTD_D, PAL_NONE, off_x + 96, 50); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
237 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
238 |
} |
2639 | 239 |
|
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
240 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
241 |
{ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
242 |
switch (keycode) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
243 |
case 'Q' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
244 |
case 'Q' | WKC_META: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
245 |
HandleExitGameRequest(); |
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
246 |
return ES_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
247 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
248 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
249 |
/* Disable all key shortcuts, except quit shortcuts when |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
250 |
* generating the world, otherwise they create threading |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
251 |
* problem during the generating, resulting in random |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
252 |
* assertions that are hard to trigger and debug */ |
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
253 |
if (IsGeneratingWorld()) return ES_NOT_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
254 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
255 |
if (keycode == WKC_BACKQUOTE) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
256 |
IConsoleSwitch(); |
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
257 |
return ES_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
258 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
259 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
260 |
if (keycode == ('B' | WKC_CTRL)) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
261 |
extern bool _draw_bounding_boxes; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
262 |
_draw_bounding_boxes = !_draw_bounding_boxes; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
263 |
MarkWholeScreenDirty(); |
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
264 |
return ES_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
265 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
266 |
|
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
267 |
if (_game_mode == GM_MENU) return ES_NOT_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
268 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
269 |
switch (keycode) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
270 |
case 'C': |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
271 |
case 'Z': { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
272 |
Point pt = GetTileBelowCursor(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
273 |
if (pt.x != -1) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
274 |
if (keycode == 'Z') MaxZoomInOut(ZOOM_IN, this); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
275 |
ScrollMainWindowTo(pt.x, pt.y); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
276 |
} |
8806
4fe163e0b52a
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
8790
diff
changeset
|
277 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
278 |
} |
8806
4fe163e0b52a
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
8790
diff
changeset
|
279 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
280 |
case WKC_ESC: ResetObjectToPlace(); break; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
281 |
case WKC_DELETE: DeleteNonVitalWindows(); break; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
282 |
case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
283 |
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
284 |
|
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
285 |
#if defined(_DEBUG) |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
286 |
case '0' | WKC_ALT: // Crash the game |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
287 |
*(byte*)0 = 0; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
288 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
289 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
290 |
case '1' | WKC_ALT: // Gimme money |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
291 |
/* Server can not cheat in advertise mode either! */ |
9481
25ed9b0c242a
(svn r13433) -Codechange: remove a now useless global variable.
rubidium
parents:
9428
diff
changeset
|
292 |
if (!_networking || !_network_server || !_settings_client.network.server_advertise) |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
293 |
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
294 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
295 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
296 |
case '2' | WKC_ALT: // Update the coordinates of all station signs |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
297 |
UpdateAllStationVirtCoord(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
298 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
299 |
#endif |
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
300 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
301 |
case '1' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
302 |
case '2' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
303 |
case '3' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
304 |
case '4' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
305 |
case '5' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
306 |
case '6' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
307 |
case '7' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
308 |
case '8' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
309 |
case '9' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
310 |
/* Transparency toggle hot keys */ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
311 |
ToggleTransparency((TransparencyOption)(keycode - ('1' | WKC_CTRL))); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
312 |
MarkWholeScreenDirty(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
313 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
314 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
315 |
case '1' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
316 |
case '2' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
317 |
case '3' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
318 |
case '4' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
319 |
case '5' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
320 |
case '6' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
321 |
case '7' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
322 |
case '8' | WKC_CTRL | WKC_SHIFT: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
323 |
/* Invisibility toggle hot keys */ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
324 |
ToggleInvisibilityWithTransparency((TransparencyOption)(keycode - ('1' | WKC_CTRL | WKC_SHIFT))); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
325 |
MarkWholeScreenDirty(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
326 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
327 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
328 |
case 'X' | WKC_CTRL: |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
329 |
ShowTransparencyToolbar(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
330 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
331 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
332 |
case 'X': |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
333 |
ResetRestoreAllTransparency(); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
334 |
break; |
6427
7dc1012757d8
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138
parents:
6357
diff
changeset
|
335 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
336 |
#ifdef ENABLE_NETWORK |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
337 |
case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
338 |
if (_networking) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
339 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
340 |
bool teamchat = false; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
341 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
342 |
if (cio == NULL) break; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
343 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
344 |
/* Only players actually playing can speak to team. Eg spectators cannot */ |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9533
diff
changeset
|
345 |
if (_settings_client.gui.prefer_teamchat && IsValidPlayerID(cio->client_playas)) { |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
346 |
const NetworkClientInfo *ci; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
347 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
348 |
if (ci->client_playas == cio->client_playas && ci != cio) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
349 |
teamchat = true; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
350 |
break; |
5107
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
351 |
} |
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
352 |
} |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
353 |
} |
4887
71da70810c22
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
354 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
355 |
ShowNetworkChatQueryWindow(teamchat ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
356 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
357 |
break; |
5672
86ab5e4289a5
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Darkvater
parents:
5668
diff
changeset
|
358 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
359 |
case WKC_SHIFT | WKC_RETURN: case WKC_SHIFT | 'T': // send text message to all players |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
360 |
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
361 |
break; |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
362 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
363 |
case WKC_CTRL | WKC_RETURN: case WKC_CTRL | 'T': // send text to all team mates |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
364 |
if (_networking) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
365 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
366 |
if (cio == NULL) break; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
367 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
368 |
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, cio->client_playas); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
369 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
370 |
break; |
1772
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
371 |
#endif |
a619792528e9
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
372 |
|
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
373 |
default: return ES_NOT_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
374 |
} |
9285
235e5e2d7f55
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
9273
diff
changeset
|
375 |
return ES_HANDLED; |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
376 |
} |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4300
diff
changeset
|
377 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
378 |
virtual void OnScroll(Point delta) |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
379 |
{ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
380 |
ViewPort *vp = IsPtInWindowViewport(this, _cursor.pos.x, _cursor.pos.y); |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
381 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
382 |
if (vp == NULL) { |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
383 |
_cursor.fix_at = false; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
384 |
_scrolling_viewport = false; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
385 |
} |
5045
846098142ffe
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
386 |
|
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
387 |
this->viewport->scrollpos_x += ScaleByZoom(delta.x, vp->zoom); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
388 |
this->viewport->scrollpos_y += ScaleByZoom(delta.y, vp->zoom); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
389 |
this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
390 |
this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
391 |
}; |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
392 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
393 |
virtual void OnMouseWheel(int wheel) |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
394 |
{ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
395 |
ZoomInOrOutToCursorWindow(wheel < 0, this); |
0 | 396 |
} |
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
397 |
|
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
398 |
virtual void OnInvalidateData(int data) |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
399 |
{ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
400 |
/* Forward the message to the appropiate toolbar (ingame or scenario editor) */ |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
401 |
InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data); |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
402 |
} |
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
403 |
}; |
0 | 404 |
|
405 |
||
6247 | 406 |
void ShowSelectGameWindow(); |
407 |
||
408 |
void SetupColorsAndInitialWindow() |
|
0 | 409 |
{ |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8976
diff
changeset
|
410 |
for (uint i = 0; i != 16; i++) { |
4171 | 411 |
const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i); |
1357 | 412 |
|
0 | 413 |
assert(b); |
4444
8d40844e6755
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4434
diff
changeset
|
414 |
memcpy(_colour_gradient[i], b + 0xC6, sizeof(_colour_gradient[i])); |
0 | 415 |
} |
416 |
||
9205
a519d26f9c48
(svn r13071) -Codechange: make also a class of the MainWindow.
rubidium
parents:
9184
diff
changeset
|
417 |
new MainWindow(_screen.width, _screen.height); |
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
418 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5894
diff
changeset
|
419 |
/* XXX: these are not done */ |
2639 | 420 |
switch (_game_mode) { |
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
421 |
default: NOT_REACHED(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
422 |
case GM_MENU: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
423 |
ShowSelectGameWindow(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
424 |
break; |
0 | 425 |
|
5432
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
426 |
case GM_NORMAL: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
427 |
case GM_EDITOR: |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
428 |
ShowVitalWindows(); |
5940d6a253c5
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5431
diff
changeset
|
429 |
break; |
0 | 430 |
} |
431 |
} |
|
432 |
||
6247 | 433 |
void ShowVitalWindows() |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
434 |
{ |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9205
diff
changeset
|
435 |
AllocateToolbar(); |
5048
b784951def0a
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
436 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
437 |
/* Status bad only for normal games */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
438 |
if (_game_mode == GM_EDITOR) return; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
439 |
|
8976
1a8367713b73
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
8975
diff
changeset
|
440 |
ShowStatusBar(); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
441 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
442 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8806
diff
changeset
|
443 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8806
diff
changeset
|
444 |
* Size of the application screen changed. |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8806
diff
changeset
|
445 |
* Adapt the game screen-size, re-allocate the open windows, and repaint everything |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8806
diff
changeset
|
446 |
*/ |
6247 | 447 |
void GameSizeChanged() |
0 | 448 |
{ |
9533
e8b86b70c5f6
(svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
smatz
parents:
9481
diff
changeset
|
449 |
_cur_resolution.width = _screen.width; |
e8b86b70c5f6
(svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
smatz
parents:
9481
diff
changeset
|
450 |
_cur_resolution.height = _screen.height; |
8985
6461e5c6d6e4
(svn r12779) -Codechange: remove a few constants from openttd.h.
rubidium
parents:
8979
diff
changeset
|
451 |
ScreenSizeChanged(); |
0 | 452 |
RelocateAllWindows(_screen.width, _screen.height); |
453 |
MarkWholeScreenDirty(); |
|
454 |
} |