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: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=a838c2e00ecdfff0ca1665e1bf74e617d7aebc41 Modularise commands --- diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index d905ffc7f1..18fcfd1271 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 0000000000..fc4fc527c1 --- /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 0000000000..65bf3dab93 --- /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 c66554aa46..36d159c75e 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 0000000000..fa310fdfc5 --- /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 0000000000..dc1c0441fa --- /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 0000000000..d434a86555 --- /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 7f302e0a27..dac268d7ed 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 02875f6eab..e419824ec8 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 8030f9e007..9f0883bd61 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 e6ac7cfbd3..bccc78d0bc 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 bb920d697e..700ceb46ea 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 a28f2946a9..3c5a8019b2 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 0056565a61..0000000000 --- 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 7e601fdd4e..2e41ce76ca 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 0000000000..cc07017e12 --- /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 0000000000..9d74fbb545 --- /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 0000000000..5ea300616b --- /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 547a32708c..631b91f558 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 b696651171..b861f22a92 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 d091307434..13bf15e88a 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 0000000000..1db4db181b --- /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 0000000000..d26468da2e --- /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 3fcb0a3f7e..8923ae3111 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 ac99e32dc4..0925d71378 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 38c4bf16ca..2950e975b4 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 792aba112e..a2dcebb93a 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 910d3e68e4..5d9b5a616a 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 4e2d4732d2..d9d1a30300 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 a0170e4803..350f10a72a 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 f288934a27..6b93a92b72 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