Skip to content

Commit f2a0e35

Browse files
authored
Merge pull request #3333 from Goober5000/no_xstr_entry_suppress
log missing XSTR strings only once
2 parents e637eea + 00e2c2a commit f2a0e35

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

code/localization/localize.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,18 @@ const char *XSTR(const char *str, int index, bool force_lookup)
955955
// return translation of string
956956
if (Xstr_table[index].str)
957957
return Xstr_table[index].str;
958+
#ifndef NDEBUG
958959
else
959-
mprintf(("No XSTR entry in strings.tbl for index %d\n", index));
960+
{
961+
// make sure missing strings are only logged once
962+
static SCP_unordered_set<int> Warned_xstr_indexes;
963+
if (Warned_xstr_indexes.count(index) == 0)
964+
{
965+
Warned_xstr_indexes.insert(index);
966+
mprintf(("No XSTR entry in strings.tbl for index %d\n", index));
967+
}
968+
}
969+
#endif
960970
}
961971
}
962972

0 commit comments

Comments
 (0)