]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Intrusify players
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 15:24:03 +0000 (01:24 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 15:24:03 +0000 (01:24 +1000)
qcsrc/server/client.qh
qcsrc/server/defs.qh
qcsrc/server/sv_main.qc

index 35ff6e961c61808a8f5f3cdd0f87e288653bd4f5..28f957479cce428b00320a56779c319495686d1c 100644 (file)
@@ -71,8 +71,11 @@ ENDCLASS(Spectator)
 CLASS(Player, Client)
     INIT(Player) {
         this.classname = STR_PLAYER;
+        IL_PUSH(g_players, this);
+    }
+    DESTRUCTOR(Player) {
+        IL_REMOVE(g_players, this);
     }
-    DESTRUCTOR(Player) { }
 ENDCLASS(Player)
 
 METHOD(Client, m_unwind, bool(Client this))
index 5680840456fb8e333c1087442a384ec4b38df1b9..583c6c541135e69c044f87c18bfbe801af31d71e 100644 (file)
@@ -463,3 +463,6 @@ STATIC_INIT(g_assault_objectivedecreasers) { g_assault_objectivedecreasers = IL_
 
 IntrusiveList g_spawnpoints;
 STATIC_INIT(g_spawnpoints) { g_spawnpoints = IL_NEW(); }
+
+IntrusiveList g_players;
+STATIC_INIT(g_players) { g_players = IL_NEW(); }
index 5dbcc8fd25161848bedcc1e5d99c07f6cf385adf..ea11ea36a613f25ffb8c3f9915c8fa3dbf9c58f0 100644 (file)
@@ -159,8 +159,8 @@ void sys_phys_update(entity this, float dt);
 void StartFrame()
 {
     // TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
-    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), sys_phys_update(it, frametime));
-    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PlayerPreThink(it));
+    IL_EACH(g_players, IS_FAKE_CLIENT(it), sys_phys_update(it, frametime));
+    IL_EACH(g_players, IS_FAKE_CLIENT(it), PlayerPreThink(it));
 
        execute_next_frame();
        if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
@@ -229,7 +229,7 @@ void StartFrame()
        MUTATOR_CALLHOOK(SV_StartFrame);
 
     FOREACH_CLIENT(true, GlobalStats_update(it));
-    FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PlayerPostThink(it));
+    IL_EACH(g_players, IS_FAKE_CLIENT(it), PlayerPostThink(it));
 }
 
 .vector originjitter;