Default generation now goes thru C++

This commit is contained in:
2024-04-26 02:57:52 -04:00
parent ef041d3735
commit 64842659c6
3 changed files with 27 additions and 4 deletions
+9 -3
View File
@@ -19,6 +19,8 @@
#include "gendef.h" #include "gendef.h"
#include "planets/generate.h" #include "planets/generate.h"
#include <stdlib.h>
extern GenerateFunctions generateDefaultFunctions; extern GenerateFunctions generateDefaultFunctions;
@@ -53,10 +55,14 @@ extern GenerateFunctions generateZoqFotPikScoutFunctions;
extern GenerateFunctions *getGenerateCxxFunctions( void ); extern GenerateFunctions *getGenerateCxxFunctions( void );
extern struct GeneratorBase cxxDefaultPlanetGen;
const GenerateFunctions * const GenerateFunctions *
getGenerateFunctions (STAR_DESC *const star, void **sup ) getGenerateFunctions (STAR_DESC *const star, void **sup )
{ {
*sup= 0; *sup= star->supplement;
switch (star->Index) switch (star->Index)
{ {
case SOL_DEFINED: case SOL_DEFINED:
@@ -133,11 +139,11 @@ getGenerateFunctions (STAR_DESC *const star, void **sup )
case ILWRATH_DEFINED: case ILWRATH_DEFINED:
return &generateIlwrathFunctions; return &generateIlwrathFunctions;
default: default:
return &generateDefaultFunctions; *sup= &cxxDefaultPlanetGen;
// FALLTHROUGH
// Eventually everything should go thru this. // Eventually everything should go thru this.
case CXX_DEFINED: case CXX_DEFINED:
*sup= star->supplement;
return getGenerateCxxFunctions(); return getGenerateCxxFunctions();
} }
} }
+17
View File
@@ -168,4 +168,21 @@ namespace Planets ::detail:: Generate_m
{ {
return GenerateDefault_pickupLife( solarSys, world, whichNode ); return GenerateDefault_pickupLife( solarSys, world, whichNode );
} }
namespace
{
class RealDefaultGenerator
: public DefaultGenerator
{
public:
~RealDefaultGenerator() override= default;
};
}
}
extern "C"
{
Planets::detail::Generate_m::RealDefaultGenerator cxxDefaultPlanetGen;
} }
+1 -1
View File
@@ -167,7 +167,7 @@ namespace Planets ::detail:: Generate_m
: public Generator : public Generator
{ {
public: public:
~DefaultGenerator() override; ~DefaultGenerator() override= 0;
void initNpcs(SolarSystem *solarSys) override; void initNpcs(SolarSystem *solarSys) override;
void reinitNpcs(SolarSystem *solarSys) override; void reinitNpcs(SolarSystem *solarSys) override;