diff options
-rw-r--r-- | client/main.ha | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/client/main.ha b/client/main.ha index 9f43aaf..3279fb0 100644 --- a/client/main.ha +++ b/client/main.ha @@ -106,6 +106,8 @@ export fn main() void = { if (did_move) { packet_reader::send(conn, camera_pos: packet_reader::packet_position)!; + request_visible_chunks(pictures, conn, camera_pos); + }; const n = poll::poll(pollfd, poll::NONBLOCK)!; @@ -237,11 +239,17 @@ 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; - fmt::printfln("investigating {},{}", world_pos.0, world_pos.1)!; + if (!is_picture_visible(camera_pos, world_pos)) { + fmt::printfln("invisible {},{}", world_pos.0, world_pos.1)!; + continue; + }; + fmt::printfln("visible {},{}, checking availability", world_pos.0, world_pos.1)!; match (find_chunk(pictures,world_pos)) { - case *drawing::picture => yield; + case *drawing::picture => + fmt::printfln("\talready got that one")!; + yield; case null => - fmt::printfln("requesting {},{}", world_pos.0, world_pos.1)!; + fmt::printfln("\trequesting {},{}", world_pos.0, world_pos.1)!; packet_reader::send(conn, world_pos: packet_reader::packet_reqchunk)!; }; }; |