Fix bug where chunks outside the map counted as occupied.

This prevented sites from being placed near the edge of the map.
This commit is contained in:
Tormod G. Hellen 2022-03-12 00:53:28 +01:00
parent 87b139d32b
commit 031db61c1e
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed bug that would sometimes cause taking a screenshot to panic because a buffer was mapped a the wrong time.
- Players can no longer push waypoints around
- Sites will now also be placed near the edge of the map
## [0.12.0] - 2022-02-19

View File

@ -1031,7 +1031,7 @@ fn loc_suitable_for_site(sim: &WorldSim, loc: Vec2<i32>, site_kind: SiteKind) ->
for y in (-radius)..radius {
let check_loc =
loc + Vec2::new(x, y).map2(TerrainChunkSize::RECT_SIZE, |e, sz| e * sz as i32);
if sim.get(check_loc).map_or(true, |c| !c.sites.is_empty()) {
if sim.get(check_loc).map_or(false, |c| !c.sites.is_empty()) {
return false;
}
}