fix typos and incorrect documentation

This commit is contained in:
Dominic 2024-07-07 09:45:02 +02:00
parent 2a27eaec6a
commit 1eeaf80a93
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D

View file

@ -430,21 +430,21 @@ impl Overworld {
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
/// been generated yet.
/// Iterate over all generated tiles in all generated chunks and their engine/world
/// cordinates.
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;
w_coords.y *= -1;
(w_coords, tile)
})
}
/// iterate over all tiles and its global coords
fn iter_tilese_private(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
/// Iterate over all generated tiles in all generated chunks.
fn iter_tiles_private(&self) -> impl Iterator<Item = (IVec2, &Tile)> {
self.chunks.iter().flat_map(|(chunk_coords, chunk)| {
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();
(local_coords + (*chunk_coords * CHUNK_SIZE as i32), tile)
})