mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
This commit is contained in:
parent
39dfd18880
commit
d7a053578d
@ -304,7 +304,7 @@ static const Command _command_proc_table[] = {
|
|||||||
|
|
||||||
{CmdMoneyCheat, CMD_OFFLINE}, /* CMD_MONEY_CHEAT */
|
{CmdMoneyCheat, CMD_OFFLINE}, /* CMD_MONEY_CHEAT */
|
||||||
{CmdBuildCanal, CMD_AUTO}, /* CMD_BUILD_CANAL */
|
{CmdBuildCanal, CMD_AUTO}, /* CMD_BUILD_CANAL */
|
||||||
{CmdCompanyCtrl, 0}, /* CMD_COMPANY_CTRL */
|
{CmdCompanyCtrl, CMD_SPECTATOR}, /* CMD_COMPANY_CTRL */
|
||||||
|
|
||||||
{CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO}, /* CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once */
|
{CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO}, /* CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once */
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
|
|||||||
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return false;
|
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return false;
|
||||||
|
|
||||||
/* If the server is a spectator, it may only do server commands! */
|
/* If the server is a spectator, it may only do server commands! */
|
||||||
if (_current_company == COMPANY_SPECTATOR && (cmd_flags & CMD_SERVER) == 0) return false;
|
if (_current_company == COMPANY_SPECTATOR && (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) == 0) return false;
|
||||||
|
|
||||||
bool notest = (cmd_flags & CMD_NO_TEST) != 0;
|
bool notest = (cmd_flags & CMD_NO_TEST) != 0;
|
||||||
|
|
||||||
|
@ -334,12 +334,13 @@ enum {
|
|||||||
* This enumeration defines flags for the _command_proc_table.
|
* This enumeration defines flags for the _command_proc_table.
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
CMD_SERVER = 0x01, ///< the command can only be initiated by the server
|
CMD_SERVER = 0x01, ///< the command can only be initiated by the server
|
||||||
CMD_OFFLINE = 0x02, ///< the command cannot be executed in a multiplayer game; single-player only
|
CMD_SPECTATOR = 0x02, ///< the command may be initiated by a spectator
|
||||||
CMD_AUTO = 0x04, ///< set the DC_AUTO flag on this command
|
CMD_OFFLINE = 0x04, ///< the command cannot be executed in a multiplayer game; single-player only
|
||||||
CMD_NO_TEST = 0x08, ///< the command's output may differ between test and execute due to town rating changes etc.
|
CMD_AUTO = 0x08, ///< set the DC_AUTO flag on this command
|
||||||
CMD_NO_WATER = 0x10, ///< set the DC_NO_WATER flag on this command
|
CMD_ALL_TILES = 0x10, ///< allow this command also on MP_VOID tiles
|
||||||
CMD_ALL_TILES= 0x20, ///< allow this command also on MP_VOID tiles
|
CMD_NO_TEST = 0x20, ///< the command's output may differ between test and execute due to town rating changes etc.
|
||||||
|
CMD_NO_WATER = 0x40, ///< set the DC_NO_WATER flag on this command
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -871,7 +871,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cp.cmd != CMD_COMPANY_CTRL && !IsValidCompanyID(cp.company) && ci->client_id != CLIENT_ID_SERVER) {
|
if ((GetCommandFlags(cp.cmd) & CMD_SPECTATOR) == 0 && !IsValidCompanyID(cp.company) && ci->client_id != CLIENT_ID_SERVER) {
|
||||||
IConsolePrintF(CC_ERROR, "WARNING: spectator issueing command from client %d (IP: %s), kicking...", ci->client_id, GetClientIP(ci));
|
IConsolePrintF(CC_ERROR, "WARNING: spectator issueing command from client %d (IP: %s), kicking...", ci->client_id, GetClientIP(ci));
|
||||||
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_KICKED);
|
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_KICKED);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user