diff options
author | frosch <frosch@openttd.org> | 2017-10-25 15:38:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2017-10-25 15:38:14 +0000 |
commit | 82ae414e8d81718687b88db98346cee594fb2858 (patch) | |
tree | 1225534a7f9f17933b48c7426d77d2876adf8dd9 /src/newgrf_spritegroup.cpp | |
parent | 146e4eddb631d597f1296162d3bf520e4fc524a1 (diff) | |
download | openttd-82ae414e8d81718687b88db98346cee594fb2858.tar.xz |
(svn r27928) -Fix: [NewGRF] While executing random triggers, var 5F should include the new triggers.
-Fix: [NewGRF] Reset used random triggers only after all A123 chains have been resolved, so that all RA2 in all chains can test the shard triggers. This also includes multiple RA2 in the same A123 chain.
-Fix: [NewGRF] Industry random triggers are stored per tile, even when randomising the shared random bits of the parent industry.
Diffstat (limited to 'src/newgrf_spritegroup.cpp')
-rw-r--r-- | src/newgrf_spritegroup.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index c6fcd0a9e..a838a1388 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -110,12 +110,6 @@ ScopeResolver::~ScopeResolver() {} } /** - * Set the triggers. Base class implementation does nothing. - * @param triggers Triggers to set. - */ -/* virtual */ void ScopeResolver::SetTriggers(int triggers) const {} - -/** * Get a variable value. Default implementation has no available variables. * @param variable Variable to read * @param parameter Parameter for 60+x variables @@ -304,21 +298,15 @@ const SpriteGroup *DeterministicSpriteGroup::Resolve(ResolverObject &object) con const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const { ScopeResolver *scope = object.GetScope(this->var_scope, this->count); - if (object.trigger != 0) { + if (object.callback == CBID_RANDOM_TRIGGER) { /* Handle triggers */ - /* Magic code that may or may not do the right things... */ - byte waiting_triggers = scope->GetTriggers(); - byte match = this->triggers & (waiting_triggers | object.trigger); + byte match = this->triggers & object.waiting_triggers; bool res = (this->cmp_mode == RSG_CMP_ANY) ? (match != 0) : (match == this->triggers); if (res) { - waiting_triggers &= ~match; + object.used_triggers |= match; object.reseed[this->var_scope] |= (this->num_groups - 1) << this->lowest_randbit; - } else { - waiting_triggers |= object.trigger; } - - scope->SetTriggers(waiting_triggers); } uint32 mask = (this->num_groups - 1) << this->lowest_randbit; |