(svn r11143) -Fix: the random bits were not set for the production callback when the NewGRF asked for it.
--- a/src/industry.h Sat Sep 22 21:59:02 2007 +0000
+++ b/src/industry.h Sat Sep 22 23:14:32 2007 +0000
@@ -82,6 +82,10 @@
INDUSTRYBEH_AIRPLANE_ATTACKS = 1 << 11, ///< can be exploded by a military airplane (oil refinery)
INDUSTRYBEH_CHOPPER_ATTACKS = 1 << 12, ///< can be exploded by a military helicopter (factory)
INDUSTRYBEH_CAN_SUBSIDENCE = 1 << 13, ///< can cause a subsidence (coal mine, shaft that collapses)
+ /* The following flags are only used for newindustries and do no represent any normal behaviour */
+ INDUSTRYBEH_PROD_MULTI_HNDLING = 1 << 14, ///< Automatic production multiplier handling
+ INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15, ///< Production callback needs random bits in var 10
+ INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16, ///< Do not force one instance of this type to appear on map generation
INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type
};
--- a/src/newgrf_industries.cpp Sat Sep 22 21:59:02 2007 +0000
+++ b/src/newgrf_industries.cpp Sat Sep 22 23:14:32 2007 +0000
@@ -462,13 +462,15 @@
*/
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);