// this will place the vehicles in combat
// playe and enemy setup will only be used for quickbattle to avoid values getting leftover

function PlaceVehicles(%playersetup, %enemysetup)
{
   %spawnid = getRandom(1, 4);
   
   // for the highway battles, they only have 2 spawns
   
   if($Battlegrid $= "battle8")
   {
      %rand = getRandom(1, 2);
      
      if(%rand == 1)
         %spawnid = 1;
      else
         %spawnid = 3;
   }
   
   if($Battlegrid $= "battle9")
   {
      %rand = getRandom(1, 2);
      
      if(%rand == 1)
         %spawnid = 4;
      else
         %spawnid = 2;
   }
      
   echo("SPAWN ID " @ %spawnid);
   
   if(%enemysetup $= 1 || %enemysetup $= "")
      %formation = getRandom(2, 6);
   else
      %formation = %enemysetup;
      
   switch$ (%formation)
   {
      case 2:
         EnemyLineFormation(%spawnid);
         echo("ENEMY BATTLE FORMATION LINE");
      case 3:
         EnemyLightFormation(%spawnid);
         echo("ENEMY BATTLE FORMATION LIGHT");
      case 4:
         EnemyHeavyFormation(%spawnid);      
         echo("ENEMY BATTLE FORMATION HEAVY");
      case 5:
         EnemySkirmishLine(%spawnid);
         echo("ENEMY BATTLE FORMATION SKIRMISH");
      case 6:
         EnemyBoxFormation(%spawnid);      
         echo("ENEMY BATTLE FORMATION BOX");      
   }
   
   if(%playersetup $= "")
      %formation = $battleformation;
   else
      %formation = %playersetup;
      
   echo("PLAYER BATTLE FORMATION " @ %formation);
   
   switch$ (%formation)
   {
      case "heavyfirst":
         PlayerHeavyFormation(%spawnid);      
      case "lightfirst":
         PlayerLightFormation(%spawnid);
      case "box":
         PlayerBoxFormation(%spawnid);      
      case "skirmishline":
         PlayerSkirmishLine(%spawnid);
      case "line":
         PlayerLineFormation(%spawnid);
      default:
         PlayerLineFormation(%spawnid);      
   }
}

// used for formation, just find out if a vehicle fits in a light or heavy category

function GetVehicleClass(%vehicle)
{
   switch$ (%vehicle)
   {
      case "dunebuggy":
         return "light";           
      case "bike":
         return "light";           
      case "jeep":
         return "light";           
      case "compact":
         return "light";           
      case "minivan":
         return "light";           
      case "towtruck":
         return "light";           
      case "van":
         return "light";           
      case "limo":
         return "heavy";           
      case "sedan":
         return "light";           
      case "sportscar":
         return "light";           
      case "pickuptruck":
         return "light";           
      case "musclecar":
         return "light";           
      case "stationwagon":
         return "light";           
      case "humvee":
         return "light";           
      case "suv":
         return "light";           
      case "flatbedtruck":
         return "heavy";           
      case "trailertruck":
         return "heavy";           
      case "fireengine":
         return "heavy";           
      case "garbagetruck":
         return "heavy";           
      case "bus":
         return "heavy";           
      case "boxtruck":
         return "heavy";           
      case "cargovan":
         return "heavy";           
      case "ambulance":
         return "light";           
      case "construction":
         return "heavy";           
   }   
}