InitGenericPlayerSlots

comment

This function is called in the scope of config to set up the map based on game type. Specifically, this assigns players into teams, unless the game type is GAME_TYPE_USE_MAP_SETTINGS (then map-specific code does this) or unknown (nothing is done in that case).

bug

Leaks handle gType: In Jass you must set local variables that hold agents (or any child type) to null at 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 InitGenericPlayerSlots takes nothing returns nothing
    local gametype gType = GetGameTypeSelected()

    if (gType == GAME_TYPE_MELEE) then
        call MeleeInitPlayerSlots()
    elseif (gType == GAME_TYPE_FFA) then
        call FFAInitPlayerSlots()
    elseif (gType == GAME_TYPE_USE_MAP_SETTINGS) then
        // Do nothing; the map-specific script handles this.
    elseif (gType == GAME_TYPE_ONE_ON_ONE) then
        call OneOnOneInitPlayerSlots()
    elseif (gType == GAME_TYPE_TWO_TEAM_PLAY) then
        call TeamInitPlayerSlots(2)
    elseif (gType == GAME_TYPE_THREE_TEAM_PLAY) then
        call TeamInitPlayerSlots(3)
    elseif (gType == GAME_TYPE_FOUR_TEAM_PLAY) then
        call TeamInitPlayerSlots(4)
    else
        // Unrecognized Game Type
    endif
endfunction