(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.
authorrubidium
Wed, 23 Apr 2008 00:14:49 +0000
changeset 9028 f60408bc972b
parent 9027 b28d0b8809ad
child 9029 331d9d84560c
(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.
src/industry_cmd.cpp
src/newgrf_house.cpp
src/newgrf_industrytiles.cpp
--- a/src/industry_cmd.cpp	Tue Apr 22 23:16:36 2008 +0000
+++ b/src/industry_cmd.cpp	Wed Apr 23 00:14:49 2008 +0000
@@ -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	Tue Apr 22 23:16:36 2008 +0000
+++ b/src/newgrf_house.cpp	Wed Apr 23 00:14:49 2008 +0000
@@ -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	Tue Apr 22 23:16:36 2008 +0000
+++ b/src/newgrf_industrytiles.cpp	Wed Apr 23 00:14:49 2008 +0000
@@ -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;