summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-19 10:00:30 +0000
committertruelight <truelight@openttd.org>2006-08-19 10:00:30 +0000
commit10b842bddcbe6cdcf7111736bec985cdc13e528f (patch)
treecd9ad6758b68622254b2545359b5d87f88f7074b /window.c
parent83d56d6d798a28169f00a4c67323a407037c0b0a (diff)
downloadopenttd-10b842bddcbe6cdcf7111736bec985cdc13e528f.tar.xz
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin) - Load heightmaps (either BMP or PNG) - Progress dialog while generating worlds (no longer a 'hanging' screen) - New dialogs for NewGame, Create Scenario and Play Heightmap - Easier to configure your landscape - More things to configure (tree-placer, ..) - Speedup of world generation - New console command 'restart': restart the map EXACTLY as it was when you first started it (needs a game made after or with this commit) - New console command 'getseed': get the seed of your map and share it with others (of course only works with generated maps) - Many new, world generation related, things - Many internal cleanups and rewrites Many tnx to those people who helped making this: Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic) Many tnx to those who helped testing: Arnau, Bjarni, and tokai (alfabetic) And to all other people who helped testing and sending comments / bugs Stats: 673 lines changed, 3534 new lines, 79 new strings
Diffstat (limited to 'window.c')
-rw-r--r--window.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/window.c b/window.c
index b003bd06d..b22629b33 100644
--- a/window.c
+++ b/window.c
@@ -12,6 +12,7 @@
#include "console.h"
#include "variables.h"
#include "table/sprites.h"
+#include "genworld.h"
// delta between mouse cursor and upper left corner of dragged window
static Point _drag_delta;
@@ -1323,10 +1324,11 @@ static void HandleKeypress(uint32 key)
we.keypress.cont = true;
// check if we have a query string window open before allowing hotkeys
- if (FindWindowById(WC_QUERY_STRING, 0) != NULL ||
- FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL ||
- FindWindowById(WC_CONSOLE, 0) != NULL ||
- FindWindowById(WC_SAVELOAD, 0) != NULL) {
+ if (FindWindowById(WC_QUERY_STRING, 0) != NULL ||
+ FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL ||
+ FindWindowById(WC_GENERATE_LANDSCAPE, 0) != NULL ||
+ FindWindowById(WC_CONSOLE, 0) != NULL ||
+ FindWindowById(WC_SAVELOAD, 0) != NULL) {
query_open = true;
}
@@ -1337,6 +1339,7 @@ static void HandleKeypress(uint32 key)
if (query_open &&
w->window_class != WC_QUERY_STRING &&
w->window_class != WC_SEND_NETWORK_MSG &&
+ w->window_class != WC_GENERATE_LANDSCAPE &&
w->window_class != WC_CONSOLE &&
w->window_class != WC_SAVELOAD) {
continue;
@@ -1376,7 +1379,7 @@ static void MouseLoop(int click, int mousewheel)
y = _cursor.pos.y;
if (click == 0 && mousewheel == 0) {
- if (_patches.autoscroll && _game_mode != GM_MENU) {
+ if (_patches.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) {
w = FindWindowFromPt(x, y);
if (w == NULL || w->flags4 & WF_DISABLE_VP_SCROLL) return;
vp = IsPtInWindowViewport(w, x, y);
@@ -1406,7 +1409,7 @@ static void MouseLoop(int click, int mousewheel)
w = MaybeBringWindowToFront(w);
vp = IsPtInWindowViewport(w, x, y);
if (vp != NULL) {
- if (_game_mode == GM_MENU) return;
+ if (_game_mode == GM_MENU || IsGeneratingWorld()) return;
// only allow zooming in-out in main window, or in viewports
if (mousewheel &&
@@ -1455,7 +1458,16 @@ void InputLoop(void)
int click;
int mousewheel;
- _current_player = _local_player;
+ /*
+ * During the generation of the world, there might be
+ * another thread that is currently building for example
+ * a road. To not interfere with those tasks, we should
+ * NOT change the _current_player here.
+ *
+ * This is not necessary either, as the only events that
+ * can be handled are the 'close application' events
+ */
+ if (!IsGeneratingWorld()) _current_player = _local_player;
// Handle pressed keys
if (_pressed_key != 0) {