* 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 */
| 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 |
nothing calls this directly
no test coverage detected