Further cleanup (or start thereof).

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3339 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2009-11-22 14:59:06 +00:00
parent 09ec2f57ab
commit 8465e0ab19
3 changed files with 28 additions and 3 deletions
+2
View File
@@ -39,6 +39,8 @@ typedef struct GenerateFunctions GenerateFunctions;
* solarSys->genFuncs->..., but use a function for this, which first * solarSys->genFuncs->..., but use a function for this, which first
* checks for solar system dependent handlers, and if this does not exist, * checks for solar system dependent handlers, and if this does not exist,
* or returns false, calls the default function. * 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 // Any of these functions returning true means that the action has been
+22 -3
View File
@@ -18,6 +18,7 @@
#include "lander.h" #include "lander.h"
#include "lifeform.h" #include "lifeform.h"
#include "scan.h"
#include "../build.h" #include "../build.h"
#include "../cons_res.h" #include "../cons_res.h"
#include "../controls.h" #include "../controls.h"
@@ -1303,7 +1304,7 @@ GeneratePlanetSide (void)
if (pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED) if (pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)
return; return;
memset (life_init_tab, 0, sizeof (life_init_tab)); memset (life_init_tab, 0, sizeof life_init_tab);
for (scan = BIOLOGICAL_SCAN; scan >= MINERAL_SCAN; --scan) for (scan = BIOLOGICAL_SCAN; scan >= MINERAL_SCAN; --scan)
{ {
@@ -1323,8 +1324,8 @@ GeneratePlanetSide (void)
HELEMENT hNodeElement; HELEMENT hNodeElement;
ELEMENT *NodeElementPtr; ELEMENT *NodeElementPtr;
if (pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[scan] if (isNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo,
& (1L << num_nodes)) scan, num_nodes))
continue; continue;
hNodeElement = AllocElement (); hNodeElement = AllocElement ();
@@ -1404,4 +1405,22 @@ GeneratePlanetSide (void)
} }
} }
bool
isNodeRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr)
{
return (planetInfo->ScanRetrieveMask[scanType] & ((DWORD) 1 << nodeNr))
!= 0;
}
void
setNodeRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr)
{
planetInfo->ScanRetrieveMask[scanType] |= ((DWORD) 1 << nodeNr);
}
void
setNodeNotRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr)
{
planetInfo->ScanRetrieveMask[scanType] &= ~((DWORD) 1 << nodeNr);
}
+4
View File
@@ -50,5 +50,9 @@ extern bool callGenerateForScanType (SOLARSYS_STATE *solarSys,
extern void RedrawSurfaceScan (const POINT *newLoc); extern void RedrawSurfaceScan (const POINT *newLoc);
bool isNodeRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr);
void setNodeRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr);
void setNodeNotRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr);
#endif /* _SCAN_H */ #endif /* _SCAN_H */