Codechange: remove size_t indexer from EnumIndexContainer

Makes container index even stronger.
This commit is contained in:
Peter Nelson
2026-04-06 14:06:09 +01:00
committed by Peter Nelson
parent a9d7397a77
commit 1d10e8ee64
2 changed files with 1 additions and 5 deletions
-4
View File
@@ -246,16 +246,12 @@ public:
template <typename Container, typename Index>
class EnumClassIndexContainer : public Container {
public:
Container::reference at(size_t pos) { return this->Container::at(pos); }
Container::reference at(const Index &pos) { return this->Container::at(to_underlying(pos)); }
Container::const_reference at(size_t pos) const { return this->Container::at(pos); }
Container::const_reference at(const Index &pos) const { return this->Container::at(to_underlying(pos)); }
Container::reference operator[](size_t pos) { return this->Container::operator[](pos); }
Container::reference operator[](const Index &pos) { return this->Container::operator[](to_underlying(pos)); }
Container::const_reference operator[](size_t pos) const { return this->Container::operator[](pos); }
Container::const_reference operator[](const Index &pos) const { return this->Container::operator[](to_underlying(pos)); }
};
+1 -1
View File
@@ -138,7 +138,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint first, uint last, int prop, Byt
int factor = buf.ReadByte();
if (id < to_underlying(Price::End)) {
_cur_gps.grffile->price_base_multipliers[id] = std::min<int>(factor - 8, MAX_PRICE_MODIFIER);
_cur_gps.grffile->price_base_multipliers[static_cast<Price>(id)] = std::min<int>(factor - 8, MAX_PRICE_MODIFIER);
} else {
GrfMsg(1, "GlobalVarChangeInfo: Price {} out of range, ignoring", id);
}