1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-27 21:12:49 +00:00

ru:: save only edited rooms

This commit is contained in:
Zeno Rogue 2025-05-17 11:08:17 +02:00
parent 067066df40
commit da651fd5a2
3 changed files with 10 additions and 6 deletions

View File

@ -68,6 +68,7 @@ struct room {
bool which_map_rendered;
bool infile, need_rerender;
int timed_orb_end;
bool edited;
vector<unique_ptr<struct entity>> entities;
@ -84,6 +85,7 @@ struct room {
}
void initial() {
edited = false;
int ylev = where->master->distance;
if(ylev <= 0)
for(int y=room_y-6; y<room_y; y++)

View File

@ -77,11 +77,11 @@ void update_keystate() {
void editmap_frame() {
if(keyheld('1'))
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 8*sel);
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 8*sel), current_room->edited = true;
if(keyheld('2'))
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 8*sel+4);
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 8*sel+4), current_room->edited = true;
if(keyheld('3'))
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 0);
current_room->place_block_full(mousepx / block_x, mousepy / block_y, 0), current_room->edited = true;
if(keypressed('4')) pushScreen([] {
dialog::init();
dialog::addTitle("what to add", 0x4040C0, 150);
@ -92,7 +92,7 @@ void editmap_frame() {
dialog::display();
});
if(keypressed('f')) floodfill_pick(mousepx / block_x, mousepy / block_y);
if(keypressed('t')) { m.where = xy(mousepx, mousepy); m.vel = xy(0, 0); }
if(keypressed('t')) { m.where = xy(mousepx, mousepy); m.vel = xy(0, 0); current_room->edited = true; }
}
void playing_frame() {

View File

@ -22,6 +22,10 @@ void save_map(string fname) {
q.pop();
auto& r = rooms[c];
if(!r.infile) continue;
for(int i=0; i<c->type; i++) visit(c->cmove(i), c->c.spin(i));
if(!r.edited) continue;
auto inq = in_queue[c];
if(inq != -1) {
println(f, "MOVE ", c->c.spin(inq), " ", rooms[c->move(inq)].roomname);
@ -54,8 +58,6 @@ void save_map(string fname) {
}
println(f, "OK\n");
for(int i=0; i<c->type; i++) visit(c->cmove(i), c->c.spin(i));
}
}