2009-08-21 22:21:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 17:11:33 +02:00
|
|
|
/** @file main_gui.cpp Handling of the main viewport. */
|
2007-03-03 05:04:22 +01:00
|
|
|
|
2004-08-09 19:04:08 +02:00
|
|
|
#include "stdafx.h"
|
2005-08-06 17:18:26 +02:00
|
|
|
#include "currency.h"
|
2005-02-10 06:43:30 +01:00
|
|
|
#include "spritecache.h"
|
2007-12-19 21:45:46 +01:00
|
|
|
#include "window_gui.h"
|
|
|
|
#include "window_func.h"
|
|
|
|
#include "textbuf_gui.h"
|
2008-01-09 10:45:45 +01:00
|
|
|
#include "viewport_func.h"
|
2007-12-21 22:50:46 +01:00
|
|
|
#include "command_func.h"
|
2008-05-24 12:15:06 +02:00
|
|
|
#include "console_gui.h"
|
2011-08-21 14:48:46 +02:00
|
|
|
#include "progress.h"
|
2007-04-05 09:49:04 +02:00
|
|
|
#include "transparency_gui.h"
|
2011-02-07 23:37:22 +01:00
|
|
|
#include "map_func.h"
|
2007-12-29 10:24:26 +01:00
|
|
|
#include "sound_func.h"
|
2007-11-10 02:17:15 +01:00
|
|
|
#include "transparency.h"
|
2007-12-21 20:49:27 +01:00
|
|
|
#include "strings_func.h"
|
2007-12-23 11:56:02 +01:00
|
|
|
#include "zoom_func.h"
|
2008-09-30 22:51:04 +02:00
|
|
|
#include "company_base.h"
|
|
|
|
#include "company_func.h"
|
2008-03-23 08:35:29 +01:00
|
|
|
#include "toolbar_gui.h"
|
2008-05-16 09:08:04 +02:00
|
|
|
#include "statusbar_gui.h"
|
2013-05-19 16:49:25 +02:00
|
|
|
#include "linkgraph/linkgraph_gui.h"
|
2008-05-07 15:10:15 +02:00
|
|
|
#include "tilehighlight_func.h"
|
2010-07-03 15:42:27 +02:00
|
|
|
#include "hotkeys.h"
|
2020-07-05 20:18:35 +02:00
|
|
|
#include "error.h"
|
|
|
|
#include "news_gui.h"
|
2021-10-31 19:39:09 +01:00
|
|
|
#include "misc_cmd.h"
|
2023-04-13 17:18:27 +02:00
|
|
|
#include "timer/timer.h"
|
|
|
|
#include "timer/timer_window.h"
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2010-12-11 00:38:26 +01:00
|
|
|
#include "saveload/saveload.h"
|
|
|
|
|
2011-12-15 23:22:55 +01:00
|
|
|
#include "widgets/main_widget.h"
|
|
|
|
|
2008-01-13 02:21:35 +01:00
|
|
|
#include "network/network.h"
|
2008-05-30 20:20:26 +02:00
|
|
|
#include "network/network_func.h"
|
2008-01-13 02:21:35 +01:00
|
|
|
#include "network/network_gui.h"
|
2008-12-23 12:06:52 +01:00
|
|
|
#include "network/network_base.h"
|
2008-01-13 02:21:35 +01:00
|
|
|
|
|
|
|
#include "table/sprites.h"
|
|
|
|
#include "table/strings.h"
|
|
|
|
|
2014-04-23 22:13:33 +02:00
|
|
|
#include "safeguards.h"
|
|
|
|
|
2005-01-19 21:55:23 +01:00
|
|
|
/**
|
|
|
|
* This code is shared for the majority of the pushbuttons.
|
|
|
|
* Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters
|
|
|
|
*
|
|
|
|
* @param w Window which called the function
|
|
|
|
* @param widget ID of the widget (=button) that called this function
|
|
|
|
* @param cursor How should the cursor image change? E.g. cursor with depot image in it
|
|
|
|
* @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
|
|
|
|
* @return true if the button is clicked, false if it's unclicked
|
|
|
|
*/
|
2023-12-29 20:11:59 +01:00
|
|
|
bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode)
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2007-12-02 15:29:48 +01:00
|
|
|
if (w->IsWidgetDisabled(widget)) return false;
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2012-12-23 22:09:09 +01:00
|
|
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
2008-05-07 00:08:18 +02:00
|
|
|
w->SetDirty();
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-12-02 15:29:48 +01:00
|
|
|
if (w->IsWidgetLowered(widget)) {
|
2004-08-09 19:04:08 +02:00
|
|
|
ResetObjectToPlace();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-01-14 20:57:49 +01:00
|
|
|
SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number);
|
2007-12-02 15:29:48 +01:00
|
|
|
w->LowerWidget(widget);
|
2004-08-09 19:04:08 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-16 22:20:53 +02:00
|
|
|
void CcPlaySound_EXPLOSION(Commands, const CommandCost &result, TileIndex tile)
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2012-12-23 22:09:09 +01:00
|
|
|
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile);
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
|
|
|
|
2010-10-23 20:28:20 +02:00
|
|
|
/**
|
|
|
|
* Zooms a viewport in a window in or out.
|
|
|
|
* @param how Zooming direction.
|
|
|
|
* @param w Window owning the viewport.
|
|
|
|
* @return Returns \c true if zooming step could be done, \c false if further zooming is not possible.
|
|
|
|
* @note No button handling or what so ever is done.
|
|
|
|
*/
|
2010-05-13 10:56:01 +02:00
|
|
|
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2020-06-29 03:38:29 +02:00
|
|
|
Viewport *vp;
|
2004-09-10 21:02:27 +02:00
|
|
|
|
2019-04-10 23:07:06 +02:00
|
|
|
assert(w != nullptr);
|
2004-08-09 19:04:08 +02:00
|
|
|
vp = w->viewport;
|
|
|
|
|
2006-11-07 14:01:36 +01:00
|
|
|
switch (how) {
|
2010-05-13 12:00:51 +02:00
|
|
|
case ZOOM_NONE:
|
|
|
|
/* On initialisation of the viewport we don't do anything. */
|
|
|
|
break;
|
|
|
|
|
2006-11-07 14:01:36 +01:00
|
|
|
case ZOOM_IN:
|
2011-11-24 13:20:14 +01:00
|
|
|
if (vp->zoom <= _settings_client.gui.zoom_min) return false;
|
2007-12-17 23:04:07 +01:00
|
|
|
vp->zoom = (ZoomLevel)((int)vp->zoom - 1);
|
2006-11-07 14:01:36 +01:00
|
|
|
vp->virtual_width >>= 1;
|
|
|
|
vp->virtual_height >>= 1;
|
|
|
|
|
2008-05-11 17:08:44 +02:00
|
|
|
w->viewport->scrollpos_x += vp->virtual_width >> 1;
|
|
|
|
w->viewport->scrollpos_y += vp->virtual_height >> 1;
|
|
|
|
w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
|
|
|
|
w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
|
2010-08-04 10:58:45 +02:00
|
|
|
w->viewport->follow_vehicle = INVALID_VEHICLE;
|
2006-11-07 14:01:36 +01:00
|
|
|
break;
|
|
|
|
case ZOOM_OUT:
|
2011-11-24 13:20:14 +01:00
|
|
|
if (vp->zoom >= _settings_client.gui.zoom_max) return false;
|
2007-12-17 23:04:07 +01:00
|
|
|
vp->zoom = (ZoomLevel)((int)vp->zoom + 1);
|
2006-11-07 14:01:36 +01:00
|
|
|
|
2008-05-11 17:08:44 +02:00
|
|
|
w->viewport->scrollpos_x -= vp->virtual_width >> 1;
|
|
|
|
w->viewport->scrollpos_y -= vp->virtual_height >> 1;
|
|
|
|
w->viewport->dest_scrollpos_x = w->viewport->scrollpos_x;
|
|
|
|
w->viewport->dest_scrollpos_y = w->viewport->scrollpos_y;
|
2006-11-07 14:01:36 +01:00
|
|
|
|
|
|
|
vp->virtual_width <<= 1;
|
|
|
|
vp->virtual_height <<= 1;
|
2010-08-04 10:58:45 +02:00
|
|
|
w->viewport->follow_vehicle = INVALID_VEHICLE;
|
2006-11-07 14:01:36 +01:00
|
|
|
break;
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
2019-04-10 23:07:06 +02:00
|
|
|
if (vp != nullptr) { // the vp can be null when how == ZOOM_NONE
|
2008-05-11 17:08:44 +02:00
|
|
|
vp->virtual_left = w->viewport->scrollpos_x;
|
|
|
|
vp->virtual_top = w->viewport->scrollpos_y;
|
2006-12-03 14:40:16 +01:00
|
|
|
}
|
2006-11-07 14:06:02 +01:00
|
|
|
/* Update the windows that have zoom-buttons to perhaps disable their buttons */
|
2009-09-30 23:00:35 +02:00
|
|
|
w->InvalidateData();
|
2004-08-09 19:04:08 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-09-10 21:02:27 +02:00
|
|
|
void ZoomInOrOutToCursorWindow(bool in, Window *w)
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2019-04-10 23:07:06 +02:00
|
|
|
assert(w != nullptr);
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2006-09-04 00:07:28 +02:00
|
|
|
if (_game_mode != GM_MENU) {
|
2020-06-29 03:38:29 +02:00
|
|
|
Viewport *vp = w->viewport;
|
2011-11-24 13:20:14 +01:00
|
|
|
if ((in && vp->zoom <= _settings_client.gui.zoom_min) || (!in && vp->zoom >= _settings_client.gui.zoom_max)) return;
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2009-01-09 23:56:28 +01:00
|
|
|
Point pt = GetTileZoomCenterWindow(in, w);
|
2004-08-09 19:04:08 +02:00
|
|
|
if (pt.x != -1) {
|
2009-03-15 16:25:18 +01:00
|
|
|
ScrollWindowTo(pt.x, pt.y, -1, w, true);
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2004-09-03 21:59:05 +02:00
|
|
|
DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-09 20:39:56 +02:00
|
|
|
void FixTitleGameZoom(int zoom_adjust)
|
2019-04-23 22:55:27 +02:00
|
|
|
{
|
|
|
|
if (_game_mode != GM_MENU) return;
|
|
|
|
|
2023-01-06 23:24:38 +01:00
|
|
|
Viewport *vp = GetMainWindow()->viewport;
|
2021-04-09 20:39:56 +02:00
|
|
|
|
|
|
|
/* Adjust the zoom in/out.
|
|
|
|
* Can't simply add, since operator+ is not defined on the ZoomLevel type. */
|
2019-04-23 22:55:27 +02:00
|
|
|
vp->zoom = _gui_zoom;
|
2021-10-20 22:08:08 +02:00
|
|
|
while (zoom_adjust < 0 && vp->zoom != _settings_client.gui.zoom_min) {
|
2021-04-09 20:39:56 +02:00
|
|
|
vp->zoom--;
|
|
|
|
zoom_adjust++;
|
|
|
|
}
|
2021-10-20 22:08:08 +02:00
|
|
|
while (zoom_adjust > 0 && vp->zoom != _settings_client.gui.zoom_max) {
|
2021-04-09 20:39:56 +02:00
|
|
|
vp->zoom++;
|
|
|
|
zoom_adjust--;
|
|
|
|
}
|
|
|
|
|
2019-04-23 22:55:27 +02:00
|
|
|
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
|
|
|
|
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
|
|
|
|
}
|
|
|
|
|
2024-01-15 23:49:24 +01:00
|
|
|
static constexpr NWidgetPart _nested_main_window_widgets[] = {
|
2011-12-16 17:49:53 +01:00
|
|
|
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),
|
2009-08-01 14:42:27 +02:00
|
|
|
};
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
enum {
|
|
|
|
GHK_QUIT,
|
2010-12-11 00:38:26 +01:00
|
|
|
GHK_ABANDON,
|
2010-07-03 15:42:27 +02:00
|
|
|
GHK_CONSOLE,
|
|
|
|
GHK_BOUNDING_BOXES,
|
2012-03-25 21:06:59 +02:00
|
|
|
GHK_DIRTY_BLOCKS,
|
2023-10-28 20:07:50 +02:00
|
|
|
GHK_WIDGET_OUTLINES,
|
2010-07-03 15:42:27 +02:00
|
|
|
GHK_CENTER,
|
|
|
|
GHK_CENTER_ZOOM,
|
|
|
|
GHK_RESET_OBJECT_TO_PLACE,
|
|
|
|
GHK_DELETE_WINDOWS,
|
|
|
|
GHK_DELETE_NONVITAL_WINDOWS,
|
2019-02-17 00:15:58 +01:00
|
|
|
GHK_DELETE_ALL_MESSAGES,
|
2010-07-03 15:42:27 +02:00
|
|
|
GHK_REFRESH_SCREEN,
|
|
|
|
GHK_CRASH,
|
|
|
|
GHK_MONEY,
|
|
|
|
GHK_UPDATE_COORDS,
|
|
|
|
GHK_TOGGLE_TRANSPARENCY,
|
|
|
|
GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9,
|
|
|
|
GHK_TRANSPARENCY_TOOLBAR = GHK_TOGGLE_INVISIBILITY + 8,
|
|
|
|
GHK_TRANSPARANCY,
|
|
|
|
GHK_CHAT,
|
|
|
|
GHK_CHAT_ALL,
|
|
|
|
GHK_CHAT_COMPANY,
|
2010-10-20 09:30:15 +02:00
|
|
|
GHK_CHAT_SERVER,
|
2020-07-05 20:18:35 +02:00
|
|
|
GHK_CLOSE_NEWS,
|
|
|
|
GHK_CLOSE_ERROR,
|
2010-07-03 15:42:27 +02:00
|
|
|
};
|
|
|
|
|
2008-05-13 16:59:50 +02:00
|
|
|
struct MainWindow : Window
|
2006-06-27 23:25:53 +02:00
|
|
|
{
|
2013-06-15 17:30:44 +02:00
|
|
|
MainWindow(WindowDesc *desc) : Window(desc)
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2013-05-26 21:23:42 +02:00
|
|
|
this->InitNested(0);
|
2011-12-15 20:54:23 +01:00
|
|
|
CLRBITS(this->flags, WF_WHITE_BORDER);
|
2009-08-01 14:42:27 +02:00
|
|
|
ResizeWindow(this, _screen.width, _screen.height);
|
|
|
|
|
2011-12-16 17:49:53 +01:00
|
|
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT);
|
2022-09-04 08:55:03 +02:00
|
|
|
nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZOOM_LVL_VIEWPORT));
|
2013-05-19 16:49:25 +02:00
|
|
|
|
2023-03-31 17:06:36 +02:00
|
|
|
this->viewport->overlay = std::make_shared<LinkGraphOverlay>(this, WID_M_VIEWPORT, 0, 0, 2);
|
2023-04-13 17:18:27 +02:00
|
|
|
this->refresh_timeout.Reset();
|
2013-05-19 16:49:25 +02:00
|
|
|
}
|
|
|
|
|
2023-04-13 17:18:27 +02:00
|
|
|
/** Refresh the link-graph overlay. */
|
|
|
|
void RefreshLinkGraph()
|
2013-05-19 16:49:25 +02:00
|
|
|
{
|
2014-02-15 13:19:46 +01:00
|
|
|
if (this->viewport->overlay->GetCargoMask() == 0 ||
|
|
|
|
this->viewport->overlay->GetCompanyMask() == 0) {
|
|
|
|
return;
|
2013-05-19 16:49:25 +02:00
|
|
|
}
|
2014-02-15 13:19:46 +01:00
|
|
|
|
2019-02-23 20:19:41 +01:00
|
|
|
this->viewport->overlay->SetDirty();
|
2014-02-15 13:19:46 +01:00
|
|
|
this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
2007-09-26 21:27:29 +02:00
|
|
|
|
2023-04-13 17:18:27 +02:00
|
|
|
/** Refresh the link-graph overlay on a regular interval. */
|
|
|
|
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(7650), [this](auto) {
|
|
|
|
RefreshLinkGraph();
|
|
|
|
}};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sometimes when something happened, force an update to the link-graph a bit sooner.
|
|
|
|
*
|
|
|
|
* We don't do it instantly on those changes, as for example when you are scrolling,
|
|
|
|
* constantly refreshing the link-graph would be very slow. So we delay it a bit,
|
|
|
|
* and only draw it once the scrolling settles down.
|
|
|
|
*/
|
|
|
|
TimeoutTimer<TimerWindow> refresh_timeout = {std::chrono::milliseconds(450), [this]() {
|
|
|
|
RefreshLinkGraph();
|
|
|
|
}};
|
|
|
|
|
2019-03-04 08:49:37 +01:00
|
|
|
void OnPaint() override
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2009-08-01 14:42:27 +02:00
|
|
|
this->DrawWidgets();
|
2008-05-13 16:59:50 +02:00
|
|
|
if (_game_mode == GM_MENU) {
|
2024-04-05 22:52:50 +02:00
|
|
|
static const std::initializer_list<SpriteID> title_sprites = {SPR_OTTD_O, SPR_OTTD_P, SPR_OTTD_E, SPR_OTTD_N, SPR_OTTD_T, SPR_OTTD_T, SPR_OTTD_D};
|
2022-09-04 14:53:15 +02:00
|
|
|
uint letter_spacing = ScaleGUITrad(10);
|
2024-04-05 22:52:50 +02:00
|
|
|
int name_width = static_cast<int>(std::size(title_sprites) - 1) * letter_spacing;
|
2010-07-04 14:49:51 +02:00
|
|
|
|
2024-04-05 22:52:50 +02:00
|
|
|
for (const SpriteID &sprite : title_sprites) {
|
|
|
|
name_width += GetSpriteSize(sprite).width;
|
2010-07-04 14:49:51 +02:00
|
|
|
}
|
|
|
|
int off_x = (this->width - name_width) / 2;
|
|
|
|
|
2024-04-05 22:52:50 +02:00
|
|
|
for (const SpriteID &sprite : title_sprites) {
|
|
|
|
DrawSprite(sprite, PAL_NONE, off_x, ScaleGUITrad(50));
|
|
|
|
off_x += GetSpriteSize(sprite).width + letter_spacing;
|
2010-07-04 14:49:51 +02:00
|
|
|
}
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
|
|
|
}
|
2005-11-14 20:48:04 +01:00
|
|
|
|
2019-03-04 08:49:37 +01:00
|
|
|
EventState OnHotkey(int hotkey) override
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2013-06-15 17:30:44 +02:00
|
|
|
if (hotkey == GHK_QUIT) {
|
2010-07-03 15:42:27 +02:00
|
|
|
HandleExitGameRequest();
|
|
|
|
return ES_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2008-05-13 16:59:50 +02:00
|
|
|
/* Disable all key shortcuts, except quit shortcuts when
|
2009-03-14 19:16:29 +01:00
|
|
|
* generating the world, otherwise they create threading
|
|
|
|
* problem during the generating, resulting in random
|
|
|
|
* assertions that are hard to trigger and debug */
|
2011-08-21 14:46:46 +02:00
|
|
|
if (HasModalProgress()) return ES_NOT_HANDLED;
|
2005-11-14 20:48:04 +01:00
|
|
|
|
2013-06-15 17:30:44 +02:00
|
|
|
switch (hotkey) {
|
2010-12-11 00:38:26 +01:00
|
|
|
case GHK_ABANDON:
|
|
|
|
/* No point returning from the main menu to itself */
|
|
|
|
if (_game_mode == GM_MENU) return ES_HANDLED;
|
|
|
|
if (_settings_client.gui.autosave_on_exit) {
|
|
|
|
DoExitSave();
|
|
|
|
_switch_mode = SM_MENU;
|
|
|
|
} else {
|
|
|
|
AskExitToGameMenu();
|
|
|
|
}
|
|
|
|
return ES_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
|
2010-12-11 00:38:26 +01:00
|
|
|
case GHK_CONSOLE:
|
|
|
|
IConsoleSwitch();
|
|
|
|
return ES_HANDLED;
|
|
|
|
|
|
|
|
case GHK_BOUNDING_BOXES:
|
2011-07-20 18:19:48 +02:00
|
|
|
ToggleBoundingBoxes();
|
2010-12-11 00:38:26 +01:00
|
|
|
return ES_HANDLED;
|
2012-03-25 21:06:59 +02:00
|
|
|
|
|
|
|
case GHK_DIRTY_BLOCKS:
|
|
|
|
ToggleDirtyBlocks();
|
|
|
|
return ES_HANDLED;
|
2023-10-28 20:07:50 +02:00
|
|
|
|
|
|
|
case GHK_WIDGET_OUTLINES:
|
|
|
|
ToggleWidgetOutlines();
|
|
|
|
return ES_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
|
|
|
|
2008-05-18 01:11:06 +02:00
|
|
|
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
|
2013-06-15 17:30:44 +02:00
|
|
|
switch (hotkey) {
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_CENTER:
|
|
|
|
case GHK_CENTER_ZOOM: {
|
2008-05-13 16:59:50 +02:00
|
|
|
Point pt = GetTileBelowCursor();
|
|
|
|
if (pt.x != -1) {
|
2013-06-15 17:30:44 +02:00
|
|
|
bool instant = (hotkey == GHK_CENTER_ZOOM && this->viewport->zoom != _settings_client.gui.zoom_min);
|
|
|
|
if (hotkey == GHK_CENTER_ZOOM) MaxZoomInOut(ZOOM_IN, this);
|
2011-02-05 22:07:25 +01:00
|
|
|
ScrollMainWindowTo(pt.x, pt.y, -1, instant);
|
2008-04-18 17:18:16 +02:00
|
|
|
}
|
2008-05-13 16:59:50 +02:00
|
|
|
break;
|
|
|
|
}
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_RESET_OBJECT_TO_PLACE: ResetObjectToPlace(); break;
|
2021-05-17 15:46:38 +02:00
|
|
|
case GHK_DELETE_WINDOWS: CloseNonVitalWindows(); break;
|
|
|
|
case GHK_DELETE_NONVITAL_WINDOWS: CloseAllNonVitalWindows(); break;
|
2019-02-17 00:15:58 +01:00
|
|
|
case GHK_DELETE_ALL_MESSAGES: DeleteAllMessages(); break;
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
|
2008-04-03 21:55:40 +02:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_CRASH: // Crash the game
|
2024-03-16 23:59:32 +01:00
|
|
|
*(volatile uint8_t *)nullptr = 0;
|
2008-05-13 16:59:50 +02:00
|
|
|
break;
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_MONEY: // Gimme money
|
2021-01-22 16:24:29 +01:00
|
|
|
/* You can only cheat for money in singleplayer mode. */
|
2021-11-23 01:05:58 +01:00
|
|
|
if (!_networking) Command<CMD_MONEY_CHEAT>::Post(10000000);
|
2008-05-13 16:59:50 +02:00
|
|
|
break;
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_UPDATE_COORDS: // Update the coordinates of all station signs
|
2009-12-13 20:33:07 +01:00
|
|
|
UpdateAllVirtCoords();
|
2008-05-13 16:59:50 +02:00
|
|
|
break;
|
2007-04-05 09:49:04 +02:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_TOGGLE_TRANSPARENCY:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 1:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 2:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 3:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 4:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 5:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 6:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 7:
|
|
|
|
case GHK_TOGGLE_TRANSPARENCY + 8:
|
2008-05-13 16:59:50 +02:00
|
|
|
/* Transparency toggle hot keys */
|
2013-06-15 17:30:44 +02:00
|
|
|
ToggleTransparency((TransparencyOption)(hotkey - GHK_TOGGLE_TRANSPARENCY));
|
2008-05-13 16:59:50 +02:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_TOGGLE_INVISIBILITY:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 1:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 2:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 3:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 4:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 5:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 6:
|
|
|
|
case GHK_TOGGLE_INVISIBILITY + 7:
|
2008-05-13 16:59:50 +02:00
|
|
|
/* Invisibility toggle hot keys */
|
2013-06-15 17:30:44 +02:00
|
|
|
ToggleInvisibilityWithTransparency((TransparencyOption)(hotkey - GHK_TOGGLE_INVISIBILITY));
|
2008-05-13 16:59:50 +02:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
break;
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_TRANSPARENCY_TOOLBAR:
|
2008-05-13 16:59:50 +02:00
|
|
|
ShowTransparencyToolbar();
|
|
|
|
break;
|
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_TRANSPARANCY:
|
2008-05-13 16:59:50 +02:00
|
|
|
ResetRestoreAllTransparency();
|
|
|
|
break;
|
2007-04-05 09:49:04 +02:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_CHAT: // smart chat; send to team if any, otherwise to all
|
2008-05-13 16:59:50 +02:00
|
|
|
if (_networking) {
|
2011-04-22 17:54:16 +02:00
|
|
|
const NetworkClientInfo *cio = NetworkClientInfo::GetByClientID(_network_own_client_id);
|
2019-04-10 23:07:06 +02:00
|
|
|
if (cio == nullptr) break;
|
2008-05-13 16:59:50 +02:00
|
|
|
|
2008-12-22 22:15:02 +01:00
|
|
|
ShowNetworkChatQueryWindow(NetworkClientPreferTeamChat(cio) ? DESTTYPE_TEAM : DESTTYPE_BROADCAST, cio->client_playas);
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
|
|
|
break;
|
2006-10-18 23:07:36 +02:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_CHAT_ALL: // send text message to all clients
|
2008-05-13 16:59:50 +02:00
|
|
|
if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
|
|
|
|
break;
|
2007-01-14 22:32:13 +01:00
|
|
|
|
2010-07-03 15:42:27 +02:00
|
|
|
case GHK_CHAT_COMPANY: // send text to all team mates
|
2008-05-13 16:59:50 +02:00
|
|
|
if (_networking) {
|
2011-04-22 17:54:16 +02:00
|
|
|
const NetworkClientInfo *cio = NetworkClientInfo::GetByClientID(_network_own_client_id);
|
2019-04-10 23:07:06 +02:00
|
|
|
if (cio == nullptr) break;
|
2008-05-13 16:59:50 +02:00
|
|
|
|
|
|
|
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, cio->client_playas);
|
|
|
|
}
|
|
|
|
break;
|
2010-10-20 09:30:15 +02:00
|
|
|
|
|
|
|
case GHK_CHAT_SERVER: // send text to the server
|
|
|
|
if (_networking && !_network_server) {
|
|
|
|
ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, CLIENT_ID_SERVER);
|
|
|
|
}
|
|
|
|
break;
|
2004-12-04 18:54:56 +01:00
|
|
|
|
2020-07-05 20:18:35 +02:00
|
|
|
case GHK_CLOSE_NEWS: // close active news window
|
|
|
|
if (!HideActiveNewsMessage()) return ES_NOT_HANDLED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GHK_CLOSE_ERROR: // close active error window
|
|
|
|
if (!HideActiveErrorMessage()) return ES_NOT_HANDLED;
|
|
|
|
break;
|
|
|
|
|
2008-05-18 01:11:06 +02:00
|
|
|
default: return ES_NOT_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
2008-05-18 01:11:06 +02:00
|
|
|
return ES_HANDLED;
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
2006-08-21 16:34:59 +02:00
|
|
|
|
2019-03-04 08:49:37 +01:00
|
|
|
void OnScroll(Point delta) override
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2011-01-22 15:51:36 +01:00
|
|
|
this->viewport->scrollpos_x += ScaleByZoom(delta.x, this->viewport->zoom);
|
|
|
|
this->viewport->scrollpos_y += ScaleByZoom(delta.y, this->viewport->zoom);
|
2008-05-13 16:59:50 +02:00
|
|
|
this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x;
|
|
|
|
this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
|
2023-04-13 17:18:27 +02:00
|
|
|
this->refresh_timeout.Reset();
|
2011-01-15 16:36:58 +01:00
|
|
|
}
|
2006-08-21 16:59:58 +02:00
|
|
|
|
2019-03-04 08:49:37 +01:00
|
|
|
void OnMouseWheel(int wheel) override
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2018-04-28 00:12:49 +02:00
|
|
|
if (_settings_client.gui.scrollwheel_scrolling != 2) {
|
2011-02-05 17:36:37 +01:00
|
|
|
ZoomInOrOutToCursorWindow(wheel < 0, this);
|
|
|
|
}
|
2008-05-13 16:59:50 +02:00
|
|
|
}
|
2006-11-07 14:06:02 +01:00
|
|
|
|
2019-03-04 08:49:37 +01:00
|
|
|
void OnResize() override
|
2009-08-01 14:42:27 +02:00
|
|
|
{
|
2019-04-10 23:07:06 +02:00
|
|
|
if (this->viewport != nullptr) {
|
2011-12-16 17:49:53 +01:00
|
|
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT);
|
2009-08-01 14:42:27 +02:00
|
|
|
nvp->UpdateViewportCoordinates(this);
|
2023-04-13 17:18:27 +02:00
|
|
|
this->refresh_timeout.Reset();
|
2009-08-01 14:42:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 20:11:59 +01:00
|
|
|
bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override
|
2021-08-18 16:52:42 +02:00
|
|
|
{
|
|
|
|
if (widget != WID_M_VIEWPORT) return false;
|
|
|
|
return this->viewport->overlay->ShowTooltip(pt, close_cond);
|
|
|
|
}
|
|
|
|
|
2011-03-13 22:31:29 +01:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
|
|
|
*/
|
2023-09-16 22:20:53 +02:00
|
|
|
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
|
2008-05-13 16:59:50 +02:00
|
|
|
{
|
2011-03-13 22:31:29 +01:00
|
|
|
if (!gui_scope) return;
|
2012-12-01 14:12:39 +01:00
|
|
|
/* Forward the message to the appropriate toolbar (ingame or scenario editor) */
|
2011-02-23 21:54:55 +01:00
|
|
|
InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
2010-07-03 15:42:27 +02:00
|
|
|
|
2023-06-05 19:12:30 +02:00
|
|
|
static inline HotkeyList hotkeys{"global", {
|
|
|
|
Hotkey({'Q' | WKC_CTRL, 'Q' | WKC_META}, "quit", GHK_QUIT),
|
|
|
|
Hotkey({'W' | WKC_CTRL, 'W' | WKC_META}, "abandon", GHK_ABANDON),
|
|
|
|
Hotkey(WKC_BACKQUOTE, "console", GHK_CONSOLE),
|
|
|
|
Hotkey('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
|
|
|
|
Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
|
2023-10-28 20:07:50 +02:00
|
|
|
Hotkey('O' | WKC_CTRL, "widget_outlines", GHK_WIDGET_OUTLINES),
|
2023-06-05 19:12:30 +02:00
|
|
|
Hotkey('C', "center", GHK_CENTER),
|
|
|
|
Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
|
|
|
|
Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
|
|
|
|
Hotkey(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
|
|
|
|
Hotkey(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
|
|
|
|
Hotkey(WKC_DELETE | WKC_CTRL, "delete_all_messages", GHK_DELETE_ALL_MESSAGES),
|
|
|
|
Hotkey('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
|
2010-07-03 15:42:27 +02:00
|
|
|
#if defined(_DEBUG)
|
2023-06-05 19:12:30 +02:00
|
|
|
Hotkey('0' | WKC_ALT, "crash_game", GHK_CRASH),
|
|
|
|
Hotkey('1' | WKC_ALT, "money", GHK_MONEY),
|
|
|
|
Hotkey('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
|
2010-07-03 15:42:27 +02:00
|
|
|
#endif
|
2023-06-05 19:12:30 +02:00
|
|
|
Hotkey('1' | WKC_CTRL, "transparency_signs", GHK_TOGGLE_TRANSPARENCY),
|
|
|
|
Hotkey('2' | WKC_CTRL, "transparency_trees", GHK_TOGGLE_TRANSPARENCY + 1),
|
|
|
|
Hotkey('3' | WKC_CTRL, "transparency_houses", GHK_TOGGLE_TRANSPARENCY + 2),
|
|
|
|
Hotkey('4' | WKC_CTRL, "transparency_industries", GHK_TOGGLE_TRANSPARENCY + 3),
|
|
|
|
Hotkey('5' | WKC_CTRL, "transparency_buildings", GHK_TOGGLE_TRANSPARENCY + 4),
|
|
|
|
Hotkey('6' | WKC_CTRL, "transparency_bridges", GHK_TOGGLE_TRANSPARENCY + 5),
|
|
|
|
Hotkey('7' | WKC_CTRL, "transparency_structures", GHK_TOGGLE_TRANSPARENCY + 6),
|
|
|
|
Hotkey('8' | WKC_CTRL, "transparency_catenary", GHK_TOGGLE_TRANSPARENCY + 7),
|
|
|
|
Hotkey('9' | WKC_CTRL, "transparency_loading", GHK_TOGGLE_TRANSPARENCY + 8),
|
|
|
|
Hotkey('1' | WKC_CTRL | WKC_SHIFT, "invisibility_signs", GHK_TOGGLE_INVISIBILITY),
|
|
|
|
Hotkey('2' | WKC_CTRL | WKC_SHIFT, "invisibility_trees", GHK_TOGGLE_INVISIBILITY + 1),
|
|
|
|
Hotkey('3' | WKC_CTRL | WKC_SHIFT, "invisibility_houses", GHK_TOGGLE_INVISIBILITY + 2),
|
|
|
|
Hotkey('4' | WKC_CTRL | WKC_SHIFT, "invisibility_industries", GHK_TOGGLE_INVISIBILITY + 3),
|
|
|
|
Hotkey('5' | WKC_CTRL | WKC_SHIFT, "invisibility_buildings", GHK_TOGGLE_INVISIBILITY + 4),
|
|
|
|
Hotkey('6' | WKC_CTRL | WKC_SHIFT, "invisibility_bridges", GHK_TOGGLE_INVISIBILITY + 5),
|
|
|
|
Hotkey('7' | WKC_CTRL | WKC_SHIFT, "invisibility_structures", GHK_TOGGLE_INVISIBILITY + 6),
|
|
|
|
Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
|
|
|
|
Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
|
|
|
|
Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY),
|
|
|
|
Hotkey({WKC_RETURN, 'T'}, "chat", GHK_CHAT),
|
|
|
|
Hotkey({WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T'}, "chat_all", GHK_CHAT_ALL),
|
|
|
|
Hotkey({WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T'}, "chat_company", GHK_CHAT_COMPANY),
|
|
|
|
Hotkey({WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T'}, "chat_server", GHK_CHAT_SERVER),
|
|
|
|
Hotkey(WKC_SPACE, "close_news", GHK_CLOSE_NEWS),
|
|
|
|
Hotkey(WKC_SPACE, "close_error", GHK_CLOSE_ERROR),
|
|
|
|
}};
|
2008-05-13 16:59:50 +02:00
|
|
|
};
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2024-01-17 04:17:02 +01:00
|
|
|
static WindowDesc _main_window_desc(
|
2019-04-10 23:07:06 +02:00
|
|
|
WDP_MANUAL, nullptr, 0, 0,
|
2013-06-15 17:30:44 +02:00
|
|
|
WC_MAIN_WINDOW, WC_NONE,
|
2023-06-14 18:24:14 +02:00
|
|
|
WDF_NO_CLOSE,
|
2023-09-03 22:54:13 +02:00
|
|
|
std::begin(_nested_main_window_widgets), std::end(_nested_main_window_widgets),
|
2013-06-15 17:30:44 +02:00
|
|
|
&MainWindow::hotkeys
|
|
|
|
);
|
|
|
|
|
2010-07-04 13:28:16 +02:00
|
|
|
/**
|
|
|
|
* Does the given keycode match one of the keycodes bound to 'quit game'?
|
|
|
|
* @param keycode The keycode that was pressed by the user.
|
|
|
|
* @return True iff the keycode matches one of the hotkeys for 'quit'.
|
|
|
|
*/
|
2023-05-08 19:01:06 +02:00
|
|
|
bool IsQuitKey(uint16_t keycode)
|
2010-07-04 13:28:16 +02:00
|
|
|
{
|
2013-06-15 17:28:09 +02:00
|
|
|
int num = MainWindow::hotkeys.CheckMatch(keycode);
|
2010-07-04 13:28:16 +02:00
|
|
|
return num == GHK_QUIT;
|
|
|
|
}
|
|
|
|
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-03-07 12:47:46 +01:00
|
|
|
void ShowSelectGameWindow();
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2011-05-01 21:14:12 +02:00
|
|
|
/**
|
|
|
|
* Initialise the default colours (remaps and the likes), and load the main windows.
|
|
|
|
*/
|
2009-02-09 03:57:15 +01:00
|
|
|
void SetupColoursAndInitialWindow()
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2023-12-24 23:51:55 +01:00
|
|
|
for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) {
|
2024-03-16 23:59:32 +01:00
|
|
|
const uint8_t *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1;
|
2023-12-24 23:51:55 +01:00
|
|
|
assert(b != nullptr);
|
2023-12-28 11:02:49 +01:00
|
|
|
for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) {
|
2023-12-24 23:51:55 +01:00
|
|
|
SetColourGradient(i, j, b[0xC6 + j]);
|
|
|
|
}
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
|
|
|
|
2013-06-15 17:30:44 +02:00
|
|
|
new MainWindow(&_main_window_desc);
|
2006-12-30 02:52:09 +01:00
|
|
|
|
2007-03-03 05:04:22 +01:00
|
|
|
/* XXX: these are not done */
|
2005-11-14 20:48:04 +01:00
|
|
|
switch (_game_mode) {
|
2006-12-30 02:52:09 +01:00
|
|
|
default: NOT_REACHED();
|
|
|
|
case GM_MENU:
|
|
|
|
ShowSelectGameWindow();
|
|
|
|
break;
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2006-12-30 02:52:09 +01:00
|
|
|
case GM_NORMAL:
|
|
|
|
case GM_EDITOR:
|
|
|
|
ShowVitalWindows();
|
|
|
|
break;
|
2004-08-09 19:04:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-01 21:14:12 +02:00
|
|
|
/**
|
|
|
|
* Show the vital in-game windows.
|
|
|
|
*/
|
2007-03-07 12:47:46 +01:00
|
|
|
void ShowVitalWindows()
|
2005-01-11 01:54:06 +01:00
|
|
|
{
|
2008-05-15 21:00:20 +02:00
|
|
|
AllocateToolbar();
|
2006-11-07 15:41:53 +01:00
|
|
|
|
(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
2006-08-19 12:00:30 +02:00
|
|
|
/* Status bad only for normal games */
|
|
|
|
if (_game_mode == GM_EDITOR) return;
|
2005-01-11 01:54:06 +01:00
|
|
|
|
2008-04-18 17:13:45 +02:00
|
|
|
ShowStatusBar();
|
2005-01-11 01:54:06 +01:00
|
|
|
}
|
|
|
|
|
2008-04-07 22:28:58 +02:00
|
|
|
/**
|
|
|
|
* Size of the application screen changed.
|
|
|
|
* Adapt the game screen-size, re-allocate the open windows, and repaint everything
|
|
|
|
*/
|
2007-03-07 12:47:46 +01:00
|
|
|
void GameSizeChanged()
|
2004-08-09 19:04:08 +02:00
|
|
|
{
|
2008-06-16 21:38:41 +02:00
|
|
|
_cur_resolution.width = _screen.width;
|
|
|
|
_cur_resolution.height = _screen.height;
|
2004-08-09 19:04:08 +02:00
|
|
|
ScreenSizeChanged();
|
2008-04-18 23:49:38 +02:00
|
|
|
RelocateAllWindows(_screen.width, _screen.height);
|
2004-08-09 19:04:08 +02:00
|
|
|
MarkWholeScreenDirty();
|
|
|
|
}
|