Merge remote-tracking branch 'upstream/master'

This commit is contained in:
dP
2025-09-28 02:33:49 +05:00
926 changed files with 37902 additions and 27369 deletions

View File

@@ -72,7 +72,7 @@ bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLigh
{
if (w->IsWidgetDisabled(widget)) return false;
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
SndClickBeep();
w->SetDirty();
if (w->IsWidgetLowered(widget) && mode == _thd.place_mode) {
@@ -211,14 +211,14 @@ enum GlobalHotKeys : int32_t {
GHK_TOGGLE_TRANSPARENCY,
GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9,
GHK_TRANSPARENCY_TOOLBAR = GHK_TOGGLE_INVISIBILITY + 8,
GHK_TRANSPARANCY,
GHK_BORROW_ALL,
GHK_TRANSPARENCY,
GHK_CHAT,
GHK_CHAT_ALL,
GHK_CHAT_COMPANY,
GHK_CHAT_SERVER,
GHK_CLOSE_NEWS,
GHK_CLOSE_ERROR,
CM_GHK_BORROW_ALL,
};
struct MainWindow : Window
@@ -230,7 +230,7 @@ struct MainWindow : Window
ResizeWindow(this, _screen.width, _screen.height);
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT);
nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZOOM_LVL_VIEWPORT));
nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZoomLevel::Viewport));
this->viewport->overlay = std::make_shared<LinkGraphOverlay>(this, WID_M_VIEWPORT, 0, CompanyMask{}, 2);
this->refresh_timeout.Reset();
@@ -249,7 +249,7 @@ struct MainWindow : Window
}
/** Refresh the link-graph overlay on a regular interval. */
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(7650), [this](auto) {
const IntervalTimer<TimerWindow> refresh_interval = {std::chrono::milliseconds(7650), [this](auto) {
RefreshLinkGraph();
}};
@@ -281,6 +281,9 @@ struct MainWindow : Window
DrawSprite(sprite, PAL_NONE, off_x, ScaleGUITrad(50));
off_x += GetSpriteSize(sprite).width + letter_spacing;
}
int text_y = this->height - GetCharacterHeight(FS_NORMAL) * 2;
DrawString(0, this->width - 1, text_y, STR_INTRO_VERSION, TC_WHITE, SA_CENTER);
}
}
@@ -390,11 +393,11 @@ struct MainWindow : Window
ShowTransparencyToolbar();
break;
case GHK_TRANSPARANCY:
case GHK_TRANSPARENCY:
ResetRestoreAllTransparency();
break;
case GHK_BORROW_ALL:
case CM_GHK_BORROW_ALL:
citymania::cmd::IncreaseLoan(LoanCommand::Max, 0)
.with_error(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY)
.post();
@@ -450,8 +453,9 @@ struct MainWindow : Window
this->refresh_timeout.Reset();
}
void OnMouseWheel(int wheel) override
void OnMouseWheel(int wheel, WidgetID widget) override
{
if (widget != WID_M_VIEWPORT) return;
if (_settings_client.gui.scrollwheel_scrolling != SWS_OFF) {
bool in = wheel < 0;
@@ -535,19 +539,19 @@ struct MainWindow : Window
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_NONE, "cm_borrow_all", GHK_BORROW_ALL), // CM
Hotkey('X', "toggle_transparency", GHK_TRANSPARENCY),
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),
Hotkey(WKC_NONE, "cm_borrow_all", CM_GHK_BORROW_ALL),
}};
};
static WindowDesc _main_window_desc(
WDP_MANUAL, nullptr, 0, 0,
WDP_MANUAL, {}, 0, 0,
WC_MAIN_WINDOW, WC_NONE,
WindowDefaultFlag::NoClose,
_nested_main_window_widgets,
@@ -574,10 +578,10 @@ void ShowSelectGameWindow();
void SetupColoursAndInitialWindow()
{
for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) {
const uint8_t *b = GetNonSprite(GENERAL_SPRITE_COLOUR(i), SpriteType::Recolour) + 1;
const uint8_t *b = GetNonSprite(GetColourPalette(i), SpriteType::Recolour) + 1;
assert(b != nullptr);
for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) {
SetColourGradient(i, j, b[0xC6 + j]);
SetColourGradient(i, j, PixelColour{b[0xC6 + j]});
}
}