Browse Source

💄 Apply code style to src

pull/2410/head
Anders Jenbo 5 years ago
parent
commit
3ffedb7a69
  1. 11
      Source/DiabloUI/diabloui.cpp
  2. 6
      Source/cursor.cpp
  3. 3
      Source/diablo.cpp
  4. 10
      Source/dthread.cpp
  5. 3
      Source/track.cpp

11
Source/DiabloUI/diabloui.cpp

@ -395,18 +395,19 @@ void UiHandleEvents(SDL_Event *event)
HandleControllerAddedOrRemovedEvent(*event); HandleControllerAddedOrRemovedEvent(*event);
if (event->type == SDL_WINDOWEVENT) { if (event->type == SDL_WINDOWEVENT) {
if (event->window.event == SDL_WINDOWEVENT_SHOWN) if (event->window.event == SDL_WINDOWEVENT_SHOWN) {
gbActive = true; gbActive = true;
else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) } else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) {
gbActive = false; gbActive = false;
else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) } else if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
ReinitializeHardwareCursor(); ReinitializeHardwareCursor();
#ifndef NOSOUND #ifndef NOSOUND
else if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST) } else if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
music_mute(); music_mute();
else if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) } else if (event->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
music_unmute(); music_unmute();
#endif #endif
}
} }
#endif #endif
} }

6
Source/cursor.cpp

@ -377,15 +377,15 @@ void CheckCursMove()
if (sgbMouseDown == CLICK_LEFT && pcursinvitem == -1) { if (sgbMouseDown == CLICK_LEFT && pcursinvitem == -1) {
if (pcursmonst != -1) { if (pcursmonst != -1) {
if (Monsters[pcursmonst]._mDelFlag || Monsters[pcursmonst]._mhitpoints >> 6 <= 0 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; pcursmonst = -1;
} else if (pcursobj != -1) { } else if (pcursobj != -1) {
if (Objects[pcursobj]._oSelFlag < 1) if (Objects[pcursobj]._oSelFlag < 1)
pcursobj = -1; pcursobj = -1;
} else if (pcursplr != -1) { } else if (pcursplr != -1) {
if (Players[pcursplr]._pmode == PM_DEATH || Players[pcursplr]._pmode == PM_QUIT || !Players[pcursplr].plractive if (Players[pcursplr]._pmode == PM_DEATH || Players[pcursplr]._pmode == PM_QUIT || !Players[pcursplr].plractive
|| currlevel != Players[pcursplr].plrlevel || Players[pcursplr]._pHitPoints >> 6 <= 0 || currlevel != Players[pcursplr].plrlevel || Players[pcursplr]._pHitPoints >> 6 <= 0
|| !(dFlags[Players[pcursplr].position.tile.x][Players[pcursplr].position.tile.y] & BFLAG_VISIBLE)) || ((dFlags[Players[pcursplr].position.tile.x][Players[pcursplr].position.tile.y] & BFLAG_VISIBLE) == 0))
pcursplr = -1; pcursplr = -1;
} }

3
Source/diablo.cpp

@ -1791,8 +1791,7 @@ void diablo_focus_pause()
void diablo_focus_unpause() void diablo_focus_unpause()
{ {
if (gbIsMultiplayer || !MinimizePaused) if (gbIsMultiplayer || !MinimizePaused) {
{
return; return;
} }

10
Source/dthread.cpp

@ -4,8 +4,8 @@
* Implementation of functions for updating game state from network commands. * Implementation of functions for updating game state from network commands.
*/ */
#include <list>
#include <atomic> #include <atomic>
#include <list>
#include <mutex> #include <mutex>
#include "nthread.h" #include "nthread.h"
@ -21,10 +21,10 @@ struct DThreadPkt {
uint32_t len; uint32_t len;
DThreadPkt(int pnum, _cmd_id(cmd), std::unique_ptr<byte[]> data, uint32_t len) DThreadPkt(int pnum, _cmd_id(cmd), std::unique_ptr<byte[]> data, uint32_t len)
: pnum(pnum) : pnum(pnum)
, cmd(cmd) , cmd(cmd)
, data(std::move(data)) , data(std::move(data))
, len(len) , len(len)
{ {
} }
}; };

3
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) if (lastAction != MouseActionType::Attack && lastAction != MouseActionType::Attack_MonsterTarget && lastAction != MouseActionType::Attack_PlayerTarget && lastAction != MouseActionType::Spell && lastAction != MouseActionType::Spell_ComplainedAboutMana)
return false; return false;
if (Players[MyPlayerId]._pmode != PM_DEATH && Players[MyPlayerId]._pmode != PM_QUIT && if (Players[MyPlayerId]._pmode != PM_DEATH && Players[MyPlayerId]._pmode != PM_QUIT && Players[MyPlayerId].destAction == ACTION_NONE && SDL_GetTicks() - *timePressed >= (Uint32)gnTickDelay * 4) {
Players[MyPlayerId].destAction == ACTION_NONE && SDL_GetTicks() - *timePressed >= (Uint32)gnTickDelay * 4) {
bool rangedAttack = Players[MyPlayerId]._pwtype == WT_RANGED; bool rangedAttack = Players[MyPlayerId]._pwtype == WT_RANGED;
*timePressed = SDL_GetTicks(); *timePressed = SDL_GetTicks();
switch (lastAction) { switch (lastAction) {

Loading…
Cancel
Save