Browse Source

Update clang-format-check GitHub Workflow

Taking this opportunity as we've just done a global reformat and it's
quite small.
pull/3607/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
0e63b3ee0b
  1. 8
      .github/workflows/clang-format-check.yml
  2. 2
      Source/DiabloUI/settingsmenu.cpp
  3. 20
      Source/player.cpp

8
.github/workflows/clang-format-check.yml

@ -17,15 +17,15 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Formatting Check (Source) - name: Formatting Check (Source)
uses: jidicula/clang-format-action@v3.4.0 uses: jidicula/clang-format-action@v4.3.1
with: with:
clang-format-version: '11' clang-format-version: '13'
check-path: 'Source' check-path: 'Source'
fallback-style: 'webkit' fallback-style: 'webkit'
- name: Formatting Check (test) - name: Formatting Check (test)
uses: jidicula/clang-format-action@v3.4.0 uses: jidicula/clang-format-action@v4.3.1
with: with:
clang-format-version: '11' clang-format-version: '13'
check-path: 'test' check-path: 'test'
fallback-style: 'webkit' fallback-style: 'webkit'

2
Source/DiabloUI/settingsmenu.cpp

@ -1,8 +1,8 @@
#include "selstart.h" #include "selstart.h"
#include "control.h"
#include "DiabloUI/diabloui.h" #include "DiabloUI/diabloui.h"
#include "DiabloUI/scrollbar.h" #include "DiabloUI/scrollbar.h"
#include "control.h"
#include "hwcursor.hpp" #include "hwcursor.hpp"
#include "options.h" #include "options.h"
#include "utils/language.h" #include "utils/language.h"

20
Source/player.cpp

@ -348,7 +348,7 @@ void HandleWalkMode(int pnum, Displacement vel, Direction dir)
} }
player.position.offset = dirModeParams.offset; // Offset player sprite to align with their previous tile position player.position.offset = dirModeParams.offset; // Offset player sprite to align with their previous tile position
//The player's tile position after finishing this movement action // The player's tile position after finishing this movement action
player.position.future = player.position.tile + dirModeParams.tileAdd; player.position.future = player.position.tile + dirModeParams.tileAdd;
if (pnum == MyPlayerId) { if (pnum == MyPlayerId) {
@ -703,7 +703,7 @@ bool DoWalk(int pnum, int variant)
} }
auto &player = Players[pnum]; auto &player = Players[pnum];
//Play walking sound effect on certain animation frames // Play walking sound effect on certain animation frames
if (*sgOptions.Audio.walkingSound && (currlevel != 0 || sgGameInitInfo.bRunInTown == 0)) { if (*sgOptions.Audio.walkingSound && (currlevel != 0 || sgGameInitInfo.bRunInTown == 0)) {
if (player.AnimInfo.CurrentFrame == 1 if (player.AnimInfo.CurrentFrame == 1
|| player.AnimInfo.CurrentFrame == 5) { || player.AnimInfo.CurrentFrame == 5) {
@ -711,10 +711,10 @@ bool DoWalk(int pnum, int variant)
} }
} }
//Check if we reached new tile // Check if we reached new tile
if (player.AnimInfo.CurrentFrame >= player._pWFrames) { if (player.AnimInfo.CurrentFrame >= player._pWFrames) {
//Update the player's tile position // Update the player's tile position
switch (variant) { switch (variant) {
case PM_WALK: case PM_WALK:
dPlayer[player.position.tile.x][player.position.tile.y] = 0; dPlayer[player.position.tile.x][player.position.tile.y] = 0;
@ -732,13 +732,13 @@ bool DoWalk(int pnum, int variant)
break; break;
} }
//Update the coordinates for lighting and vision entries for the player // Update the coordinates for lighting and vision entries for the player
if (leveltype != DTYPE_TOWN) { if (leveltype != DTYPE_TOWN) {
ChangeLightXY(player._plid, player.position.tile); ChangeLightXY(player._plid, player.position.tile);
ChangeVisionXY(player._pvid, player.position.tile); ChangeVisionXY(player._pvid, player.position.tile);
} }
//Update the "camera" tile position // Update the "camera" tile position
if (pnum == MyPlayerId && ScrollInfo._sdir != ScrollDirection::None) { if (pnum == MyPlayerId && ScrollInfo._sdir != ScrollDirection::None) {
ViewPosition = Point { 0, 0 } + (player.position.tile - ScrollInfo.tile); ViewPosition = Point { 0, 0 } + (player.position.tile - ScrollInfo.tile);
} }
@ -751,14 +751,14 @@ bool DoWalk(int pnum, int variant)
ClearStateVariables(player); ClearStateVariables(player);
//Reset the "sub-tile" position of the player's light entry to 0 // Reset the "sub-tile" position of the player's light entry to 0
if (leveltype != DTYPE_TOWN) { if (leveltype != DTYPE_TOWN) {
ChangeLightOffset(player._plid, { 0, 0 }); ChangeLightOffset(player._plid, { 0, 0 });
} }
AutoGoldPickup(pnum); AutoGoldPickup(pnum);
return true; return true;
} //We didn't reach new tile so update player's "sub-tile" position } // We didn't reach new tile so update player's "sub-tile" position
ChangeOffset(pnum); ChangeOffset(pnum);
return false; return false;
} }
@ -1977,7 +1977,7 @@ void Player::RemoveInvItem(int iv, bool calcScrolls)
{ {
iv++; iv++;
//Iterate through invGrid and remove every reference to item // Iterate through invGrid and remove every reference to item
for (int8_t &itemId : InvGrid) { for (int8_t &itemId : InvGrid) {
if (itemId == iv || itemId == -iv) { if (itemId == iv || itemId == -iv) {
itemId = 0; itemId = 0;
@ -1987,7 +1987,7 @@ void Player::RemoveInvItem(int iv, bool calcScrolls)
iv--; iv--;
_pNumInv--; _pNumInv--;
//If the item at the end of inventory array isn't the one we removed, we need to swap its position in the array with the removed item // If the item at the end of inventory array isn't the one we removed, we need to swap its position in the array with the removed item
if (_pNumInv > 0 && _pNumInv != iv) { if (_pNumInv > 0 && _pNumInv != iv) {
InvList[iv] = InvList[_pNumInv]; InvList[iv] = InvList[_pNumInv];

Loading…
Cancel
Save