(svn r9009) -Fix (r1): Determine whether to play a sound or not when entering a tunnel based on engine type (only steam engines) instead of on spritenum which can be invalid for newgrf trains. DBSet(XL) or any other steam trains without newsounds should sound their horn now.
authorDarkvater
Sun, 04 Mar 2007 22:14:32 +0000
changeset 6539 6824b94ed21c
parent 6538 c7be4b80c4a7
child 6540 4db000b2cc41
(svn r9009) -Fix (r1): Determine whether to play a sound or not when entering a tunnel based on engine type (only steam engines) instead of on spritenum which can be invalid for newgrf trains. DBSet(XL) or any other steam trains without newsounds should sound their horn now.
src/tunnelbridge_cmd.cpp
--- a/src/tunnelbridge_cmd.cpp	Sun Mar 04 08:05:43 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp	Sun Mar 04 22:14:32 2007 +0000
@@ -1265,7 +1265,7 @@
 
 			if (v->u.rail.track != TRACK_BIT_WORMHOLE && dir == vdir) {
 				if (IsFrontEngine(v) && fc == _tunnel_fractcoord_1[dir]) {
-					if (!PlayVehicleSound(v, VSE_TUNNEL) && v->spritenum < 4) {
+					if (!PlayVehicleSound(v, VSE_TUNNEL) && RailVehInfo(v->engine_type)->engclass == 0) {
 						SndPlayVehicleFx(SND_05_TRAIN_THROUGH_TUNNEL, v);
 					}
 					return VETSB_CONTINUE;