diff options
Diffstat (limited to 'bench')
-rw-r--r-- | bench/bench_window.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bench/bench_window.cpp b/bench/bench_window.cpp index 70cbbbf..99d7926 100644 --- a/bench/bench_window.cpp +++ b/bench/bench_window.cpp @@ -1,3 +1,4 @@ +#include <cassert> #include <fstream> #include "bench_window.hpp" @@ -193,7 +194,22 @@ void bench_window::on_click_new_round() { .bnumber = 0 }); - lib94::init_round(warriors.data(), warriors.size()); + if (!lib94::init_round(warriors.data(), warriors.size())) { + Gtk::MessageDialog *md = new Gtk::MessageDialog("warriors do not fit in core; removing last warrior"); + md->set_transient_for(*this); + md->set_modal(); + md->signal_response().connect([md](int) {delete md;}); + md->show(); + + //is this safe? + delete warriors.back(); + warriors.pop_back(); + if (warriors.size() == 0) { + update_ui(); + return; + } + assert(lib94::init_round(warriors.data(), warriors.size())); + } core.mut.lock(); core.age_scale = std::pow(2.0 / 3.0, 1.0 / (float)warriors.size()); |