Reverting pellet C++20 changes since we don't target 20 fully.
This commit is contained in:
parent
613831f1c0
commit
2f62f7ae1d
2 changed files with 10 additions and 2 deletions
|
@ -7,7 +7,11 @@ Pellets::Pellets()
|
||||||
: positions(initialPelletPositions()) {}
|
: positions(initialPelletPositions()) {}
|
||||||
|
|
||||||
bool Pellets::eatPelletAtPosition(GridPosition p) {
|
bool Pellets::eatPelletAtPosition(GridPosition p) {
|
||||||
return std::erase(positions, p) > 0;
|
auto it = std::find(positions.begin(), positions.end(), p);
|
||||||
|
if (it == positions.end())
|
||||||
|
return false;
|
||||||
|
positions.erase(it);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pacman
|
} // namespace pacman
|
||||||
|
|
|
@ -7,7 +7,11 @@ SuperPellets::SuperPellets()
|
||||||
: positions(initialSuperPelletPositions()) {}
|
: positions(initialSuperPelletPositions()) {}
|
||||||
|
|
||||||
bool SuperPellets::eatPelletAtPosition(GridPosition p) {
|
bool SuperPellets::eatPelletAtPosition(GridPosition p) {
|
||||||
return std::erase(positions, p) > 0;
|
auto it = std::find(positions.begin(), positions.end(), p);
|
||||||
|
if (it == positions.end())
|
||||||
|
return false;
|
||||||
|
positions.erase(it);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pacman
|
} // namespace pacman
|
||||||
|
|
Loading…
Reference in a new issue