Initial implementation of pet evolution system + Pet DB conversion to YAML (#3544)
* Implemented official pet evolution system * Added evolved pets to pet database * Corrected various pet system mechanics * Migrated pet database to YAML format and the converter from CSV format Thanks to @Lemongrass3110 @aleos89 and @Atemo for their suggestions and additional fixes
This commit is contained in:
committed by
GitHub
parent
e4b41ef7e0
commit
ac558d7c1e
@@ -20,6 +20,24 @@ bool YamlDatabase::nodeExists( const YAML::Node& node, const std::string& name )
|
||||
}
|
||||
}
|
||||
|
||||
bool YamlDatabase::nodesExist( const YAML::Node& node, std::initializer_list<const std::string> names ){
|
||||
bool missing = false;
|
||||
|
||||
for( const std::string& name : names ){
|
||||
if( !this->nodeExists( node, name ) ){
|
||||
ShowError( "Missing mandatory node \"%s\".\n", name.c_str() );
|
||||
missing = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( missing ){
|
||||
this->invalidWarning( node, "At least one mandatory node did not exist.\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool YamlDatabase::verifyCompatibility( const YAML::Node& rootNode ){
|
||||
if( !this->nodeExists( rootNode, "Header" ) ){
|
||||
ShowError( "No database \"Header\" was found.\n" );
|
||||
@@ -67,6 +85,12 @@ bool YamlDatabase::load(){
|
||||
return this->load( this->getDefaultLocation() );
|
||||
}
|
||||
|
||||
bool YamlDatabase::reload(){
|
||||
this->clear();
|
||||
|
||||
return this->load();
|
||||
}
|
||||
|
||||
bool YamlDatabase::load(const std::string& path) {
|
||||
YAML::Node rootNode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user