From: Mario Date: Sat, 15 Jul 2017 22:46:38 +0000 (+1000) Subject: Port version_mismatch to ClientState X-Git-Tag: xonotic-v0.8.5~2607 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e435344ae1d6288dde08dc931f1e1b48547218ce;p=xonotic%2Fxonotic-data.pk3dir.git Port version_mismatch to ClientState --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 4a1961df8..b29f785b9 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2099,7 +2099,7 @@ void PrintWelcomeMessage(entity this) bool joinAllowed(entity this) { - if (this.version_mismatch) return false; + if (CS(this).version_mismatch) return false; if (!nJoinAllowed(this, this)) return false; if (teamplay && lockteams) return false; if (ShowTeamSelection(this)) return false; @@ -2306,7 +2306,7 @@ void ObserverThink(entity this) if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) { this.flags &= ~FL_JUMPRELEASED; this.flags |= FL_SPAWNING; - } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) { + } else if(PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) { this.flags &= ~FL_JUMPRELEASED; if(SpectateNext(this)) { TRANSMUTE(Spectator, this); diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 532bf899b..304513132 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -89,6 +89,7 @@ CLASS(Client, Object) ATTRIB(Client, active_minigame, entity, this.active_minigame); ATTRIB(Client, taunt_soundtime, float, this.taunt_soundtime); ATTRIB(Client, killcount, int, this.killcount); + ATTRIB(Client, version_mismatch, bool, this.version_mismatch); METHOD(Client, m_unwind, bool(Client this)); diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index da9fd8621..ef1116317 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -105,7 +105,7 @@ void ClientCommand_clientversion(entity caller, float request, float argc) // i if (caller.version < autocvar_gameversion_min || caller.version > autocvar_gameversion_max) { - caller.version_mismatch = 1; + CS(caller).version_mismatch = true; ClientKill_TeamChange(caller, -2); // observe } else if (autocvar_g_campaign || autocvar_g_balance_teams) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 9c14d9ccb..07bec4b6c 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -243,8 +243,6 @@ float next_pingtime; .float cvar_cl_voice_directional; .float cvar_cl_voice_directional_taunt_attenuation; -.float version_mismatch; - int autocvar__independent_players; bool independent_players; #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index d8bf72cd6..51ad5edb9 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -87,7 +87,7 @@ void InitGameplayMode() string GetClientVersionMessage(entity this) { - if (this.version_mismatch) { + if (CS(this).version_mismatch) { if(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");