shithub: choc

Download patch

ref: 714d7a29397b44fcb2b1fef2d675d296cb984264
parent: 51ab62f6fb06b42c80c98ea71ab29d208d10e422
author: Simon Howard <fraggle@soulsphere.org>
date: Thu Feb 19 18:50:04 EST 2015

doom: Change weaponowned[] to an int array.

The st_stuff.c status bar code passes pointer to an entry in
weaponowned[] as an int pointer, but weaponowned[] is an array
of booleans and booleans are not always represented as 32-bit ints.
Remove the (int *) cast and ensure correct behavior.

This fixes the immediate issue in #509 (thanks floppes).

--- a/src/doom/d_player.h
+++ b/src/doom/d_player.h
@@ -111,7 +111,7 @@
     // Is wp_nochange if not changing.
     weapontype_t	pendingweapon;
 
-    boolean		weaponowned[NUMWEAPONS];
+    int                 weaponowned[NUMWEAPONS];
     int			ammo[NUMAMMO];
     int			maxammo[NUMAMMO];
 
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -1261,11 +1261,12 @@
     // weapons owned
     for(i=0;i<6;i++)
     {
-	STlib_initMultIcon(&w_arms[i],
-			   ST_ARMSX+(i%3)*ST_ARMSXSPACE,
-			   ST_ARMSY+(i/3)*ST_ARMSYSPACE,
-			   arms[i], (int *) &plyr->weaponowned[i+1],
-			   &st_armson);
+        STlib_initMultIcon(&w_arms[i],
+                           ST_ARMSX+(i%3)*ST_ARMSXSPACE,
+                           ST_ARMSY+(i/3)*ST_ARMSYSPACE,
+                           arms[i],
+                           &plyr->weaponowned[i+1],
+                           &st_armson);
     }
 
     // frags sum