(svn r16337) -Codechange: remove pointless variable + wrapper function; having it return anything else than ORIGINAL_SAMPLE_COUNT is asking for NewGRFs failing to load (due to invalid sample index), thus desyncs

This commit is contained in:
rubidium
2009-05-17 14:57:14 +00:00
parent 10ea72a08e
commit 83dc6ef6e6
5 changed files with 7 additions and 15 deletions

View File

@@ -60,7 +60,7 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
callback = GetVehicleCallback(CBID_VEHICLE_SOUND_EFFECT, event, 0, v->engine_type, v);
if (callback == CALLBACK_FAILED) return false;
if (callback >= GetNumOriginalSounds()) callback += file->sound_offset - GetNumOriginalSounds();
if (callback >= ORIGINAL_SAMPLE_COUNT) callback += file->sound_offset - ORIGINAL_SAMPLE_COUNT;
if (callback < GetNumSounds()) SndPlayVehicleFx((SoundFx)callback, v);
return true;
@@ -68,7 +68,7 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
bool PlayTileSound(const GRFFile *file, uint16 sound_id, TileIndex tile)
{
if (sound_id >= GetNumOriginalSounds()) sound_id += file->sound_offset - GetNumOriginalSounds();
if (sound_id >= ORIGINAL_SAMPLE_COUNT) sound_id += file->sound_offset - ORIGINAL_SAMPLE_COUNT;
if (sound_id < GetNumSounds()) {
SndPlayTileFx((SoundFx)sound_id, tile);