]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'TimePath/botammo_div0' into 'master'
authorMario <zacjardine@y7mail.com>
Sun, 16 Jul 2017 09:18:25 +0000 (09:18 +0000)
committerMario <zacjardine@y7mail.com>
Sun, 16 Jul 2017 09:18:25 +0000 (09:18 +0000)
Suppress a division by zero warning when bots evaluate ammo to collect

See merge request !456

CMakeLists.txt
qcsrc/Makefile
qcsrc/client/view.qc
qcsrc/common/debug.qh
qcsrc/common/effects/all.qc
qcsrc/server/client.qh
qcsrc/server/command/cmd.qc
qcsrc/server/defs.qh
qcsrc/server/teamplay.qc
qcsrc/tools/compilationunits.sh

index bbed1b243bd86761d4569de07a94fde69e7738de..d550d7b6c6849d35738b93c394a9d52fed0ac79a 100644 (file)
@@ -6,6 +6,9 @@ include_directories(qcsrc)
 
 add_definitions(-DXONOTIC=1)
 add_definitions(-DNDEBUG=1)
+add_definitions(-DENABLE_EFFECTINFO=0)
+add_definitions(-DENABLE_DEBUGDRAW=0)
+add_definitions(-DENABLE_DEBUGTRACE=0)
 
 find_package(Git REQUIRED)
 if (DEFINED ENV{VERSION})
index c660a7e94e5269d40aeea9f433fc2de70ee00bca..bd17dad6aaf5e93c0c729891009cfedfa85ca258 100644 (file)
@@ -8,6 +8,9 @@ QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
 VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
 NDEBUG ?= 1
 XONOTIC ?= 1
+ENABLE_EFFECTINFO ?= 0
+ENABLE_DEBUGDRAW ?= 0
+ENABLE_DEBUGTRACE ?= 0
 BUILD_MOD ?=
 
 ifndef ZIP
@@ -34,6 +37,9 @@ QCCDEFS ?= \
        -DXONOTIC=$(XONOTIC) \
        -DWATERMARK="$(QCCFLAGS_WATERMARK)" \
        -DNDEBUG=$(NDEBUG) \
+       -DENABLE_EFFECTINFO=$(ENABLE_EFFECTINFO) \
+       -DENABLE_DEBUGDRAW=$(ENABLE_DEBUGDRAW) \
+       -DENABLE_DEBUGTRACE=$(ENABLE_DEBUGTRACE) \
        $(if $(BUILD_MOD), -DBUILD_MOD="$(BUILD_MOD)" -I$(BUILD_MOD), ) \
        $(QCCDEFS_EXTRA)
 
index 75afcfccb1691869a863bab13166837ee142f32c..9b78e4907402b309345698a5082ea38cf761bc5a 100644 (file)
@@ -2256,7 +2256,7 @@ void CSQC_UpdateView(entity this, float w, float h)
        // draw 2D entities
        IL_EACH(g_drawables_2d, it.draw2d, it.draw2d(it));
        Draw_ShowNames_All();
-#ifdef DEBUGDRAW
+#if ENABLE_DEBUGDRAW
        Debug_Draw();
 #endif
 
index 7aabe69a90e51f29d6cdcb6156a8730a25cb29a3..28153a7d404a0eb764de7ca093c79ab43c04cd2f 100644 (file)
@@ -47,7 +47,7 @@ REGISTER_NET_TEMP(net_debug)
        }
 #endif
 
-#ifdef DEBUGDRAW
+#if ENABLE_DEBUGDRAW
 #ifdef GAMEQC
 /**
  * 0: off
@@ -259,7 +259,7 @@ GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars")
        }
 }
 
-#ifdef DEBUGTRACE
+#if ENABLE_DEBUGTRACE
 REGISTER_STAT(TRACE_ENT, int)
 #ifdef SVQC
 bool autocvar_debugtrace;
index f43b25dcfbcac143bb7e29580befba124cc782c3..af41054e31c1c40c462ce041a2cc540fa1c570be 100644 (file)
@@ -91,6 +91,6 @@ void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
 }
 #endif
 
-#ifdef EFFECTINFO_ENABLED
+#if ENABLE_EFFECTINFO
        #include "effectinfo.qc"
 #endif
index 30451313202097f54e0891541b87f7ad46c6cb24..be6cc0d605e308191fb601024937f05b741f2551 100644 (file)
@@ -90,6 +90,7 @@ CLASS(Client, Object)
     ATTRIB(Client, taunt_soundtime, float, this.taunt_soundtime);
     ATTRIB(Client, killcount, int, this.killcount);
     ATTRIB(Client, version_mismatch, bool, this.version_mismatch);
+    ATTRIB(Client, version, int, this.version);
 
     METHOD(Client, m_unwind, bool(Client this));
 
index ef1116317ce071aebac0d093f7eb35d2c99123f9..6d7ee81af4ddc7807696a6085ebe11073ebba5c3 100644 (file)
@@ -101,9 +101,9 @@ void ClientCommand_clientversion(entity caller, float request, float argc)  // i
                        {
                                if (IS_CLIENT(caller))
                                {
-                                       caller.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
+                                       CS(caller).version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
 
-                                       if (caller.version < autocvar_gameversion_min || caller.version > autocvar_gameversion_max)
+                                       if (CS(caller).version < autocvar_gameversion_min || CS(caller).version > autocvar_gameversion_max)
                                        {
                                                CS(caller).version_mismatch = true;
                                                ClientKill_TeamChange(caller, -2);  // observe
index 07bec4b6c2abc0301bee338c1bec478f1e0dfc33..1c65847f4f2989ca6817e5e594952164a7ca9665 100644 (file)
@@ -131,8 +131,6 @@ float intermission_running;
 float intermission_exittime;
 float alreadychangedlevel;
 
-.float version;
-
 // footstep interval
 .float nextstep;
 
index 51ad5edb93c16cc91250277f35b5bf4f0cc88690..1cc9db2b970eb0357db1ab57c7f61480c539451c 100644 (file)
@@ -88,7 +88,7 @@ void InitGameplayMode()
 string GetClientVersionMessage(entity this)
 {
        if (CS(this).version_mismatch) {
-               if(this.version < autocvar_gameversion) {
+               if(CS(this).version < autocvar_gameversion) {
                        return strcat("This is Xonotic ", autocvar_g_xonoticversion,
                                "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
                } else {
index ebb232105f51a66d03770486c0afe3950c44f7fb..8543f8c861244934b6b4af4277a80d9ad1ebeace 100755 (executable)
@@ -11,6 +11,9 @@ declare -a QCCDEFS=(
     -DNDEBUG=1
     -DXONOTIC=1
     -DWATERMARK="\"$(git describe --tags --dirty='~')\""
+    -DENABLE_EFFECTINFO=0
+    -DENABLE_DEBUGDRAW=0
+    -DENABLE_DEBUGTRACE=0
 )
 QCCDEFS="${QCCDEFS[@]}"