]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tentatively port msg_choice_choices to ClientState
authorMario <mario@smbclan.net>
Mon, 17 Jul 2017 21:18:55 +0000 (07:18 +1000)
committerMario <mario@smbclan.net>
Mon, 17 Jul 2017 21:18:55 +0000 (07:18 +1000)
qcsrc/common/notifications/all.qc
qcsrc/server/client.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh

index d39c9f86e13bb59a3b2ba0952a8fbe4f4f5d2f35..9fac59d5b788835901ee76126f2eb1eca2388a57 100644 (file)
@@ -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; \
index 32fa2f0f30c06275fd25205be487e7cee4ae17b8..431ea8a01ec80246411fc59c94387debb5dbc21d 100644 (file)
@@ -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));
 
index 578445e815a238c40ecbd0f591b62323eeb8334a..a1e85305427509df78c64c71fda09afbe4ebf094 100644 (file)
@@ -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)
index 33d5c14f315020e1aedb5baf860663380a9c9886..c5f846b162590f19ba39031bc4a27363cf753ad9 100644 (file)
@@ -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);