From 4f868faee467cbf16179f2c056ed820a89b1990d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 2 Jun 2024 17:14:41 +0200 Subject: [PATCH] improved handling of missing files in arb::run --- arbitrile.cpp | 16 ++++++++++------ mapeditor.cpp | 2 +- textures.cpp | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arbitrile.cpp b/arbitrile.cpp index 3677ffb3..0293c475 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -1637,16 +1637,20 @@ struct hrmap_arbi : hrmap { EX hrmap *new_map() { return new hrmap_arbi; } -EX void run(string fname) { +EX void run_raw(string fname) { stop_game(); + set_geometry(gArbitrary); + load(fname); + ginf[gArbitrary].tiling_name = current.name; + tes = fname; + } + +EX void run(string fname) { eGeometry g = geometry; arbi_tiling t = current; auto v = variation; - set_geometry(gArbitrary); try { - load(fname); - ginf[gArbitrary].tiling_name = current.name; - tes = fname; + run_raw(fname); } catch(hr_polygon_error& poly) { set_geometry(g); @@ -2087,7 +2091,7 @@ int readArgs() { else if(argis("-tes") || argis("-arbi")) { PHASEFROM(2); shift(); - run(args()); + run_raw(args()); } else if(argis("-tes-opt")) { arg::run_arguments(current.options); diff --git a/mapeditor.cpp b/mapeditor.cpp index 1492237a..f1578dfb 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -662,7 +662,7 @@ EX namespace mapstream { else { string s; f.read(s); - arb::run(s); + arb::run_raw(s); stop_game(); } if(rk) rulegen::prepare_rules(); diff --git a/textures.cpp b/textures.cpp index 1414f38a..eb60575b 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1098,7 +1098,7 @@ bool texture_config::load() { } #endif if(targetgeometry == gArbitrary) { - arb::run(tes); + arb::run_raw(tes); stop_game(); } set_geometry(targetgeometry);