Use isNodeRetrieved(), setNodeRetrieved(), and setNodeNotRetrieved()

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3581 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2011-04-21 21:27:18 +00:00
parent 9cdd69fe46
commit 717a49ff6c
16 changed files with 116 additions and 97 deletions
-2
View File
@@ -43,8 +43,6 @@ typedef struct GenerateFunctions GenerateFunctions;
* solarSys->genFuncs->..., but use a function for this, which first
* checks for solar system dependent handlers, and if this does not exist,
* or returns false, calls the default function.
* - use isNodeRetrieved, setNodeRetrieved, and setNodeNotRetrieved instead
* of manually messing with bit shifts, etc.
*/
// Any of these functions returning true means that the action has been
+33 -27
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../globdata.h"
#include "../../nameref.h"
#include "../../resinst.h"
@@ -71,7 +72,8 @@ GenerateAndrosynth_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
{
if (matchWorld (solarSys, world, 1, MATCH_PLANET))
{
UWORD retval;
COUNT i;
COUNT visits = 0;
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
solarSys->PlanetSideFrame[1] =
@@ -79,25 +81,28 @@ GenerateAndrosynth_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
solarSys->SysInfo.PlanetInfo.DiscoveryString =
CaptureStringTable (
LoadStringTable (ANDROSYNTH_RUINS_STRTAB));
retval = HIWORD (
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]);
while (retval)
// Androsynth ruins are a special case. The DiscoveryString contains
// several lander reports which form a story. Each report is given
// when the player collides with a new city ruin. Ruins previously
// visited are marked in the upper 16 bits of ScanRetrieveMask, and
// the lower bits are cleared to keep the ruin nodes on the map.
for (i = 16; i < 32; ++i)
{
if (retval & 1)
{
solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
if (GetStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString) == 0)
{
DestroyStringTable (ReleaseStringTable (
solarSys->SysInfo.PlanetInfo.DiscoveryString));
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
}
}
retval >>= 1;
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
++visits;
}
if (visits >= GetStringTableCount (
solarSys->SysInfo.PlanetInfo.DiscoveryString))
{ // All the reports were already given
DestroyStringTable (ReleaseStringTable (
solarSys->SysInfo.PlanetInfo.DiscoveryString));
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
}
else
{ // Advance the report sequence to the first unread
solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString, visits);
}
}
@@ -139,23 +144,24 @@ GenerateAndrosynth_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << i);
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << (i + 16))))
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
// Ruins previously visited are marked in the upper 16 bits
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
i + 16))
{
SET_GAME_STATE (PLANETARY_CHANGE, 1);
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
|= (1L << (i + 16));
setNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
i + 16);
if (solarSys->SysInfo.PlanetInfo.DiscoveryString)
{
UnbatchGraphics ();
DoDiscoveryReport (MenuSounds);
BatchGraphics ();
// Advance to the next report
solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString,
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h"
#include "../planets.h"
#include "../scan.h"
#include "../../globdata.h"
#include "../../nameref.h"
#include "../../resinst.h"
@@ -179,8 +180,7 @@ GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -188,8 +188,7 @@ GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (BURVIXESE_BROADCASTERS, 1);
SET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../globdata.h"
@@ -149,11 +150,11 @@ GenerateDruuge_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << i);
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (ROSY_SPHERE))
{
@@ -163,6 +164,7 @@ GenerateDruuge_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
}
}
if (i >= *whichNode)
break;
}
+7 -10
View File
@@ -18,6 +18,7 @@
#include "genall.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../encount.h"
@@ -161,8 +162,8 @@ GenerateMycon_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) == 0)
SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 1);
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0)))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo,
ENERGY_SCAN, 0))
{
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
solarSys->PlanetSideFrame[1] =
@@ -202,8 +203,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (CurStarDescPtr->Index == SUN_DEVICE_DEFINED)
{
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -211,8 +211,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (SUN_DEVICE, 1);
SET_GAME_STATE (SUN_DEVICE_ON_SHIP, 1);
@@ -222,8 +221,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
}
else
{
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -233,8 +231,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
*whichNode = 0;
// XXX: Why does this also test the PlanetInfo.DiscoveryString?
// No other similar code ever tests the DiscoveryString.
if ((solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& solarSys->SysInfo.PlanetInfo.DiscoveryString)
{
switch (CurStarDescPtr->Index)
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../encount.h"
@@ -181,8 +182,7 @@ GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -190,8 +190,7 @@ GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (TAALO_PROTECTOR, 1);
SET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../globdata.h"
@@ -139,11 +140,11 @@ GeneratePkunk_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << i);
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (CLEAR_SPINDLE))
{
@@ -153,6 +154,7 @@ GeneratePkunk_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
}
}
if (i >= *whichNode)
break;
}
+11 -8
View File
@@ -20,6 +20,7 @@
#include "../lander.h"
#include "../lifeform.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../encount.h"
#include "../../globdata.h"
@@ -521,13 +522,17 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT - 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 2;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1);
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << 0);
// Retrieval status is cleared to keep the node on the map
// while the lander is taking off. FOUND_PLUTO_SPATHI bit
// will keep the node from showing up on subsequent visits.
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
SetLanderTakeoff ();
// XXX: This does NOT set *whichNode when the node is
// retrieved. Other similar pieces of code return the node
// count. See just below. AFAICT, the returned value is ignored.
}
else if (*whichNode == (COUNT)~0)
*whichNode = 1;
@@ -542,8 +547,7 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 1 / 4;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -551,8 +555,7 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (MOONBASE_DESTROYED, 1);
SET_GAME_STATE (MOONBASE_ON_SHIP, 1);
+3 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lifeform.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../globdata.h"
@@ -209,8 +210,7 @@ GenerateSpathi_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -218,8 +218,7 @@ GenerateSpathi_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (UMGAH_BROADCASTERS, 1);
SET_GAME_STATE (UMGAH_BROADCASTERS_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../globdata.h"
@@ -142,11 +143,11 @@ GenerateSupox_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << i);
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (ULTRON_CONDITION))
{
@@ -155,6 +156,7 @@ GenerateSupox_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (ULTRON_CONDITION, 1);
}
}
if (i >= *whichNode)
break;
}
+4 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../encount.h"
@@ -199,16 +200,15 @@ GenerateThraddash_generateEnergy (SOLARSYS_STATE *solarSys,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0)) && *whichNode == (COUNT)~0)
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
}
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (HELIX_VISITS, 0);
SET_GAME_STATE (AQUA_HELIX, 1);
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../encount.h"
@@ -251,8 +252,7 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -260,8 +260,7 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (UTWIG_BOMB, 1);
SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 1);
+9 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../globdata.h"
#include "../../nameref.h"
#include "../../resinst.h"
@@ -95,13 +96,17 @@ GenerateVault_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0;
else
solarSys->SysInfo.PlanetInfo.CurType = 1;
// XXX: This node is always present, even after it is "picked up".
// Other similar pieces return the current node index when called
// by GeneratePlanetSide() to get the node info, and in that
// case the returned value is ignored AFAICT.
*whichNode = 1;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << 0);
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP))
{
SetLanderTakeoff ();
+9 -6
View File
@@ -20,6 +20,7 @@
#include "../lander.h"
#include "../lifeform.h"
#include "../planets.h"
#include "../scan.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../encount.h"
@@ -216,8 +217,7 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 5 / 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
&& *whichNode == (COUNT)~0)
{
*whichNode = 1;
@@ -225,8 +225,7 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else
{
*whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
SET_GAME_STATE (SHOFIXTI_MAIDENS, 1);
SET_GAME_STATE (MAIDENS_ON_SHIP, 1);
@@ -326,9 +325,12 @@ GenerateVux_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else /* if (i <= 10) */
/* {BEHAVIOR_UNPREDICTABLE | SPEED_SLOW | DANGER_NORMAL, MAKE_BYTE (3, 8)}, */
solarSys->SysInfo.PlanetInfo.CurType = 8;
// XXX: This currently does not need to be done in a loop. When a
// node is retrieved, the func is called with *whichNode==~0
if (i == 0
&& (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[BIOLOGICAL_SCAN]
& (1L << i))
&& isNodeRetrieved (&solarSys->SysInfo.PlanetInfo,
BIOLOGICAL_SCAN, 0)
&& !GET_GAME_STATE (VUX_BEAST))
{
UnbatchGraphics ();
@@ -339,6 +341,7 @@ GenerateVux_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (VUX_BEAST, 1);
SET_GAME_STATE (VUX_BEAST_ON_SHIP, 1);
}
if (i >= *whichNode)
break;
}
+9 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../scan.h"
#include "../../globdata.h"
#include "../../nameref.h"
#include "../../resinst.h"
@@ -89,12 +90,16 @@ GenerateWreck_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0;
else
solarSys->SysInfo.PlanetInfo.CurType = 1;
// XXX: This node is always present, even after it is "picked up".
// Other similar pieces return the current node index when called
// by GeneratePlanetSide() to get the node info, and in that
// case the returned value is ignored AFAICT.
*whichNode = 1;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0))
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
&= ~(1L << 0);
// Retrieval status is cleared to keep the node on the map
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
if (!GET_GAME_STATE (PORTAL_KEY))
{
+4 -4
View File
@@ -858,15 +858,15 @@ CheckObjectCollision (COUNT index)
}
which_node = HIBYTE (ElementPtr->scan_node) - 1;
pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[scan] |=
(1L << which_node);
setNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
which_node);
allNodes = (COUNT)~0;
callGenerateForScanType (pSolarSysState,
pSolarSysState->pOrbitalDesc,
&allNodes, scan);
if (!(pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[scan] &
(1L << which_node)))
if (!isNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
which_node))
{
/* If our discovery strings have cycled, we're done */
if (GetStringTableIndex (