From be6748cbb35236f2ff282b00f2d4fd9df7f0cea7 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 22 Aug 2018 00:02:08 +0200 Subject: [PATCH] Archimedean tilings are now saved correctly in map editor and texture mode --- mapeditor.cpp | 17 +++++++++++++++++ textures.cpp | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/mapeditor.cpp b/mapeditor.cpp index 1fab0e9a..4726e6a4 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -132,6 +132,12 @@ namespace mapstream { save(fgeomextras[current_extra].current_prime_id); } } + if(geometry == gArchimedean) { + const string& symbol = arcm::current.symbol; + char size = isize(symbol); + save(size); + for(int i=0; igamestart() : cwt.at->master->c7); for(int i=0; i 0) { + printf("Errors! %s\n", arcm::current.errormsg.c_str()); + } + } } resetGeometry(); diff --git a/textures.cpp b/textures.cpp index 61ade066..b8e784ca 100644 --- a/textures.cpp +++ b/textures.cpp @@ -785,6 +785,8 @@ saverlist texturesavers; bool target_nonbitru; +string csymbol; + void init_textureconfig() { #if CAP_CONFIG texturesavers = move(savers); @@ -827,6 +829,8 @@ void init_textureconfig() { addsaver(config.texturename, "texture filename", ""); addsaver(config.texture_tuner, "texture tuning", ""); + addsaver(csymbol, "symbol", ""); + swap(texturesavers, savers); #endif } @@ -854,6 +858,9 @@ bool texture_config::save() { cell *ctr = euclid ? centerover.at : viewctr.at->c7; si_save = patterns::getpatterninfo0(ctr); + if(archimedean) csymbol = arcm::current.symbol; + else csymbol = ""; + for(auto s: texturesavers) if(s->dosave()) fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str()); @@ -880,6 +887,16 @@ bool texture_config::load() { dynamicval d2(patterns::subpattern_flags, patterns::subpattern_flags); if(targetgeometry != geometry) { + stop_game(); + if(targetgeometry == gArchimedean) { + arcm::current.symbol = csymbol; + arcm::current.parse(); + if(arcm::current.errors) { + printf("Error while reading Archimedean texture: %s\n", arcm::current.errormsg.c_str()); + addMessage("Error: " + arcm::current.errormsg); + return false; + } + } stop_game_and_switch_mode(rg::geometry); start_game(); return config.load();