Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -33,7 +33,7 @@ struct ERR_GameMode{Array<IEntity*>owned;Faction* EnemyFaction(){return &enemy;}
|
||||
struct ERR_ForceRoute{};
|
||||
struct ERR_ConvoyReceipt{bool used=false;};
|
||||
struct ERR_ConvoyPool{int consumes=0;bool Consume(ERR_ConvoyReceipt* r){if(!r||r->used)return false;r->used=true;consumes++;return true;}};
|
||||
struct ERR_ConvoyVehicle{int Index=0;Vehicle* Entity=nullptr;SCR_AIGroup* Group=nullptr;};
|
||||
struct ERR_ConvoyVehicle{bool Released=false;int Index=0;Vehicle* Entity=nullptr;SCR_AIGroup* Group=nullptr;};
|
||||
struct ERR_ConvoyTask{ERR_ConvoyReceipt* Receipt=nullptr;ERR_ForceRoute* Route=nullptr;float Deadline=0;Array<ERR_ConvoyVehicle*>Vehicles;bool stopped=false;void Stop(ERR_GameMode*,string){stopped=true;}};
|
||||
namespace ERR_ForceRules{bool Finite(float f){return f==f;}}
|
||||
namespace ERR_ConvoyRules{bool valid=true,clear=true,empty=true;bool EmptyCrewTemplate(SCR_AIGroup*){return empty;}bool GroundClear(Array<vector>&,Array<vector>&){return clear;}bool Plan(Array<vector>&,Array<vector>&,ERR_ForceRoute*){return valid;}}
|
||||
@@ -51,17 +51,18 @@ int main(){
|
||||
ERR_ConvoyRules::clear=false;assert(!service.Dispatch(&receipt,positions,angles,&route,100));assert(!receipt.used&&ERR_Actors::calls==0);ERR_ConvoyRules::clear=true;
|
||||
ERR_ConvoyResources::available=false;assert(!service.Dispatch(&receipt,positions,angles,&route,100));assert(!receipt.used&&ERR_Actors::calls==0);ERR_ConvoyResources::available=true;
|
||||
enemy.key="US"; // A selected non-USSR enemy uses the same finite dispatch transaction.
|
||||
auto task=service.Dispatch(&receipt,positions,angles,&route,100);assert(task&&task->Vehicles.Count()==6&&!task->stopped&&receipt.used&&pool.consumes==1&&ERR_Actors::calls==12&&mode.owned.Count()==12&&service.crews==6);
|
||||
assert(!service.Dispatch(&receipt,positions,angles,&route,100));assert(ERR_Actors::calls==12);
|
||||
for(int failed=1;failed<=12;failed++){
|
||||
auto task=service.Dispatch(&receipt,positions,angles,&route,100);assert(task&&task->Vehicles.Count()==6&&!task->stopped&&receipt.used&&pool.consumes==1&&ERR_Actors::calls==10&&mode.owned.Count()==10&&service.crews==5);
|
||||
assert(task->Vehicles[2]->Released&&!task->Vehicles[2]->Entity&&!task->Vehicles[2]->Group);
|
||||
assert(!service.Dispatch(&receipt,positions,angles,&route,100));assert(ERR_Actors::calls==10);
|
||||
for(int failed=1;failed<=10;failed++){
|
||||
ERR_GameMode partial;ERR_ConvoyPool budget;Service run{&partial,&budget};ERR_ConvoyReceipt ticket;ERR_Actors::calls=0;ERR_Actors::fail=failed;
|
||||
auto result=run.Dispatch(&ticket,positions,angles,&route,0);assert(result&&result->stopped&&ticket.used&&budget.consumes==1&&run.m_Tasks.Count()==1);int attempted=ERR_Actors::calls;
|
||||
assert(!run.Dispatch(&ticket,positions,angles,&route,1)&&ERR_Actors::calls==attempted);assert(partial.owned.Count()==attempted-1);
|
||||
}
|
||||
ERR_Actors::fail=0;ERR_ConvoyRules::empty=false;ERR_GameMode unexpected;ERR_ConvoyPool rejectBudget;Service wrongTemplate{&unexpected,&rejectBudget};ERR_ConvoyReceipt rejectTicket;
|
||||
auto rejected=wrongTemplate.Dispatch(&rejectTicket,positions,angles,&route,100);assert(rejected&&rejected->stopped&&rejectTicket.used&&wrongTemplate.crews==0);ERR_ConvoyRules::empty=true;
|
||||
ERR_Actors::fail=0;ERR_GameMode seats;ERR_ConvoyPool budget;Service noCrew{&seats,&budget};noCrew.failCrew=2;ERR_ConvoyReceipt ticket;
|
||||
auto partial=noCrew.Dispatch(&ticket,positions,angles,&route,100);assert(partial&&partial->stopped&&partial->Vehicles.Count()==3&&ticket.used&&seats.owned.Count()==6);
|
||||
ERR_Actors::fail=0;ERR_GameMode seats;ERR_ConvoyPool budget;Service noCrew{&seats,&budget};noCrew.failCrew=3;ERR_ConvoyReceipt ticket;
|
||||
auto partial=noCrew.Dispatch(&ticket,positions,angles,&route,100);assert(partial&&partial->stopped&&partial->Vehicles.Count()==4&&ticket.used&&seats.owned.Count()==6);
|
||||
}
|
||||
''')
|
||||
# Execute the seat-selection and creation body. Failed capacity cannot shrink
|
||||
@@ -85,7 +86,7 @@ struct BaseCompartmentSlot{ECompartmentType type;bool occupied=false,accessible=
|
||||
struct Vehicle{Array<BaseCompartmentSlot*>seats;};
|
||||
struct ERR_ConvoyVehicle{int Index=0;Vehicle* Entity;AIGroup* Group;Array<BaseCompartmentSlot*>Seats;Array<IEntity*>Members;IEntity* Driver=nullptr;};
|
||||
namespace ERR_ConvoyRules{bool CollectSeats(Vehicle* v,Array<BaseCompartmentSlot*>& out){out=v->seats;return true;}}
|
||||
namespace ERR_ConvoyPool{int CrewCount(int i){if(i==1)return 1;if(i==2)return 9;if(i==4)return 3;return 2;}}
|
||||
namespace ERR_ConvoyPool{int CrewCount(int i){if(i==1)return 1;if(i==2)return 0;if(i==4)return 3;return 2;}}
|
||||
namespace ERR_ConvoyResources{int Soldier(){return 1;}int GroupPrefab(){return 2;}}
|
||||
struct Mode{int owned=0;void Own(IEntity*){owned++;}};
|
||||
struct Service{Mode* m_Mode;
|
||||
@@ -93,6 +94,7 @@ struct Service{Mode* m_Mode;
|
||||
};
|
||||
int main(){
|
||||
for(int i=0;i<6;i++){
|
||||
if(i==2)continue;
|
||||
Vehicle vehicle;AIGroup group;Mode mode;Service service{&mode};ERR_ConvoyVehicle unit;unit.Index=i;unit.Entity=&vehicle;unit.Group=&group;
|
||||
BaseCompartmentSlot driver{ECompartmentType::PILOT},gunner{ECompartmentType::TURRET},commander{ECompartmentType::TURRET};vehicle.seats={&driver,&gunner,&commander};
|
||||
BaseCompartmentSlot seats[8];for(auto& seat:seats){seat.type=ECompartmentType::CARGO;vehicle.seats.Insert(&seat);}
|
||||
@@ -101,10 +103,10 @@ int main(){
|
||||
Vehicle vehicle;AIGroup group;Mode mode;Service service{&mode};ERR_ConvoyVehicle unit;unit.Index=2;unit.Entity=&vehicle;unit.Group=&group;
|
||||
BaseCompartmentSlot driver{ECompartmentType::PILOT};vehicle.seats={&driver};assert(!service.FillCrew(&unit)&&driver.spawns==0&&mode.owned==0);
|
||||
BaseCompartmentSlot seats[8];for(auto& seat:seats){seat.type=ECompartmentType::CARGO;vehicle.seats.Insert(&seat);}seats[3].fail=true;
|
||||
assert(!service.FillCrew(&unit)&&unit.Members.Count()==4&&mode.owned==4);assert(seats[4].spawns==0);
|
||||
assert(!service.FillCrew(&unit)&&unit.Members.Count()==0&&mode.owned==0);assert(seats[4].spawns==0);
|
||||
}
|
||||
''')
|
||||
print('PASS: actual convoy dispatch validates before receipt consumption, consumes once before native mutation, retains all12 partial-failure paths, accepts the selected non-USSR enemy, and allocates exact19 bodies without capacity shrinking')
|
||||
print('PASS: actual convoy dispatch validates before receipt consumption, consumes once before native mutation, retains all10 partial-failure paths, accepts the selected non-USSR enemy, and allocates exact10 bodies without capacity shrinking')
|
||||
|
||||
# The resource must suppress authored allocation before native EOnInit, not try
|
||||
# to purge a queued default squad after custom seat occupants have been added.
|
||||
|
||||
Reference in New Issue
Block a user