Implement a feature flags system.

* Scenarios contain a string map of feature flags. The flag names are the keys, and flag versions are the values, so a typical value might be "fixed" for bug fixes or for evolving features, "V1", "V2", etc.
* The game has a map of flags to lists of supported versions. The game can therefore signal that it supports a legacy behavior for a given feature flag. The last version in the list is considered to be this build version's default behavior.
* When launching a scenario, we check to make sure the game supports the scenario's required versions of its feature flags.
* When launching a replay, we make sure the game supports the feature flags that the version of the game that made the recording did.

Fix #555
Close #591
This commit is contained in:
2025-02-08 19:27:27 -06:00
committed by Celtic Minstrel
parent f0662902cb
commit f80f8a932a
11 changed files with 135 additions and 1 deletions

View File

@@ -2960,6 +2960,8 @@ bool build_scenario() {
scenario.contact_info[0] = author;
scenario.default_ground = grass ? 2 : 0;
scenario.feature_flags = {};
fs::path basePath = progDir/"Blades of Exile Base"/"bladbase.boes";
if(!fs::exists(basePath)) {
basePath = basePath.parent_path()/"bladbase.exs";

View File

@@ -133,6 +133,11 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario) {
data.PushElement("name", scenario.contact_info[0]);
data.PushElement("email", scenario.contact_info[1]);
data.CloseElement("author");
data.OpenElement("feature-flags");
for(auto& p : scenario.feature_flags){
data.PushElement(p.first, p.second);
}
data.CloseElement("feature-flags");
data.OpenElement("text");
data.PushElement("teaser", scenario.who_wrote[0]);
data.PushElement("teaser", scenario.who_wrote[1]);