MeleeStartingUnits
- comment
- note
It is called directly by the default "Melee Initialization" trigger.
- bug
Leaks handle
indexStartLoc: In Jass you must set local variables that hold agents (or any child type) tonullat the end of functions to avoid reference counter leaks.- patch
1.00
- Source
- Blizzard.j (raise an issue to discuss on Github or submit a PR)
- return type
nothing- Source code
function MeleeStartingUnits takes nothing returns nothing local integer index local player indexPlayer local location indexStartLoc local race indexRace call Preloader( "scripts\\SharedMelee.pld" ) set index = 0 loop set indexPlayer = Player(index) if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then set indexStartLoc = GetStartLocationLoc(GetPlayerStartLocation(indexPlayer)) set indexRace = GetPlayerRace(indexPlayer) // Create initial race-specific starting units if (indexRace == RACE_HUMAN) then call MeleeStartingUnitsHuman(indexPlayer, indexStartLoc, true, true, true) elseif (indexRace == RACE_ORC) then call MeleeStartingUnitsOrc(indexPlayer, indexStartLoc, true, true, true) elseif (indexRace == RACE_UNDEAD) then call MeleeStartingUnitsUndead(indexPlayer, indexStartLoc, true, true, true) elseif (indexRace == RACE_NIGHTELF) then call MeleeStartingUnitsNightElf(indexPlayer, indexStartLoc, true, true, true) else call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true) endif endif set index = index + 1 exitwhen index == bj_MAX_PLAYERS endloop endfunction