From: Mario Date: Mon, 17 Jul 2017 21:18:55 +0000 (+1000) Subject: Tentatively port msg_choice_choices to ClientState X-Git-Tag: xonotic-v0.8.5~2578 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7ed76fcc3865e5f8d5997512d7f1accfb5690441;p=xonotic%2Fxonotic-data.pk3dir.git Tentatively port msg_choice_choices to ClientState --- diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index d39c9f86e..9fac59d5b 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -764,6 +764,7 @@ void Notification_GetCvars(entity this) FOREACH(Notifications, it.nent_type == MSG_CHOICE, { GetCvars_handleFloat( this, + CS(this), get_cvars_s, get_cvars_f, msg_choice_choices[it.nent_choice_idx], @@ -1605,7 +1606,7 @@ void Send_Notification( #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \ if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \ - switch (ent.msg_choice_choices[net_name.nent_choice_idx]) \ + switch (CS(ent).msg_choice_choices[net_name.nent_choice_idx]) \ { \ case 1: found_choice = notif.nent_optiona; break; \ case 2: found_choice = notif.nent_optionb; break; \ diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 32fa2f0f3..431ea8a01 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -95,6 +95,7 @@ CLASS(Client, Object) ATTRIB(Client, zoomstate, bool, this.zoomstate); ATTRIB(Client, just_joined, bool, this.just_joined); ATTRIB(Client, race_completed, bool, this.race_completed); + ATTRIBARRAY(Client, msg_choice_choices, int, 50); // TODO: actually NOTIF_CHOICE_MAX METHOD(Client, m_unwind, bool(Client this)); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 578445e81..a1e853054 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -325,7 +325,7 @@ void GetCvars_handleString_Fixup(entity this, string thisname, float f, .string } } } -void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name) +void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name) { if (f < 0) { @@ -333,7 +333,7 @@ void GetCvars_handleFloat(entity this, string thisname, float f, .float field, s else if (f > 0) { if (thisname == name) - this.(field) = stof(argv(f + 1)); + store.(field) = stof(argv(f + 1)); } else stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n")); @@ -434,7 +434,7 @@ void GetCvars(entity this, int f) GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete); - GetCvars_handleFloat(this, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking"); + GetCvars_handleFloat(this, this, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking"); // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early) if (f > 0) diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 33d5c14f3..c5f846b16 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -38,7 +38,7 @@ void play2all(string samp); void play2team(float t, string filename); -void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name); +void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name); float spamsound(entity e, float chan, Sound samp, float vol, float _atten);