(svn r6611) - Newsounds:

- If the NewGRF sound effect chosen doesn't exist, then ignore it.
  - Play load/unload sound if provided.
This commit is contained in:
peter1138 2006-10-01 17:56:38 +00:00
parent 0e0af039db
commit 21591b5219
2 changed files with 5 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "ai/ai.h"
#include "train.h"
#include "newgrf_engine.h"
#include "newgrf_sound.h"
#include "unmovable.h"
#include "date.h"
@ -1464,7 +1465,9 @@ int LoadUnloadVehicle(Vehicle *v)
v->profit_this_year += profit;
SubtractMoneyFromPlayer(-profit);
if (IsLocalPlayer()) SndPlayVehicleFx(SND_14_CASHTILL, v);
if (IsLocalPlayer() && !PlayVehicleSound(v, VSE_LOAD_UNLOAD)) {
SndPlayVehicleFx(SND_14_CASHTILL, v);
}
ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, -profit);
}

View File

@ -68,6 +68,6 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
if (callback == CALLBACK_FAILED) return false;
if (callback >= GetNumOriginalSounds()) callback += file->sound_offset - GetNumOriginalSounds();
SndPlayVehicleFx(callback, v);
if (callback < GetNumSounds()) SndPlayVehicleFx(callback, v);
return true;
}