summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-23 00:14:49 +0000
committerrubidium <rubidium@openttd.org>2008-04-23 00:14:49 +0000
commit97f78133d241275973651840b7b697af96321087 (patch)
treece7256cb62030c63a9834a408c4ce5f57d1076c9
parent80a0435ba822f4b92d84f10744bec5a7028ee69b (diff)
downloadopenttd-97f78133d241275973651840b7b697af96321087.tar.xz
(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.
-rw-r--r--src/industry_cmd.cpp5
-rw-r--r--src/newgrf_house.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 6dac2fab9..75b7c3ca0 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1033,6 +1033,9 @@ static void ProduceIndustryGoods(Industry *i)
if (cut) ChopLumberMillTrees(i);
}
+
+ TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
+ StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
}
}
@@ -1054,8 +1057,6 @@ void OnTick_Industry()
if (_game_mode == GM_EDITOR) return;
FOR_ALL_INDUSTRIES(i) {
- TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
- StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
ProduceIndustryGoods(i);
}
}
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index aa462f8a8..604bb3660 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -547,6 +547,8 @@ static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_rando
HouseID hid = GetHouseType(tile);
HouseSpec *hs = GetHouseSpecs(hid);
+ if (hs->spritegroup == NULL) return;
+
NewHouseResolver(&object, hid, tile, GetTownByTile(tile));
object.callback = CBID_RANDOM_TRIGGER;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 79bbf72eb..093aeef0b 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -417,6 +417,8 @@ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, I
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;