Add deprecation messages for the most FormulaAI WML
This commit is contained in:
parent
318ed3bf30
commit
5ae496e492
2 changed files with 17 additions and 5 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "serialization/parser.hpp"
|
||||
#include "serialization/preprocessor.hpp"
|
||||
#include "game_config_view.hpp"
|
||||
#include "deprecation.hpp"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
|
@ -290,6 +291,9 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
}
|
||||
if (aiparam.has_attribute("engine")) {
|
||||
engine = aiparam["engine"].str();
|
||||
if(engine == "fai") {
|
||||
deprecated_message("FormulaAI", DEP_LEVEL::FOR_REMOVAL, "1.17", "FormulaAI is slated to be removed. Use equivalent Lua AIs instead");
|
||||
}
|
||||
}
|
||||
if (aiparam.has_attribute("ai_algorithm")) {
|
||||
if (algorithm.empty()) {
|
||||
|
@ -317,6 +321,12 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
if (just_copy_tags.count(child.key)) {
|
||||
// These aren't simplified, so just copy over unchanged.
|
||||
parsed_config.add_child(child.key, child.cfg);
|
||||
if(
|
||||
(child.key != "modify_ai" && child.cfg["engine"] == "fai") ||
|
||||
(child.key == "modify_ai" && child.cfg.all_children_count() > 0 && child.cfg.all_children_range().front().cfg["engine"] == "fai")
|
||||
) {
|
||||
deprecated_message("FormulaAI", DEP_LEVEL::FOR_REMOVAL, "1.17", "FormulaAI is slated to be removed. Use equivalent Lua AIs instead");
|
||||
}
|
||||
continue;
|
||||
} else if(old_goal_tags.count(child.key)) {
|
||||
// A simplified goal, mainly kept around just for backwards compatibility.
|
||||
|
@ -374,6 +384,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) {
|
|||
// Support old recruitment aspect syntax
|
||||
for(auto& child : parsed_config.child_range("aspect")) {
|
||||
if(child["id"] == "recruitment") {
|
||||
deprecated_message("AI recruitment aspect", DEP_LEVEL::INDEFINITE, "", "Use the recruitment_instructions aspect instead");
|
||||
child["id"] = "recruitment_instructions";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "formula/formula.hpp"
|
||||
#include "map/location.hpp"
|
||||
#include "log.hpp"
|
||||
#include "deprecation.hpp"
|
||||
|
||||
void unit_formula_manager::add_formula_var(std::string str,wfl:: variant var)
|
||||
{
|
||||
|
@ -29,16 +30,16 @@ void unit_formula_manager::add_formula_var(std::string str,wfl:: variant var)
|
|||
|
||||
void unit_formula_manager::read(const config & ai)
|
||||
{
|
||||
unit_formula_ = ai["formula"].str();
|
||||
unit_loop_formula_ = ai["loop_formula"].str();
|
||||
unit_priority_formula_ = ai["priority"].str();
|
||||
unit_formula_ = ai.get_deprecated_attribute("formula", "unit][ai", DEP_LEVEL::FOR_REMOVAL, "FormulaAI will be removed in 1.17").str();
|
||||
unit_loop_formula_ = ai.get_deprecated_attribute("loop_formula", "unit][ai", DEP_LEVEL::FOR_REMOVAL, "FormulaAI will be removed in 1.17").str();
|
||||
unit_priority_formula_ = ai.get_deprecated_attribute("priority", "unit][ai", DEP_LEVEL::FOR_REMOVAL, "FormulaAI will be removed in 1.17").str();
|
||||
|
||||
if (const config &ai_vars = ai.child("vars"))
|
||||
if (auto ai_vars = ai.get_deprecated_child("vars", "unit][ai", DEP_LEVEL::FOR_REMOVAL, "FormulaAI will be removed in 1.17"))
|
||||
{
|
||||
formula_vars_ = std::make_shared<wfl::map_formula_callable>();
|
||||
|
||||
wfl::variant var;
|
||||
for (const config::attribute &i : ai_vars.attribute_range()) {
|
||||
for (const config::attribute &i : ai_vars->attribute_range()) {
|
||||
var.serialize_from_string(i.second);
|
||||
formula_vars_->add(i.first, var);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue