From 5394a8c220669a47275f88aee8e7ea1c5845da01 Mon Sep 17 00:00:00 2001 From: truebrain Date: Mon, 19 Dec 2011 20:50:36 +0000 Subject: [PATCH] (svn r23602) -Add: support for DEITY commands, commands where no real company was involved in (Rubidium) --- src/command.cpp | 2 +- src/command_type.h | 17 +++++++++-------- src/company_type.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index 31c4843f0e..f2bf49c13c 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -609,7 +609,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, /* If the company isn't valid it may only do server command or start a new company! * The server will ditch any server commands a client sends to it, so effectively * this guards the server from executing functions for an invalid company. */ - if (_game_mode == GM_NORMAL && !exec_as_spectator && !Company::IsValidID(_current_company)) { + if (_game_mode == GM_NORMAL && !exec_as_spectator && !Company::IsValidID(_current_company) && !(_current_company == OWNER_DEITY && (cmd_flags & CMD_DEITY) != 0)) { return_dcpi(CMD_ERROR, false); } diff --git a/src/command_type.h b/src/command_type.h index 2995340808..fd8f0d9bf6 100644 --- a/src/command_type.h +++ b/src/command_type.h @@ -346,14 +346,15 @@ enum FlaggedCommands { * This enumeration defines flags for the _command_proc_table. */ enum CommandFlags { - CMD_SERVER = 0x01, ///< the command can only be initiated by the server - CMD_SPECTATOR = 0x02, ///< the command may be initiated by a spectator - CMD_OFFLINE = 0x04, ///< the command cannot be executed in a multiplayer game; single-player only - CMD_AUTO = 0x08, ///< set the DC_AUTO flag on this command - CMD_ALL_TILES = 0x10, ///< 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 - CMD_CLIENT_ID = 0x80, ///< set p2 with the ClientID of the sending client. + CMD_SERVER = 0x001, ///< the command can only be initiated by the server + CMD_SPECTATOR = 0x002, ///< the command may be initiated by a spectator + CMD_OFFLINE = 0x004, ///< the command cannot be executed in a multiplayer game; single-player only + CMD_AUTO = 0x008, ///< set the DC_AUTO flag on this command + CMD_ALL_TILES = 0x010, ///< allow this command also on MP_VOID tiles + CMD_NO_TEST = 0x020, ///< the command's output may differ between test and execute due to town rating changes etc. + CMD_NO_WATER = 0x040, ///< set the DC_NO_WATER flag on this command + CMD_CLIENT_ID = 0x080, ///< set p2 with the ClientID of the sending client. + CMD_DEITY = 0x100, ///< the command may be executed by COMPANY_DEITY }; DECLARE_ENUM_AS_BIT_SET(CommandFlags) diff --git a/src/company_type.h b/src/company_type.h index 0de8b58671..44a074e104 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -26,6 +26,7 @@ enum Owner { OWNER_TOWN = 0x0F, ///< A town owns the tile, or a town is expanding OWNER_NONE = 0x10, ///< The tile has no ownership OWNER_WATER = 0x11, ///< The tile/execution is done by "water" + OWNER_DEITY = 0x12, ///< The object is owned by a superuser / goal script OWNER_END, ///< Last + 1 owner INVALID_OWNER = 0xFF, ///< An invalid owner INVALID_COMPANY = 0xFF, ///< An invalid company