Send AI and difficulty changes to other players. Allow host and only host to change the position of other players and set AIs.

master
Per Inge Mathisen 2011-01-12 22:44:14 +01:00
parent e823dc2fd4
commit 9b6ee7f3c5
1 changed files with 7 additions and 3 deletions

View File

@ -2829,6 +2829,7 @@ static void processMultiopWidgets(UDWORD id)
int idx = id - MULTIOP_DIFFICULTY_CHOOSE_START; int idx = id - MULTIOP_DIFFICULTY_CHOOSE_START;
NetPlay.players[difficultyChooserUp].difficulty = idx; NetPlay.players[difficultyChooserUp].difficulty = idx;
game.skDiff[difficultyChooserUp] = difficultyValue[idx]; game.skDiff[difficultyChooserUp] = difficultyValue[idx];
NETBroadcastPlayerInfo(difficultyChooserUp);
closeDifficultyChooser(); closeDifficultyChooser();
addPlayerBox(!ingame.bHostSetup || bHosted); addPlayerBox(!ingame.bHostSetup || bHosted);
} }
@ -2837,6 +2838,7 @@ static void processMultiopWidgets(UDWORD id)
{ {
int idx = id - MULTIOP_AI_START; int idx = id - MULTIOP_AI_START;
NetPlay.players[aiChooserUp].ai = idx; NetPlay.players[aiChooserUp].ai = idx;
NETBroadcastPlayerInfo(aiChooserUp);
closeAiChooser(); closeAiChooser();
addPlayerBox(!ingame.bHostSetup || bHosted); addPlayerBox(!ingame.bHostSetup || bHosted);
} }
@ -2906,10 +2908,12 @@ static void processMultiopWidgets(UDWORD id)
} }
} }
if (id >= MULTIOP_PLAYER_START && id <= MULTIOP_PLAYER_END) // clicked on a player // clicked on a player
if (id >= MULTIOP_PLAYER_START && id <= MULTIOP_PLAYER_END && (id - MULTIOP_PLAYER_START == selectedPlayer || NetPlay.isHost))
{ {
int player = id - MULTIOP_PLAYER_START; int player = id - MULTIOP_PLAYER_START;
if (player == selectedPlayer && positionChooserUp < 0 && teamChooserUp < 0 && colourChooserUp < 0) if ((player == selectedPlayer || (NetPlay.players[player].allocated && NetPlay.isHost))
&& positionChooserUp < 0 && teamChooserUp < 0 && colourChooserUp < 0)
{ {
addPositionChooser(player); addPositionChooser(player);
} }
@ -2926,7 +2930,7 @@ static void processMultiopWidgets(UDWORD id)
closePositionChooser(); closePositionChooser();
addPlayerBox(!ingame.bHostSetup || bHosted); addPlayerBox(!ingame.bHostSetup || bHosted);
} }
else if (!NetPlay.players[id - MULTIOP_PLAYER_START].allocated && !challengeActive else if (!NetPlay.players[player].allocated && !challengeActive && NetPlay.isHost
&& positionChooserUp < 0 && teamChooserUp < 0 && colourChooserUp < 0) && positionChooserUp < 0 && teamChooserUp < 0 && colourChooserUp < 0)
{ {
addAiChooser(player); addAiChooser(player);