summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-22 23:14:32 +0000
committerrubidium <rubidium@openttd.org>2007-09-22 23:14:32 +0000
commitc00db50edc454977da30f833a96ad08e86f24d0c (patch)
treee5aa1ced1e70d9426b2445bc410e0c9ae8b4edbb /src/newgrf_industries.cpp
parent90602b356a9834522cece05cb3e9fc9fc9c67b9f (diff)
downloadopenttd-c00db50edc454977da30f833a96ad08e86f24d0c.tar.xz
(svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 5574673a6..811f76a6d 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -462,13 +462,15 @@ static int32 DerefIndProd(uint field, bool use_register)
*/
void IndustryProductionCallback(Industry *ind, int reason)
{
+ const IndustrySpec *spec = GetIndustrySpec(ind->type);
ResolverObject object;
NewIndustryResolver(&object, ind->xy, ind);
+ if ((spec->behaviour & INDUSTRYBEH_PRODCALLBACK_RANDOM) != 0) object.callback_param1 = Random();
object.callback_param2 = reason;
for (uint loop = 0;; loop++) {
SB(object.callback_param2, 8, 16, loop);
- const SpriteGroup *group = Resolve(GetIndustrySpec(ind->type)->grf_prop.spritegroup, &object);
+ const SpriteGroup *group = Resolve(spec->grf_prop.spritegroup, &object);
if (group == NULL || group->type != SGT_INDUSTRY_PRODUCTION) break;
bool deref = (group->g.indprod.version == 1);