// FinalAlert2:YR Script file
// Name: Make Aircraft Recruitable
// Written By: Matthias Wagner
// Last Change: August 21, 2001
// Be careful when editing scripts, they may cause damage to maps if used improperly


AllowDelete("Necessary for changing aircraft");
AllowAdd("Necessary for changing aircraft");
Is("%DeleteAllowed%","=","0","%NoDelete%");
Print("Deletion must be allowed for this script to run!","%NoDelete%");
Cancel("%NoDelete%");
Is("%AddAllowed%","=","0","%NoAdd%");
Print("Adding must be allowed for this script to run!","%NoAdd%");
Cancel("%NoAdd%");

Ask("%specified%","你想限制一个到特殊所属方变化？","所属方限制");

SetVariable("%House%","");
UInputGetHouse("%House%","House:","%specified%");

SetAutoUpdate("FALSE"); // no screen flickering...

Is("%AircraftCount%","=","0","%Abort%");
Cancel("%Abort%");

SetVariable("%TCounter%","%AircraftCount%");

// LOOP BEGIN
:Loop:
SetVariable("%pos%","%TCounter%");
Substract("%pos%","1");
GetAircraft("%data%","%pos%");

SetVariable("%Differ%","0");
GetParam("%param%", "%data%", "0", "%specified%");
Is("%param%","!=","%House%","%Differ%","%specified%");

Substract("%TCounter%","1", "%Differ%");
And("%cancelloop%","%Differ%", "%TCounter%");
JumpTo("Loop", "%cancelloop%");

// if we are here, and Differ is set to TRUE, TCounter must be 0, so cancel script.
Cancel("%Differ%");

DeleteAircraft("%pos%");

// recruitable & AI recruitable
SetParam("%data%","10","1");
SetParam("%data%","11","1");

AddAircraft("%data%");
Substract("%TCounter%", "1", "%TCounter%"); // only substract if >=0, else infinite loop!
JumpTo("Loop","%TCounter%");


