From f69731b0c4ef6fe7a330e32bb0f5cb0ce0876aeb Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 24 Oct 2020 14:02:02 +0200 Subject: [PATCH] Initialize contoller values --- SourceX/controls/plrctrls.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SourceX/controls/plrctrls.cpp b/SourceX/controls/plrctrls.cpp index b171988be..dfd0930e8 100644 --- a/SourceX/controls/plrctrls.cpp +++ b/SourceX/controls/plrctrls.cpp @@ -197,8 +197,9 @@ bool CanTargetMonster(int mi) void FindRangedTarget() { - int distance, rotations; - bool canTalk; + int rotations = 0; + int distance = 0; + bool canTalk = false; // The first MAX_PLRS monsters are reserved for players' golems. for (int mi = MAX_PLRS; mi < MAXMONSTERS; mi++) { @@ -230,8 +231,8 @@ void FindMeleeTarget() { bool visited[MAXDUNX][MAXDUNY] = { { 0 } }; int maxSteps = 25; // Max steps for FindPath is 25 - int rotations; - bool canTalk; + int rotations = 0; + bool canTalk = false; struct SearchNode { int x, y; @@ -309,7 +310,9 @@ void CheckMonstersNearby() void CheckPlayerNearby() { - int distance, newDdistance, rotations; + int newDdistance; + int rotations = 0; + int distance = 0; if (pcursmonst != -1) return; @@ -365,7 +368,8 @@ int pcursquest; void FindTrigger() { - int distance, rotations; + int rotations; + int distance = 0; if (pcursitem != -1 || pcursobj != -1) return; // Prefer showing items/objects over triggers (use of cursm* conflicts)