src/newgrf_house.cpp
branchnoai
changeset 10294 7798ae816af8
parent 9869 6404afe43575
child 10355 ee4b5f7a5bf2
--- a/src/newgrf_house.cpp	Mon Apr 21 20:52:54 2008 +0000
+++ b/src/newgrf_house.cpp	Mon Apr 21 21:15:50 2008 +0000
@@ -21,6 +21,8 @@
 #include "transparency.h"
 #include "functions.h"
 #include "player_func.h"
+#include "animated_tile_func.h"
+#include "date_func.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -428,7 +430,7 @@
 
 			/* If the lower 7 bits of the upper byte of the callback
 			 * result are not empty, it is a sound effect. */
-			if (GB(callback_res, 8, 7) != 0) PlayHouseSound(GB(callback_res, 8, 7), tile);
+			if (GB(callback_res, 8, 7) != 0) PlayTileSound(hs->grffile, GB(callback_res, 8, 7), tile);
 		}
 	}
 
@@ -448,7 +450,7 @@
 	MarkTileDirtyByTile(tile);
 }
 
-void ChangeHouseAnimationFrame(TileIndex tile, uint16 callback_result)
+void ChangeHouseAnimationFrame(const GRFFile *file, TileIndex tile, uint16 callback_result)
 {
 	switch (callback_result & 0xFF) {
 		case 0xFD: /* Do nothing. */         break;
@@ -461,7 +463,7 @@
 	}
 	/* If the lower 7 bits of the upper byte of the callback
 	 * result are not empty, it is a sound effect. */
-	if (GB(callback_result, 8, 7) != 0) PlayHouseSound(GB(callback_result, 8, 7), tile);
+	if (GB(callback_result, 8, 7) != 0) PlayTileSound(file, GB(callback_result, 8, 7), tile);
 }
 
 bool CanDeleteHouse(TileIndex tile)
@@ -489,7 +491,7 @@
 		uint32 param = (hs->extra_flags & SYNCHRONISED_CALLBACK_1B) ? (GB(Random(), 0, 16) | random_bits << 16) : Random();
 		uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_START_STOP, param, 0, GetHouseType(tile), GetTownByTile(tile), tile);
 
-		if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(tile, callback_res);
+		if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(hs->grffile, tile, callback_res);
 	}
 }
 
@@ -525,7 +527,7 @@
 	/* Check callback 21, which determines if a house should be destroyed. */
 	if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
 		uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
-		if (callback_res != CALLBACK_FAILED && callback_res > 0) {
+		if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) > 0) {
 			ClearTownHouse(GetTownByTile(tile), tile);
 			return false;
 		}