changeset 18280:7910779b241a draft

(svn r23116) -Fix (r23114): Ambient sound effect callback was called for unsupported tile types.
author michi_cc <michi_cc@openttd.org>
date Fri, 04 Nov 2011 22:59:23 +0000
parents 574646cd34a7
children 53b4895476ee
files src/tree_cmd.cpp src/water_cmd.cpp
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -621,16 +621,15 @@
 static void TileLoop_Trees(TileIndex tile)
 {
 	if (GetTreeGround(tile) == TREE_GROUND_SHORE) {
-		TileLoop_Water(tile); // Calls AmbientSoundEffectCallback
+		TileLoop_Water(tile);
 	} else {
 		switch (_settings_game.game_creation.landscape) {
 			case LT_TROPIC: TileLoopTreesDesert(tile); break;
 			case LT_ARCTIC: TileLoopTreesAlps(tile);   break;
 		}
-
-		AmbientSoundEffectCallback(tile);
 	}
 
+	AmbientSoundEffectCallback(tile);
 	TileLoopClearHelper(tile);
 
 	uint treeCounter = GetTreeCounter(tile);
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -1071,7 +1071,7 @@
  */
 void TileLoop_Water(TileIndex tile)
 {
-	AmbientSoundEffectCallback(tile);
+	if (IsTileType(tile, MP_WATER)) AmbientSoundEffectCallback(tile);
 
 	switch (GetFloodingBehaviour(tile)) {
 		case FLOOD_ACTIVE: