Added new achievements (#4368)

* Added new achievements
* Reordered some older achievements by ID.
* Fixed memory management on duplicate achievements.
Thanks to @Lemongrass3110!
This commit is contained in:
Aleos
2019-09-30 11:27:49 -04:00
committed by GitHub
parent 752d3143f5
commit bbca9efd57
3 changed files with 446 additions and 392 deletions

View File

@@ -187,7 +187,14 @@ uint64 AchievementDatabase::parseBodyNode(const YAML::Node &node){
condition = "achievement_condition( " + condition + " );";
}
if( achievement->condition ){
aFree( achievement->condition );
achievement->condition = nullptr;
}
achievement->condition = parse_script( condition.c_str(), this->getCurrentFile().c_str(), node["Condition"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
}else{
achievement->condition = nullptr;
}
if( this->nodeExists( node, "Map" ) ){
@@ -270,7 +277,14 @@ uint64 AchievementDatabase::parseBodyNode(const YAML::Node &node){
return 0;
}
if( achievement->rewards.script ){
aFree( achievement->rewards.script );
achievement->rewards.script = nullptr;
}
achievement->rewards.script = parse_script( script.c_str(), this->getCurrentFile().c_str(), achievement_id, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
}else{
achievement->rewards.script = nullptr;
}
// TODO: not camel case