]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
server: remove _all
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Aug 2017 14:07:45 +0000 (00:07 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Aug 2017 15:50:41 +0000 (01:50 +1000)
Added REGISTRY_DEPENDS

67 files changed:
qcsrc/common/items/all.qh
qcsrc/common/sounds/all.qc
qcsrc/common/stats.qh
qcsrc/common/t_items.qh
qcsrc/common/turrets/sv_turrets.qh
qcsrc/lib/registry.qh
qcsrc/server/_all.inc [deleted file]
qcsrc/server/_all.qh [deleted file]
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/antilag.qc
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/aim.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/campaign.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/compat/quake.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/wop.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/ipban.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/gamemode.qh
qcsrc/server/mutators/loader.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/utility.qc
qcsrc/server/player.qc
qcsrc/server/portals.qc
qcsrc/server/progs.inc
qcsrc/server/race.qc
qcsrc/server/round_handler.qc
qcsrc/server/scores_rules.qc
qcsrc/server/tests.qh
qcsrc/server/utils.qh [new file with mode: 0644]
qcsrc/server/weapons/accuracy.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponstats.qc
qcsrc/server/weapons/weaponsystem.qh

index dc8cf21c020a6d06993f87281cc1dad98f29cbac..14c5a347ad26f534158fb635fc5a8ccbb9eb0cdf 100644 (file)
@@ -6,6 +6,9 @@
 
 REGISTRY(Items, BITS(7))
 #define Items_from(i) _Items_from(i, NULL)
+#ifdef GAMEQC
+REGISTRY_DEPENDS(Items, Models)
+#endif
 REGISTER_REGISTRY(Items)
 #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
 
index 203b643854c5d5cf6b7cf0aaba762390ec6fa7e4..328486d35470cfc3594e437742d6428d2426a14c 100644 (file)
@@ -1,6 +1,8 @@
 #include "all.qh"
 #ifdef SVQC
 
+#include <server/utils.qh>
+
 bool autocvar_bot_sound_monopoly;
 
 .entity realowner;
index c1503ca68b5b167f414992d97a405cbbec5dc8d2..c452b1128188603f4ec3d62027e90590d2cfd335 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 #ifdef SVQC
+#include <server/autocvars.qh>
 #include <server/client.qh>
 #endif
 
index 1b2293bcff0651d442032c328d7a0455783adb3b..e52604d994e97c1bf970394d083e1357550f31e6 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef SVQC
+#include <server/defs.qh>
+#endif
+
 const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
 
 // item networking
index edd06bd6db0f846bb793f1d950dbdfd7f4eaa529..41a7bd962dc6e8a19ffcef03eb4291db7e55ed29 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <server/miscfunctions.qh>
+
 entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
 void turret_projectile_explode(entity this);
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
index a3282a0ab1c9e1e3181a80353531defe91491a43..8ca07b43f3d34ecaa83e63b1810f415e26ad47a6 100644 (file)
  */
 #define REGISTRY(id, max) \
        void Register##id(); \
+       [[accumulate]] void REGISTRY_DEPENDS_(id) {} \
        [[accumulate]] REGISTRY_BEGIN(id) {} \
        [[accumulate]] REGISTRY_END(id) {} \
        void _Register##id() {} \
-       void Register##id() { REGISTRY_BEGIN_(id); _Register##id(); REGISTRY_END_(id); } \
+       int id##_state = 0; \
+       void Register##id() { if (id##_state) return; id##_state = 1; REGISTRY_DEPENDS_(id); REGISTRY_BEGIN_(id); _Register##id(); id##_state = 2; REGISTRY_END_(id); } \
        const int id##_MAX = max; \
        int id##_COUNT; \
        noref entity id##_first, id##_last; \
        SHUTDOWN(id) { _R_DEL(_##id); } \
        entity _##id##_from(int i, entity null) { if (i >= 0 && i < id##_COUNT) { entity e = _R_GET(_##id, i); if (e) return e; } return null; }
 
+/** Add registry dependencies to a registry */
+#define REGISTRY_DEPENDS(id, dep) void Register##dep(); void REGISTRY_DEPENDS_(id) { Register##dep(); }
+#define REGISTRY_DEPENDS_(id) Register##id##_Depends()
+
 /** Called before initializing a registry. */
 #define REGISTRY_BEGIN(id) [[accumulate]] void REGISTRY_BEGIN_(id) { noref void() f = Register##id; } void REGISTRY_BEGIN_(id)
 #define REGISTRY_BEGIN_(id) Register##id##_First()
@@ -189,5 +195,6 @@ void Registry_send(string id, string hash);
        ENDCLASS(id##Registry) \
        REGISTER(Registries, REGISTRY, id, m_id, NEW(id##Registry)); \
        METHOD(id##Registry, m_reload, void()) { \
+           id##_state = 0; \
                Register##id(); \
        }
diff --git a/qcsrc/server/_all.inc b/qcsrc/server/_all.inc
deleted file mode 100644 (file)
index 95bf715..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <server/_all.qh>
-#include "_mod.inc"
-
-#include "bot/_mod.inc"
-#include "command/_mod.inc"
-#include "compat/_mod.inc"
-#include "mutators/_mod.inc"
-#include "pathlib/_mod.inc"
-#include "weapons/_mod.inc"
-
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
-
-#include <lib/csqcmodel/sv_model.qc>
-
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh
deleted file mode 100644 (file)
index 1c0382c..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#pragma once
-
-int maxclients;
-
-const string STR_PLAYER = "player";
-const string STR_SPECTATOR = "spectator";
-const string STR_OBSERVER = "observer";
-
-#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
-#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
-#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
-
-#define IS_CLIENT(v) (v.flags & FL_CLIENT)
-/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
-#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
-#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
-#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
-#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
-
-#define IS_MONSTER(v) (v.flags & FL_MONSTER)
-#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
-#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
-
-// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
-// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
-// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
-
-// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
-// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
-// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
-// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
-
-#define FOREACH_CLIENTSLOT(cond, body) \
-       MACRO_BEGIN { \
-               for(int _i = 1; _i <= maxclients; ++_i) \
-               { \
-                       const noref int i = _i; \
-                       ITER_CONST noref entity it = ftoe(i); \
-                       if(cond) { LAMBDA(body) } \
-               } \
-       } MACRO_END
-
-#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
-
-// using the "inside out" version of knuth-fisher-yates shuffle
-// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
-entity _FCR_clients[255];
-bool _FCR_entered = false;
-#define FOREACH_CLIENT_RANDOM(cond, body) \
-       MACRO_BEGIN { \
-               if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
-               _FCR_entered = true; \
-               int _cnt = 0; \
-               FOREACH_CLIENT(cond, { \
-            int _j = floor(random() * (_cnt + 1)); \
-            if (_j == _cnt) \
-            { \
-                _FCR_clients[_cnt] = it; \
-            } \
-            else \
-            { \
-                _FCR_clients[_cnt] = _FCR_clients[_j]; \
-                _FCR_clients[_j] = it; \
-            } \
-            _cnt++; \
-        }); \
-               for (int _i = 0; _i < _cnt; ++_i) \
-               { \
-                       const noref int i = _i; \
-                       ITER_CONST noref entity it = _FCR_clients[i]; \
-                       if (cond) { LAMBDA(body) } \
-               } \
-               _FCR_entered = false; \
-       } MACRO_END
-
-// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
-
-#include <common/effects/all.qh>
-#include <common/models/all.qh>
-#include <common/sounds/all.qh>
-
-#include "autocvars.qh"
-#include "constants.qh"
-#include "defs.qh"
-#include "miscfunctions.qh"
index eb74529a64daf066777af19f3f5b27faae7b38e8..87a8d56892d69577c7d07d2cbe9f9ced6cc5162e 100644 (file)
 #endif
 #include <server/teamplay.qc>
 #include <server/tests.qc>
+
+#include <server/bot/_mod.inc>
+#include <server/command/_mod.inc>
+#include <server/compat/_mod.inc>
+#include <server/mutators/_mod.inc>
+#include <server/pathlib/_mod.inc>
+#include <server/weapons/_mod.inc>
index a0d160d57c31194100a4951913721c7449da2da3..2967c110ce9a5a58db86abcf00a996c27b53172b 100644 (file)
 #endif
 #include <server/teamplay.qh>
 #include <server/tests.qh>
+
+#include <server/bot/_mod.qh>
+#include <server/command/_mod.qh>
+#include <server/compat/_mod.qh>
+#include <server/mutators/_mod.qh>
+#include <server/pathlib/_mod.qh>
+#include <server/weapons/_mod.qh>
index d5f8e39f756aa00a52b9a9c7b48371beabb9bd39..46c871876108005a0a69978681454bf1a9446f09 100644 (file)
@@ -2,6 +2,7 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
+    #include <server/defs.qh>
     #include <common/state.qh>
     #include <common/vehicles/all.qh>
     #include "antilag.qh"
index d4882135768a0adf146bd93c1897d51ef6c598fb..f33cc4f2646502447f0bcf60fd4c96c10d0d5738 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <server/defs.qh>
 #include <common/weapons/_all.qh>
 
 const int WAYPOINTFLAG_GENERATED = BIT(23);
index d0ba63365abfc5fc3b7877e5e45549e4f8fced47..feb19afe1f921b25fec4c0422555482c70ff1b43 100644 (file)
@@ -1,5 +1,7 @@
 #include "aim.qh"
 
+#include <server/defs.qh>
+
 #include "cvars.qh"
 
 #include "bot.qh"
index 5d31c7ee9bb0bb2115c6f874c90aa2a4a410d3bc..46acf8828774324f3790596ce465576f6c6c7b77 100644 (file)
@@ -1,5 +1,7 @@
 #include "havocbot.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../cvars.qh"
 
 #include "../aim.qh"
index 22f444fd1987db19155a730614ddfac21673abc3..94aed9c96e1219333a5c792572b7a33e74a9a0cd 100644 (file)
@@ -1,5 +1,7 @@
 #include "roles.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "havocbot.qh"
 
 #include "../cvars.qh"
index fc97931541bc3bcdf5d8401ae7612b9e1b6da866..d0061b90068efbcade910b2332e20c5aff9198b5 100644 (file)
@@ -1,5 +1,7 @@
 #include "navigation.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
index ca74965be41d5f3b6ab57889d890e0f1f8bbdc45..badf9437ecb9c8f16cc0ac28afbed8d1dc93d82c 100644 (file)
@@ -1,5 +1,7 @@
 #include "scripting.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include <common/state.qh>
index 65cc69f664b17ba500671de65fb8833724357dc2..c8a958ddbd0f2a0fca0cf8f3e7606d684ea77c7d 100644 (file)
@@ -1,5 +1,7 @@
 #include "waypoints.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "cvars.qh"
 
 #include "bot.qh"
index b39f82a1003a66c59da68b4ce31bfe32efe52170..ec8990de25602905b11a12e5e5458523cc4bf8ee 100644 (file)
@@ -1,4 +1,7 @@
 #include "campaign.qh"
+
+#include "defs.qh"
+
 #include "cheats.qh"
 #include "miscfunctions.qh"
 #include "g_world.qh"
index 78c591264d3c94229fc81ad70dc4be5b44724e12..ee1e767601a223b6964aff9ac1aba498a717796e 100644 (file)
@@ -1,5 +1,9 @@
 #include "cheats.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
+
 #include "g_damage.qh"
 #include "race.qh"
 #include "../common/triggers/teleporters.qh"
index 14b854bc6eb5f35cc279db18b12bf70634b45d94..a8e2ef34818796c0b7da326d99590baee6a3eed3 100644 (file)
@@ -1,5 +1,8 @@
 #include "client.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
 #include "anticheat.qh"
 #include "impulse.qh"
 #include "player.qh"
index ee00c60ca6f97f4603c1572ec34099a1cb800e46..383383ad76aaacdf4d0566a05a6de34115aa257d 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "utils.qh"
+#include <common/sounds/all.qh>
+
 void ClientState_attach(entity this);
 
 IntrusiveList g_players;
index fa1be75112914be996dde63c5499328c79bab773..d90b372bb7a8f990b6fec7d9944a6ce93428120b 100644 (file)
@@ -1,4 +1,7 @@
 #include "banning.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/state.qh>
 #include <common/command/_mod.qh>
 #include "banning.qh"
index 03f484d2e68f566e42c526a7239a88bacf0312ec..d1d79981182ceb91e560895f22f7f3d2e4c3a3df 100644 (file)
@@ -1,4 +1,8 @@
 #include "cmd.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 
 #include "common.qh"
index 77c3930258420f5f542156e780a1c9aab183c41e..d8bc3ac8b3ef07f979c53215e0a761741c864f1e 100644 (file)
@@ -1,4 +1,8 @@
 #include "common.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "common.qh"
 
index cfcadf4456cb9652ea9239e4fdf4ca532229dee2..e67625a307caac26580d06c7491f3299f8f5e255 100644 (file)
@@ -1,4 +1,8 @@
 #include "getreplies.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "getreplies.qh"
 
index 0bc47c0acf67fcdb2d81234429b5ef1a585a7836..49bee362e7481fdc8deb171de0c440ed88f4a2f5 100644 (file)
@@ -1,6 +1,8 @@
 #include "sv_cmd.qh"
 #include "_mod.qh"
 
+#include <common/effects/all.qh>
+
 #include "banning.qh"
 #include "cmd.qh"
 #include "common.qh"
index 2db503ca285cf7b0426cd160152d17bc913908c5..ed17ed0b8c89b083436b650983f6deaac3d9612f 100644 (file)
@@ -1,4 +1,8 @@
 #include "vote.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 #include <common/command/_mod.qh>
 #include "vote.qh"
 
index 539042d636038206f7c19b2cbcf77d5776bc09c9..126a0f6f6e7a98fc357917b8707f0c34ebf7dc8b 100644 (file)
@@ -1,5 +1,7 @@
 #include "quake.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 spawnfunc(weapon_electro);
index 905523bfba33696632d096af7bbfb96efe4ba0d2..532428dd08893eb39a78c033b51850f43f3904dd 100644 (file)
@@ -1,5 +1,7 @@
 #include "quake3.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 spawnfunc(weapon_crylink);
index f6b2f2621de31c1298fe5ab07604052bca63ccd7..6c69859fdfe0c6e748acc5b227227f49d5e9626c 100644 (file)
@@ -1,5 +1,7 @@
 #include "wop.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 // #include <server/mutators/gamemode.qh>
 
index 61d04801bfbf6a956ef0f5844c8572f316122317..d96c28bf1adaac3df8328bbc05ef5db3c9f76b6b 100644 (file)
@@ -1,5 +1,6 @@
 #include "g_damage.qh"
 
+#include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "g_hook.qh"
 #include "mutators/_mod.qh"
index e242de4a8a2a43add28f4f008dab92e55f13186b..aee4a93df80da7cecde86899592331cd79b55777 100644 (file)
@@ -3,6 +3,8 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
+    #include <server/defs.qh>
+    #include <server/miscfunctions.qh>
     #include <lib/warpzone/common.qh>
     #include <common/constants.qh>
     #include <common/teams.qh>
index 2081b688dcb0f3d964bf3f1f374a80b2b993579d..0fc60b2cdc1ffef3f4a2bac6832822e2a0c91db3 100644 (file)
@@ -1,5 +1,8 @@
 #include "g_hook.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
 #include "weapons/common.qh"
 #include "weapons/csqcprojectile.qh"
 #include "weapons/weaponsystem.qh"
index 425716d2da7cb92dc3001d2383947b7a4eab86dd..852f1efc01d70cda4a73a3d903a67c20a67e1601 100644 (file)
@@ -1,5 +1,8 @@
 #include "g_lights.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 void train_next(entity this);
 
 const float LOOP = 1;
index d3f56f5f04424f55b9eb77c3a40fc92422ea7175..539522f2dce7f61ca49d840f6040439450916e8c 100644 (file)
@@ -1,5 +1,7 @@
 #include "g_models.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "g_subs.qh"
 #include <common/net_linked.qh>
 #include "../common/triggers/subs.qh"
index 33f471eb488cf97cde02e41d86e6390c03e6a7c0..8c39f88c9480507ab63f6cd4a5815d3db248d1d9 100644 (file)
@@ -1,5 +1,7 @@
 #include "g_subs.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "antilag.qh"
 #include "command/common.qh"
 #include "../common/state.qh"
index 50c258f927a8295766d6317d92b6dc138ef2d35d..6211362ac67f815d25c153880dac6f43eb07b6fd 100644 (file)
@@ -1,5 +1,7 @@
 #include "ipban.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "autocvars.qh"
 #include "command/banning.qh"
 #include "defs.qh"
index 53cf1cdbacbc97699fa79556bba95aee49ef7497..209ac7af98085daf7bdffed0fc335eacba721141 100644 (file)
@@ -1,5 +1,7 @@
 #include "mapvoting.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "g_world.qh"
 #include "command/cmd.qh"
 #include "command/getreplies.qh"
index 652ef656b0fdbc45a7d19913cd7be886a58be126..ffc0e9ea568cbd65278a5f050a6f8d1babd91404 100644 (file)
@@ -1,4 +1,5 @@
 #include "miscfunctions.qh"
+
 #include "antilag.qh"
 #include "command/common.qh"
 #include "constants.qh"
index 789ba938140755b202f3e568c63e42ba904847d8..abe8cd74a6c78c5aac70029d0acf971ce6e590a0 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <server/defs.qh>
+
 #include <common/t_items.qh>
 
 #include "mutators/events.qh"
index 84094df6bdf3a684ee64303c9d444310e4da5f23..ac8746516ca516b0552d56f6a26a1f2eea633cdb 100644 (file)
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <server/miscfunctions.qh>
 #include <server/g_world.qh>
 #include <server/round_handler.qh>
 #include <server/scores.qh>
index 43c668edd7e81289be23818b5535be7d3e05cbdb..7c20b372906b842661b3abfa2e577a88448af81f 100644 (file)
@@ -1,5 +1,8 @@
 #include "loader.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 STATIC_INIT_LATE(Gametype) {
     Gametype g = MapInfo_CurrentGametype();
     if (g) {
index 23bbeaae2b5ce03e5090d95198c85bcf5283c54f..c1698c554a0161e4e5a52523c60a0d74c425d689 100644 (file)
@@ -1,6 +1,7 @@
 #include "gamemode_ctf.qh"
 
 #ifndef CSQC
+#include <common/effects/all.qh>
 void ctf_Initialize();
 
 REGISTER_MUTATOR(ctf, false)
index 0b4bd54aaa21c554d4fbaf8b0800e683a3c8c0f2..c28fd5eb8e7eab4f30378ad5fdaeccc2b84dc909 100644 (file)
@@ -1,5 +1,7 @@
 #include "gamemode_keepaway.qh"
 
+#include <common/effects/all.qh>
+
 int autocvar_g_keepaway_ballcarrier_effects;
 float autocvar_g_keepaway_ballcarrier_damage;
 float autocvar_g_keepaway_ballcarrier_force;
index 706e10d9e249135e73764dcda180f4f0ac8519f3..c2f33260302c7899dbba85212c3df2eeece69172 100644 (file)
@@ -1,5 +1,7 @@
 #include "main.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 #include "../command/common.qh"
index f27ab4879dad2dedeea575b1146248ae291ca4c9..cbcfe3d4c6038f07c00abb44047019d6988748a3 100644 (file)
@@ -1,5 +1,7 @@
 #include "movenode.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 #include "utility.qh"
 
index da64db697345b9a2cd70f0ef100ef6ff6409661b..151fb44b56abec6096379d63b351b42a315e7d9a 100644 (file)
@@ -1,5 +1,7 @@
 #include "utility.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "pathlib.qh"
 
 bool location_isok(vector point, bool waterok, bool air_isok)
index d70210feab5b3726645b74706ca34afebcaa4131..827c86ae47ccda1a6c8acfae6e8809ee75f57728 100644 (file)
@@ -1,5 +1,6 @@
 #include "player.qh"
 
+#include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "cheats.qh"
 #include "g_damage.qh"
index 260e035b5bef4251057af0cec6d12663b211677f..6de3e0af39fc0e16840ae692f4b13548ca83b755 100644 (file)
@@ -1,5 +1,6 @@
 #include "portals.qh"
 
+#include <common/effects/all.qh>
 #include "g_hook.qh"
 #include "mutators/_mod.qh"
 #include "../common/constants.qh"
index 1a8ada45fe306f9156bf74e789acf51de830f1bf..f72ff8533f57555adc4e0a49526f59ab07b8b463 100644 (file)
@@ -1,7 +1,18 @@
 #include <lib/_all.inc>
 
 #if XONOTIC
-#include <server/_all.inc>
+
+#include <server/_mod.inc>
+
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
+
+#include <lib/csqcmodel/sv_model.qc>
+
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
 
 #include <ecs/_mod.inc>
 #endif
index 0a3e2e8fa0a52c5578102eb9107fca8a46d15008..7f2aaaaf58739f8d040460df84e6667340cf93ff 100644 (file)
@@ -1,5 +1,7 @@
 #include "race.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "portals.qh"
 #include "scores.qh"
index 16564cd39b7c7175187e659bcb119fc7ba27cca0..ae64e74e4909d66882ea09e261926086977b4da0 100644 (file)
@@ -1,5 +1,7 @@
 #include "round_handler.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "campaign.qh"
 #include "command/vote.qh"
 #include "../common/util.qh"
index 9c416472f40a207b0870c9bc5be4fc416502d48b..97e80409cce87cc98805b1d458f3b575c82e94da 100644 (file)
@@ -1,5 +1,7 @@
 #include "scores_rules.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "client.qh"
 #include "scores.qh"
 
index e6d6f66a0d0442ef426980cf355006af81698fd6..ad40da4dd99c8533527c8454cfdc593875a94f7b 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "defs.qh"
+#include "miscfunctions.qh"
 #include "autocvars.qh"
 #include "client.qh"
 #include "command/_mod.qh"
diff --git a/qcsrc/server/utils.qh b/qcsrc/server/utils.qh
new file mode 100644 (file)
index 0000000..da5c7a5
--- /dev/null
@@ -0,0 +1,77 @@
+#pragma once
+
+int maxclients;
+
+const string STR_PLAYER = "player";
+const string STR_SPECTATOR = "spectator";
+const string STR_OBSERVER = "observer";
+
+#define IS_PLAYER(v) ((v).classname == STR_PLAYER)
+#define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
+#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
+
+#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
+#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
+
+#define IS_MONSTER(v) (v.flags & FL_MONSTER)
+#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
+#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
+
+// NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
+// NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
+// NOTE: FOR_EACH_REALCLIENT deprecated! Use the following instead: FOREACH_CLIENT(IS_REAL_CLIENT(it), { code; });
+
+// NOTE: FOR_EACH_PLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it), { code; });
+// NOTE: FOR_EACH_SPEC deprecated! Use the following instead: FOREACH_CLIENT(IS_SPEC(it), { code; });
+// NOTE: FOR_EACH_OBSERVER deprecated! Use the following instead: FOREACH_CLIENT(IS_OBSERVER(it), { code; });
+// NOTE: FOR_EACH_REALPLAYER deprecated! Use the following instead: FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { code; });
+
+#define FOREACH_CLIENTSLOT(cond, body) \
+       MACRO_BEGIN { \
+               for(int _i = 1; _i <= maxclients; ++_i) \
+               { \
+                       const noref int i = _i; \
+                       ITER_CONST noref entity it = ftoe(i); \
+                       if(cond) { LAMBDA(body) } \
+               } \
+       } MACRO_END
+
+#define FOREACH_CLIENT(cond, body) FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), body)
+
+// using the "inside out" version of knuth-fisher-yates shuffle
+// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
+entity _FCR_clients[255];
+bool _FCR_entered = false;
+#define FOREACH_CLIENT_RANDOM(cond, body) \
+       MACRO_BEGIN { \
+               if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
+               _FCR_entered = true; \
+               int _cnt = 0; \
+               FOREACH_CLIENT(cond, { \
+            int _j = floor(random() * (_cnt + 1)); \
+            if (_j == _cnt) \
+            { \
+                _FCR_clients[_cnt] = it; \
+            } \
+            else \
+            { \
+                _FCR_clients[_cnt] = _FCR_clients[_j]; \
+                _FCR_clients[_j] = it; \
+            } \
+            _cnt++; \
+        }); \
+               for (int _i = 0; _i < _cnt; ++_i) \
+               { \
+                       const noref int i = _i; \
+                       ITER_CONST noref entity it = _FCR_clients[i]; \
+                       if (cond) { LAMBDA(body) } \
+               } \
+               _FCR_entered = false; \
+       } MACRO_END
+
+// NOTE: FOR_EACH_MONSTER deprecated! Use the following instead: IL_EACH(g_monsters, true, { code; });
index 35b0174ec7dae3ab1a0a926b66c2116fbb20ca3e..d24ee1cf50cf514605e9cc8d1122e854129ffa70 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 .bool cvar_cl_accuracy_data_share;
 REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
 .bool cvar_cl_accuracy_data_receive;
index fb57d92774d01657e5c4e98228a7175f8efe6252..b94b2533f3441a1e5955a13f54214b142e94a398 100644 (file)
@@ -1,5 +1,7 @@
 #include "common.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/t_items.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
index 42bff7c0e9118de43506f95d0f796081cb2c0033..d426e2f610d3000c69c2b16cba9defb350adfb9f 100644 (file)
@@ -1,5 +1,7 @@
 #include "csqcprojectile.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include <common/t_items.qh>
 
 #include "../command/common.qh"
index 89cec6aea98dacaadca0f44df7c58e82e63653c1..fb13bd1b9e126201de97ef73bf439f4119a6a97e 100644 (file)
@@ -1,5 +1,7 @@
 #include "hitplot.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../antilag.qh"
 #include "../g_subs.qh"
 #include <common/weapons/_all.qh>
index 071a0fea8bcb73fb1b2ebad279b7d26cbdcf3f83..ea580e9118671e128bd03d45795e4dba6625e87c 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type);
 
index 9ce5ca30e4da2426627d11a463e0fcc321c8c243..d435002ad69fb3c6784bc68f210051afae856df4 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 string W_Apply_Weaponreplace(string in);
 
 void weapon_defaultspawnfunc(entity this, Weapon e);
index 1b62b64c805b28c475c04f51b50f2448459bafe7..9ea5e5cb8e442c930f628f47f1e93ff29ef150de 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 .float savenextthink;
 void thrown_wep_think(entity this);
 
index d6c9fdfffbb436980b31e78983f063c20416b133..649726658784d163dfbfbd92427bfc1dde6f0d33 100644 (file)
@@ -1,5 +1,7 @@
 #include "tracing.qh"
 
+#include <common/effects/all.qh>
+
 #include "accuracy.qh"
 #include "common.qh"
 #include "hitplot.qh"
index 0c17e197497988a2ccdee5e4bcbdbe6901f9053b..3fa16d6545910d2e99a2a02197e43440eb3aaafe 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 vector w_shotorg;
 vector w_shotdir;
 vector w_shotend;
index 2ffb1c1ec8dfa60403d672d524f5239af73da64f..a71abe70f347f780f9c8189e7e21501ee785d50a 100644 (file)
@@ -1,5 +1,7 @@
 #include "weaponstats.qh"
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
 #include "../g_world.qh"
 
 #include <common/weapons/_all.qh>
index 2fb0f9956833236250c0266fc70b91a2b412d21a..4ddf5a5159eac5adf534d6c61cafd0dc8a933445 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
 float internalteam;
 float weaponswapping;
 entity weapon_dropevent_item;