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
|
void
|
||||||
validateAllStars()
|
validateAllStars()
|
||||||
{
|
{
|
||||||
|
std::cerr << "Checking if any stars are out of required sorting order..."
|
||||||
|
<< std::endl;
|
||||||
const auto where= std::is_sorted_until( GetAllStars(),
|
const auto where= std::is_sorted_until( GetAllStars(),
|
||||||
GetAllStars() + GetStarCount(),
|
GetAllStars() + GetStarCount(),
|
||||||
[]( const auto &lhs_, const auto &rhs_ )
|
[]( 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 >{} );
|
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
|
void
|
||||||
SetupGeneratorForSolarSystem( STAR_DESC *const desc, SolarSystem *const solarSys )
|
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,
|
// Must either have a legacy constructor or a named lookup,
|
||||||
// but not both.
|
// but not both.
|
||||||
|
|||||||
Reference in New Issue
Block a user