1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

rulegen:: fixed a bug which caused problems on MYSTERY-th state

This commit is contained in:
Zeno Rogue 2022-07-13 17:25:04 +02:00
parent 0bcf2ca0ab
commit ffdc74a0b5

View File

@ -1021,11 +1021,13 @@ EX twalker get_parent_dir(twalker& cw) {
#if HDR #if HDR
using aid_t = pair<int, int>; using aid_t = pair<int, int>;
/* for leaves, id equals MYSTERY and dir equals treestate ID for this code */
struct analyzer_state { struct analyzer_state {
int analyzer_id; int analyzer_id;
int id, dir; int id, dir;
map<int, analyzer_state*> substates; map<int, analyzer_state*> substates;
analyzer_state() { id = MYSTERY; dir = MYSTERY; } // for(int i=0; i<10; i++) substates[i] = nullptr; } analyzer_state() { id = MYSTERY; dir = MYSTERY_LARGE; } // for(int i=0; i<10; i++) substates[i] = nullptr; }
vector<twalker> inhabitants; vector<twalker> inhabitants;
}; };
@ -1391,7 +1393,7 @@ EX pair<int, int> get_code(twalker& cw) {
EX pair<int, int> get_treestate_id(twalker& cw) { EX pair<int, int> get_treestate_id(twalker& cw) {
auto co = get_code(cw); auto co = get_code(cw);
auto v = all_analyzers[co.second]; auto v = all_analyzers[co.second];
if(v->dir == MYSTERY) { if(v->dir == MYSTERY_LARGE) {
int id = isize(treestates); int id = isize(treestates);
v->dir = id; v->dir = id;
treestates.emplace_back(); treestates.emplace_back();
@ -1863,7 +1865,7 @@ EX void clean_parents() {
void clear_treestates() { void clear_treestates() {
treestates.clear(); treestates.clear();
for(auto a: all_analyzers) for(auto a: all_analyzers)
if(a->id == MYSTERY) a->dir = MYSTERY; if(a->id == MYSTERY) a->dir = MYSTERY_LARGE;
} }
EX void rules_iteration() { EX void rules_iteration() {