/// <summary> /// Returns an unique callsign in the NATO format (Callsign Number Number) /// </summary> /// <param name="callsignFamily">A callsign family</param> /// <returns>The callsign</returns> private UnitCallsign GetNATOCallsign(UnitCallsignFamily callsignFamily) { int callsignIndex; do { callsignIndex = Toolbox.RandomInt(NATO_CALLSIGN_NAMES[(int)callsignFamily].Length); } while (NATOCallsigns[(int)callsignFamily][callsignIndex] >= 9); NATOCallsigns[(int)callsignFamily][callsignIndex]++; string groupName = NATO_CALLSIGN_NAMES[(int)callsignFamily][callsignIndex] + " " + Toolbox.ValToString(NATOCallsigns[(int)callsignFamily][callsignIndex]); string unitName = groupName + " $INDEX$"; string lua = $"{{ [1]= {Toolbox.ValToString(callsignIndex + 1)}, " + $"[2]={Toolbox.ValToString(NATOCallsigns[(int)callsignFamily][callsignIndex])}, " + "[3]=$INDEX$, " + $"[\"name\"] = \"{unitName.Replace(" ", "")}\", }}"; return(new UnitCallsign(groupName, unitName /*, onboardNum*/, lua)); }
private UnitCallsign GetNATOCallsign(UnitCallsignFamily callsignFamily, UnitFamily unitFamily, Side side, bool isUsingSkynet) { int callsignIndex; do { callsignIndex = Toolbox.RandomInt(NATO_CALLSIGN_NAMES[(int)callsignFamily].Length); } while (NATOCallsigns[(int)callsignFamily][callsignIndex] >= 9); NATOCallsigns[(int)callsignFamily][callsignIndex]++; string groupName = NATO_CALLSIGN_NAMES[(int)callsignFamily][callsignIndex] + " " + Toolbox.ValToString(NATOCallsigns[(int)callsignFamily][callsignIndex]); string unitName = groupName + " $INDEX$"; string lua = $"{{ [1]= {Toolbox.ValToString(callsignIndex + 1)}, " + $"[2]={Toolbox.ValToString(NATOCallsigns[(int)callsignFamily][callsignIndex])}, " + "[3]=$INDEX$, " + $"[\"name\"] = \"{unitName.Replace(" ", "")}\", }}"; if (isUsingSkynet && unitFamily == UnitFamily.PlaneAWACS) { unitName = SetSkyNetPrefix(unitName, side); } return(new UnitCallsign(groupName, unitName /*, onboardNum*/, lua)); }
/// <summary> /// Returns an unique callsign for an aircraft group. /// </summary> /// <param name="unitFamily">The unit family</param> /// <param name="natoCallsign">Should this callsign be in the NATO format (true) or the Russian format (false)</param> /// <returns></returns> public UnitCallsign GetCallsign(UnitFamily unitFamily, Coalition coalition) { UnitCallsignFamily callsignFamily = GetCallsignFamilyFromUnitFamily(unitFamily); if (CoalitionsDB[(int)coalition].NATOCallsigns) { return(GetNATOCallsign(callsignFamily)); } return(GetRussianCallsign()); }
internal UnitCallsign GetCallsign(UnitFamily unitFamily, Coalition coalition, Side side, bool isUsingSkynet) { UnitCallsignFamily callsignFamily = GetCallsignFamilyFromUnitFamily(unitFamily); if (CoalitionsDB[(int)coalition].NATOCallsigns) { return(GetNATOCallsign(callsignFamily, unitFamily, side, isUsingSkynet)); } return(GetRussianCallsign(unitFamily, side, isUsingSkynet)); }