Don't use RaceDescPtr as both a pointer and an integer containing

two values.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2300 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-03-28 20:22:58 +00:00
parent 157b351d10
commit 5412e18dfe
2 changed files with 34 additions and 11 deletions
+4 -3
View File
@@ -34,11 +34,12 @@
#define NUM_CAPTAINS_NAMES 16
#define OwnStarShip(S,p,n) \
(S)->RaceDescPtr = (RACE_DESCPTR)MAKE_DWORD(p, n)
(S)->s.Player = (p); \
(S)->s.Captain = (n);
#define StarShipCaptain(S) \
(BYTE)HIWORD ((S)->RaceDescPtr)
(S)->s.Captain
#define StarShipPlayer(S) \
(COUNT)LOWORD ((S)->RaceDescPtr)
(S)->s.Player
#define PickCaptainName() (((COUNT)TFB_Random () \
& (NUM_CAPTAINS_NAMES - 1)) \
+ NAME_OFFSET)
+23 -1
View File
@@ -254,7 +254,21 @@ typedef struct
HSTARSHIP succ;
DWORD RaceResIndex;
/* This field is abused to store other data when the ship
* is in GLOBAL(built_ship_q), GLOBDATA(npc_built_ship_q),
* or race_q[], namely the side this ship is on (accessed
* through StarShipPlayer()), and the captains name for
* the ship (accessed through StarShipCaptain()).
* These values are set using OwnStarShip(). */
union {
RACE_DESCPTR RaceDescPtr;
struct {
COUNT Player;
BYTE Captain;
} s;
};
BYTE captains_name_index;
BYTE weapon_counter;
@@ -278,13 +292,21 @@ typedef struct
HSTARSHIP succ;
DWORD RaceResIndex;
RACE_DESCPTR RaceDescPtr;
/* This field is abused to store other data when the ship
* is in GLOBAL(built_ship_q), GLOBDATA(npc_built_ship_q),
* or race_q[], namely the side this ship is on (accessed
* through StarShipPlayer()), and the captains name for
* the ship (accessed through StarShipCaptain()).
* These values are set using OwnStarShip(). */
union {
RACE_DESCPTR RaceDescPtr;
struct {
COUNT Player;
BYTE Captain;
} s;
};
SHIP_INFO ShipInfo;
} SHIP_FRAGMENT;
typedef SHIP_FRAGMENT *PSHIP_FRAGMENT;