Actually load the sprite tables. */
| 170 | |
| 171 | /** Actually load the sprite tables. */ |
| 172 | static void LoadSpriteTables() |
| 173 | { |
| 174 | const GraphicsSet *used_set = BaseGraphics::GetUsedSet(); |
| 175 | |
| 176 | LoadGrfFile(used_set->files[GFT_BASE].filename, 0, PAL_DOS != used_set->palette); |
| 177 | |
| 178 | /* |
| 179 | * The second basic file always starts at the given location and does |
| 180 | * contain a different amount of sprites depending on the "type"; DOS |
| 181 | * has a few sprites less. However, we do not care about those missing |
| 182 | * sprites as they are not shown anyway (logos in intro game). |
| 183 | */ |
| 184 | LoadGrfFile(used_set->files[GFT_LOGOS].filename, 4793, PAL_DOS != used_set->palette); |
| 185 | |
| 186 | /* |
| 187 | * Load additional sprites for climates other than temperate. |
| 188 | * This overwrites some of the temperate sprites, such as foundations |
| 189 | * and the ground sprites. |
| 190 | */ |
| 191 | if (_settings_game.game_creation.landscape != LandscapeType::Temperate) { |
| 192 | LoadGrfFileIndexed( |
| 193 | used_set->files[GFT_ARCTIC + to_underlying(_settings_game.game_creation.landscape) - 1].filename, |
| 194 | _landscape_spriteindexes[to_underlying(_settings_game.game_creation.landscape) - 1], |
| 195 | PAL_DOS != used_set->palette |
| 196 | ); |
| 197 | } |
| 198 | |
| 199 | /* Initialize the unicode to sprite mapping table */ |
| 200 | InitializeUnicodeGlyphMap(); |
| 201 | |
| 202 | /* |
| 203 | * Load the base and extra NewGRF with OTTD required graphics as first NewGRF. |
| 204 | * However, we do not want it to show up in the list of used NewGRFs, |
| 205 | * so we have to manually add it, and then remove it later. |
| 206 | */ |
| 207 | |
| 208 | auto default_extra = GetDefaultExtraGRFConfig(); |
| 209 | auto baseset_extra = GetBasesetExtraGRFConfig(); |
| 210 | std::string default_filename = default_extra->filename; |
| 211 | |
| 212 | _grfconfig.insert(std::begin(_grfconfig), std::move(default_extra)); |
| 213 | _grfconfig.insert(std::next(std::begin(_grfconfig)), std::move(baseset_extra)); |
| 214 | |
| 215 | LoadNewGRF(SPR_NEWGRFS_BASE, 2); |
| 216 | |
| 217 | uint total_extra_graphics = SPR_NEWGRFS_BASE - SPR_OPENTTD_BASE; |
| 218 | Debug(sprite, 4, "Checking sprites from fallback grf"); |
| 219 | _missing_extra_graphics = GetSpriteCountForFile(default_filename, SPR_OPENTTD_BASE, SPR_NEWGRFS_BASE); |
| 220 | Debug(sprite, 1, "{} extra sprites, {} from baseset, {} from fallback", total_extra_graphics, total_extra_graphics - _missing_extra_graphics, _missing_extra_graphics); |
| 221 | |
| 222 | /* The original baseset extra graphics intentionally make use of the fallback graphics. |
| 223 | * Let's say everything which provides less than 500 sprites misses the rest intentionally. */ |
| 224 | if (500 + _missing_extra_graphics > total_extra_graphics) _missing_extra_graphics = 0; |
| 225 | |
| 226 | /* Remove the default and baseset extra graphics from the config. */ |
| 227 | _grfconfig.erase(std::begin(_grfconfig), std::next(std::begin(_grfconfig), 2)); |
| 228 | } |
| 229 |
no test coverage detected