From: TimePath Date: Sun, 3 May 2015 02:06:55 +0000 (+1000) Subject: Modularise commands X-Git-Tag: xonotic-v0.8.1~61^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a838c2e00ecdfff0ca1665e1bf74e617d7aebc41;p=xonotic%2Fxonotic-data.pk3dir.git Modularise commands --- diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index d905ffc7f..18fcfd127 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -3,6 +3,7 @@ // Last updated: December 28th, 2011 // ============================================== +#include "../../common/command/command.qh" #include "cl_cmd.qh" #include "../autocvars.qh" @@ -16,7 +17,6 @@ #include "../../common/mapinfo.qh" #include "../../common/command/generic.qh" -#include "../../common/command/shared_defs.qh" void DrawDebugModel() { diff --git a/qcsrc/client/command/commands.qc b/qcsrc/client/command/commands.qc new file mode 100644 index 000000000..fc4fc527c --- /dev/null +++ b/qcsrc/client/command/commands.qc @@ -0,0 +1,5 @@ +#include "../_.qh" + +#include "../../common/command/commands.qc" + +#include "cl_cmd.qc" diff --git a/qcsrc/client/command/commands.qh b/qcsrc/client/command/commands.qh new file mode 100644 index 000000000..65bf3dab9 --- /dev/null +++ b/qcsrc/client/command/commands.qh @@ -0,0 +1,8 @@ +#ifndef CLIENT_COMMANDS_H +#define CLIENT_COMMANDS_H + +#include "../../common/command/commands.qh" + +#include "cl_cmd.qh" + +#endif diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index c66554aa4..36d159c75 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -37,7 +37,7 @@ view.qc wall.qc waypointsprites.qc -command/cl_cmd.qc +command/commands.qc vehicles/bumblebee.qc vehicles/vehicles.qc @@ -55,10 +55,6 @@ weapons/projectile.qc // TODO ../common/urllib.qc ../common/util.qc -../common/command/generic.qc -../common/command/markup.qc -../common/command/rpn.qc - ../common/monsters/monsters.qc ../common/weapons/weapons.qc // TODO diff --git a/qcsrc/common/command/command.qh b/qcsrc/common/command/command.qh new file mode 100644 index 000000000..fa310fdfc --- /dev/null +++ b/qcsrc/common/command/command.qh @@ -0,0 +1,12 @@ +#ifndef COMMAND_H +#define COMMAND_H + +// ========================================================= +// Shared declarations for all commands, written by Samual +// Last updated: December 13th, 2011 +// ========================================================= + +// identifiers for subfunction requests by the command code structure +const int CMD_REQUEST_COMMAND = 1; +const int CMD_REQUEST_USAGE = 2; +#endif diff --git a/qcsrc/common/command/commands.qc b/qcsrc/common/command/commands.qc new file mode 100644 index 000000000..dc1c0441f --- /dev/null +++ b/qcsrc/common/command/commands.qc @@ -0,0 +1,3 @@ +#include "generic.qc" +#include "markup.qc" +#include "rpn.qc" diff --git a/qcsrc/common/command/commands.qh b/qcsrc/common/command/commands.qh new file mode 100644 index 000000000..d434a8655 --- /dev/null +++ b/qcsrc/common/command/commands.qh @@ -0,0 +1,8 @@ +#ifndef COMMON_COMMANDS_H +#define COMMON_COMMANDS_H + +#include "generic.qh" +#include "markup.qh" +#include "rpn.qh" + +#endif diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 7f302e0a2..dac268d7e 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -1,5 +1,26 @@ +#include "command.qh" #include "generic.qh" -#include "shared_defs.qh" + +#include "markup.qh" +#include "rpn.qh" + +#include "../mapinfo.qh" +#include "../test.qh" + +#ifndef MENUQC + #include "../notifications.qh" +#endif + +#ifdef CSQC + #include "../../client/command/cl_cmd.qh" +#endif + +#ifdef SVQC + #include "../../server/command/banning.qh" + #include "../../server/command/cmd.qh" + #include "../../server/command/common.qh" + #include "../../server/command/sv_cmd.qh" +#endif // ========================================================= // Generic program common command code, written by Samual diff --git a/qcsrc/common/command/generic.qh b/qcsrc/common/command/generic.qh index 02875f6ea..e419824ec 100644 --- a/qcsrc/common/command/generic.qh +++ b/qcsrc/common/command/generic.qh @@ -1,9 +1,7 @@ -#ifndef GENERIC_H -#define GENERIC_H +#ifndef COMMAND_GENERIC_H +#define COMMAND_GENERIC_H #include "../constants.qh" -#include "markup.qh" -#include "rpn.qh" // ========================================================= // Declarations for common command code, written by Samual diff --git a/qcsrc/common/command/markup.qc b/qcsrc/common/command/markup.qc index 8030f9e00..9f0883bd6 100644 --- a/qcsrc/common/command/markup.qc +++ b/qcsrc/common/command/markup.qc @@ -1,3 +1,4 @@ +#include "command.qh" #include "markup.qh" // ========================================================= diff --git a/qcsrc/common/command/markup.qh b/qcsrc/common/command/markup.qh index e6ac7cfbd..bccc78d0b 100644 --- a/qcsrc/common/command/markup.qh +++ b/qcsrc/common/command/markup.qh @@ -1,5 +1,5 @@ -#ifndef MARKUP_H -#define MARKUP_H +#ifndef COMMAND_MARKUP_H +#define COMMAND_MARKUP_H // ========================================================== // Declarations for markup command code, reworked by Samual diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index bb920d697..700ceb46e 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -1,5 +1,8 @@ +#include "command.qh" #include "rpn.qh" +#include "../../warpzonelib/mathlib.qh" + // ======================================== // RPN command code, written by divVerent // Last updated: December 28th, 2011 diff --git a/qcsrc/common/command/rpn.qh b/qcsrc/common/command/rpn.qh index a28f2946a..3c5a8019b 100644 --- a/qcsrc/common/command/rpn.qh +++ b/qcsrc/common/command/rpn.qh @@ -1,5 +1,5 @@ -#ifndef RPN_H -#define RPN_H +#ifndef COMMAND_RPN_H +#define COMMAND_RPN_H // ========================================================= // Declarations for RPN command code, written by divVerent diff --git a/qcsrc/common/command/shared_defs.qh b/qcsrc/common/command/shared_defs.qh deleted file mode 100644 index 0056565a6..000000000 --- a/qcsrc/common/command/shared_defs.qh +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SHARED_DEFS_H -#define SHARED_DEFS_H - -// ========================================================= -// Shared declarations for all commands, written by Samual -// Last updated: December 13th, 2011 -// ========================================================= - -// identifiers for subfunction requests by the command code structure -const int CMD_REQUEST_COMMAND = 1; -const int CMD_REQUEST_USAGE = 2; -#endif diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 7e601fdd4..2e41ce76c 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -385,12 +385,12 @@ string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimport string CCR(string input); #ifndef MENUQC -#ifdef CSQC -#define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages) -#else -#define GENTLE autocvar_sv_gentle -#endif -#define normal_or_gentle(normal,gentle) (GENTLE ? ((gentle != "") ? gentle : normal) : normal) + #ifdef CSQC + #define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages) + #else + #define GENTLE autocvar_sv_gentle + #endif + #define normal_or_gentle(normal, gentle) (GENTLE ? ((gentle != "") ? gentle : normal) : normal) #endif // allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example) diff --git a/qcsrc/menu/_.qh b/qcsrc/menu/_.qh new file mode 100644 index 000000000..cc07017e1 --- /dev/null +++ b/qcsrc/menu/_.qh @@ -0,0 +1,7 @@ +#ifndef CLIENT___H +#define CLIENT___H + +#include "../dpdefs/menudefs.qh" +#include "../dpdefs/keycodes.qh" + +#endif diff --git a/qcsrc/menu/command/commands.qc b/qcsrc/menu/command/commands.qc new file mode 100644 index 000000000..9d74fbb54 --- /dev/null +++ b/qcsrc/menu/command/commands.qc @@ -0,0 +1,3 @@ +#include "../../common/command/commands.qc" + +#include "menu_cmd.qc" diff --git a/qcsrc/menu/command/commands.qh b/qcsrc/menu/command/commands.qh new file mode 100644 index 000000000..5ea300616 --- /dev/null +++ b/qcsrc/menu/command/commands.qh @@ -0,0 +1,8 @@ +#ifndef MENU_COMMANDS_H +#define MENU_COMMANDS_H + +#include "../../common/command/commands.qh" + +#include "menu_cmd.qh" + +#endif diff --git a/qcsrc/menu/progs.src b/qcsrc/menu/progs.src index 547a32708..631b91f55 100644 --- a/qcsrc/menu/progs.src +++ b/qcsrc/menu/progs.src @@ -10,7 +10,7 @@ oo/implementation.qc draw.qc menu.qc -command/menu_cmd.qc +command/commands.qc xonotic/util.qc @@ -22,10 +22,6 @@ xonotic/util.qc ../common/urllib.qc ../common/util.qc -../common/command/generic.qc -../common/command/markup.qc -../common/command/rpn.qc - ../common/monsters/monsters.qc ../common/weapons/weapons.qc // TODO diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index b69665117..b861f22a9 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -1,14 +1,14 @@ +#include "../../common/command/command.qh" +#include "banning.qh" #include "../_.qh" -#include "../cl_player.qh" -#include "banning.qh" #include "common.qh" +#include "../cl_player.qh" #include "../ipban.qh" -#include "../../common/command/shared_defs.qh" - #include "../../common/util.qh" + // ===================================================== // Banning and kicking command code, written by Samual // Last updated: December 29th, 2011 diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index d09130743..13bf15e88 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "cmd.qh" #include "../_.qh" @@ -28,11 +29,6 @@ #include "../../common/monsters/spawn.qh" #include "../../common/monsters/sv_monsters.qh" -#include "../../common/command/shared_defs.qh" - -#include "../../dpdefs/dpextensions.qh" -#include "../../dpdefs/progsdefs.qh" - #include "../../warpzonelib/common.qh" void ClientKill_TeamChange (float targetteam); // 0 = don't change, -1 = auto, -2 = spec diff --git a/qcsrc/server/command/commands.qc b/qcsrc/server/command/commands.qc new file mode 100644 index 000000000..1db4db181 --- /dev/null +++ b/qcsrc/server/command/commands.qc @@ -0,0 +1,10 @@ +#include "../../common/command/commands.qc" + +#include "sv_cmd.qc" + +#include "banning.qc" +#include "cmd.qc" +#include "common.qc" +#include "getreplies.qc" +#include "radarmap.qc" +#include "vote.qc" diff --git a/qcsrc/server/command/commands.qh b/qcsrc/server/command/commands.qh new file mode 100644 index 000000000..d26468da2 --- /dev/null +++ b/qcsrc/server/command/commands.qh @@ -0,0 +1,15 @@ +#ifndef SERVER_COMMANDS_H +#define SERVER_COMMANDS_H + +#include "../../common/command/commands.qh" + +#include "sv_cmd.qh" + +#include "banning.qh" +#include "cmd.qh" +#include "common.qh" +#include "getreplies.qh" +#include "radarmap.qh" +#include "vote.qh" + +#endif diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 3fcb0a3f7..8923ae311 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "common.qh" #include "../_.qh" diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index ac99e32dc..0925d7137 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -4,7 +4,7 @@ #include "vote.qh" #include "../../common/command/generic.qh" -#include "../../common/command/shared_defs.qh" +#include "../../common/command/command.qh" // ============================================================ // Shared declarations for server commands, written by Samual diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 38c4bf16c..2950e975b 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "getreplies.qh" #include "../_.qh" diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index 792aba112..a2dcebb93 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "radarmap.qh" #include "../_.qh" diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 910d3e68e..5d9b5a616 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "sv_cmd.qh" #include "../_.qh" @@ -28,8 +29,6 @@ #include "../../common/teams.qh" #include "../../common/util.qh" -#include "../../common/command/shared_defs.qh" - #include "../../common/monsters/sv_monsters.qh" #include "../../warpzonelib/mathlib.qh" diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 4e2d4732d..d9d1a3030 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -1,3 +1,4 @@ +#include "../../common/command/command.qh" #include "vote.qh" #include "../_.qh" @@ -17,8 +18,6 @@ #include "../../common/playerstats.qh" #include "../../common/util.qh" -#include "../../common/command/shared_defs.qh" - // ============================================= // Server side voting code, reworked by Samual // Last updated: December 27th, 2011 diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index a0170e480..350f10a72 100644 --- a/qcsrc/server/mutators/mutators_include.qc +++ b/qcsrc/server/mutators/mutators_include.qc @@ -20,7 +20,7 @@ #include "../../common/command/markup.qh" #include "../../common/command/rpn.qh" #include "../../common/command/generic.qh" - #include "../../common/command/shared_defs.qh" + #include "../../common/command/command.qh" #include "../../common/net_notice.qh" #include "../../common/animdecide.qh" #include "../../common/monsters/monsters.qh" diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index f288934a2..6b93a92b7 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -71,13 +71,7 @@ bot/havocbot/role_keyhunt.qc bot/havocbot/role_onslaught.qc bot/havocbot/roles.qc -command/banning.qc -command/cmd.qc -command/common.qc -command/getreplies.qc -command/radarmap.qc -command/sv_cmd.qc -command/vote.qc +command/commands.qc mutators/mutators_include.qc mutators/mutators.qc @@ -104,9 +98,6 @@ weapons/weaponsystem.qc ../common/buffs.qc ../common/campaign_file.qc ../common/campaign_setup.qc -../common/command/generic.qc -../common/command/markup.qc -../common/command/rpn.qc ../common/mapinfo.qc ../common/monsters/monsters.qc ../common/monsters/spawn.qc