Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
qndel committed Sep 20, 2018
2 parents 77c1ebd + 3e0ae36 commit 9e7f581
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
19 changes: 11 additions & 8 deletions .editorconfig
@@ -1,8 +1,11 @@
root = true

[*]
indent_style = tab
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
root = true

[*]
indent_style = tab
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.sh]
end_of_line = lf
2 changes: 1 addition & 1 deletion .travis/are-we-d1-yet.sh
Expand Up @@ -3,7 +3,7 @@
# based on https://github.com/k3rn31p4nic/travis-ci-discord-webhook

# Only run for commits/builds on master, not for PRs for now
if [[ "$TRAVIS_BRANCH" != "master" || $TRAVIS_PULL_REQUEST != "false" ]]; then
if [[ "$TRAVIS_BRANCH" != "nightly" || $TRAVIS_PULL_REQUEST != "false" ]]; then
exit
fi

Expand Down
4 changes: 2 additions & 2 deletions Source/inv.cpp
Expand Up @@ -1952,7 +1952,7 @@ void __fastcall RemoveInvItem(int pnum, int iv)
{
if (plr[pnum]._pRSpell != SPL_INVALID)
{
// BUGFIX: Cast the literal `1` to `UINT64` to make that bitshift 64bit
// BUGFIX: Cast the literal `1` to `unsigned __int64` to make that bitshift 64bit
// this causes the last 4 skills to not reset correctly after use
if (!(
plr[pnum]._pScrlSpells64
Expand All @@ -1976,7 +1976,7 @@ void __fastcall RemoveSpdBarItem(int pnum, int iv)
{
if (plr[pnum]._pRSpell != SPL_INVALID)
{
// BUGFIX: Cast the literal `1` to `UINT64` to make that bitshift 64bit
// BUGFIX: Cast the literal `1` to `unsigned __int64` to make that bitshift 64bit
// this causes the last 4 skills to not reset correctly after use
if (!(
plr[pnum]._pScrlSpells64
Expand Down
4 changes: 2 additions & 2 deletions Source/items.cpp
Expand Up @@ -974,7 +974,7 @@ void __fastcall CalcPlrItemVals(int p, BOOL Loadgfx)
int dadd = 0; // added dexterity
int vadd = 0; // added vitality

UINT64 spl = 0; // bitarray for all enabled/active spells
unsigned __int64 spl = 0; // bitarray for all enabled/active spells

signed int fr = 0; // fire resistance
signed int lr = 0; // lightning resistance
Expand Down Expand Up @@ -1137,7 +1137,7 @@ void __fastcall CalcPlrItemVals(int p, BOOL Loadgfx)

// check if the current RSplType is a valid/allowed spell
if ( plr[p]._pRSplType == RSPLTYPE_CHARGES
&& !(spl & ((UINT64)1 << (plr[p]._pRSpell - 1))) )
&& !(spl & ((unsigned __int64)1 << (plr[p]._pRSpell - 1))) )
{
plr[p]._pRSpell = SPL_INVALID;
plr[p]._pRSplType = RSPLTYPE_INVALID;
Expand Down
28 changes: 15 additions & 13 deletions Source/player.cpp
Expand Up @@ -2789,7 +2789,7 @@ BOOL __fastcall WeaponDur(int pnum, int durrnd)
}

plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability--;
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability != 0) {
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability == 0) {
NetSendCmdDelItem(TRUE, INVLOC_HAND_LEFT);
plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype = ITYPE_NONE;
CalcPlrInv(pnum, TRUE);
Expand All @@ -2803,7 +2803,7 @@ BOOL __fastcall WeaponDur(int pnum, int durrnd)
}

plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability--;
if ( plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability != 0 ) {
if ( plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability == 0 ) {
NetSendCmdDelItem(TRUE, INVLOC_HAND_RIGHT);
plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype = ITYPE_NONE;
CalcPlrInv(pnum, TRUE);
Expand All @@ -2817,7 +2817,7 @@ BOOL __fastcall WeaponDur(int pnum, int durrnd)
}

plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability--;
if ( plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability != 0 ) {
if ( plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iDurability == 0 ) {
NetSendCmdDelItem(TRUE, INVLOC_HAND_RIGHT);
plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype = ITYPE_NONE;
CalcPlrInv(pnum, TRUE);
Expand All @@ -2826,14 +2826,16 @@ BOOL __fastcall WeaponDur(int pnum, int durrnd)
}

if ( plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_NONE && plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SHIELD ) {
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability != 255 ) {
plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability--;
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability != 0 ) {
NetSendCmdDelItem(TRUE, INVLOC_HAND_LEFT);
plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype = ITYPE_NONE;
CalcPlrInv(pnum, TRUE);
return TRUE;
}
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability == 255 ) {
return FALSE;
}

plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability--;
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._iDurability == 0 ) {
NetSendCmdDelItem(TRUE, INVLOC_HAND_LEFT);
plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype = ITYPE_NONE;
CalcPlrInv(pnum, TRUE);
return TRUE;
}
}

Expand Down Expand Up @@ -3432,7 +3434,7 @@ BOOL __fastcall PM_DoSpell(int pnum)
if ( !plr[pnum]._pSplFrom ) {
if ( plr[pnum]._pRSplType == RSPLTYPE_SCROLL) {
if ( !(plr[pnum]._pScrlSpells64
& (UINT64)1 << (plr[pnum]._pRSpell - 1))
& (unsigned __int64)1 << (plr[pnum]._pRSpell - 1))
) {
plr[pnum]._pRSpell = SPL_INVALID;
plr[pnum]._pRSplType = RSPLTYPE_INVALID;
Expand All @@ -3442,7 +3444,7 @@ BOOL __fastcall PM_DoSpell(int pnum)

if ( plr[pnum]._pRSplType == RSPLTYPE_CHARGES) {
if ( !(plr[pnum]._pISpells64
& (UINT64)1 << (plr[pnum]._pRSpell - 1))
& (unsigned __int64)1 << (plr[pnum]._pRSpell - 1))
) {
plr[pnum]._pRSpell = SPL_INVALID;
plr[pnum]._pRSplType = RSPLTYPE_INVALID;
Expand Down
8 changes: 4 additions & 4 deletions structs.h
Expand Up @@ -442,15 +442,15 @@ struct PlayerStruct
char _pSBkSplType;
char _pSplLvl[64];
union {
__int64 _pMemSpells64;
unsigned __int64 _pMemSpells64;
int _pMemSpells[2];
};
union {
__int64 _pAblSpells64;
unsigned __int64 _pAblSpells64;
int _pAblSpells[2];
};
union {
__int64 _pScrlSpells64;
unsigned __int64 _pScrlSpells64;
int _pScrlSpells[2];
};
int _pSpellFlags;
Expand Down Expand Up @@ -551,7 +551,7 @@ struct PlayerStruct
int _pIBonusAC;
int _pIBonusDamMod;
union {
__int64 _pISpells64;
unsigned __int64 _pISpells64;
int _pISpells[2];
};
int _pIFlags;
Expand Down

0 comments on commit 9e7f581

Please sign in to comment.