mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-04 06:39:07 +02:00
Introduce ChunkCoords type
This commit is contained in:
parent
0d8b989c10
commit
48e03aa266
3 changed files with 26 additions and 10 deletions
15
src/types.rs
15
src/types.rs
|
@ -1,3 +1,5 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
pub const CHUNKS_PER_REGION: u8 = 32;
|
||||
|
||||
/// A chunk X coordinate relative to a region
|
||||
|
@ -7,3 +9,16 @@ pub struct ChunkX(pub u8);
|
|||
/// A chunk Z coordinate relative to a region
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ChunkZ(pub u8);
|
||||
|
||||
/// A pair of chunk coordinates relative to a region
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct ChunkCoords {
|
||||
pub x: ChunkX,
|
||||
pub z: ChunkZ,
|
||||
}
|
||||
|
||||
impl Debug for ChunkCoords {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "({}, {})", self.x.0, self.z.0)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue