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:
meep-eep
2005-08-22 22:51:42 +00:00
parent 74017795a8
commit 29a58df162
2 changed files with 72 additions and 1 deletions
+66 -1
View File
@@ -566,6 +566,8 @@ dumpUniverseToFile (void)
fprintf(stdout, "*** Star dump complete. The game may be in an "
"undefined state.\n");
// Data generation may have changed the game state,
// in particular for special planet generation.
}
static void
@@ -792,6 +794,8 @@ dumpMoon (FILE *out, const PLANET_DESC *moon)
static void
dumpWorld (FILE *out, const PLANET_DESC *world)
{
PLANET_INFO *info;
if (world->data_index == (BYTE) ~0) {
// StarBase
return;
@@ -802,6 +806,19 @@ dumpWorld (FILE *out, const PLANET_DESC *world)
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) {
// Slave-shielded planet
return;
@@ -818,7 +835,6 @@ calculateBioValue (const SOLARSYS_STATE *system, const PLANET_DESC *world)
COUNT result;
COUNT numBio;
COUNT i;
extern const LIFEFORM_DESC CreatureData[];
assert(system->pOrbitalDesc == world);
@@ -837,6 +853,30 @@ calculateBioValue (const SOLARSYS_STATE *system, const PLANET_DESC *world)
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
calculateMineralValue (const SOLARSYS_STATE *system,
const PLANET_DESC *world)
@@ -863,6 +903,31 @@ calculateMineralValue (const SOLARSYS_STATE *system,
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
+6
View File
@@ -98,9 +98,15 @@ void dumpMoon (FILE *out, const PLANET_DESC *moon);
// Calculate the total value of all minerals on a world.
COUNT calculateMineralValue (const SOLARSYS_STATE *system,
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.
COUNT calculateBioValue (const SOLARSYS_STATE *system,
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.