Some additions.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1858 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -566,6 +566,8 @@ dumpUniverseToFile (void)
|
|||||||
|
|
||||||
fprintf(stdout, "*** Star dump complete. The game may be in an "
|
fprintf(stdout, "*** Star dump complete. The game may be in an "
|
||||||
"undefined state.\n");
|
"undefined state.\n");
|
||||||
|
// Data generation may have changed the game state,
|
||||||
|
// in particular for special planet generation.
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -792,6 +794,8 @@ dumpMoon (FILE *out, const PLANET_DESC *moon)
|
|||||||
static void
|
static void
|
||||||
dumpWorld (FILE *out, const PLANET_DESC *world)
|
dumpWorld (FILE *out, const PLANET_DESC *world)
|
||||||
{
|
{
|
||||||
|
PLANET_INFO *info;
|
||||||
|
|
||||||
if (world->data_index == (BYTE) ~0) {
|
if (world->data_index == (BYTE) ~0) {
|
||||||
// StarBase
|
// StarBase
|
||||||
return;
|
return;
|
||||||
@@ -802,6 +806,19 @@ dumpWorld (FILE *out, const PLANET_DESC *world)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info = &pSolarSysState->SysInfo.PlanetInfo;
|
||||||
|
fprintf(out, " AxialTilt: %d\n", info->AxialTilt);
|
||||||
|
fprintf(out, " Tectonics: %d\n", info->Tectonics);
|
||||||
|
fprintf(out, " Weather: %d\n", info->Weather);
|
||||||
|
fprintf(out, " Density: %d\n", info->PlanetDensity);
|
||||||
|
fprintf(out, " Radius: %d\n", info->PlanetRadius);
|
||||||
|
fprintf(out, " Gravity: %d\n", info->SurfaceGravity);
|
||||||
|
fprintf(out, " Temp: %d\n", info->SurfaceTemperature);
|
||||||
|
fprintf(out, " Day: %d\n", info->RotationPeriod);
|
||||||
|
fprintf(out, " Atmosphere: %d\n", info->AtmoDensity);
|
||||||
|
fprintf(out, " LifeChance: %d\n", info->LifeChance);
|
||||||
|
fprintf(out, " DistToSun: %d\n", info->PlanetToSunDist);
|
||||||
|
|
||||||
if (world->data_index & PLANET_SHIELDED) {
|
if (world->data_index & PLANET_SHIELDED) {
|
||||||
// Slave-shielded planet
|
// Slave-shielded planet
|
||||||
return;
|
return;
|
||||||
@@ -818,7 +835,6 @@ calculateBioValue (const SOLARSYS_STATE *system, const PLANET_DESC *world)
|
|||||||
COUNT result;
|
COUNT result;
|
||||||
COUNT numBio;
|
COUNT numBio;
|
||||||
COUNT i;
|
COUNT i;
|
||||||
extern const LIFEFORM_DESC CreatureData[];
|
|
||||||
|
|
||||||
assert(system->pOrbitalDesc == world);
|
assert(system->pOrbitalDesc == world);
|
||||||
|
|
||||||
@@ -837,6 +853,30 @@ calculateBioValue (const SOLARSYS_STATE *system, const PLANET_DESC *world)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
generateBioIndex(const SOLARSYS_STATE *system,
|
||||||
|
const PLANET_DESC *world, COUNT bio[])
|
||||||
|
{
|
||||||
|
COUNT numBio;
|
||||||
|
COUNT i;
|
||||||
|
|
||||||
|
assert(system->pOrbitalDesc == world);
|
||||||
|
|
||||||
|
((SOLARSYS_STATE *) system)->CurNode = (COUNT)~0;
|
||||||
|
(*system->GenFunc) (GENERATE_LIFE);
|
||||||
|
numBio = system->CurNode;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_CREATURE_TYPES + NUM_SPECIAL_CREATURE_TYPES; i++)
|
||||||
|
bio[i] = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < numBio; i++)
|
||||||
|
{
|
||||||
|
((SOLARSYS_STATE *) system)->CurNode = i;
|
||||||
|
(*system->GenFunc) (GENERATE_LIFE);
|
||||||
|
bio[system->SysInfo.PlanetInfo.CurType]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
COUNT
|
COUNT
|
||||||
calculateMineralValue (const SOLARSYS_STATE *system,
|
calculateMineralValue (const SOLARSYS_STATE *system,
|
||||||
const PLANET_DESC *world)
|
const PLANET_DESC *world)
|
||||||
@@ -863,6 +903,31 @@ calculateMineralValue (const SOLARSYS_STATE *system,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
generateMineralIndex(const SOLARSYS_STATE *system,
|
||||||
|
const PLANET_DESC *world, COUNT minerals[])
|
||||||
|
{
|
||||||
|
COUNT numDeposits;
|
||||||
|
COUNT i;
|
||||||
|
|
||||||
|
assert(system->pOrbitalDesc == world);
|
||||||
|
|
||||||
|
((SOLARSYS_STATE *) system)->CurNode = (COUNT)~0;
|
||||||
|
(*system->GenFunc) (GENERATE_MINERAL);
|
||||||
|
numDeposits = system->CurNode;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_ELEMENT_CATEGORIES; i++)
|
||||||
|
minerals[i] = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < numDeposits; i++)
|
||||||
|
{
|
||||||
|
((SOLARSYS_STATE *) system)->CurNode = i;
|
||||||
|
(*system->GenFunc) (GENERATE_MINERAL);
|
||||||
|
minerals[ElementCategory(system->SysInfo.PlanetInfo.CurType)] +=
|
||||||
|
HIBYTE (system->SysInfo.PlanetInfo.CurDensity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -98,9 +98,15 @@ void dumpMoon (FILE *out, const PLANET_DESC *moon);
|
|||||||
// Calculate the total value of all minerals on a world.
|
// Calculate the total value of all minerals on a world.
|
||||||
COUNT calculateMineralValue (const SOLARSYS_STATE *system,
|
COUNT calculateMineralValue (const SOLARSYS_STATE *system,
|
||||||
const PLANET_DESC *world);
|
const PLANET_DESC *world);
|
||||||
|
// Determine how much of each mineral type is present on a world
|
||||||
|
void generateMineralIndex(const SOLARSYS_STATE *system,
|
||||||
|
const PLANET_DESC *world, COUNT minerals[]);
|
||||||
// Calculate the total value of all bio on a world.
|
// Calculate the total value of all bio on a world.
|
||||||
COUNT calculateBioValue (const SOLARSYS_STATE *system,
|
COUNT calculateBioValue (const SOLARSYS_STATE *system,
|
||||||
const PLANET_DESC *world);
|
const PLANET_DESC *world);
|
||||||
|
// Determine how much of each mineral type is present on a world
|
||||||
|
void generateBioIndex(const SOLARSYS_STATE *system,
|
||||||
|
const PLANET_DESC *world, COUNT bio[]);
|
||||||
|
|
||||||
|
|
||||||
// Call a function for all planet types.
|
// Call a function for all planet types.
|
||||||
|
|||||||
Reference in New Issue
Block a user