diff --git a/arbitrile.cpp b/arbitrile.cpp index ab7af344..ec901655 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -49,18 +49,63 @@ EX arbi_tiling current; EX short& id_of(heptagon *h) { return h->zebraval; } +struct hr_polygon_error : hr_exception { + vector v; + eGeometryClass c; + int id; + hr_polygon_error(const vector& _v, int _id) : v(_v), c(cgclass), id(_id) {} + ~hr_polygon_error() noexcept(true) {} + }; + +void start_debugger(hr_polygon_error& err) { + stop_game(); + if(err.c != cgclass) { + if(err.c == gcEuclid) set_geometry(gEuclid); + if(err.c == gcHyperbolic) set_geometry(gNormal); + if(err.c == gcSphere) set_geometry(gSphere); + } + + if(specialland != laCanvas) { + canvas_default_wall = waInvisibleFloor; + patterns::whichCanvas = 'g'; + patterns::canvasback = 0xFFFFFF; + firstland = specialland = laCanvas; + } + + start_game(); + drawthemap(); + + mapeditor::drawing_tool = true; + pushScreen(mapeditor::showDrawEditor); + mapeditor::initdraw(cwt.at); + + int n = isize(err.v); + + mapeditor::dtcolor = 0xFF0000FF; + mapeditor::dtwidth = 0.02; + for(int i=0; i matrices; for(int i=0; imaster)].flags & arcm::sfLINE; @@ -523,19 +586,7 @@ EX bool pseudohept(cell *c) { EX void choose() { dialog::openFileDialog(tes, XLAT("open a tiling"), ".tes", [] () { - stop_game(); - set_geometry(gArbitrary); - try { - load(tes); - ginf[gArbitrary].tiling_name = current.name; - } - catch(hr_parse_exception& ex) { - println(hlog, "failed: ", ex.s); - set_geometry(gNormal); - start_game(); - addMessage("failed: " + ex.s); - } - start_game(); + run(tes); return true; }); }