src/network/network_data.cpp
changeset 5609 dc6a58930ba4
parent 5587 167d9a91ef02
child 5624 6afe9d27430a
equal deleted inserted replaced
5608:0b0aff054402 5609:dc6a58930ba4
    12 #include "../helpers.hpp"
    12 #include "../helpers.hpp"
    13 
    13 
    14 // Add a command to the local command queue
    14 // Add a command to the local command queue
    15 void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
    15 void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
    16 {
    16 {
    17 	CommandPacket* new_cp;
    17 	CommandPacket* new_cp = MallocT<CommandPacket>(1);
    18 	MallocT(&new_cp, 1);
       
    19 
    18 
    20 	*new_cp = *cp;
    19 	*new_cp = *cp;
    21 
    20 
    22 	if (cs->command_queue == NULL) {
    21 	if (cs->command_queue == NULL) {
    23 		cs->command_queue = new_cp;
    22 		cs->command_queue = new_cp;
    29 }
    28 }
    30 
    29 
    31 // Prepare a DoCommand to be send over the network
    30 // Prepare a DoCommand to be send over the network
    32 void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback)
    31 void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback)
    33 {
    32 {
    34 	CommandPacket *c;
    33 	CommandPacket *c = MallocT<CommandPacket>(1);
    35 	MallocT(&c, 1);
       
    36 	byte temp_callback;
    34 	byte temp_callback;
    37 
    35 
    38 	c->player = _local_player;
    36 	c->player = _local_player;
    39 	c->next = NULL;
    37 	c->next = NULL;
    40 	c->tile = tile;
    38 	c->tile = tile;