changeset 9028:32052f89dbbd draft

(svn r12844) -Fix: the industry tick trigger should only be triggered once every 256 ticks, not every tick... Also bail out of the triggers a little earlier if you know they are not going to happen anyway.
author rubidium <rubidium@openttd.org>
date Wed, 23 Apr 2008 00:14:49 +0000
parents d114ec6ce9fd
children 774180fd1ec8
files src/industry_cmd.cpp src/newgrf_house.cpp src/newgrf_industrytiles.cpp
diffstat 3 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1033,6 +1033,9 @@
 
 			if (cut) ChopLumberMillTrees(i);
 		}
+
+		TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
+		StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
 	}
 }
 
@@ -1054,8 +1057,6 @@
 	if (_game_mode == GM_EDITOR) return;
 
 	FOR_ALL_INDUSTRIES(i) {
-		TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
-		StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
 		ProduceIndustryGoods(i);
 	}
 }
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -547,6 +547,8 @@
 	HouseID hid = GetHouseType(tile);
 	HouseSpec *hs = GetHouseSpecs(hid);
 
+	if (hs->spritegroup == NULL) return;
+
 	NewHouseResolver(&object, hid, tile, GetTownByTile(tile));
 
 	object.callback = CBID_RANDOM_TRIGGER;
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -417,6 +417,8 @@
 	IndustryGfx gfx = GetIndustryGfx(tile);
 	const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
 
+	if (itspec->grf_prop.spritegroup == NULL) return;
+
 	NewIndustryTileResolver(&object, gfx, tile, ind);
 
 	object.callback = CBID_RANDOM_TRIGGER;