diff options
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r-- | src/game/game.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 883df60..246a222 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -503,6 +503,36 @@ void state_t::resume(void) paused = false; } +void state_t::check_game_over(void) +{ + if (game_over_displayed) + return; + + if (!first_teleporter_placed) + return; + + // Can collect crystals and got a teleporter. + if (num_scientists && num_teleporters) + return; + + // Got a teleporter and enough crystals for a scientist. + if (num_teleporters && crystals >= 95) + return; + + // Got a scientist, a builder and enough crystals for a teleporter. + if (num_scientists && num_builders && crystals >= 265) + return; + + // Got a builder and enough crystals for a teleporter and a scientist. + if (num_builders && crystals >= 265 + 95) + return; + + interface.print("FURTHER PROGRESS IS NOT POSSIBLE."); + interface.print("At this point you might want to restart the game."); + + game_over_displayed = true; +} + #define TIME_DELTA ((ntime_t)1000000000 / 100) #define TIME_LIMIT ((ntime_t)1000000000 / 20) @@ -536,6 +566,8 @@ void state_t::tick(ntime_t time_) if (awake_entities.find(ent) != awake_entities.end()) ent->on_think(); + check_game_over(); + frames++; frames_since_t0++; time += TIME_DELTA; |