src/gfxinit.cpp
branchNewGRF_ports
changeset 10991 d8811e327d12
parent 10731 67db0d431d5e
equal deleted inserted replaced
10731:67db0d431d5e 10991:d8811e327d12
    53 
    53 
    54 	while (LoadNextSprite(load_index, file_index, sprite_id)) {
    54 	while (LoadNextSprite(load_index, file_index, sprite_id)) {
    55 		load_index++;
    55 		load_index++;
    56 		sprite_id++;
    56 		sprite_id++;
    57 		if (load_index >= MAX_SPRITES) {
    57 		if (load_index >= MAX_SPRITES) {
    58 			error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
    58 			usererror("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
    59 		}
    59 		}
    60 	}
    60 	}
    61 	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
    61 	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
    62 
    62 
    63 	return load_index - load_index_org;
    63 	return load_index - load_index_org;
    69 	uint start;
    69 	uint start;
    70 	while ((start = *index_tbl++) != END) {
    70 	while ((start = *index_tbl++) != END) {
    71 		uint end = *index_tbl++;
    71 		uint end = *index_tbl++;
    72 
    72 
    73 		do {
    73 		do {
    74 		#ifdef NDEBUG
       
    75 			LoadNextSprite(start, file_index, *sprite_id);
       
    76 		#else
       
    77 			bool b = LoadNextSprite(start, file_index, *sprite_id);
    74 			bool b = LoadNextSprite(start, file_index, *sprite_id);
    78 			assert(b);
    75 			assert(b);
    79 		#endif
       
    80 			(*sprite_id)++;
    76 			(*sprite_id)++;
    81 		} while (++start <= end);
    77 		} while (++start <= end);
    82 	}
    78 	}
    83 }
    79 }
    84 
    80 
   212 	/*
   208 	/*
   213 	 * Load additional sprites for climates other than temperate.
   209 	 * Load additional sprites for climates other than temperate.
   214 	 * This overwrites some of the temperate sprites, such as foundations
   210 	 * This overwrites some of the temperate sprites, such as foundations
   215 	 * and the ground sprites.
   211 	 * and the ground sprites.
   216 	 */
   212 	 */
   217 	if (_settings.game_creation.landscape != LT_TEMPERATE) {
   213 	if (_settings_game.game_creation.landscape != LT_TEMPERATE) {
   218 		LoadGrfIndexed(
   214 		LoadGrfIndexed(
   219 			files->landscape[_settings.game_creation.landscape - 1].filename,
   215 			files->landscape[_settings_game.game_creation.landscape - 1].filename,
   220 			_landscape_spriteindexes[_settings.game_creation.landscape - 1],
   216 			_landscape_spriteindexes[_settings_game.game_creation.landscape - 1],
   221 			i++
   217 			i++
   222 		);
   218 		);
   223 	}
   219 	}
   224 
   220 
   225 	/* Initialize the unicode to sprite mapping table */
   221 	/* Initialize the unicode to sprite mapping table */
   246 }
   242 }
   247 
   243 
   248 
   244 
   249 void GfxLoadSprites()
   245 void GfxLoadSprites()
   250 {
   246 {
   251 	DEBUG(sprite, 2, "Loading sprite set %d", _settings.game_creation.landscape);
   247 	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
   252 
   248 
   253 	GfxInitSpriteMem();
   249 	GfxInitSpriteMem();
   254 	LoadSpriteTables();
   250 	LoadSpriteTables();
   255 	GfxInitPalettes();
   251 	GfxInitPalettes();
   256 }
   252 }