mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-01 23:14:06 +00:00
arb:: converted and rulegen status is now saved in save_geometry
This commit is contained in:
parent
253c5ee531
commit
0dfa361453
@ -1026,6 +1026,9 @@ EX void set_sliders() {
|
|||||||
/** convert a tessellation (e.g. Archimedean, regular, etc.) to the arb::current internal representation */
|
/** convert a tessellation (e.g. Archimedean, regular, etc.) to the arb::current internal representation */
|
||||||
EX namespace convert {
|
EX namespace convert {
|
||||||
|
|
||||||
|
EX eGeometry base_geometry;
|
||||||
|
EX eVariation base_variation;
|
||||||
|
|
||||||
struct id_record {
|
struct id_record {
|
||||||
int target; /* master of this id type */
|
int target; /* master of this id type */
|
||||||
int shift; /* sample direction 0 == our direction shift */
|
int shift; /* sample direction 0 == our direction shift */
|
||||||
@ -1219,6 +1222,21 @@ EX void convert() {
|
|||||||
arb::compute_vertex_valence();
|
arb::compute_vertex_valence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX bool in() {
|
||||||
|
return arb::in() && base_geometry != gArbitrary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** activate the converted tessellation */
|
||||||
|
EX void activate() {
|
||||||
|
if(geometry != gArbitrary) {
|
||||||
|
base_geometry = geometry;
|
||||||
|
base_variation = variation;
|
||||||
|
stop_game();
|
||||||
|
geometry = gArbitrary;
|
||||||
|
variation = eVariation::pure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EX }
|
EX }
|
||||||
|
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
|
@ -469,7 +469,17 @@ EX namespace mapstream {
|
|||||||
#if CAP_ARCM
|
#if CAP_ARCM
|
||||||
if(geometry == gArchimedean) f.write(arcm::current.symbol);
|
if(geometry == gArchimedean) f.write(arcm::current.symbol);
|
||||||
#endif
|
#endif
|
||||||
if(geometry == gArbitrary) f.write(arb::current.filename);
|
if(geometry == gArbitrary) {
|
||||||
|
f.write<bool>(rulegen::known());
|
||||||
|
f.write<bool>(arb::convert::in());
|
||||||
|
if(arb::convert::in()) {
|
||||||
|
dynamicval<eGeometry> dg(geometry, arb::convert::base_geometry);
|
||||||
|
dynamicval<eVariation> dv(variation, arb::convert::base_variation);
|
||||||
|
save_geometry(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
f.write(arb::current.filename);
|
||||||
|
}
|
||||||
if(geometry == gNil) {
|
if(geometry == gNil) {
|
||||||
f.write(S7);
|
f.write(S7);
|
||||||
f.write(nilv::nilperiod);
|
f.write(nilv::nilperiod);
|
||||||
@ -555,10 +565,20 @@ EX namespace mapstream {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(geometry == gArbitrary) {
|
if(geometry == gArbitrary) {
|
||||||
string s;
|
bool rk = vernum >= 0xA905 && f.get<bool>();
|
||||||
f.read(s);
|
bool ac = vernum >= 0xA905 && f.get<bool>();
|
||||||
arb::run(s);
|
if(ac) {
|
||||||
stop_game();
|
load_geometry(f);
|
||||||
|
arb::convert::convert();
|
||||||
|
arb::convert::activate();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
string s;
|
||||||
|
f.read(s);
|
||||||
|
arb::run(s);
|
||||||
|
stop_game();
|
||||||
|
}
|
||||||
|
if(rk) rulegen::prepare_rules();
|
||||||
}
|
}
|
||||||
#if CAP_ARCM
|
#if CAP_ARCM
|
||||||
if(geometry == gArchimedean) {
|
if(geometry == gArchimedean) {
|
||||||
|
@ -1520,7 +1520,7 @@ EX bool known() {
|
|||||||
return rules_known_for == arb::current.name;
|
return rules_known_for == arb::current.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prepare_rules() {
|
EX bool prepare_rules() {
|
||||||
if(known()) return true;
|
if(known()) return true;
|
||||||
try {
|
try {
|
||||||
generate_rules();
|
generate_rules();
|
||||||
@ -1555,7 +1555,7 @@ int args() {
|
|||||||
PHASEFROM(3);
|
PHASEFROM(3);
|
||||||
if(prepare_rules()) {
|
if(prepare_rules()) {
|
||||||
stop_game();
|
stop_game();
|
||||||
set_geometry(gArbitrary);
|
arb::convert::activate();
|
||||||
start_game();
|
start_game();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1367,6 +1367,11 @@ EX void set_geometry(eGeometry target) {
|
|||||||
if(WDIM == 2 && (cgflags & qIDEAL) && vid.always3 && vid.texture_step < 32) vid.texture_step = 32;
|
if(WDIM == 2 && (cgflags & qIDEAL) && vid.always3 && vid.texture_step < 32) vid.texture_step = 32;
|
||||||
if(sl2) nisot::geodesic_movement = true;
|
if(sl2) nisot::geodesic_movement = true;
|
||||||
|
|
||||||
|
if(geometry == gArbitrary) {
|
||||||
|
arb::convert::base_geometry = geometry;
|
||||||
|
arb::convert::base_variation = variation;
|
||||||
|
}
|
||||||
|
|
||||||
if(rotspace) {
|
if(rotspace) {
|
||||||
check_cgi(); cgi.require_basics();
|
check_cgi(); cgi.require_basics();
|
||||||
hybrid::csteps = cgi.psl_steps;
|
hybrid::csteps = cgi.psl_steps;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user