function SetPlayerAllianceStateBJ takes player sourcePlayer,player otherPlayer,integer allianceState returns nothing
if (sourcePlayer == otherPlayer) then
return
endif
if allianceState == bj_ALLIANCE_UNALLIED then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_UNALLIED_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_UNITS then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
elseif allianceState == bj_ALLIANCE_ALLIED_ADVUNITS then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, true )
elseif allianceState == bj_ALLIANCE_NEUTRAL then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAlliance( sourcePlayer, otherPlayer, ALLIANCE_PASSIVE, true )
elseif allianceState == bj_ALLIANCE_NEUTRAL_VISION then
call SetPlayerAllianceStateAllyBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateVisionBJ( sourcePlayer, otherPlayer, true )
call SetPlayerAllianceStateControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAllianceStateFullControlBJ( sourcePlayer, otherPlayer, false )
call SetPlayerAlliance( sourcePlayer, otherPlayer, ALLIANCE_PASSIVE, true )
else
endif
endfunction