Cleanup: Use std::vector in RandomSpriteGroup.

(cherry picked from commit 913d8a7f28)
This commit is contained in:
Peter Nelson
2021-05-02 00:00:40 +01:00
committed by Jonathan G Rennison
parent a69a1d19a9
commit f5722a999e
3 changed files with 6 additions and 14 deletions

View File

@@ -56,11 +56,6 @@ TemporaryStorageArray<int32, 0x110> _temp_store;
}
}
RandomizedSpriteGroup::~RandomizedSpriteGroup()
{
free(this->groups);
}
static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *scope, byte variable, uint32 parameter, GetVariableExtra *extra)
{
uint32 value;
@@ -275,11 +270,11 @@ const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const
if (res) {
object.used_triggers |= match;
object.reseed[this->var_scope] |= (this->num_groups - 1) << this->lowest_randbit;
object.reseed[this->var_scope] |= (this->groups.size() - 1) << this->lowest_randbit;
}
}
uint32 mask = (this->num_groups - 1) << this->lowest_randbit;
uint32 mask = ((uint)this->groups.size() - 1) << this->lowest_randbit;
byte index = (scope->GetRandomBits() & mask) >> this->lowest_randbit;
return SpriteGroup::Resolve(this->groups[index], object, false);