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: misc_gui.cpp 27995 2018-03-21 19:34:17Z frosch $ */
/* $Id$ */
/*
* This file is part of OpenTTD.
@@ -27,6 +27,7 @@
#include "newgrf_debug.h"
#include "newgrf_cargo.h"
#include "zoom_func.h"
#include "guitimer_func.h"
#include "widgets/misc_widget.h"
@@ -155,6 +156,7 @@ public:
DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5);
DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _me[tile].m6);
DEBUG(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7);
DEBUG(misc, LANDINFOD_LEVEL, "m8 = %#x", _me[tile].m8);
#undef LANDINFOD_LEVEL
}
@@ -217,11 +219,8 @@ public:
StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
Company *c = Company::GetIfValid(_local_company);
if (c != NULL) {
Money old_money = c->money;
c->money = INT64_MAX;
assert(_current_company == _local_company);
CommandCost costclear = DoCommand(tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
c->money = old_money;
CommandCost costclear = DoCommand(tile, 0, 0, DC_QUERY_COST, CMD_LANDSCAPE_CLEAR);
if (costclear.Succeeded()) {
Money cost = costclear.GetCost();
if (cost < 0) {
@@ -344,10 +343,7 @@ public:
for (CargoID i = 0; i < NUM_CARGO; ++i) {
if (acceptance[i] > 0) {
/* Add a comma between each item. */
if (found) {
*strp++ = ',';
*strp++ = ' ';
}
if (found) strp = strecpy(strp, ", ", lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
found = true;
/* If the accepted value is less than 8, show it in 1/8:ths */
@@ -453,6 +449,7 @@ static const char * const _credits[] = {
" Christoph Elsenhans (frosch) - General coding (since 0.6)",
" Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
" Michael Lutz (michi_cc) - Path based signals (since 0.7)",
" Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)",
" Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
" Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
" Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
@@ -490,7 +487,6 @@ static const char * const _credits[] = {
" Mike Ragsdale - OpenTTD installer",
" Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
" Richard Kempton (richK) - additional airports, initial TGP implementation",
" Emperor Jake - titlegame",
"",
" Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
" L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
@@ -508,16 +504,18 @@ static const char * const _credits[] = {
struct AboutWindow : public Window {
int text_position; ///< The top of the scrolling text
byte counter; ///< Used to scroll the text every 5 ticks
int line_height; ///< The height of a single line
static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
static const uint TIMER_INTERVAL = 150; ///< Scrolling interval in ms
GUITimer timer;
AboutWindow() : Window(&_about_desc)
{
this->InitNested(WN_GAME_OPTIONS_ABOUT);
this->counter = 5;
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
this->timer.SetInterval(TIMER_INTERVAL);
}
virtual void SetStringParameters(int widget) const
@@ -556,11 +554,11 @@ struct AboutWindow : public Window {
}
}
virtual void OnTick()
virtual void OnRealtimeTick(uint delta_ms)
{
if (--this->counter == 0) {
this->counter = 5;
this->text_position--;
uint count = this->timer.CountElapsed(delta_ms);
if (count > 0) {
this->text_position -= count;
/* If the last text has scrolled start a new from the start */
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) {
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
@@ -709,7 +707,7 @@ struct TooltipsWindow : public Window
this->string_id = str;
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
assert(paramcount <= lengthof(this->params));
memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
if (paramcount > 0) memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
this->paramcount = paramcount;
this->close_cond = close_tooltip;
@@ -787,7 +785,7 @@ struct TooltipsWindow : public Window
* @param str String to be displayed
* @param paramcount number of params to deal with
* @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
* @param use_left_mouse_button close the tooltip when the left (true) or right (false) mouse button is released
* @param close_tooltip when the left (true) or right (false) mouse button is released
*/
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
{
@@ -1123,7 +1121,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *paren
*/
struct QueryWindow : public Window {
QueryCallbackProc *proc; ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise
uint64 params[10]; ///< local copy of _decode_parameters
uint64 params[10]; ///< local copy of #_global_string_params
StringID message; ///< message shown for query window
StringID caption; ///< title of window