From 3ffedb7a6973d7a151c50587dae7eb7368d1aaeb Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 17 Jul 2021 16:45:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Apply=20code=20style=20to=20src?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/DiabloUI/diabloui.cpp | 11 ++++++----- Source/cursor.cpp | 6 +++--- Source/diablo.cpp | 3 +-- Source/dthread.cpp | 10 +++++----- Source/track.cpp | 3 +-- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Source/DiabloUI/diabloui.cpp b/Source/DiabloUI/diabloui.cpp index 9f3f5db63..d20ca8f9c 100644 --- a/Source/DiabloUI/diabloui.cpp +++ b/Source/DiabloUI/diabloui.cpp @@ -395,18 +395,19 @@ void UiHandleEvents(SDL_Event *event) HandleControllerAddedOrRemovedEvent(*event); if (event->type == SDL_WINDOWEVENT) { - if (event->window.event == SDL_WINDOWEVENT_SHOWN) + if (event->window.event == SDL_WINDOWEVENT_SHOWN) { gbActive = true; - else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) + } else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) { gbActive = false; - else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) + } else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { ReinitializeHardwareCursor(); #ifndef NOSOUND - else if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST) + } else if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST) { music_mute(); - else if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) + } else if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) { music_unmute(); #endif + } } #endif } diff --git a/Source/cursor.cpp b/Source/cursor.cpp index d2ffee241..051a71b45 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -377,15 +377,15 @@ void CheckCursMove() if (sgbMouseDown == CLICK_LEFT && pcursinvitem == -1) { if (pcursmonst != -1) { if (Monsters[pcursmonst]._mDelFlag || Monsters[pcursmonst]._mhitpoints >> 6 <= 0 - || !(dFlags[Monsters[pcursmonst].position.tile.x][Monsters[pcursmonst].position.tile.y] & BFLAG_VISIBLE)) + || ((dFlags[Monsters[pcursmonst].position.tile.x][Monsters[pcursmonst].position.tile.y] & BFLAG_VISIBLE) == 0)) pcursmonst = -1; } else if (pcursobj != -1) { if (Objects[pcursobj]._oSelFlag < 1) pcursobj = -1; } else if (pcursplr != -1) { if (Players[pcursplr]._pmode == PM_DEATH || Players[pcursplr]._pmode == PM_QUIT || !Players[pcursplr].plractive - || currlevel != Players[pcursplr].plrlevel || Players[pcursplr]._pHitPoints >> 6 <= 0 - || !(dFlags[Players[pcursplr].position.tile.x][Players[pcursplr].position.tile.y] & BFLAG_VISIBLE)) + || currlevel != Players[pcursplr].plrlevel || Players[pcursplr]._pHitPoints >> 6 <= 0 + || ((dFlags[Players[pcursplr].position.tile.x][Players[pcursplr].position.tile.y] & BFLAG_VISIBLE) == 0)) pcursplr = -1; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 55f951f52..5794d5ee5 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1791,8 +1791,7 @@ void diablo_focus_pause() void diablo_focus_unpause() { - if (gbIsMultiplayer || !MinimizePaused) - { + if (gbIsMultiplayer || !MinimizePaused) { return; } diff --git a/Source/dthread.cpp b/Source/dthread.cpp index a85913afc..7ba8792a4 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -4,8 +4,8 @@ * Implementation of functions for updating game state from network commands. */ -#include #include +#include #include #include "nthread.h" @@ -21,10 +21,10 @@ struct DThreadPkt { uint32_t len; DThreadPkt(int pnum, _cmd_id(cmd), std::unique_ptr data, uint32_t len) - : pnum(pnum) - , cmd(cmd) - , data(std::move(data)) - , len(len) + : pnum(pnum) + , cmd(cmd) + , data(std::move(data)) + , len(len) { } }; diff --git a/Source/track.cpp b/Source/track.cpp index 30d73ceff..792accb39 100644 --- a/Source/track.cpp +++ b/Source/track.cpp @@ -43,8 +43,7 @@ static bool RepeatMouseAttack(bool leftButton) if (lastAction != MouseActionType::Attack && lastAction != MouseActionType::Attack_MonsterTarget && lastAction != MouseActionType::Attack_PlayerTarget && lastAction != MouseActionType::Spell && lastAction != MouseActionType::Spell_ComplainedAboutMana) return false; - if (Players[MyPlayerId]._pmode != PM_DEATH && Players[MyPlayerId]._pmode != PM_QUIT && - Players[MyPlayerId].destAction == ACTION_NONE && SDL_GetTicks() - *timePressed >= (Uint32)gnTickDelay * 4) { + if (Players[MyPlayerId]._pmode != PM_DEATH && Players[MyPlayerId]._pmode != PM_QUIT && Players[MyPlayerId].destAction == ACTION_NONE && SDL_GetTicks() - *timePressed >= (Uint32)gnTickDelay * 4) { bool rangedAttack = Players[MyPlayerId]._pwtype == WT_RANGED; *timePressed = SDL_GetTicks(); switch (lastAction) {