MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetLanguageMap

Method GetLanguageMap

src/newgrf.cpp:357–367  ·  view source on GitHub ↗

* Get the language map associated with a given NewGRF and language. * @param grfid The NewGRF to get the map for. * @param language_id The (NewGRF) language ID to get the map for. * @return The LanguageMap, or nullptr if it couldn't be found. */ static */

Source from the content-addressed store, hash-verified

355 * @return The LanguageMap, or nullptr if it couldn't be found.
356 */
357/* static */ const LanguageMap *LanguageMap::GetLanguageMap(uint32_t grfid, uint8_t language_id)
358{
359 /* LanguageID "MAX_LANG", i.e. 7F is any. This language can't have a gender/case mapping, but has to be handled gracefully. */
360 const GRFFile *grffile = GetFileByGRFID(grfid);
361 if (grffile == nullptr) return nullptr;
362
363 auto it = grffile->language_map.find(language_id);
364 if (it == std::end(grffile->language_map)) return nullptr;
365
366 return &it->second;
367}
368
369/**
370 * Set the current NewGRF as unsafe for static use

Callers

nothing calls this directly

Calls 3

GetFileByGRFIDFunction · 0.85
endFunction · 0.50
findMethod · 0.45

Tested by

no test coverage detected