From 0840f6742ba1a16e1788de8faed7b146a4740bf2 Mon Sep 17 00:00:00 2001 From: morfidon <57798071+morfidon@users.noreply.github.com> Date: Wed, 11 Mar 2026 09:28:36 +0100 Subject: [PATCH] Remove redundant IsAutoSavePending wrapper and fix SDL_TICKS_PASSED location --- Source/diablo.cpp | 14 ++++---------- Source/diablo.h | 1 - Source/utils/sdl2_backports.h | 4 ++++ Source/utils/sdl_compat.h | 3 --- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 5111b0954..3f0c594cb 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -831,11 +831,9 @@ void GameEventHandler(const SDL_Event &event, uint16_t modState) ReleaseKey(SDLC_EventKey(event)); return; case SDL_EVENT_MOUSE_MOTION: - if (ControlMode == ControlTypes::KeyboardAndMouse) { - if (invflag) - InvalidateInventorySlot(); - MousePosition = { SDLC_EventMotionIntX(event), SDLC_EventMotionIntY(event) }; - } + if (ControlMode == ControlTypes::KeyboardAndMouse && invflag) + InvalidateInventorySlot(); + MousePosition = { SDLC_EventMotionIntX(event), SDLC_EventMotionIntY(event) }; gmenu_on_mouse_move(); return; case SDL_EVENT_MOUSE_BUTTON_DOWN: @@ -1948,7 +1946,7 @@ int GetSecondsUntilNextAutoSave() if (!*GetOptions().Gameplay.autoSaveEnabled) return -1; - if (IsAutoSavePending()) + if (HasPendingAutoSave()) return 0; const uint32_t now = SDL_GetTicks(); @@ -1975,10 +1973,6 @@ void RequestAutoSave(AutoSaveReason reason) QueueAutoSave(reason); } -bool IsAutoSavePending() -{ - return HasPendingAutoSave(); -} void QueueAutoSave(AutoSaveReason reason) { diff --git a/Source/diablo.h b/Source/diablo.h index 5b47bc9c9..86c378cc9 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -113,7 +113,6 @@ void MarkCombatActivity(); bool IsAutoSaveSafe(); int GetSecondsUntilNextAutoSave(); bool HasPendingAutoSave(); -bool IsAutoSavePending(); void RequestAutoSave(AutoSaveReason reason); void QueueAutoSave(AutoSaveReason reason); bool AttemptAutoSave(AutoSaveReason reason); diff --git a/Source/utils/sdl2_backports.h b/Source/utils/sdl2_backports.h index f1c3f584d..cefc8a223 100644 --- a/Source/utils/sdl2_backports.h +++ b/Source/utils/sdl2_backports.h @@ -7,6 +7,10 @@ #define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) #endif +#ifndef SDL_TICKS_PASSED +#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) +#endif + #if !SDL_VERSION_ATLEAST(2, 0, 4) inline SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) { diff --git a/Source/utils/sdl_compat.h b/Source/utils/sdl_compat.h index 56690864c..e60e3d33a 100644 --- a/Source/utils/sdl_compat.h +++ b/Source/utils/sdl_compat.h @@ -19,9 +19,6 @@ #endif #endif -#ifndef SDL_TICKS_PASSED -#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) -#endif #ifdef USE_SDL1 #define SDL_Scancode Uint8