summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/tcp.h1
-rw-r--r--src/network/network_client.cpp1
-rw-r--r--src/network/network_data.cpp3
-rw-r--r--src/network/network_server.cpp3
4 files changed, 7 insertions, 1 deletions
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index bd6a1d01f..8314edc17 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -68,6 +68,7 @@ struct CommandPacket {
char text[80]; ///< possible text sent for name changes etc
uint32 frame; ///< the frame in which this packet is executed
byte callback; ///< any callback function executed upon successful completion of the command
+ bool my_cmd; ///< did the command originate from "me"
};
/** Status of a client */
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 0cf21c2ba..495181d76 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -628,6 +628,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMMAND)
p->Recv_string(cp->text, sizeof(cp->text));
cp->callback = p->Recv_uint8();
cp->frame = p->Recv_uint32();
+ cp->my_cmd = p->Recv_bool();
cp->next = NULL;
// The server did send us this command..
diff --git a/src/network/network_data.cpp b/src/network/network_data.cpp
index 3e148cb43..8f0ffb33e 100644
--- a/src/network/network_data.cpp
+++ b/src/network/network_data.cpp
@@ -62,6 +62,7 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma
CommandPacket *new_cp = MallocT<CommandPacket>(1);
*new_cp = c;
+ new_cp->my_cmd = true;
if (_local_command_queue == NULL) {
_local_command_queue = new_cp;
} else {
@@ -102,7 +103,7 @@ void NetworkExecuteCommand(CommandPacket *cp)
debug_dump_commands("ddc:cmd:%d;%d;%d;%d;%d;%d;%d;%s\n", _date, _date_fract, (int)cp->player, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text);
#endif /* DUMP_COMMANDS */
- DoCommandP(cp->tile, cp->p1, cp->p2, _callback_table[cp->callback], cp->cmd | CMD_NETWORK_COMMAND);
+ DoCommandP(cp->tile, cp->p1, cp->p2, _callback_table[cp->callback], cp->cmd | CMD_NETWORK_COMMAND, cp->my_cmd);
}
#endif /* ENABLE_NETWORK */
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index ad9985572..8de68e0aa 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -491,6 +491,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_COMMAND)(NetworkTCPSocketHandler *cs
p->Send_string(cp->text);
p->Send_uint8 (cp->callback);
p->Send_uint32(cp->frame);
+ p->Send_bool (cp->my_cmd);
cs->Send_Packet(p);
}
@@ -915,11 +916,13 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
// Callbacks are only send back to the client who sent them in the
// first place. This filters that out.
cp->callback = (new_cs != cs) ? 0 : callback;
+ cp->my_cmd = (new_cs == cs);
NetworkAddCommandQueue(new_cs, cp);
}
}
cp->callback = 0;
+ cp->my_cmd = false;
// Queue the command on the server
if (_local_command_queue == NULL) {
_local_command_queue = cp;