mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r12362) -Fix (r11985, r12006): Randomize variable 8F only once per callback 28.
This commit is contained in:
parent
8af1696cd3
commit
d744451345
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
static Randomizer _industry_creation_randomizer;
|
static uint32 _industry_creation_random_bits;
|
||||||
|
|
||||||
/* Since the industry IDs defined by the GRF file don't necessarily correlate
|
/* Since the industry IDs defined by the GRF file don't necessarily correlate
|
||||||
* to those used by the game, the IDs used for overriding old industries must be
|
* to those used by the game, the IDs used for overriding old industries must be
|
||||||
@ -469,7 +469,7 @@ uint32 IndustryLocationGetVariable(const ResolverObject *object, byte variable,
|
|||||||
case 0x8D: return min(DistanceSquare(industry->town->xy, tile), 65535);
|
case 0x8D: return min(DistanceSquare(industry->town->xy, tile), 65535);
|
||||||
|
|
||||||
/* 32 random bits */
|
/* 32 random bits */
|
||||||
case 0x8F: return _industry_creation_randomizer.Next();
|
case 0x8F: return _industry_creation_random_bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* None of the special ones, so try the general ones */
|
/* None of the special ones, so try the general ones */
|
||||||
@ -494,7 +494,7 @@ bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspe
|
|||||||
NewIndustryResolver(&object, tile, &ind, type);
|
NewIndustryResolver(&object, tile, &ind, type);
|
||||||
object.GetVariable = IndustryLocationGetVariable;
|
object.GetVariable = IndustryLocationGetVariable;
|
||||||
object.callback = CBID_INDUSTRY_LOCATION;
|
object.callback = CBID_INDUSTRY_LOCATION;
|
||||||
_industry_creation_randomizer.SetSeed(seed);
|
_industry_creation_random_bits = seed;
|
||||||
|
|
||||||
group = Resolve(GetIndustrySpec(type)->grf_prop.spritegroup, &object);
|
group = Resolve(GetIndustrySpec(type)->grf_prop.spritegroup, &object);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user