File diff r25561:3defb050f30b → r25562:30716ba6a396
src/network/network_command.cpp
Show inline comments
 
@@ -130,25 +130,25 @@ static CommandQueue _local_execution_que
 
 * @param p2 Additional data for the command (see #CommandProc)
 
 * @param cmd The command to execute (a CMD_* value)
 
 * @param callback A callback function to call after the command is finished
 
 * @param text The text to pass
 
 * @param company The company that wants to send the command
 
 */
 
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company)
 
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const std::string &text, CompanyID company)
 
{
 
	assert((cmd & CMD_FLAGS_MASK) == 0);
 

	
 
	CommandPacket c;
 
	c.company  = company;
 
	c.tile     = tile;
 
	c.p1       = p1;
 
	c.p2       = p2;
 
	c.cmd      = cmd;
 
	c.callback = callback;
 

	
 
	strecpy(c.text, (text != nullptr) ? text : "", lastof(c.text));
 
	strecpy(c.text, text.c_str(), lastof(c.text));
 

	
 
	if (_network_server) {
 
		/* If we are the server, we queue the command in our 'special' queue.
 
		 *   In theory, we could execute the command right away, but then the
 
		 *   client on the server can do everything 1 tick faster than others.
 
		 *   So to keep the game fair, we delay the command with 1 tick