Skip to content

Commit

Permalink
team, color and announcing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsupermanhd committed Oct 6, 2024
1 parent e5e2dd9 commit a5907a4
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions src/multiint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}

// ////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit a5907a4

Please sign in to comment.