Save on room change

master
Louis Pearson 2022-02-01 00:10:51 -07:00
parent 105d7d3395
commit 50060dfa33
1 changed files with 5 additions and 1 deletions

View File

@ -329,7 +329,11 @@ export fn update() void {
if (shouldSave) save();
}
camera = @divTrunc(util.world2cell(player.pos.pos), @splat(2, @as(i32, 20))) * @splat(2, @as(i32, 20));
const newCamera = @divTrunc(util.world2cell(player.pos.pos), @splat(2, @as(i32, 20))) * @splat(2, @as(i32, 20));
if (!@reduce(.And, newCamera == camera)) {
save();
}
camera = newCamera;
map.draw(camera);
circuit.draw(camera);