mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-01 01:54:22 +00:00
299e3c7338
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>