mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
save_chunk: Remove a bunch of dbg!s
This commit is contained in:
parent
6d205fa8f7
commit
d2da1b39ed
1 changed files with 0 additions and 4 deletions
|
|
@ -13,7 +13,6 @@ use super::{default_chunk_tiles, loc_byte_idx_xy, Chunk, ChunkPos};
|
||||||
|
|
||||||
pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk) {
|
pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk) {
|
||||||
let reg_file_name = format_reg_file_name(pos.region());
|
let reg_file_name = format_reg_file_name(pos.region());
|
||||||
dbg!(®_file_name);
|
|
||||||
let reg_file_exists = Path::new(®_file_name).exists();
|
let reg_file_exists = Path::new(®_file_name).exists();
|
||||||
if !reg_file_exists {
|
if !reg_file_exists {
|
||||||
log::warn!("Region file doesn't exist. Going to create one.");
|
log::warn!("Region file doesn't exist. Going to create one.");
|
||||||
|
|
@ -29,7 +28,6 @@ pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk) {
|
||||||
} else {
|
} else {
|
||||||
ExistenceBitset::EMPTY
|
ExistenceBitset::EMPTY
|
||||||
};
|
};
|
||||||
dbg!(existence_bitset);
|
|
||||||
let mut region_tile_data = if reg_file_exists {
|
let mut region_tile_data = if reg_file_exists {
|
||||||
assert_eq!(f.stream_position().unwrap(), 8);
|
assert_eq!(f.stream_position().unwrap(), 8);
|
||||||
zstd::decode_all(&mut f).unwrap()
|
zstd::decode_all(&mut f).unwrap()
|
||||||
|
|
@ -39,11 +37,9 @@ pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk) {
|
||||||
// Even the zstd decompressed data should be exactly REGION_BYTES size
|
// Even the zstd decompressed data should be exactly REGION_BYTES size
|
||||||
assert_eq!(region_tile_data.len(), REGION_BYTES);
|
assert_eq!(region_tile_data.len(), REGION_BYTES);
|
||||||
let (loc_x, loc_y) = pos.local();
|
let (loc_x, loc_y) = pos.local();
|
||||||
dbg!(loc_x, loc_y);
|
|
||||||
let loc_idx = loc_idx(loc_y, loc_x);
|
let loc_idx = loc_idx(loc_y, loc_x);
|
||||||
crate::bitmanip::set_nth_bit(&mut existence_bitset.0, loc_idx as usize, true);
|
crate::bitmanip::set_nth_bit(&mut existence_bitset.0, loc_idx as usize, true);
|
||||||
let byte_idx = loc_byte_idx(loc_idx);
|
let byte_idx = loc_byte_idx(loc_idx);
|
||||||
dbg!(byte_idx);
|
|
||||||
for (i, tile) in chk.tiles.iter().enumerate() {
|
for (i, tile) in chk.tiles.iter().enumerate() {
|
||||||
let off = byte_idx + (i * TILE_BYTES);
|
let off = byte_idx + (i * TILE_BYTES);
|
||||||
region_tile_data[off..off + 2].copy_from_slice(&tile.bg.to_le_bytes());
|
region_tile_data[off..off + 2].copy_from_slice(&tile.bg.to_le_bytes());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue