From 2d185597ca22e668c85e112bb439a37752f732bc Mon Sep 17 00:00:00 2001 From: josemam Date: Mon, 10 Oct 2016 17:09:14 +0200 Subject: [PATCH] Fixed PIDtest bug Nearly half of the results of any IV to PID search were lost due to the whacky behaviour of the % operator for negative inputs (-1 % n returns -1, not n-1). --- src/func.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/func.cpp b/src/func.cpp index c2706f9..4deb105 100644 --- a/src/func.cpp +++ b/src/func.cpp @@ -35,7 +35,7 @@ IVtester GetIVtester(bool exact) { } bool PIDtest(uint32_t pid, int nature, int ability) { - return (nature == -1 || (int) pid%25 == nature) && (ability == 2 || (int) pid%2 == ability); + return (nature == -1 || (int) (pid%25) == nature) && (ability == 2 || (int) (pid%2) == ability); } bool HPpretest(uint16_t iv, int hpt, int hpp) {