Browse Source

Remove redundant IsAutoSavePending wrapper and fix SDL_TICKS_PASSED location

pull/8497/head
morfidon 6 days ago
parent
commit
0840f6742b
  1. 14
      Source/diablo.cpp
  2. 1
      Source/diablo.h
  3. 4
      Source/utils/sdl2_backports.h
  4. 3
      Source/utils/sdl_compat.h

14
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)
{

1
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);

4
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)
{

3
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

Loading…
Cancel
Save