summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-21 13:47:39 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-21 13:47:39 -0400
commitda016b298ce845d4f719e08ae6c1d904ad0863ce (patch)
treed79e5bc3681a1004ba58d6b22caa655afae669de /src
parentdfae5ac251994a3f25f7473197f716148374e7ca (diff)
downloadether-1.0.0.tar.gz
ether-1.0.0.tar.bz2
ether-1.0.0.zip
game shouldn't crash if all lamps are in unloaded chunks v1.0.0
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index b5d667a..66b488c 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -920,10 +920,14 @@ void Game::updatePlaying(size_t frameTime) {
920 } 920 }
921 } 921 }
922 922
923 std::uniform_int_distribution<int> lampDist(0, lamps.size() - 1); 923 if (lamps.empty()) {
924 std::tuple<int, int> popPos = lamps[lampDist(rng)]; 924 losing = LoseState::PoppingPlayer;
925 } else {
926 std::uniform_int_distribution<int> lampDist(0, lamps.size() - 1);
927 std::tuple<int, int> popPos = lamps[lampDist(rng)];
925 928
926 popLamp(std::get<0>(popPos), std::get<1>(popPos), 1); 929 popLamp(std::get<0>(popPos), std::get<1>(popPos), 1);
930 }
927 } 931 }
928 } 932 }
929 933