summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/main.ha12
-rw-r--r--server/main.ha2
-rw-r--r--todo3
3 files changed, 7 insertions, 10 deletions
diff --git a/client/main.ha b/client/main.ha
index 3279fb0..977827c 100644
--- a/client/main.ha
+++ b/client/main.ha
@@ -112,7 +112,6 @@ export fn main() void = {
const n = poll::poll(pollfd, poll::NONBLOCK)!;
if (n > 0) {
- fmt::println("data available")!;
packet_reader::read(&packet_reader, conn)!;
for (const packet => packet_reader::next(&packet_reader)!) {
match (packet) {
@@ -120,7 +119,6 @@ export fn main() void = {
const opc = op as drawing::op_circle;
drawing::perform(pictures, opc);
case let packet: packet_reader::packet_sendchunk =>
- fmt::println(packet.world_pos.0, packet.world_pos.1, len(packet.chunk_data))!;
assert(packet.world_pos.0 % CHUNKSIZE == 0
&& packet.world_pos.1 % CHUNKSIZE == 0, "bad chunk world pos");
const pic = find_picture_for_chunkdata(camera_pos, packet.world_pos, pictures);
@@ -200,11 +198,11 @@ fn find_picture_for_chunkdata(camera_pos: pos, world_pos: pos, pictures: []drawi
for (const pic &.. pictures) {
if (pic.world_pos.0 == world_pos.0 && pic.world_pos.1 == world_pos.1) {
- fmt::printfln("found already pic at {},{}",pic.world_pos.0, pic.world_pos.1)!;
+ // fmt::printfln("found already pic at {},{}",pic.world_pos.0, pic.world_pos.1)!;
return pic;
};
if (invisible == null && !is_picture_visible(camera_pos, pic.world_pos)) {
- fmt::printfln("can recycle pic at {},{}",pic.world_pos.0,pic.world_pos.1)!;
+ // fmt::printfln("can recycle pic at {},{}",pic.world_pos.0,pic.world_pos.1)!;
invisible = pic;
};
};
@@ -240,13 +238,13 @@ fn request_visible_chunks(pictures: []drawing::picture, conn: net::socket, camer
for (let dx = 0i32; dx < 3; dx += 1) for (let dy = 0i32; dy < 3; dy += 1) {
let world_pos = (x0+CHUNKSIZE*dx, y0+CHUNKSIZE*dy): pos;
if (!is_picture_visible(camera_pos, world_pos)) {
- fmt::printfln("invisible {},{}", world_pos.0, world_pos.1)!;
+ // fmt::printfln("invisible {},{}", world_pos.0, world_pos.1)!;
continue;
};
- fmt::printfln("visible {},{}, checking availability", world_pos.0, world_pos.1)!;
+ // fmt::printfln("visible {},{}, checking availability", world_pos.0, world_pos.1)!;
match (find_chunk(pictures,world_pos)) {
case *drawing::picture =>
- fmt::printfln("\talready got that one")!;
+ // fmt::printfln("\talready got that one")!;
yield;
case null =>
fmt::printfln("\trequesting {},{}", world_pos.0, world_pos.1)!;
diff --git a/server/main.ha b/server/main.ha
index 19ecc51..31cb6dc 100644
--- a/server/main.ha
+++ b/server/main.ha
@@ -258,6 +258,8 @@ fn floor_div(a: i32, b: i32) i32 = {
fn unload_distant_chunks(state: *server_state) void = {
const n_pics = len(state.pictures);
+ if (n_pics == 0) return;
+
let should_unload = alloc([true...], n_pics);
defer free(should_unload);
diff --git a/todo b/todo
index 15f4f09..8b13789 100644
--- a/todo
+++ b/todo
@@ -1,4 +1 @@
-multiple chunks on server
-not showing all 3x3 area
-server crashes when no chunks loaded