Merge remote-tracking branch 'upstream/master' into 13.0

This commit is contained in:
Pavel Stupnikov
2022-11-26 22:16:25 +04:00
508 changed files with 14617 additions and 9750 deletions

View File

@@ -33,6 +33,7 @@
#include "guitimer_func.h"
#include "error.h"
#include "news_gui.h"
#include "misc_cmd.h"
#include "saveload/saveload.h"
@@ -77,7 +78,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyl
}
void CcPlaySound_EXPLOSION(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
void CcPlaySound_EXPLOSION(Commands cmd, const CommandCost &result, TileIndex tile)
{
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile);
}
@@ -223,7 +224,7 @@ struct MainWindow : Window
ResizeWindow(this, _screen.width, _screen.height);
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT);
nvp->InitializeViewport(this, TileXY(32, 32), ZOOM_LVL_VIEWPORT);
nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZOOM_LVL_VIEWPORT));
this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3);
this->refresh.SetInterval(LINKGRAPH_DELAY);
@@ -249,8 +250,8 @@ struct MainWindow : Window
this->DrawWidgets();
if (_game_mode == GM_MENU) {
static const SpriteID title_sprites[] = {SPR_OTTD_O, SPR_OTTD_P, SPR_OTTD_E, SPR_OTTD_N, SPR_OTTD_T, SPR_OTTD_T, SPR_OTTD_D};
static const uint LETTER_SPACING = 10;
int name_width = (lengthof(title_sprites) - 1) * LETTER_SPACING;
uint letter_spacing = ScaleGUITrad(10);
int name_width = (lengthof(title_sprites) - 1) * letter_spacing;
for (uint i = 0; i < lengthof(title_sprites); i++) {
name_width += GetSpriteSize(title_sprites[i]).width;
@@ -258,8 +259,8 @@ struct MainWindow : Window
int off_x = (this->width - name_width) / 2;
for (uint i = 0; i < lengthof(title_sprites); i++) {
DrawSprite(title_sprites[i], PAL_NONE, off_x, 50);
off_x += GetSpriteSize(title_sprites[i]).width + LETTER_SPACING;
DrawSprite(title_sprites[i], PAL_NONE, off_x, ScaleGUITrad(50));
off_x += GetSpriteSize(title_sprites[i]).width + letter_spacing;
}
}
}
@@ -328,7 +329,7 @@ struct MainWindow : Window
case GHK_MONEY: // Gimme money
/* You can only cheat for money in singleplayer mode. */
if (!_networking) DoCommandP(0, 10000000, 0, CMD_MONEY_CHEAT);
if (!_networking) Command<CMD_MONEY_CHEAT>::Post(10000000);
break;
case GHK_UPDATE_COORDS: // Update the coordinates of all station signs
@@ -440,6 +441,12 @@ struct MainWindow : Window
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_M_VIEWPORT) return false;
return this->viewport->overlay->ShowTooltip(pt, close_cond);
}
/**
* Some data on this window has become invalid.
* @param data Information about the changed data.