1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

intra::switching so that you can store off an intra game

This commit is contained in:
Zeno Rogue 2022-08-05 19:23:57 +02:00
parent dd0c1e6b3d
commit 7931ced3f8

View File

@ -18,6 +18,9 @@ struct intra_data {
EX vector<intra_data> data; EX vector<intra_data> data;
/** tells gamedata store that we are just storing one world */
EX bool switching;
/** index of the space we are currently in */ /** index of the space we are currently in */
EX int current; EX int current;
@ -327,6 +330,7 @@ EX connection_data* find_connection(int a, int b) {
EX void switch_to(int id) { EX void switch_to(int id) {
if(current == id) return; if(current == id) return;
dynamicval<bool> is(switching, true);
data[current].gd.storegame(); data[current].gd.storegame();
current = id; current = id;
ginf[gProduct] = data[current].gi; ginf[gProduct] = data[current].gi;
@ -435,6 +439,7 @@ EX void regenerate_full_sample_list() {
/** make currentmap into one of the spaces in intra */ /** make currentmap into one of the spaces in intra */
EX void become() { EX void become() {
dynamicval<bool> is(switching, true);
if(intra::in) { if(intra::in) {
/* let them add more spaces in this case */ /* let them add more spaces in this case */
data[current].gd.storegame(); data[current].gd.storegame();
@ -462,6 +467,7 @@ EX void become() {
EX void start(int id IS(0)) { EX void start(int id IS(0)) {
in = true; in = true;
current = id; current = id;
dynamicval<bool> is(switching, true);
data[current].gd.restoregame(); data[current].gd.restoregame();
ginf[gProduct] = data[current].gi; ginf[gProduct] = data[current].gi;
@ -782,6 +788,7 @@ EX void kill(int id) {
EX void erase_all_maps() { EX void erase_all_maps() {
println(hlog, "erase_all_maps called"); println(hlog, "erase_all_maps called");
dynamicval<bool> is(switching, true);
data[current].gd.storegame(); data[current].gd.storegame();
in = false; in = false;
for(int i=0; i<isize(data); i++) { for(int i=0; i<isize(data); i++) {