diff --git a/pkg/memory/terrorzones.go b/pkg/memory/terrorzones.go index f5bcf6d..4023857 100644 --- a/pkg/memory/terrorzones.go +++ b/pkg/memory/terrorzones.go @@ -5,10 +5,12 @@ import ( ) func (gd *GameReader) TerrorZones() (areas []area.ID) { - tzPtr := uintptr(gd.ReadUInt(gd.moduleBaseAddressPtr+tzOnline, Uint64)) + structPtr := gd.moduleBaseAddressPtr + tzOnline + zonesPtr := uintptr(gd.ReadUInt(structPtr, Uint64)) + actualActiveZoneCount := int(gd.ReadUInt(structPtr+0x8, Uint8)) - for i := 0; i < 8; i++ { - tzArea := gd.ReadUInt(tzPtr+uintptr(i*Uint32), Uint32) + for i := 0; i < actualActiveZoneCount; i++ { + tzArea := gd.ReadUInt(zonesPtr+uintptr(i*Uint32), Uint32) if tzArea != 0 { areas = append(areas, area.ID(tzArea)) }