diff --git a/sc2/src/uqm/planets/generate-base.cpp b/sc2/src/uqm/planets/generate-base.cpp index c1e02c111..0c800f08e 100644 --- a/sc2/src/uqm/planets/generate-base.cpp +++ b/sc2/src/uqm/planets/generate-base.cpp @@ -79,6 +79,8 @@ namespace Planets ::detail:: Generate_m Generator::~Generator()= default; + void Generator::checkSupplementRequirements( const std::optional< std::string > & ) {} + // All of the default C++ generator functions forward to the // plain C default impls. The idea is that you derive your @@ -273,6 +275,12 @@ namespace Planets ::detail:: Generate_m throw std::runtime_error{ mesg }; } + + std::cerr << "Performing supplementary argument checks for `" << star.supplement + << "`..." << std::endl; + const auto name= star.supplement; + auto gen= registry().at( name ).get(); + gen->checkSupplementRequirements( star.supArg ? star.supArg : std::optional< std::string >{} ); } } } diff --git a/sc2/src/uqm/planets/generate.h b/sc2/src/uqm/planets/generate.h index 2eb7e089f..2431617de 100644 --- a/sc2/src/uqm/planets/generate.h +++ b/sc2/src/uqm/planets/generate.h @@ -123,6 +123,7 @@ void SetupGeneratorForSolarSystem( STAR_DESC *desc, SOLARSYS_STATE *state ); #include #include +#include namespace Planets ::detail:: Generate_m { @@ -168,6 +169,8 @@ namespace Planets ::detail:: Generate_m PLANET_DESC *world, COUNT whichNode )= 0; virtual bool pickupLife( SolarSystem *solarSys, PLANET_DESC *world, COUNT whichNode )= 0; + + virtual void checkSupplementRequirements( const std::optional< std::string > & ); // Normally does nothing. }; class exports::DefaultGenerator