mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-17 08:09:44 +00:00
Codechange: remove size_t indexer from EnumIndexContainer
Makes container index even stronger.
This commit is contained in:
committed by
Peter Nelson
parent
a9d7397a77
commit
1d10e8ee64
@@ -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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user