From e7e82817c495d2dfc91e3751a04b04f1ad6c3872 Mon Sep 17 00:00:00 2001 From: vietdungdev Date: Mon, 8 Jun 2026 21:12:58 +0700 Subject: [PATCH] improve terror zone --- pkg/memory/terrorzones.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/memory/terrorzones.go b/pkg/memory/terrorzones.go index 3c07607..176ce0b 100644 --- a/pkg/memory/terrorzones.go +++ b/pkg/memory/terrorzones.go @@ -5,14 +5,20 @@ import ( ) func (gd *GameReader) TerrorZones() (areas []area.ID) { + const maxActiveZoneCount = 16 + structPtr := gd.moduleBaseAddressPtr + gd.offset.TZ zonesPtr := uintptr(gd.ReadUInt(structPtr, Uint64)) actualActiveZoneCount := int(gd.ReadUInt(structPtr+0x8, Uint8)) + if zonesPtr == 0 || actualActiveZoneCount <= 0 || actualActiveZoneCount > maxActiveZoneCount { + return nil + } for i := 0; i < actualActiveZoneCount; i++ { tzArea := gd.ReadUInt(zonesPtr+uintptr(i*Uint32), Uint32) - if tzArea != 0 { - areas = append(areas, area.ID(tzArea)) + id := area.ID(tzArea) + if id.CanBeTerrorized() { + areas = append(areas, id) } }