Skip to content

Commit

Permalink
Fixed PIDtest bug
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
josemam committed Oct 10, 2016
1 parent 69f5dd2 commit 2d18559
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2d18559

Please sign in to comment.