spritecache.c
branch0.5
changeset 5509 0b111f4e6dc9
parent 5433 c136db538201
child 5513 0d3227e250eb
equal deleted inserted replaced
5508:f84e84891954 5509:0b111f4e6dc9
    86 
    86 
    87 static void* ReadSprite(SpriteID id)
    87 static void* ReadSprite(SpriteID id)
    88 {
    88 {
    89 	uint num;
    89 	uint num;
    90 	byte type;
    90 	byte type;
       
    91 	uint32 filepos = _sprite_file_pos[id];
    91 
    92 
    92 	DEBUG(spritecache, 9) ("load sprite %d", id);
    93 	DEBUG(spritecache, 9) ("load sprite %d", id);
    93 
    94 
    94 	if (!SpriteExists(id)) {
    95 	if (!SpriteExists(id)) {
    95 		DEBUG(spritecache, 1) ("Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
    96 		DEBUG(spritecache, 1) ("Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
    96 
    97 
    97 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
    98 		/* SPR_IMG_QUERY is a BIG FAT RED ? */
    98 		id = SPR_IMG_QUERY;
    99 		filepos = _sprite_file_pos[SPR_IMG_QUERY];
    99 	}
   100 	}
   100 
   101 
   101 	FioSeekToFile(_sprite_file_pos[id]);
   102 	FioSeekToFile(filepos);
   102 
   103 
   103 	num  = FioReadWord();
   104 	num  = FioReadWord();
   104 	type = FioReadByte();
   105 	type = FioReadByte();
   105 	if (type == 0xFF) {
   106 	if (type == 0xFF) {
   106 		byte* dest = AllocSprite(num);
   107 		byte* dest = AllocSprite(num);