1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

(svn r10501) -Fix [FS#1015]: error dialog was sometimes shown on all clients when a command failed instead of only the client that actually did the command.

This commit is contained in:
rubidium
2007-07-10 20:59:41 +00:00
parent 0cd8274658
commit 872e74c028
6 changed files with 12 additions and 6 deletions

View File

@@ -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 */

View File

@@ -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..

View File

@@ -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 */

View File

@@ -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;