summaryrefslogtreecommitdiff
path: root/src/hexen/sb_bar.c
diff options
context:
space:
mode:
authorSimon Howard2011-10-23 13:29:09 +0000
committerSimon Howard2011-10-23 13:29:09 +0000
commit1ec21c92ed4c3f792e642524c5cd5bc30b6d7457 (patch)
tree1263f68ae3736eef7cfd40c2c60b1b0ace40e3c5 /src/hexen/sb_bar.c
parentd64626ff417323e05a479caeee02168c1eafd798 (diff)
downloadchocolate-doom-1ec21c92ed4c3f792e642524c5cd5bc30b6d7457.tar.gz
chocolate-doom-1ec21c92ed4c3f792e642524c5cd5bc30b6d7457.tar.bz2
chocolate-doom-1ec21c92ed4c3f792e642524c5cd5bc30b6d7457.zip
Fix compiler warnings (thanks Edward-San).
Subversion-branch: /branches/v2-branch Subversion-revision: 2459
Diffstat (limited to 'src/hexen/sb_bar.c')
-rw-r--r--src/hexen/sb_bar.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c
index 13b41ae3..01a2ef0c 100644
--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -1798,10 +1798,20 @@ static void CheatIDKFAFunc(player_t * player, Cheat_t * cheat)
{
return;
}
- for (i = 1; i < 8; i++)
+ for (i = 1; i < NUMWEAPONS; i++)
{
player->weaponowned[i] = false;
}
+
+ // In the original code, NUMWEAPONS was 8. So the writes to weaponowned
+ // overflowed the array. We must set the following fields to zero as
+ // well:
+
+ player->mana[0] = 0;
+ player->mana[1] = 0;
+ player->attackdown = 0;
+ player->usedown = 0;
+
player->pendingweapon = WP_FIRST;
P_SetMessage(player, TXT_CHEATIDKFA, true);
}