Set a bogus sound when a sound is skipped in gamedata_read_tbl and don't let piggy_close free it

This commit is contained in:
Chris Taylor 2010-12-04 13:45:43 +08:00
parent 3ccde930c3
commit 61586a8d26
3 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20101204
--------
main/bmread.c, main/piggy.c: Set a bogus sound when a sound is skipped in gamedata_read_tbl and don't let piggy_close free it
20101203
--------
main/net_udp.c: Made resent_delay for net_udp_noloss_process_queue() a bit longer depending on the player's ping

View file

@ -292,7 +292,9 @@ int ds_load(int skip, char * filename ) {
char rawname[100];
if (skip) {
return 0; //don't know what I should return here //&bogus_sound;
// We tell piggy_register_sound it's in the pig file, when in actual fact it's in no file
// This just tells piggy_close not to attempt to free it
return piggy_register_sound( &bogus_sound, "bogus", 1 );
}
removeext(filename, fname);

View file

@ -229,6 +229,8 @@ bitmap_index piggy_register_bitmap( grs_bitmap * bmp, char * name, int in_file )
if ( !GameArg.DbgBigPig ) gr_bitmap_rle_compress( bmp );
Num_bitmap_files_new++;
}
else if (SoundOffset[Num_sound_files] == 0)
SoundOffset[Num_sound_files] = -1; // make sure this sound's data is not individually freed
strncpy( AllBitmaps[Num_bitmap_files].name, name, 12 );
hashtable_insert( &AllBitmapsNames, AllBitmaps[Num_bitmap_files].name, Num_bitmap_files );