diff --git a/sc2/src/sc2code/build.h b/sc2/src/sc2code/build.h index a060d6524..20e50173a 100644 --- a/sc2/src/sc2code/build.h +++ b/sc2/src/sc2code/build.h @@ -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) diff --git a/sc2/src/sc2code/races.h b/sc2/src/sc2code/races.h index dcc959da7..86e0640f6 100644 --- a/sc2/src/sc2code/races.h +++ b/sc2/src/sc2code/races.h @@ -254,7 +254,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; + }; + 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(). */ + + /* 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;