mirror of
https://github.com/swarm-game/swarm.git
synced 2024-10-03 19:17:31 +03:00
c2a3220f62
Fixes a bug from #1826.
## Background
Structure definitions can be nested, in that a structure can reference and place multiple "substructures", each with an "offset", to compose something more complicated. Each placement onto a particular "base" structure is a "child". Multiple child placements atop the same base structure are "siblings".
It so happened that if a child placement with a "negative" horizontal offset preceded a sibling with non-negative offset, this would result in miscalculated placements. This had to do with the fact that "growing" the "base grid" in the negative direction means that the original "origin" (that the "offset" of subsequent placements are made with respect to) of the base grid must be shifted further right (to somewhere in the middle of the grid), rather than lying on the left edge.
Conversely, if negative offsets occurred as later siblings, then the placement would be correct (the bug would not be triggered).
## The fix
This fix ensures that sibling placements can be re-ordered without affecting the end result. There were actually two bugs:
* changes to the origin offset were not propagated between sibling placements (i.e. across iterations of [`foldlM`](
|
||
---|---|---|
.. | ||
gen | ||
normalize | ||
test | ||
validate | ||
autoplay-tutorials.sh | ||
build-game.sh | ||
play.sh | ||
remote-repl.sh |