fix typos and incorrect documentation
This commit is contained in:
parent
2a27eaec6a
commit
1eeaf80a93
1 changed files with 6 additions and 6 deletions
|
@ -430,21 +430,21 @@ impl Overworld {
|
||||||
chunk.get_tile(local_chunk_coords).unwrap()
|
chunk.get_tile(local_chunk_coords).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over all generated tiles and its engine/world cordinates. using a [`Tile`] at the given world coordinates, or `None` if that tile has not
|
/// Iterate over all generated tiles in all generated chunks and their engine/world
|
||||||
/// been generated yet.
|
/// cordinates.
|
||||||
pub fn iter_tiles(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
|
pub fn iter_tiles(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
|
||||||
self.iter_tilese_private().map(|(coords, tile)| {
|
self.iter_tiles_private().map(|(coords, tile)| {
|
||||||
let mut w_coords = coords;
|
let mut w_coords = coords;
|
||||||
w_coords.y *= -1;
|
w_coords.y *= -1;
|
||||||
(w_coords, tile)
|
(w_coords, tile)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// iterate over all tiles and its global coords
|
/// Iterate over all generated tiles in all generated chunks.
|
||||||
fn iter_tilese_private(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
|
fn iter_tiles_private(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
|
||||||
self.chunks.iter().flat_map(|(chunk_coords, chunk)| {
|
self.chunks.iter().flat_map(|(chunk_coords, chunk)| {
|
||||||
chunk.iter_tiles().map(|(local_coords, tile)| {
|
chunk.iter_tiles().map(|(local_coords, tile)| {
|
||||||
// never fail because chunksize fits alswas into i32
|
// never fail because chunksize fits always into i32
|
||||||
let local_coords: IVec2 = local_coords.try_into().unwrap();
|
let local_coords: IVec2 = local_coords.try_into().unwrap();
|
||||||
(local_coords + (*chunk_coords * CHUNK_SIZE as i32), tile)
|
(local_coords + (*chunk_coords * CHUNK_SIZE as i32), tile)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue