Merge 1.9.0-beta2

This commit is contained in:
Pavel Stupnikov
2019-02-14 00:47:22 +03:00
1364 changed files with 22213 additions and 10721 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: main_gui.cpp 27571 2016-05-22 10:07:48Z frosch $ */
/* $Id$ */
/*
* This file is part of OpenTTD.
@@ -32,6 +32,7 @@
#include "linkgraph/linkgraph_gui.h"
#include "tilehighlight_func.h"
#include "hotkeys.h"
#include "guitimer_func.h"
#include "saveload/saveload.h"
@@ -236,10 +237,11 @@ enum {
struct MainWindow : Window
{
uint refresh;
GUITimer refresh;
static const uint LINKGRAPH_REFRESH_PERIOD = 0xff;
static const uint LINKGRAPH_DELAY = 0xf;
/* Refresh times in milliseconds */
static const uint LINKGRAPH_REFRESH_PERIOD = 7650;
static const uint LINKGRAPH_DELAY = 450;
MainWindow(WindowDesc *desc) : Window(desc)
{
@@ -251,14 +253,14 @@ struct MainWindow : Window
nvp->InitializeViewport(this, TileXY(32, 32), ZOOM_LVL_VIEWPORT);
this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3);
this->refresh = LINKGRAPH_DELAY;
this->refresh.SetInterval(LINKGRAPH_DELAY);
}
virtual void OnTick()
virtual void OnRealtimeTick(uint delta_ms)
{
if (--this->refresh > 0) return;
if (!this->refresh.Elapsed(delta_ms)) return;
this->refresh = LINKGRAPH_REFRESH_PERIOD;
this->refresh.SetInterval(LINKGRAPH_REFRESH_PERIOD);
if (this->viewport->overlay->GetCargoMask() == 0 ||
this->viewport->overlay->GetCompanyMask() == 0) {
@@ -439,12 +441,12 @@ struct MainWindow : Window
this->viewport->scrollpos_y += ScaleByZoom(delta.y, this->viewport->zoom);
this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x;
this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
this->refresh = LINKGRAPH_DELAY;
this->refresh.SetInterval(LINKGRAPH_DELAY);
}
virtual void OnMouseWheel(int wheel)
{
if (_settings_client.gui.scrollwheel_scrolling == 0) {
if (_settings_client.gui.scrollwheel_scrolling != 2) {
ZoomInOrOutToCursorWindow(wheel < 0, this);
}
}
@@ -454,7 +456,7 @@ struct MainWindow : Window
if (this->viewport != NULL) {
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT);
nvp->UpdateViewportCoordinates(this);
this->refresh = LINKGRAPH_DELAY;
this->refresh.SetInterval(LINKGRAPH_DELAY);
}
}