summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-10-01 17:56:38 +0000
committerpeter1138 <peter1138@openttd.org>2006-10-01 17:56:38 +0000
commit21591b5219a99a9d798c43dc2d89e7d00475f7cd (patch)
tree57eb0a57cbb2b1d07cc281291ecbcb85c71b9116
parent0e0af039dbd812ca62e3a8cdac0ab8fbfd7d4005 (diff)
downloadopenttd-21591b5219a99a9d798c43dc2d89e7d00475f7cd.tar.xz
(svn r6611) - Newsounds:
- If the NewGRF sound effect chosen doesn't exist, then ignore it. - Play load/unload sound if provided.
-rw-r--r--economy.c5
-rw-r--r--newgrf_sound.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/economy.c b/economy.c
index c2984123d..5a66be14c 100644
--- a/economy.c
+++ b/economy.c
@@ -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);
}
diff --git a/newgrf_sound.c b/newgrf_sound.c
index 7d746f712..990629e82 100644
--- a/newgrf_sound.c
+++ b/newgrf_sound.c
@@ -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;
}