From 0e13989f9c13e878f72d342acae296838cfc833e Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 28 Dec 2022 17:54:09 +0300 Subject: [PATCH] Fix critter lists sorting functions --- src/combat_ai.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/combat_ai.cc b/src/combat_ai.cc index 04837f5..c8a4a4e 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -1270,9 +1270,9 @@ static int _compare_nearer(const void* a1, const void* a2) if (object1 == NULL && object2 == NULL) { return 0; - } else if (object1 != NULL) { + } else if (object1 != NULL && object2 == NULL) { return -1; - } else if (object2 != NULL) { + } else if (object1 == NULL && object2 != NULL) { return 1; } @@ -1307,9 +1307,9 @@ static int _compare_strength(const void* a1, const void* a2) if (object1 == NULL && object2 == NULL) { return 0; - } else if (object1 != NULL) { + } else if (object1 != NULL && object2 == NULL) { return -1; - } else if (object2 != NULL) { + } else if (object1 == NULL && object2 != NULL) { return 1; } @@ -1343,9 +1343,9 @@ static int _compare_weakness(const void* a1, const void* a2) if (object1 == NULL && object2 == NULL) { return 0; - } else if (object1 != NULL) { + } else if (object1 != NULL && object2 == NULL) { return -1; - } else if (object2 != NULL) { + } else if (object1 == NULL && object2 != NULL) { return 1; }