From a5907a493ae8d950ff1b27bedb176ba33b5ea537 Mon Sep 17 00:00:00 2001 From: maxsupermanhd Date: Sun, 6 Oct 2024 18:46:05 +0300 Subject: [PATCH] team, color and announcing --- src/multiint.cpp | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/multiint.cpp b/src/multiint.cpp index ffec876897f..673156b2bbd 100644 --- a/src/multiint.cpp +++ b/src/multiint.cpp @@ -2513,13 +2513,22 @@ bool recvTeamRequest(NETQUEUE queue) return false; } - if (whosResponsible(player) != queue.index) + if (whosResponsible(player) != queue.index && !senderHasLobbyCommandAdminPrivs(queue.index)) { HandleBadParam("NET_TEAMREQUEST given incorrect params.", player, queue.index); return false; } - if (locked.teams) + if (senderHasLobbyCommandAdminPrivs(queue.index)) + { + sendRoomSystemMessage(astringf("Admin %s changed team of player [%d] %s to %d", + NetPlay.players[queue.index].name, + NetPlay.players[player].position, + NetPlay.players[player].name, + team).c_str()); + } + + if (locked.teams && !senderHasLobbyCommandAdminPrivs(queue.index)) { return false; } @@ -2805,12 +2814,21 @@ bool recvColourRequest(NETQUEUE queue) return false; } - if (whosResponsible(player) != queue.index) + if (whosResponsible(player) != queue.index && !senderHasLobbyCommandAdminPrivs(queue.index)) { HandleBadParam("NET_COLOURREQUEST given incorrect params.", player, queue.index); return false; } + if (senderHasLobbyCommandAdminPrivs(queue.index)) + { + sendRoomSystemMessage(astringf("Admin %s changed color of player [%d] %s to %d", + NetPlay.players[queue.index].name, + NetPlay.players[player].position, + NetPlay.players[player].name, + col).c_str()); + } + resetReadyStatus(false, true); return changeColour(player, col, false); @@ -2846,6 +2864,15 @@ bool recvPositionRequest(NETQUEUE queue) return false; } + if (senderHasLobbyCommandAdminPrivs(queue.index)) + { + sendRoomSystemMessage(astringf("Admin %s changed position of player [%d] %s to %d", + NetPlay.players[queue.index].name, + NetPlay.players[player].position, + NetPlay.players[player].name, + position).c_str()); + } + resetReadyStatus(false); return changePosition(player, position); @@ -3269,7 +3296,7 @@ static SwapPlayerIndexesResult recvSwapPlayerIndexes(NETQUEUE queue, const std:: static bool canChooseTeamFor(int i) { - return (i == selectedPlayer || NetPlay.isHost); + return (i == selectedPlayer || (NetPlay.isHost || NetPlay.isAdmin)); } // ////////////////////////////////////////////////////////////////////////////