Codechange: Use proper enum type to index sprite groups in VariableGRFFileProps.
This commit is contained in:
@@ -740,30 +740,3 @@ void GRFFilePropsBase::SetGRFFile(const struct GRFFile *grffile)
|
||||
this->grffile = grffile;
|
||||
this->grfid = grffile == nullptr ? 0 : grffile->grfid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SpriteGroup at the specified index.
|
||||
* @param index Index to get.
|
||||
* @returns SpriteGroup at index, or nullptr if not present.
|
||||
*/
|
||||
const SpriteGroup *VariableGRFFileProps::GetSpriteGroup(size_t index) const
|
||||
{
|
||||
auto it = std::ranges::lower_bound(this->spritegroups, index, std::less{}, &CargoSpriteGroup::first);
|
||||
if (it == std::end(this->spritegroups) || it->first != index) return nullptr;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the SpriteGroup at the specified index.
|
||||
* @param index Index to set.
|
||||
* @param spritegroup SpriteGroup to set.
|
||||
*/
|
||||
void VariableGRFFileProps::SetSpriteGroup(size_t index, const SpriteGroup *spritegroup)
|
||||
{
|
||||
auto it = std::ranges::lower_bound(this->spritegroups, index, std::less{}, &CargoSpriteGroup::first);
|
||||
if (it == std::end(this->spritegroups) || it->first != index) {
|
||||
this->spritegroups.emplace(it, index, spritegroup);
|
||||
} else {
|
||||
it->second = spritegroup;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user