Configure anger points per Sarka instead of cars per point
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-10-17 18:58:35 +02:00
parent 82b52ae1fc
commit 372fca7a68
15 changed files with 125 additions and 59 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ assert 'Apply_planeReconEnabled' not in names # Saved-state toggle pair, not a
assert len(names) == len(set(names)), 'Menu widget names must be unique'
for key in keys:
assert all(name in names for name in (key, 'Apply_' + key, 'Saved_' + key, 'Help_' + key))
if key not in ('sarkaCarsPerAnger','emptyRestartHours','aiDoctrine','aiShadow','motorbikeCount','planeAltitudeMetres','planeReplacementSeconds','planeSectorSeconds','fieldCampCount','fieldHospitalCount','startMode','civilianTrafficCount','roadblockCount','hunterSpawnDistanceMetres','objectGuardCount','objectGuardEvery','objectGuardHQMode','startWeaponCount','startMagazineCount'): assert ('Default_' if key == 'viewDistanceMetres' else 'Random_') + key in names
if key not in ('sarkaAngerPerCar','emptyRestartHours','aiDoctrine','aiShadow','motorbikeCount','planeAltitudeMetres','planeReplacementSeconds','planeSectorSeconds','fieldCampCount','fieldHospitalCount','startMode','civilianTrafficCount','roadblockCount','hunterSpawnDistanceMetres','objectGuardCount','objectGuardEvery','objectGuardHQMode','startWeaponCount','startMagazineCount'): assert ('Default_' if key == 'viewDistanceMetres' else 'Random_') + key in names
else: assert 'Random_startMode' not in names
for name in ('Close', 'SettingsPage', 'HQPage', 'JournalPage', 'JournalText', 'JournalContent', 'JournalScroll', 'PauseJournal', 'LatestJournal', 'Status'):
assert name in names
+3 -3
View File
@@ -21,9 +21,9 @@ int main(){
assert(!Valid("emptyRestartHours",-1)&&!Valid("emptyRestartHours",169));
for(std::string key:{"aiDoctrine","aiShadow"}){ assert(Valid(key,0)&&Valid(key,1)); assert(!Valid(key,-1)&&!Valid(key,2)); }
assert(CoreSetting("mission","motorbikes")=="motorbikeCount");
assert(CoreSetting("mission","sarkacars")=="sarkaCarsPerAnger");
assert(Valid("sarkaCarsPerAnger",0)&&Valid("sarkaCarsPerAnger",1)&&Valid("sarkaCarsPerAnger",5));
assert(!Valid("sarkaCarsPerAnger",-1)&&!Valid("sarkaCarsPerAnger",6));
assert(CoreSetting("mission","sarkapoints")=="sarkaAngerPerCar");
assert(Valid("sarkaAngerPerCar",0)&&Valid("sarkaAngerPerCar",1)&&Valid("sarkaAngerPerCar",30));
assert(!Valid("sarkaAngerPerCar",-1)&&!Valid("sarkaAngerPerCar",31));
assert(Valid("motorbikeCount",0)&&Valid("motorbikeCount",2)&&Valid("motorbikeCount",6));
assert(!Valid("motorbikeCount",-1)&&!Valid("motorbikeCount",7));
assert(CoreSetting("mission","planealtitude")=="planeAltitudeMetres");
+18
View File
@@ -47,6 +47,24 @@ int main(){
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(Settings::AddedDefault("sarkaAngerPerCar")==3);
for(int old=0;old<=5;++old){
files["sarka"]=files["old"];files["sarka"]["sarkaCarsPerAnger"]=old;
assert(s.Read("sarka",loaded)&&loaded->Get("sarkaAngerPerCar")== (old==0?0:3));
}
for(float bad:{-1.0f,6.0f,0.5f}){
files["sarka"]=files["old"];files["sarka"]["sarkaCarsPerAnger"]=bad;
assert(!s.Read("sarka",loaded));
}
for(int points:{0,1,3,5,30}){
files["sarka"]=files["old"];files["sarka"]["sarkaCarsPerAnger"]=0;
files["sarka"]["sarkaAngerPerCar"]=points;
assert(s.Read("sarka",loaded)&&loaded->Get("sarkaAngerPerCar")==points);
}
for(float bad:{-1.0f,31.0f,0.5f}){
files["sarka"]=files["old"];files["sarka"]["sarkaAngerPerCar"]=bad;
assert(!s.Read("sarka",loaded));
}
assert(!s.Read("missing",loaded));
}
''')
+18 -6
View File
@@ -21,6 +21,8 @@ struct Waves
struct Rules {'''+band+seats+r'''};
int main(){
Waves w{};
assert(w.AngerPerCar==3);
w.Configure(1); // Preserve the timing/retry checks at the densest allowed rate.
assert(!w.Due(100,3,true)&&w.NextWave==600100);
assert(!w.Due(600099,3,true));
assert(w.Due(600100,3,true)&&w.Pending==3&&w.Wave==1);
@@ -41,16 +43,26 @@ int main(){
Waves configured{};
configured.Configure(2);
assert(!configured.Due(0,3,true));
assert(configured.Due(600000,3,true)&&configured.Target==6);
configured.Commit();assert(configured.Pending==5&&configured.Spawned==1);
assert(configured.Due(600000,5,true)&&configured.Target==2);
configured.Commit();assert(configured.Pending==1&&configured.Spawned==1);
configured.Configure(5); // Already sampled wave and deadline stay unchanged.
assert(configured.Pending==5&&configured.NextWave==1200000);
assert(configured.Due(1200000,30,true)&&configured.Target==30); // Keep the formation cap.
assert(configured.Pending==1&&configured.NextWave==1200000);
assert(configured.Due(1200000,30,true)&&configured.Target==6);
configured.Configure(0);assert(configured.Pending==0&&configured.Target==0);
assert(!configured.Due(9999999,30,true)&&configured.Spawned==1); // No waves; retain deployed count.
configured.Configure(2);assert(!configured.Due(10000000,3,true));
assert(!configured.Due(10599999,3,true)); // Re-enable waits normally, no backlog.
assert(configured.Due(10600000,3,true)&&configured.Target==6);
assert(configured.Due(10600000,3,true)&&configured.Target==1);
// All supported divisors, exact thresholds, remainders and clamped anger.
for(int points=1;points<=30;++points){
for(int anger=-1;anger<=31;++anger){
Waves threshold{};threshold.Configure(points);
assert(!threshold.Due(0,anger,true));
int expected=std::clamp(anger,0,30)/points;
assert(threshold.Due(600000,anger,true)==(expected>0));
assert(threshold.Target==expected&&threshold.Pending==expected);
}
}
Array<vector> players{{0,10,0}};
assert(!Rules::InBand({999,0,0},players));
assert(Rules::InBand({1000,900,0},players)&&Rules::InBand({1250,0,0},players));
@@ -61,4 +73,4 @@ int main(){
assert(Rules::Seats(1,0,3,4)&&!Rules::Seats(1,1,2,4)&&!Rules::Seats(1,0,4,5));
}
''')
print('PASS: configurable anger multiplier, disable/re-enable, wave cap, staged retries, empty-round reset, no backlog, four seats and nearest-player road distance')
print('PASS: anger per car, all thresholds and remainders, disable/re-enable, wave cap, staged retries, empty-round reset, no backlog, four seats and nearest-player road distance')