Validation really only needs to be done once.
Also be a bit more noisy with validation.
This commit is contained in:
@@ -235,6 +235,8 @@ namespace Planets ::detail:: Generate_m
|
||||
void
|
||||
validateAllStars()
|
||||
{
|
||||
std::cerr << "Checking if any stars are out of required sorting order..."
|
||||
<< std::endl;
|
||||
const auto where= std::is_sorted_until( GetAllStars(),
|
||||
GetAllStars() + GetStarCount(),
|
||||
[]( const auto &lhs_, const auto &rhs_ )
|
||||
@@ -283,6 +285,15 @@ namespace Planets ::detail:: Generate_m
|
||||
gen->checkSupplementRequirements( star.supArg ? star.supArg : std::optional< std::string >{} );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
stickyValidateAllStars()
|
||||
{
|
||||
static bool validated= false;
|
||||
if( validated ) return;
|
||||
validateAllStars();
|
||||
validated= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +308,7 @@ extern "C"
|
||||
void
|
||||
SetupGeneratorForSolarSystem( STAR_DESC *const desc, SolarSystem *const solarSys )
|
||||
{
|
||||
if( C::debugGenerationByValidatingAllStars ) validateAllStars();
|
||||
if( C::debugGenerationByValidatingAllStars ) stickyValidateAllStars();
|
||||
|
||||
// Must either have a legacy constructor or a named lookup,
|
||||
// but not both.
|
||||
|
||||
Reference in New Issue
Block a user