@@ -15,8 +15,11 @@ Variable sar_ehm_hud_font("sar_ehm_hud_font", "2", "Font used by the EHM debug H
1515
1616Variable sar_ehm_hud_list_length (" sar_ehm_hud_list_length" , " 20" , " How many slots to show in the EHM debug HUD.\n " , 0 );
1717
18- Variable sar_ehm_hud_autofill (" sar_ehm_hud_autofill" , " 1" ,
19- " Whether to listen for changed slot and use it to replace the oldest one in EHM debug HUD.\n " );
18+ Variable sar_ehm_hud_autofill (" sar_ehm_hud_autofill" , " 1" , 0 , 2 ,
19+ " Whether to listen for changed slot and use it to replace the oldest one in EHM debug HUD.\n "
20+ " 1 = listens only to networked slots\n "
21+ " 2 = listens to all slots\n "
22+ );
2023
2124struct SlotInfoRecord {
2225 int slot;
@@ -70,6 +73,22 @@ static void swapOldestSlotWith(int slot) {
7073 }
7174}
7275
76+ static void attemptAutofill (int slot) {
77+ int autofillMode = sar_ehm_hud_autofill.GetInt ();
78+
79+ int autofillSlotsRange = 0 ;
80+
81+ if (autofillMode == 1 ) {
82+ autofillSlotsRange = server->gpGlobals ->maxEntities ;
83+ } else if (autofillMode == 2 ) {
84+ autofillSlotsRange = Offsets::NUM_ENT_ENTRIES;
85+ }
86+
87+ if (slot < autofillSlotsRange) {
88+ swapOldestSlotWith (slot);
89+ }
90+ }
91+
7392static void handleSlotRecords () {
7493 bool fresh = false ;
7594 if (g_slotStates.size () != (size_t )Offsets::NUM_ENT_ENTRIES) {
@@ -94,8 +113,9 @@ static void handleSlotRecords() {
94113 ? server->GetEntityClassName (info->m_pEntity )
95114 : g_slotStates[i].lastClassname ;
96115
97- if (!fresh && sar_ehm_hud_autofill.GetBool ()) {
98- swapOldestSlotWith (i);
116+
117+ if (!fresh) {
118+ attemptAutofill (i);
99119 }
100120
101121 continue ;
0 commit comments