1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-30 18:09:09 +00:00

(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).

This commit is contained in:
rubidium
2009-01-08 14:55:28 +00:00
parent 427e2d30c5
commit e39484e9a8
3 changed files with 33 additions and 13 deletions

View File

@@ -92,16 +92,6 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma
SEND_COMMAND(PACKET_CLIENT_COMMAND)(&c);
}
/**
* Execute a DoCommand we received from the network
* @param cp the command to execute
*/
static void NetworkExecuteCommand(CommandPacket *cp)
{
_current_company = cp->company;
DoCommandP(cp->tile, cp->p1, cp->p2, cp->cmd | CMD_NETWORK_COMMAND, cp->callback, cp->text, cp->my_cmd);
}
/**
* Execute all commands on the local command queue that ought to be executed this frame.
*/
@@ -119,10 +109,13 @@ void NetworkExecuteLocalCommandQueue()
error("[net] Trying to execute a packet in the past!");
}
/* We can execute this command */
NetworkExecuteCommand(_local_command_queue);
CommandPacket *cp = _local_command_queue;
/* We can execute this command */
_current_company = cp->company;
cp->cmd |= CMD_NETWORK_COMMAND;
DoCommandP(cp, cp->my_cmd);
_local_command_queue = _local_command_queue->next;
free(cp);
}