From 1e2ca75a82a11068d7f90fd5b99d2863fc9ba132 Mon Sep 17 00:00:00 2001 From: sauerbraten Date: Sun, 24 Jan 2021 20:32:32 +0100 Subject: [PATCH] fix -1 CN arg in PLAYER_VARGS_ICOMMAND --- patches/scoreboard.patch | 2 +- src/fpsgame/weaponstats.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/scoreboard.patch b/patches/scoreboard.patch index 58bd688..0205e0b 100644 --- a/patches/scoreboard.patch +++ b/patches/scoreboard.patch @@ -802,7 +802,7 @@ Index: src/fpsgame/weaponstats.h + extern float playeraccuracy(fpsent *p, int gun = -1); + + #define PLAYER_VARGS_ICOMMAND(name,b) ICOMMAND(name, "V", (tagval *args, int numargs), { \ -+ fpsent *p = numargs > 0 ? getclient(args[0].getint()) : hudplayer(); \ ++ fpsent *p = (numargs > 0 && args[0].getint() != -1) ? getclient(args[0].getint()) : hudplayer(); \ + if(!p) { conoutf("\f6no player with CN %d", args[0].getint()); return; } \ + b; \ + }) diff --git a/src/fpsgame/weaponstats.h b/src/fpsgame/weaponstats.h index 5764213..4df7850 100644 --- a/src/fpsgame/weaponstats.h +++ b/src/fpsgame/weaponstats.h @@ -13,7 +13,7 @@ namespace game { extern float playeraccuracy(fpsent *p, int gun = -1); #define PLAYER_VARGS_ICOMMAND(name,b) ICOMMAND(name, "V", (tagval *args, int numargs), { \ - fpsent *p = numargs > 0 ? getclient(args[0].getint()) : hudplayer(); \ + fpsent *p = (numargs > 0 && args[0].getint() != -1) ? getclient(args[0].getint()) : hudplayer(); \ if(!p) { conoutf("\f6no player with CN %d", args[0].getint()); return; } \ b; \ })