Files
TravianZ/GameEngine
Ferywir 299e3c7338 fix(spawn): stop WW/artifact villages colliding on axis tiles [#301] (#308)
generateBase()'s four sector predicates overlapped on the axes: a tile
with x = 0 or y = 0 satisfied two of them (e.g. both "x <= 0" and
"x >= 0" matched x = 0). createWWVillages() and addArtifactVillages()
generate a whole batch in one go and only flip occupied = 0 -> 1 at the
very end (setFieldTaken()), so two sectors could each select the SAME
axis tile and assign its wref to two different villages. The duplicate
addVillage() insert then violated the vdata PRIMARY KEY(wref); under the
PHP 8.1+ mysqli exception mode this threw and aborted generateVillages()
before setFieldTaken()/addResourceFields()/addUnits() ran. The result:
the villages existed in vdata (and showed up under the Natars profile)
but their map tile was never marked occupied and had no resource fields
or troops, so the map still rendered an "abandoned valley" (issue #301).

Make the four sectors mutually exclusive by using a strict bound on one
side of each axis, so every tile belongs to exactly one sector and no
wref can be handed out twice within a batch.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 11:54:23 +03:00
..
2026-06-29 11:42:22 +03:00
2026-06-29 08:02:09 +03:00
2026-05-15 08:17:14 +03:00
2026-06-29 08:02:09 +03:00
2026-05-07 08:24:40 +03:00
2026-05-28 12:25:28 +03:00
2026-06-29 08:02:09 +03:00
2026-05-15 08:17:14 +03:00
2026-05-15 08:17:14 +03:00
2026-06-09 15:15:27 +03:00
2026-05-15 08:17:14 +03:00
2026-06-29 07:49:49 +03:00
2026-05-15 08:17:14 +03:00
2026-06-29 08:02:09 +03:00
2026-06-29 08:02:09 +03:00
2026-06-29 08:02:09 +03:00