mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	Archimedean tilings are now saved correctly in map editor and texture mode
This commit is contained in:
		| @@ -132,6 +132,12 @@ namespace mapstream { | |||||||
|         save(fgeomextras[current_extra].current_prime_id); |         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; i<size; i++) save(symbol[i]); | ||||||
|  |       } | ||||||
|     addToQueue((bounded || euclid) ? currentmap->gamestart() : cwt.at->master->c7); |     addToQueue((bounded || euclid) ? currentmap->gamestart() : cwt.at->master->c7); | ||||||
|     for(int i=0; i<isize(cellbyid); i++) { |     for(int i=0; i<isize(cellbyid); i++) { | ||||||
|       cell *c = cellbyid[i]; |       cell *c = cellbyid[i]; | ||||||
| @@ -225,6 +231,17 @@ namespace mapstream { | |||||||
|           enableFieldChange(); |           enableFieldChange(); | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  |       if(geometry == gArchimedean) { | ||||||
|  |         string& symbol = arcm::current.symbol; | ||||||
|  |         char size; | ||||||
|  |         load(size); | ||||||
|  |         symbol.resize(size); | ||||||
|  |         for(int i=0; i<size; i++) load(symbol[i]); | ||||||
|  |         arcm::current.parse(); | ||||||
|  |         if(arcm::current.errors > 0) { | ||||||
|  |           printf("Errors! %s\n", arcm::current.errormsg.c_str()); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|      |      | ||||||
|     resetGeometry(); |     resetGeometry(); | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								textures.cpp
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								textures.cpp
									
									
									
									
									
								
							| @@ -785,6 +785,8 @@ saverlist texturesavers; | |||||||
|  |  | ||||||
| bool target_nonbitru; | bool target_nonbitru; | ||||||
|  |  | ||||||
|  | string csymbol; | ||||||
|  |  | ||||||
| void init_textureconfig() { | void init_textureconfig() { | ||||||
| #if CAP_CONFIG | #if CAP_CONFIG | ||||||
|   texturesavers = move(savers);   |   texturesavers = move(savers);   | ||||||
| @@ -827,6 +829,8 @@ void init_textureconfig() { | |||||||
|   addsaver(config.texturename, "texture filename", ""); |   addsaver(config.texturename, "texture filename", ""); | ||||||
|   addsaver(config.texture_tuner, "texture tuning", ""); |   addsaver(config.texture_tuner, "texture tuning", ""); | ||||||
|    |    | ||||||
|  |   addsaver(csymbol, "symbol", ""); | ||||||
|  |    | ||||||
|   swap(texturesavers, savers); |   swap(texturesavers, savers); | ||||||
| #endif | #endif | ||||||
|   } |   } | ||||||
| @@ -854,6 +858,9 @@ bool texture_config::save() { | |||||||
|   cell *ctr = euclid ? centerover.at : viewctr.at->c7; |   cell *ctr = euclid ? centerover.at : viewctr.at->c7; | ||||||
|   si_save = patterns::getpatterninfo0(ctr); |   si_save = patterns::getpatterninfo0(ctr); | ||||||
|    |    | ||||||
|  |   if(archimedean) csymbol = arcm::current.symbol; | ||||||
|  |   else csymbol = ""; | ||||||
|  |    | ||||||
|   for(auto s: texturesavers) if(s->dosave()) |   for(auto s: texturesavers) if(s->dosave()) | ||||||
|     fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str()); |     fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str()); | ||||||
|    |    | ||||||
| @@ -880,6 +887,16 @@ bool texture_config::load() { | |||||||
|     dynamicval<int> d2(patterns::subpattern_flags, patterns::subpattern_flags); |     dynamicval<int> d2(patterns::subpattern_flags, patterns::subpattern_flags); | ||||||
|  |  | ||||||
|     if(targetgeometry != geometry) { |     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); |       stop_game_and_switch_mode(rg::geometry); | ||||||
|       start_game(); |       start_game(); | ||||||
|       return config.load(); |       return config.load(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue