Fixed Bug #7466: Can Send Commands for other players
This commit is contained in:
parent
b3fbda4e03
commit
e42d51addc
2 changed files with 27 additions and 3 deletions
|
@ -36,6 +36,7 @@
|
|||
<li>Future 2.00 Release<p>
|
||||
<ul>
|
||||
<li>++
|
||||
<li>Fixed Bug #7466: Can Send Commands for other players (from Russell Smith).
|
||||
<li>Fixed Bug #7294: Building cursor over hidden building (from Russell Smith).
|
||||
<li>Fixed Bug #7411: crash when loading this saved game(Magnant) (from Russell Smith).
|
||||
<li>Drawing mirror images for units and missiles facing left is optional (from Jimmy Salmon).
|
||||
|
|
|
@ -751,6 +751,7 @@ global void NetworkEvent(void)
|
|||
int player;
|
||||
int i;
|
||||
int commands;
|
||||
int allowed;
|
||||
unsigned long n;
|
||||
|
||||
if (NetworkFildes == (Socket)-1) {
|
||||
|
@ -897,9 +898,31 @@ global void NetworkEvent(void)
|
|||
NetworkLastFrame[player] = FrameCounter;
|
||||
|
||||
// Place in network in
|
||||
NetworkIn[packet->Header.Cycle][player][i].Time = n;
|
||||
NetworkIn[packet->Header.Cycle][player][i].Type = packet->Header.Type[i];
|
||||
NetworkIn[packet->Header.Cycle][player][i].Data = *nc;
|
||||
switch (packet->Header.Type[i]) {
|
||||
case MessageExtendedCommand:
|
||||
// FIXME: ensure the sender is part of the command
|
||||
allowed = 1;
|
||||
break;
|
||||
case MessageSync:
|
||||
// Sync does not matter
|
||||
allowed = 1;
|
||||
break;
|
||||
default:
|
||||
if (UnitSlots[ntohs(nc->Unit)]->Player->Player == player ||
|
||||
PlayersTeamed(player, UnitSlots[ntohs(nc->Unit)]->Player->Player)) {
|
||||
allowed = 1;
|
||||
} else {
|
||||
allowed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (allowed) {
|
||||
NetworkIn[packet->Header.Cycle][player][i].Time = n;
|
||||
NetworkIn[packet->Header.Cycle][player][i].Type = packet->Header.Type[i];
|
||||
NetworkIn[packet->Header.Cycle][player][i].Data = *nc;
|
||||
} else {
|
||||
SetMessage("%s Sent Bad Command", Players[player].Name);
|
||||
}
|
||||
}
|
||||
|
||||
for ( ; i < MaxNetworkCommands; ++i) {
|
||||
|
|
Loading…
Add table
Reference in a new issue