diff options
| -rw-r--r-- | src/esp.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/esp.cpp b/src/esp.cpp index 0966ff5..b09588f 100644 --- a/src/esp.cpp +++ b/src/esp.cpp | |||
| @@ -151,6 +151,22 @@ static bool model_is_neutral(const char *m) { | |||
| 151 | static bool npc_is_friendly(int idx, const char *model, int local_idx, | 151 | static bool npc_is_friendly(int idx, const char *model, int local_idx, |
| 152 | bool &neutral) { | 152 | bool &neutral) { |
| 153 | int rel = server_npc_relation(idx, local_idx); | 153 | int rel = server_npc_relation(idx, local_idx); |
| 154 | // Debug-only: relation values are the authoritative answer and are the | ||
| 155 | // first thing to check when a friendly NPC still looks hostile. Logged only | ||
| 156 | // when an entity's relation changes, so this does not flood the log. | ||
| 157 | static int rel_cache[2048]; | ||
| 158 | static bool rel_cache_init = false; | ||
| 159 | if (!rel_cache_init) { | ||
| 160 | for (int i = 0; i < 2048; i++) | ||
| 161 | rel_cache[i] = -999; | ||
| 162 | rel_cache_init = true; | ||
| 163 | } | ||
| 164 | if (idx > 0 && idx < 2048 && rel_cache[idx] != rel) { | ||
| 165 | rel_cache[idx] = rel; | ||
| 166 | logd("npc %d (%s): relation=%d followtarget=%d local=%d", idx, | ||
| 167 | model ? model : "?", rel, | ||
| 168 | (int)server_npc_has_follow_target(idx), local_idx); | ||
| 169 | } | ||
| 154 | if (rel == 3) { // D_LI | 170 | if (rel == 3) { // D_LI |
| 155 | neutral = false; | 171 | neutral = false; |
| 156 | return true; | 172 | return true; |
