]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/less_fields' into 'master'
authorMario <mario.mario@y7mail.com>
Thu, 29 Aug 2019 06:14:10 +0000 (06:14 +0000)
committerMario <mario.mario@y7mail.com>
Thu, 29 Aug 2019 06:14:10 +0000 (06:14 +0000)
Less fields

See merge request xonotic/xonotic-data.pk3dir!659

qcsrc/common/items/all.qh
qcsrc/common/notifications/all.qh
qcsrc/server/client.qh

index 623f71b3904ab7654d9e9e88e23291c45d84bb09..3ff4a54155a3cccaf0ea91b69a38a02ac90c15dc 100644 (file)
@@ -4,7 +4,8 @@
 
 #include "item.qh"
 
-REGISTRY(Items, BITS(7))
+// 24 so it matches the limit for the .items field
+REGISTRY(Items, 24)
 #define Items_from(i) _Items_from(i, NULL)
 #ifdef GAMEQC
 REGISTRY_DEPENDS(Items, Models)
index 6eabc983488d720ef43f7f40b2b3c0a7bb3c1f12..ee39b1881ab100937221ae3604d1cac68bb817ae 100644 (file)
@@ -699,7 +699,9 @@ REGISTRY_SORT(Notifications);
 STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); }
 REGISTRY_CHECK(Notifications)
 
-const int NOTIF_CHOICE_MAX = 50;
+const int NOTIF_CHOICE_MAX = 20;
+// NOTE: a team choice is actually made of 4 choices (one per team) with the same nent_choice_idx
+// thus they are counted as 1 in nent_choice_count
 int nent_choice_count = 0;
 .int nent_choice_idx;
 .int msg_choice_choices[NOTIF_CHOICE_MAX]; // set on each player containing MSG_CHOICE choices
@@ -707,12 +709,11 @@ int nent_choice_count = 0;
 bool notif_error;
 bool notif_global_error;
 
-STATIC_INIT_LATE(Notif_Choices) {
-       int c = 0;
-       FOREACH(Notifications, it.nent_type == MSG_CHOICE, { c++; });
-       if (c > NOTIF_CHOICE_MAX) {
-               LOG_FATALF("Too many MSG_CHOICE notifications (%d)", c);
-       }
+STATIC_INIT_LATE(Notif_Choices)
+{
+       if (nent_choice_count > NOTIF_CHOICE_MAX)
+               LOG_FATALF("Too many MSG_CHOICE notifications (%d), hit NOTIF_CHOICE_MAX (%d) limit",
+                       nent_choice_count, NOTIF_CHOICE_MAX);
 }
 
 string Get_Notif_CvarName(Notification notif)
@@ -831,7 +832,9 @@ Notification Get_Notif_Ent(MSG net_type, int net_name)
 
 #define MSG_CHOICE_NOTIF_(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb) \
        REGISTER(Notifications, name, m_id, new_pure(msg_choice_notification)) { \
-               this.nent_choice_idx = nent_choice_count++; \
+               this.nent_choice_idx = nent_choice_count; \
+               if (!teamnum || teamnum == NUM_TEAM_4) \
+                       nent_choice_count++; \
                Create_Notification_Entity       (this, defaultvalue, ACVNN(cvarname), MSG_CHOICE, strtoupper(#name), teamnum); \
                Create_Notification_Entity_Choice(this, ACVNN(cvarname), strtoupper(#name), \
                        challow,                                 /* challow_def */ \
index bc4a60e1a88d5f55d7688e0b5756d2f06329d885..b20a8af93cdd5a72539e334adaefabf7b47ae3ac 100644 (file)
@@ -98,7 +98,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
+    ATTRIBARRAY(Client, msg_choice_choices, int, 20); // TODO: actually NOTIF_CHOICE_MAX
     ATTRIB(Client, latency_sum, float, this.latency_sum);
     ATTRIB(Client, latency_cnt, int, this.latency_cnt);
     ATTRIB(Client, latency_time, float, this.latency_time);