diff options
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/window.cpp b/src/window.cpp index 4f147a670..f15293ea3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1918,16 +1918,9 @@ static bool MaybeBringWindowToFront(Window *w) */ void HandleKeypress(uint32 raw_key) { - /* - * 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_company here. - * - * This is not necessary either, as the only events that - * can be handled are the 'close application' events - */ - if (!IsGeneratingWorld()) _current_company = _local_company; + /* World generation is multithreaded and messes with companies. + * But there is no company related window open anyway, so _current_company is not used. */ + assert(IsGeneratingWorld() || _local_company == _current_company); /* Setup event */ uint16 key = GB(raw_key, 0, 16); @@ -2083,6 +2076,10 @@ static void HandleKeyScrolling() static void MouseLoop(MouseClick click, int mousewheel) { + /* World generation is multithreaded and messes with companies. + * But there is no company related window open anyway, so _current_company is not used. */ + assert(IsGeneratingWorld() || _local_company == _current_company); + HandlePlacePresize(); UpdateTileSelection(); @@ -2183,21 +2180,14 @@ static void MouseLoop(MouseClick click, int mousewheel) */ void HandleMouseEvents() { + /* World generation is multithreaded and messes with companies. + * But there is no company related window open anyway, so _current_company is not used. */ + assert(IsGeneratingWorld() || _local_company == _current_company); + static int double_click_time = 0; static int double_click_x = 0; static int double_click_y = 0; - /* - * 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_company here. - * - * This is not necessary either, as the only events that - * can be handled are the 'close application' events - */ - if (!IsGeneratingWorld()) _current_company = _local_company; - /* Mouse event? */ MouseClick click = MC_NONE; if (_left_button_down && !_left_button_clicked) { @@ -2280,6 +2270,10 @@ static void CheckSoftLimit() */ void InputLoop() { + /* World generation is multithreaded and messes with companies. + * But there is no company related window open anyway, so _current_company is not used. */ + assert(IsGeneratingWorld() || _local_company == _current_company); + CheckSoftLimit(); HandleKeyScrolling(); |