src/spritecache.cpp
changeset 6799 169d0b7fe821
parent 6481 85ad87daf4b0
child 6803 9803e56a8d9c
equal deleted inserted replaced
6798:a640d9b85407 6799:169d0b7fe821
   119 
   119 
   120 static void* ReadSprite(SpriteCache *sc, SpriteID id)
   120 static void* ReadSprite(SpriteCache *sc, SpriteID id)
   121 {
   121 {
   122 	uint num;
   122 	uint num;
   123 	byte type;
   123 	byte type;
       
   124 	uint32 file_pos = sc->file_pos;
   124 
   125 
   125 	DEBUG(sprite, 9, "Load sprite %d", id);
   126 	DEBUG(sprite, 9, "Load sprite %d", id);
   126 
   127 
   127 	if (!SpriteExists(id)) {
   128 	if (!SpriteExists(id)) {
   128 		DEBUG(sprite, 1, "Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
   129 		DEBUG(sprite, 1, "Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
   129 
   130 
   130 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   131 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
   131 		id = SPR_IMG_QUERY;
   132 		id = SPR_IMG_QUERY;
   132 		sc = GetSpriteCache(SPR_IMG_QUERY);
   133 		file_pos = GetSpriteCache(SPR_IMG_QUERY)->file_pos;
   133 	}
   134 	}
   134 
   135 
   135 	FioSeekToFile(sc->file_pos);
   136 	FioSeekToFile(file_pos);
   136 
   137 
   137 	num  = FioReadWord();
   138 	num  = FioReadWord();
   138 	type = FioReadByte();
   139 	type = FioReadByte();
   139 	if (type == 0xFF) {
   140 	if (type == 0xFF) {
   140 		byte* dest = (byte*)AllocSprite(num);
   141 		byte* dest = (byte*)AllocSprite(num);