Several generators are "sorta parameterized" -- make ready for that.
The VUX, Utwig, Melnorme and others all have branching paths on the actual `XXX_DEFINED` enum value. This is an ersatz parameter. I'll provide an extra string parameter for all generators, that lives in the `SolarSystem` type (for now). The table can now just mention the static string which indicates the kind of variation to build. (Eventually, this will become more dynamic, once I have support for runtime-insertion of stars.)
This commit is contained in:
@@ -58,9 +58,10 @@ extern struct GeneratorBase cxxDefaultPlanetGen;
|
|||||||
|
|
||||||
|
|
||||||
const GenerateFunctions *
|
const GenerateFunctions *
|
||||||
getGenerateFunctions (STAR_DESC *const star, void **sup )
|
getGenerateFunctions (STAR_DESC *const star, void **sup, const char **supArg )
|
||||||
{
|
{
|
||||||
*sup= star->supplement;
|
*sup= star->supplement;
|
||||||
|
*supArg= 0;
|
||||||
|
|
||||||
switch (star->Index)
|
switch (star->Index)
|
||||||
{
|
{
|
||||||
@@ -95,6 +96,7 @@ getGenerateFunctions (STAR_DESC *const star, void **sup )
|
|||||||
return &generateTrapFunctions;
|
return &generateTrapFunctions;
|
||||||
case BURVIXESE_DEFINED:
|
case BURVIXESE_DEFINED:
|
||||||
return &generateBurvixeseFunctions;
|
return &generateBurvixeseFunctions;
|
||||||
|
abort();
|
||||||
case DRUUGE_DEFINED:
|
case DRUUGE_DEFINED:
|
||||||
return &generateDruugeFunctions;
|
return &generateDruugeFunctions;
|
||||||
case BOMB_DEFINED:
|
case BOMB_DEFINED:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const GenerateFunctions *getGenerateFunctions (STAR_DESC *star, void **sup);
|
const GenerateFunctions *getGenerateFunctions (STAR_DESC *star, void **sup, const char **arg );
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ struct star_desc
|
|||||||
BYTE Postfix;
|
BYTE Postfix;
|
||||||
|
|
||||||
void *supplement; // The CXX builder's pointer gets put here.
|
void *supplement; // The CXX builder's pointer gets put here.
|
||||||
|
void *supArg; // Extra info for the CXX builder goes here.
|
||||||
};
|
};
|
||||||
|
|
||||||
struct node_info
|
struct node_info
|
||||||
@@ -269,6 +270,7 @@ struct solarsys_state
|
|||||||
// Since everything else probably ignores it... we can probably
|
// Since everything else probably ignores it... we can probably
|
||||||
// avoid setting it to `nullptr`, for now...
|
// avoid setting it to `nullptr`, for now...
|
||||||
void *genSupplement;
|
void *genSupplement;
|
||||||
|
const char *supArgument;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SOLARSYS_STATE *pSolarSysState;
|
extern SOLARSYS_STATE *pSolarSysState;
|
||||||
|
|||||||
@@ -1735,7 +1735,8 @@ ExploreSolarSys (void)
|
|||||||
|
|
||||||
memset (pSolarSysState, 0, sizeof (*pSolarSysState));
|
memset (pSolarSysState, 0, sizeof (*pSolarSysState));
|
||||||
|
|
||||||
SolarSysState.genFuncs = getGenerateFunctions (CurStarDescPtr, &SolarSysState.genSupplement);
|
SolarSysState.genFuncs = getGenerateFunctions (CurStarDescPtr, &SolarSysState.genSupplement,
|
||||||
|
&SolarSysState.supArgument);
|
||||||
|
|
||||||
InitSolarSys ();
|
InitSolarSys ();
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
|
|||||||
@@ -645,7 +645,8 @@ starRecurse (STAR_DESC *star, void *arg)
|
|||||||
SolarSysState.SunDesc[0].location.x = 0;
|
SolarSysState.SunDesc[0].location.x = 0;
|
||||||
SolarSysState.SunDesc[0].location.y = 0;
|
SolarSysState.SunDesc[0].location.y = 0;
|
||||||
//SolarSysState.SunDesc[0].radius = MIN_ZOOM_RADIUS;
|
//SolarSysState.SunDesc[0].radius = MIN_ZOOM_RADIUS;
|
||||||
SolarSysState.genFuncs = getGenerateFunctions (star, &SolarSysState.genSupplement);
|
SolarSysState.genFuncs = getGenerateFunctions (star, &SolarSysState.genSupplement,
|
||||||
|
&SolarSysState.supArgument);
|
||||||
|
|
||||||
pSolarSysState = &SolarSysState;
|
pSolarSysState = &SolarSysState;
|
||||||
(*SolarSysState.genFuncs->generatePlanets) (&SolarSysState);
|
(*SolarSysState.genFuncs->generatePlanets) (&SolarSysState);
|
||||||
|
|||||||
Reference in New Issue
Block a user