Merge branch 'master' into jgrpp

# Conflicts:
#	src/industry_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2017-12-10 12:41:58 +00:00
21 changed files with 169 additions and 149 deletions

View File

@@ -110,12 +110,6 @@ ScopeResolver::~ScopeResolver() {}
return 0;
}
/**
* 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
@@ -356,21 +350,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;