]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/stats.qh
Merge branch 'Mario/killother' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / stats.qh
index 3f258df52d69e7b2288722d7161e78c9254ba679..bd8b792967a5cfbba7365455c12aa6044b19b2a4 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef LIB_STATS_H
-#define LIB_STATS_H
+#pragma once
 
 // TODO: rename to 'netvars'
 
@@ -7,7 +6,7 @@
 #include "sort.qh"
 
 .int m_id;
-typedef vector vectori;
+USING(vectori, vector);
 
 #define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__))
 #define EVAL_REGISTER_STAT(...) __VA_ARGS__
@@ -94,7 +93,7 @@ typedef vector vectori;
     #define REGISTER_STAT_3(id, T, expr) \
        REGISTER_STAT_2(id, T); \
        [[accumulate]] void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \
-       STATIC_INIT(worldstat_##id) { entity this = world; STAT(id, this) = (expr); }
+       STATIC_INIT(worldstat_##id) { entity this = NULL; STAT(id, this) = (expr); }
 #else
        #define REGISTER_STAT_2(id, type)
     #define REGISTER_STAT_3(id, T, expr)
@@ -108,10 +107,8 @@ REGISTRY_SORT(Stats)
 REGISTRY_CHECK(Stats)
 STATIC_INIT(RegisterStats_renumber)
 {
-       FOREACH(Stats, true, LAMBDA(it.m_id = STATS_ENGINE_RESERVE + i));
+       FOREACH(Stats, true, it.m_id = STATS_ENGINE_RESERVE + i);
 }
 #ifdef SVQC
 STATIC_INIT(stats_add) { stats_add(); }
 #endif
-
-#endif