Improve AI garrisons, player recovery and mission administration

This commit is contained in:
2026-09-24 22:12:45 +02:00
parent 1b1a8b5173
commit 2551d171b3
115 changed files with 3622 additions and 547 deletions
+8 -1
View File
@@ -33,13 +33,20 @@ int main(){
files["old"]={{"reportIntervalSeconds",10},{"supportSquadLimit",4},{"responseRadiusMetres",2000},
{"aiIntelChancePercent",60},{"intelRevealChancePercent",15},{"radioDefenceSeconds",180}};
Settings s;Map* loaded=nullptr;assert(s.Read("old",loaded)&&loaded->Get("automaticConvoyEnabled")==1);
assert(loaded->Get("reportIntervalSeconds")==10&&loaded->Get("stingerChanceOneIn")==15);
assert(loaded->Get("reportIntervalSeconds")==10&&loaded->Get("antiAirChancePercent")==7);
files["disabled"]=files["old"];files["disabled"]["automaticConvoyEnabled"]=0;
assert(s.Read("disabled",loaded)&&loaded->Get("automaticConvoyEnabled")==0);
files["enabled"]=files["old"];files["enabled"]["automaticConvoyEnabled"]=1;
assert(s.Read("enabled",loaded)&&loaded->Get("automaticConvoyEnabled")==1);
for(float bad:{-1.0f,2.0f,0.5f}){files["invalid"]=files["old"];files["invalid"]["automaticConvoyEnabled"]=bad;assert(!s.Read("invalid",loaded));}
files["incomplete"]=files["old"];files["incomplete"].erase("reportIntervalSeconds");assert(!s.Read("incomplete",loaded));
for(auto pair:std::map<int,int>{{0,0},{1,100},{15,7},{37,3},{10000,0}}){
files["legacy"]=files["old"];files["legacy"]["stingerChanceOneIn"]=pair.first;
assert(s.Read("legacy",loaded)&&loaded->Get("antiAirChancePercent")==pair.second);
}
for(float bad:{-1.0f,10001.0f,0.5f}){files["legacy"]=files["old"];files["legacy"]["stingerChanceOneIn"]=bad;assert(!s.Read("legacy",loaded));}
files["new"]=files["old"];files["new"]["stingerChanceOneIn"]=15;files["new"]["antiAirChancePercent"]=100;
assert(s.Read("new",loaded)&&loaded->Get("antiAirChancePercent")==100&&loaded->Get("antiPersonnelMineChancePercent")==60);
assert(!s.Read("missing",loaded));
}
''')