]> git.localhorst.tv Git - blobs.git/blobdiff - src/blobs.cpp
switch creatures with left click
[blobs.git] / src / blobs.cpp
index f5cc98842b0c13280761b8004c176277a847625a..1cd3f9fad69cb6b01c60d67cf34264ab5cdd833f 100644 (file)
 
 using namespace blobs;
 
-namespace {
-
-struct SwitchPanel {
-       SwitchPanel(world::Planet &p, app::Application &app, app::MasterState &state)
-       : planet(p), app(app), state(state) { }
-
-       void operator ()(creature::Creature &c) {
-               if (planet.Creatures().empty()) {
-                       planet.GetSimulation().Log() << "no more creatures, game over" << std::endl;
-                       state.GetCreaturePanel().Hide();
-                       while (app.HasState()) {
-                               app.PopState();
-                       }
-               } else {
-                       for (auto a : planet.Creatures()) {
-                               if (a != &c) {
-                                       state.GetCreaturePanel().Show(*a);
-                                       a->WhenDead([&](creature::Creature &b) { (*this)(b); });
-                                       break;
-                               }
-                       }
-               }
-       }
-
-       world::Planet &planet;
-       app::Application &app;
-       app::MasterState &state;
-};
-}
-
 int main(int argc, char *argv[]) {
        app::Init init(true, 8);
        app::Assets assets;
@@ -101,8 +71,6 @@ int main(int argc, char *argv[]) {
        state.GetTimePanel().SetBody(planet);
 
        app::Application app(init.window, init.viewport);
-       SwitchPanel swp(planet, app, state);
-       blob->WhenDead([&](creature::Creature &c) { swp(c); });
        app.PushState(&state);
        app.Run();