[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/network network.c
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/network network.c |
Date: |
1 Feb 2004 06:42:46 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/02/01 06:42:45
Modified files:
src/network : network.c
Log message:
Fixed Bug #7466: Can Send Commands for other players
Patches:
Index: stratagus/src/network/network.c
diff -u stratagus/src/network/network.c:1.128
stratagus/src/network/network.c:1.129
--- stratagus/src/network/network.c:1.128 Thu Jan 22 17:18:21 2004
+++ stratagus/src/network/network.c Sun Feb 1 06:42:45 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: network.c,v 1.128 2004/01/22 06:18:21 wizzard Exp $
+// $Id: network.c,v 1.129 2004/01/31 19:42:45 wizzard Exp $
//@{
@@ -751,6 +751,7 @@
int player;
int i;
int commands;
+ int allowed;
unsigned long n;
if (NetworkFildes == (Socket)-1) {
@@ -897,9 +898,31 @@
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) {
- [Stratagus-CVS] stratagus/src/network network.c,
address@hidden <=