diff --git a/intra.cpp b/intra.cpp index 521cb487..ef5b8393 100644 --- a/intra.cpp +++ b/intra.cpp @@ -726,6 +726,29 @@ EX void kill(int id) { println(hlog, isize(to_remove), " connections and ", isize(to_erase_cell), " cells erased"); } +EX set need_to_save; + +EX void prepare_need_to_save() { + need_to_save.clear(); + map parent; + vector q; + cell *s = mapstream::save_start(); + parent[s] = s; + q = {s}; + for(int i=0; i=0; i--) { + cell *c = q[i]; + if(c == cwt.at) need_to_save.insert(c); + for(auto& p: connections) if(p.first.at == c) need_to_save.insert(c); + if(need_to_save.count(c)) need_to_save.insert(parent[c]); + } + println(hlog, "need to save ", isize(need_to_save), " out of ", isize(q), " cells"); + } + auto hooks1 = addHook(hooks_o_key, 90, [] (o_funcs& v) { if(intra::in) v.push_back(named_dialog(XLAT("manage portals"), show_portals)); diff --git a/mapeditor.cpp b/mapeditor.cpp index 1d9614cd..2aebea61 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -702,6 +702,7 @@ EX namespace mapstream { } addToQueue(save_start()); + if(intra::in) intra::prepare_need_to_save(); for(int i=0; ibardir); f.write(c->wparam); f.write(c->landparam); f.write_char(c->stuntime); f.write_char(c->hitpoints); + bool blocked = false; + if(intra::in && isWall3(c) && !intra::need_to_save.count(c)) blocked = true; + if(!blocked) for(int j=0; jtype; j++) { cell *c2 = c->move(j); if(c2 && c2->land != laNone) addToQueue(c2);