author | rubidium |
Wed, 07 May 2008 21:45:27 +0000 | |
changeset 10457 | ea18877d8eba |
parent 10445 | 2dd7d9d0a957 |
child 10461 | 48556aee54da |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(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:
10257
diff
changeset
|
3 |
/** @file main_gui.cpp Handling of the main viewport. */ |
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6145
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(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
07514c2cc6d1
(svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
1336
diff
changeset
|
8 |
#include "spritecache.h" |
0 | 9 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
11 |
#include "window_func.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
12 |
#include "textbuf_gui.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
13 |
#include "viewport_func.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
14 |
#include "command_func.h" |
10236
62a0a74e7332
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
10235
diff
changeset
|
15 |
#include "news_gui.h" |
126 | 16 |
#include "console.h" |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
17 |
#include "waypoint.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
18 |
#include "genworld.h" |
6923
6913c8a82cc0
(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:
6683
diff
changeset
|
19 |
#include "transparency_gui.h" |
8636
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8635
diff
changeset
|
20 |
#include "date_func.h" |
8627
448ebf3a8291
(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:
8619
diff
changeset
|
21 |
#include "functions.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8645
diff
changeset
|
22 |
#include "sound_func.h" |
8345
6caa3fdb972c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
8320
diff
changeset
|
23 |
#include "transparency.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8607
diff
changeset
|
24 |
#include "strings_func.h" |
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8617
diff
changeset
|
25 |
#include "zoom_func.h" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8704
diff
changeset
|
26 |
#include "string_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
27 |
#include "player_base.h" |
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
28 |
#include "player_func.h" |
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
29 |
#include "player_gui.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
30 |
#include "settings_type.h" |
9219
d232ad03c54c
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
9111
diff
changeset
|
31 |
#include "toolbar_gui.h" |
10235
684949ed0f03
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
10083
diff
changeset
|
32 |
#include "variables.h" |
10445
2dd7d9d0a957
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
10434
diff
changeset
|
33 |
#include "tilehighlight_func.h" |
0 | 34 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
35 |
#include "network/network.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
36 |
#include "network/network_data.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
37 |
#include "network/network_client.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
38 |
#include "network/network_server.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
39 |
#include "network/network_gui.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
40 |
|
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
41 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
42 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
43 |
|
5664 | 44 |
static int _rename_id = 1; |
45 |
static int _rename_what = -1; |
|
0 | 46 |
|
7343
7a44e07734c7
(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:
7341
diff
changeset
|
47 |
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2) |
7a44e07734c7
(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:
7341
diff
changeset
|
48 |
{ |
7394
75d35728b8b1
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
7353
diff
changeset
|
49 |
#ifdef ENABLE_NETWORK |
8153
32f871f7e7f7
(svn r11188) -Codechange: rewrite of the town action related code (remove some of the magic).
rubidium
parents:
8139
diff
changeset
|
50 |
if (!success || !_patches.give_money) return; |
7343
7a44e07734c7
(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:
7341
diff
changeset
|
51 |
|
7a44e07734c7
(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:
7341
diff
changeset
|
52 |
char msg[20]; |
7a44e07734c7
(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:
7341
diff
changeset
|
53 |
/* Inform the player of this action */ |
7a44e07734c7
(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:
7341
diff
changeset
|
54 |
snprintf(msg, sizeof(msg), "%d", p1); |
7a44e07734c7
(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:
7341
diff
changeset
|
55 |
|
7a44e07734c7
(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:
7341
diff
changeset
|
56 |
if (!_network_server) { |
7a44e07734c7
(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:
7341
diff
changeset
|
57 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg); |
7a44e07734c7
(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:
7341
diff
changeset
|
58 |
} else { |
7a44e07734c7
(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:
7341
diff
changeset
|
59 |
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX); |
7a44e07734c7
(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:
7341
diff
changeset
|
60 |
} |
7394
75d35728b8b1
(svn r10145) -Fix: make compiling with networking disabled (again) possible.
rubidium
parents:
7353
diff
changeset
|
61 |
#endif /* ENABLE_NETWORK */ |
7343
7a44e07734c7
(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:
7341
diff
changeset
|
62 |
} |
7a44e07734c7
(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:
7341
diff
changeset
|
63 |
|
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
64 |
void HandleOnEditText(const char *str) |
1799
05d56d2d0fea
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
65 |
{ |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
66 |
int id = _rename_id; |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
67 |
_cmd_text = str; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
68 |
|
1799
05d56d2d0fea
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
69 |
switch (_rename_what) { |
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6145
diff
changeset
|
70 |
case 1: // Rename a waypoint |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
71 |
if (*str == '\0') return; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
355
diff
changeset
|
72 |
DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME)); |
0 | 73 |
break; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
74 |
#ifdef ENABLE_NETWORK |
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6145
diff
changeset
|
75 |
case 3: { // Give money, you can only give money in excess of loan |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1932
diff
changeset
|
76 |
const Player *p = GetPlayer(_current_player); |
8001
3a4743f9ced0
(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:
7976
diff
changeset
|
77 |
Money money = min(p->player_money - p->current_loan, (Money)(atoi(str) / _currency->rate)); |
1799
05d56d2d0fea
(svn r2303) - CodeChange (fix): when giving money to other players only allow transferring money that is above your loan. Eg you can't give away your loan.
Darkvater
parents:
1793
diff
changeset
|
78 |
|
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8385
diff
changeset
|
79 |
uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0 |
813
90d6adb8d4ad
(svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
truelight
parents:
793
diff
changeset
|
80 |
|
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6145
diff
changeset
|
81 |
/* Give 'id' the money, and substract it from ourself */ |
7486
d130c10f4dab
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
7449
diff
changeset
|
82 |
DoCommandP(0, money_c, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS)); |
6988
76eba6a9cc6f
(svn r9673) -Cleanup: remove spaces before tabs and replace non-indenting tabs with spaces.
rubidium
parents:
6982
diff
changeset
|
83 |
} break; |
5664 | 84 |
#endif /* ENABLE_NETWORK */ |
85 |
default: NOT_REACHED(); |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
86 |
} |
5664 | 87 |
|
88 |
_rename_id = _rename_what = -1; |
|
0 | 89 |
} |
90 |
||
1070
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
91 |
/** |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
92 |
* This code is shared for the majority of the pushbuttons. |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
93 |
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
94 |
* |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
95 |
* @param w Window which called the function |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
96 |
* @param widget ID of the widget (=button) that called this function |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
97 |
* @param cursor How should the cursor image change? E.g. cursor with depot image in it |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
98 |
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
99 |
* @param placeproc Procedure which will be called when someone clicks on the map |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
100 |
* @return true if the button is clicked, false if it's unclicked |
bef634a62323
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1067
diff
changeset
|
101 |
*/ |
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8353
diff
changeset
|
102 |
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc) |
0 | 103 |
{ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8450
diff
changeset
|
104 |
if (w->IsWidgetDisabled(widget)) return false; |
0 | 105 |
|
2621
003505313684
(svn r3159) Remove the read-only variable _no_button_sound
tron
parents:
2615
diff
changeset
|
106 |
SndPlayFx(SND_15_BEEP); |
10434
d6accd017341
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
10429
diff
changeset
|
107 |
w->SetDirty(); |
0 | 108 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8450
diff
changeset
|
109 |
if (w->IsWidgetLowered(widget)) { |
0 | 110 |
ResetObjectToPlace(); |
111 |
return false; |
|
112 |
} |
|
113 |
||
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5852
diff
changeset
|
114 |
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8450
diff
changeset
|
115 |
w->LowerWidget(widget); |
0 | 116 |
_place_proc = placeproc; |
117 |
return true; |
|
118 |
} |
|
119 |
||
120 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
121 |
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 122 |
{ |
541 | 123 |
if (success) SndPlayTileFx(SND_12_EXPLOSION, tile); |
0 | 124 |
} |
125 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
126 |
#ifdef ENABLE_NETWORK |
4830
0ff2a14e90be
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4824
diff
changeset
|
127 |
void ShowNetworkGiveMoneyWindow(PlayerID player) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
128 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
129 |
_rename_id = player; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
130 |
_rename_what = 3; |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
131 |
ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
132 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
133 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
134 |
|
2116 | 135 |
void ShowRenameWaypointWindow(const Waypoint *wp) |
0 | 136 |
{ |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
137 |
int id = wp->index; |
697
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
138 |
|
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
139 |
/* Are we allowed to change the name of the waypoint? */ |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1500
diff
changeset
|
140 |
if (!CheckTileOwnership(wp->xy)) { |
926
bd4312619522
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
872
diff
changeset
|
141 |
ShowErrorMessage(_error_message, STR_CANT_CHANGE_WAYPOINT_NAME, |
3422
12cdb13ddb56
(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
|
142 |
TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE); |
697
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
143 |
return; |
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
144 |
} |
0406d50190f2
(svn r1146) -Fix: You can no longer change waypoints whom are owned by somebody else
truelight
parents:
682
diff
changeset
|
145 |
|
0 | 146 |
_rename_id = id; |
147 |
_rename_what = 1; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
148 |
SetDParam(0, id); |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5664
diff
changeset
|
149 |
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL); |
0 | 150 |
} |
151 |
||
152 |
||
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
|
153 |
/* 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
|
154 |
/* 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
|
155 |
bool DoZoomInOutWindow(int how, Window *w) |
0 | 156 |
{ |
157 |
ViewPort *vp; |
|
5045
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
158 |
|
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
159 |
assert(w != NULL); |
0 | 160 |
vp = w->viewport; |
161 |
||
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
162 |
switch (how) { |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
163 |
case ZOOM_IN: |
7122
0607a15aedc0
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
7120
diff
changeset
|
164 |
if (vp->zoom == ZOOM_LVL_MIN) return false; |
8591
46eca2eb57ba
(svn r11656) -Codechange: add ZOOM_LVL_BEGIN and postfix operators so ZoomLevel can be used in some iterations
smatz
parents:
8578
diff
changeset
|
165 |
vp->zoom = (ZoomLevel)((int)vp->zoom - 1); |
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
166 |
vp->virtual_width >>= 1; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
167 |
vp->virtual_height >>= 1; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
168 |
|
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
169 |
WP(w, vp_d).scrollpos_x += vp->virtual_width >> 1; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
170 |
WP(w, vp_d).scrollpos_y += vp->virtual_height >> 1; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
171 |
WP(w, vp_d).dest_scrollpos_x = WP(w,vp_d).scrollpos_x; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
172 |
WP(w, vp_d).dest_scrollpos_y = WP(w,vp_d).scrollpos_y; |
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
173 |
break; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
174 |
case ZOOM_OUT: |
7122
0607a15aedc0
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
7120
diff
changeset
|
175 |
if (vp->zoom == ZOOM_LVL_MAX) return false; |
8591
46eca2eb57ba
(svn r11656) -Codechange: add ZOOM_LVL_BEGIN and postfix operators so ZoomLevel can be used in some iterations
smatz
parents:
8578
diff
changeset
|
176 |
vp->zoom = (ZoomLevel)((int)vp->zoom + 1); |
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
177 |
|
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
178 |
WP(w, vp_d).scrollpos_x -= vp->virtual_width >> 1; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
179 |
WP(w, vp_d).scrollpos_y -= vp->virtual_height >> 1; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
180 |
WP(w, vp_d).dest_scrollpos_x = WP(w,vp_d).scrollpos_x; |
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8566
diff
changeset
|
181 |
WP(w, vp_d).dest_scrollpos_y = WP(w,vp_d).scrollpos_y; |
5044
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
182 |
|
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
183 |
vp->virtual_width <<= 1; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
184 |
vp->virtual_height <<= 1; |
7e70387677e5
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents:
5006
diff
changeset
|
185 |
break; |
0 | 186 |
} |
5214
521e6d945e5d
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
187 |
if (vp != NULL) { // the vp can be null when how == ZOOM_NONE |
521e6d945e5d
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
188 |
vp->virtual_left = WP(w, vp_d).scrollpos_x; |
521e6d945e5d
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
189 |
vp->virtual_top = WP(w, vp_d).scrollpos_y; |
521e6d945e5d
(svn r7329) -Fix (r7157): Invalid viewport position on quick zoom
KUDr
parents:
5118
diff
changeset
|
190 |
} |
10434
d6accd017341
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
10429
diff
changeset
|
191 |
w->SetDirty(); |
5045
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
192 |
/* Update the windows that have zoom-buttons to perhaps disable their buttons */ |
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
193 |
SendWindowMessageClass(w->window_class, how, w->window_number, 0); |
0 | 194 |
return true; |
195 |
} |
|
196 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
197 |
void ZoomInOrOutToCursorWindow(bool in, Window *w) |
0 | 198 |
{ |
9219
d232ad03c54c
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
9111
diff
changeset
|
199 |
assert(w != NULL); |
0 | 200 |
|
4536
f13408cba18f
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
201 |
if (_game_mode != GM_MENU) { |
9219
d232ad03c54c
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
9111
diff
changeset
|
202 |
ViewPort *vp = w->viewport; |
7122
0607a15aedc0
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
7120
diff
changeset
|
203 |
if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX)) |
0 | 204 |
return; |
205 |
||
9219
d232ad03c54c
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
9111
diff
changeset
|
206 |
Point pt = GetTileZoomCenterWindow(in,w); |
0 | 207 |
if (pt.x != -1) { |
7226
a8650d6ecb53
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
7187
diff
changeset
|
208 |
ScrollWindowTo(pt.x, pt.y, w, true); |
0 | 209 |
|
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
|
210 |
DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w); |
0 | 211 |
} |
212 |
} |
|
213 |
} |
|
214 |
||
6573 | 215 |
extern void UpdateAllStationVirtCoord(); |
0 | 216 |
|
4171 | 217 |
static void MainWindowWndProc(Window *w, WindowEvent *e) |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4013
diff
changeset
|
218 |
{ |
2952 | 219 |
switch (e->event) { |
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
220 |
case WE_PAINT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
221 |
DrawWindowViewport(w); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
222 |
if (_game_mode == GM_MENU) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
223 |
int off_x = _screen.width / 2; |
0 | 224 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
225 |
DrawSprite(SPR_OTTD_O, PAL_NONE, off_x - 120, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
226 |
DrawSprite(SPR_OTTD_P, PAL_NONE, off_x - 86, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
227 |
DrawSprite(SPR_OTTD_E, PAL_NONE, off_x - 53, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
228 |
DrawSprite(SPR_OTTD_N, PAL_NONE, off_x - 22, 50); |
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1397
diff
changeset
|
229 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
230 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 34, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
231 |
DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 65, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
232 |
DrawSprite(SPR_OTTD_D, PAL_NONE, off_x + 96, 50); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
233 |
} |
4536
f13408cba18f
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
rubidium
parents:
4512
diff
changeset
|
234 |
break; |
8139
16ad832aa538
(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:
8017
diff
changeset
|
235 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
236 |
case WE_KEYPRESS: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
237 |
switch (e->we.keypress.keycode) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
238 |
case 'Q' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
239 |
case 'Q' | WKC_META: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
240 |
HandleExitGameRequest(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
241 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
242 |
} |
0 | 243 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
244 |
/* Disable all key shortcuts, except quit shortcuts when |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
245 |
* generating the world, otherwise they create threading |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
246 |
* problem during the generating, resulting in random |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
247 |
* assertions that are hard to trigger and debug */ |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
248 |
if (IsGeneratingWorld()) break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
249 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
250 |
if (e->we.keypress.keycode == WKC_BACKQUOTE) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
251 |
IConsoleSwitch(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
252 |
e->we.keypress.cont = false; |
2639 | 253 |
break; |
0 | 254 |
} |
2639 | 255 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
256 |
if (e->we.keypress.keycode == ('B' | WKC_CTRL)) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
257 |
e->we.keypress.cont = false; |
10239
a66b15550485
(svn r12771) -Codechange: remove more from variables.h.
rubidium
parents:
10237
diff
changeset
|
258 |
extern bool _draw_bounding_boxes; |
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
259 |
_draw_bounding_boxes = !_draw_bounding_boxes; |
9302
4aa3c4a44b16
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
9286
diff
changeset
|
260 |
MarkWholeScreenDirty(); |
4aa3c4a44b16
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
9286
diff
changeset
|
261 |
break; |
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
262 |
} |
9302
4aa3c4a44b16
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
9286
diff
changeset
|
263 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
264 |
if (_game_mode == GM_MENU) break; |
6923
6913c8a82cc0
(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:
6683
diff
changeset
|
265 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
266 |
switch (e->we.keypress.keycode) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
267 |
case 'C': |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
268 |
case 'Z': { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
269 |
Point pt = GetTileBelowCursor(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
270 |
if (pt.x != -1) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
271 |
if (e->we.keypress.keycode == 'Z') MaxZoomInOut(ZOOM_IN, w); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
272 |
ScrollMainWindowTo(pt.x, pt.y); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
273 |
} |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
274 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
275 |
} |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
276 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
277 |
case WKC_ESC: ResetObjectToPlace(); break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
278 |
case WKC_DELETE: DeleteNonVitalWindows(); break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
279 |
case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
280 |
case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
281 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
282 |
#if defined(_DEBUG) |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
283 |
case '0' | WKC_ALT: // Crash the game |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
284 |
*(byte*)0 = 0; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
285 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
286 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
287 |
case '1' | WKC_ALT: // Gimme money |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
288 |
/* Server can not cheat in advertise mode either! */ |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
289 |
if (!_networking || !_network_server || !_network_advertise) |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
290 |
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
291 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
292 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
293 |
case '2' | WKC_ALT: // Update the coordinates of all station signs |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
294 |
UpdateAllStationVirtCoord(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
295 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
296 |
#endif |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
297 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
298 |
case '1' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
299 |
case '2' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
300 |
case '3' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
301 |
case '4' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
302 |
case '5' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
303 |
case '6' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
304 |
case '7' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
305 |
case '8' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
306 |
case '9' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
307 |
/* Transparency toggle hot keys */ |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
308 |
ToggleTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL))); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
309 |
MarkWholeScreenDirty(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
310 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
311 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
312 |
case '1' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
313 |
case '2' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
314 |
case '3' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
315 |
case '4' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
316 |
case '5' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
317 |
case '6' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
318 |
case '7' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
319 |
case '8' | WKC_CTRL | WKC_SHIFT: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
320 |
/* Invisibility toggle hot keys */ |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
321 |
ToggleInvisibilityWithTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL | WKC_SHIFT))); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
322 |
MarkWholeScreenDirty(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
323 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
324 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
325 |
case 'X' | WKC_CTRL: |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
326 |
ShowTransparencyToolbar(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
327 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
328 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
329 |
case 'X': |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
330 |
ResetRestoreAllTransparency(); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
331 |
break; |
6923
6913c8a82cc0
(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:
6683
diff
changeset
|
332 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
333 |
#ifdef ENABLE_NETWORK |
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
334 |
case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
335 |
if (_networking) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
336 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
337 |
bool teamchat = false; |
5923
8fd520e817ed
(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:
5919
diff
changeset
|
338 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
339 |
if (cio == NULL) break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
340 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
341 |
/* Only players actually playing can speak to team. Eg spectators cannot */ |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
342 |
if (_patches.prefer_teamchat && IsValidPlayer(cio->client_playas)) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
343 |
const NetworkClientInfo *ci; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
344 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
345 |
if (ci->client_playas == cio->client_playas && ci != cio) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
346 |
teamchat = true; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
347 |
break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
348 |
} |
5107
8791beb0ae51
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
349 |
} |
8791beb0ae51
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
350 |
} |
4887
3fa54b371032
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
351 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
352 |
ShowNetworkChatQueryWindow(teamchat ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
353 |
} |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
354 |
break; |
4887
3fa54b371032
(svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T)
Darkvater
parents:
4848
diff
changeset
|
355 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
356 |
case WKC_SHIFT | WKC_RETURN: case WKC_SHIFT | 'T': // send text message to all players |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
357 |
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
358 |
break; |
5923
8fd520e817ed
(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:
5919
diff
changeset
|
359 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
360 |
case WKC_CTRL | WKC_RETURN: case WKC_CTRL | 'T': // send text to all team mates |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
361 |
if (_networking) { |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
362 |
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
363 |
if (cio == NULL) break; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
364 |
|
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
365 |
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, cio->client_playas); |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
366 |
} |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
367 |
break; |
1772
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
368 |
#endif |
eae288f4fd35
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
Darkvater
parents:
1705
diff
changeset
|
369 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
370 |
default: return; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
371 |
} |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
372 |
e->we.keypress.cont = false; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
373 |
break; |
4335
18bc63352a17
(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
|
374 |
|
18bc63352a17
(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
|
375 |
case WE_SCROLL: { |
18bc63352a17
(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
|
376 |
ViewPort *vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y); |
18bc63352a17
(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 |
|
18bc63352a17
(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
|
378 |
if (vp == NULL) { |
18bc63352a17
(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
|
379 |
_cursor.fix_at = false; |
18bc63352a17
(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
|
380 |
_scrolling_viewport = false; |
18bc63352a17
(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
|
381 |
} |
18bc63352a17
(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
|
382 |
|
7150
2cfe4a46fa1c
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
truelight
parents:
7122
diff
changeset
|
383 |
WP(w, vp_d).scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom); |
2cfe4a46fa1c
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
truelight
parents:
7122
diff
changeset
|
384 |
WP(w, vp_d).scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom); |
7226
a8650d6ecb53
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
7187
diff
changeset
|
385 |
WP(w, vp_d).dest_scrollpos_x = WP(w, vp_d).scrollpos_x; |
a8650d6ecb53
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
7187
diff
changeset
|
386 |
WP(w, vp_d).dest_scrollpos_y = WP(w, vp_d).scrollpos_y; |
4335
18bc63352a17
(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
|
387 |
} break; |
4337
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
388 |
|
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
389 |
case WE_MOUSEWHEEL: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
390 |
ZoomInOrOutToCursorWindow(e->we.wheel.wheel < 0, w); |
4337
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
391 |
break; |
5045
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
392 |
|
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
393 |
case WE_MESSAGE: |
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
394 |
/* Forward the message to the appropiate toolbar (ingame or scenario editor) */ |
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
395 |
SendWindowMessage(WC_MAIN_TOOLBAR, 0, e->we.message.msg, e->we.message.wparam, e->we.message.lparam); |
3e734e178dae
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents:
5044
diff
changeset
|
396 |
break; |
0 | 397 |
} |
398 |
} |
|
399 |
||
400 |
||
6573 | 401 |
void ShowSelectGameWindow(); |
402 |
||
403 |
void SetupColorsAndInitialWindow() |
|
0 | 404 |
{ |
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
405 |
for (uint i = 0; i != 16; i++) { |
4171 | 406 |
const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i); |
1357 | 407 |
|
0 | 408 |
assert(b); |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4434
diff
changeset
|
409 |
memcpy(_colour_gradient[i], b + 0xC6, sizeof(_colour_gradient[i])); |
0 | 410 |
} |
411 |
||
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
412 |
int width = _screen.width; |
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
413 |
int height = _screen.height; |
0 | 414 |
|
10237
f14be17a032a
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
10236
diff
changeset
|
415 |
Window *w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL); |
10257
fe75471234f3
(svn r12789) -Codechange: rename AssignWindowViewport to InitializeWindowViewport because the viewport is now part of the window struct. Patch by Alberth.
rubidium
parents:
10247
diff
changeset
|
416 |
InitializeWindowViewport(w, 0, 0, width, height, TileXY(32, 32), ZOOM_LVL_VIEWPORT); |
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
417 |
|
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6145
diff
changeset
|
418 |
/* XXX: these are not done */ |
2639 | 419 |
switch (_game_mode) { |
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
420 |
default: NOT_REACHED(); |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
421 |
case GM_MENU: |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
422 |
ShowSelectGameWindow(); |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
423 |
break; |
0 | 424 |
|
5683
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
425 |
case GM_NORMAL: |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
426 |
case GM_EDITOR: |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
427 |
ShowVitalWindows(); |
dca046ba7aa3
(svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents:
5682
diff
changeset
|
428 |
break; |
0 | 429 |
} |
430 |
} |
|
431 |
||
10236
62a0a74e7332
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
10235
diff
changeset
|
432 |
extern void ShowStatusBar(); |
62a0a74e7332
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
10235
diff
changeset
|
433 |
|
6573 | 434 |
void ShowVitalWindows() |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
435 |
{ |
9219
d232ad03c54c
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
9111
diff
changeset
|
436 |
Window *w = AllocateToolbar(); |
5048
0223e3641590
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
437 |
DoZoomInOutWindow(ZOOM_NONE, w); |
0223e3641590
(svn r7098) -Regression (r7094): Zoom buttons were not properly updated with a new/loaded game. The
Darkvater
parents:
5046
diff
changeset
|
438 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
439 |
/* Status bad only for normal games */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
440 |
if (_game_mode == GM_EDITOR) return; |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
441 |
|
10236
62a0a74e7332
(svn r12768) -Codechange: move the statusbar GUI to it's own file.
rubidium
parents:
10235
diff
changeset
|
442 |
ShowStatusBar(); |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
443 |
} |
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
970
diff
changeset
|
444 |
|
10083
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
9302
diff
changeset
|
445 |
/** |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
9302
diff
changeset
|
446 |
* Size of the application screen changed. |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
9302
diff
changeset
|
447 |
* Adapt the game screen-size, re-allocate the open windows, and repaint everything |
9fb63cf5cc90
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
9302
diff
changeset
|
448 |
*/ |
6573 | 449 |
void GameSizeChanged() |
0 | 450 |
{ |
2429
94cc76052d36
(svn r2955) Fix: make ottd start with the last resolution you had set (custom) (win32)
Darkvater
parents:
2361
diff
changeset
|
451 |
_cur_resolution[0] = _screen.width; |
94cc76052d36
(svn r2955) Fix: make ottd start with the last resolution you had set (custom) (win32)
Darkvater
parents:
2361
diff
changeset
|
452 |
_cur_resolution[1] = _screen.height; |
10247
145d0458b685
(svn r12779) -Codechange: remove a few constants from openttd.h.
rubidium
parents:
10239
diff
changeset
|
453 |
ScreenSizeChanged(); |
0 | 454 |
RelocateAllWindows(_screen.width, _screen.height); |
455 |
MarkWholeScreenDirty(); |
|
456 |
} |