From 52bb744b9b605d0cbd5cc30d30709c6140c37602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Gim=C3=A9nez?= Date: Mon, 20 May 2024 21:29:15 +0900 Subject: [PATCH] sometimes the player is already loaded in memory but the map still not ready yet, so wait for it --- pkg/memory/game_reader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/memory/game_reader.go b/pkg/memory/game_reader.go index 2659531..638284e 100644 --- a/pkg/memory/game_reader.go +++ b/pkg/memory/game_reader.go @@ -65,9 +65,9 @@ func (gd *GameReader) GetData() data.Data { } func (gd *GameReader) InGame() bool { - playerUnits := gd.GetRawPlayerUnits() + player := gd.GetRawPlayerUnits().GetMainPlayer() - return playerUnits.GetMainPlayer().UnitID > 0 + return player.UnitID > 0 && player.Position.X > 0 && player.Position.Y > 0 && player.Area > 0 } func (gd *GameReader) openMenus() data.OpenMenus {