MCPcopy Create free account
hub / github.com/ZDoom/Raze / CheckString

Method CheckString

source/common/engine/stringtable.cpp:581–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579//==========================================================================
580
581const char *FStringTable::CheckString(const char *name, uint32_t *langtable, int gender) const
582{
583 if (name == nullptr || *name == 0)
584 {
585 return nullptr;
586 }
587 if (gender == -1) gender = defaultgender;
588 if (gender < 0 || gender > 3) gender = 0;
589 FName nm(name, true);
590 if (nm != NAME_None)
591 {
592 TableElement* bestItem = nullptr;
593 for (auto map : currentLanguageSet)
594 {
595 auto item = map.second->CheckKey(nm);
596 if (item)
597 {
598 if (bestItem && bestItem->filenum > item->filenum)
599 {
600 // prioritize content from later files, even if the language doesn't fully match.
601 // This is mainly for Dehacked content.
602 continue;
603 }
604 if (langtable) *langtable = map.first;
605 auto c = item->strings[gender].GetChars();
606 if (c && *c == '$' && c[1] == '$')
607 c = CheckString(c + 2, langtable, gender);
608 return c;
609 }
610 }
611 }
612 return nullptr;
613}
614
615//==========================================================================
616//

Callers

nothing calls this directly

Calls 3

CheckStringFunction · 0.85
CheckKeyMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected