Address MR 2301 review comments.

- Replace tabs with spaces in map-related i18n.
- Use `retain` in `remove_unloaded_chunks`.
This commit is contained in:
Avi Weinstock 2021-05-19 14:11:24 -04:00
parent e509a4207b
commit 6d3dcc3835
2 changed files with 4 additions and 11 deletions

View File

@ -13,8 +13,8 @@
"hud.map.dungeons": "Dungeons", "hud.map.dungeons": "Dungeons",
"hud.map.caves": "Caves", "hud.map.caves": "Caves",
"hud.map.cave": "Cave", "hud.map.cave": "Cave",
"hud.map.peaks": "Mountains", "hud.map.peaks": "Mountains",
"hud.map.voxel_map": "Voxel map", "hud.map.voxel_map": "Voxel map",
"hud.map.trees": "Giant Trees", "hud.map.trees": "Giant Trees",
"hud.map.tree": "Giant Tree", "hud.map.tree": "Giant Tree",
"hud.map.town": "Town", "hud.map.town": "Town",

View File

@ -210,15 +210,8 @@ impl VoxelMinimap {
} }
fn remove_unloaded_chunks(&mut self, terrain: &TerrainGrid) { fn remove_unloaded_chunks(&mut self, terrain: &TerrainGrid) {
let mut removals = Vec::new(); self.chunk_minimaps
for key in self.chunk_minimaps.keys() { .retain(|key, _| terrain.get_key(*key).is_some());
if terrain.get_key(*key).is_none() {
removals.push(*key);
}
}
for key in removals.into_iter() {
self.chunk_minimaps.remove(&key);
}
} }
pub fn maintain(&mut self, client: &Client, ui: &mut Ui) { pub fn maintain(&mut self, client: &Client, ui: &mut Ui) {