diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-06 20:38:11 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-06 20:38:11 +1000 |
commit | 21d918ebc34c24e4044423f393ecb3f1be4fd249 (patch) | |
tree | 971ffed6f3431488299b53d313f184b7d71073b2 /src/Java/gtPlusPlus/api/objects | |
parent | 6f3593f3d510458eaec3e97fa770b4d2a3cb241d (diff) | |
download | GT5-Unofficial-21d918ebc34c24e4044423f393ecb3f1be4fd249.tar.gz GT5-Unofficial-21d918ebc34c24e4044423f393ecb3f1be4fd249.tar.bz2 GT5-Unofficial-21d918ebc34c24e4044423f393ecb3f1be4fd249.zip |
$ Fixed an error in XSTR.java where the maximum bound for nextInt(x) could be 0.
$ Fixed some Aboriginal Trader Logic.
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects')
-rw-r--r-- | src/Java/gtPlusPlus/api/objects/random/XSTR.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java index 7f83df52c4..4b5b1298b6 100644 --- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java @@ -213,9 +213,14 @@ public class XSTR extends Random { */ @Override public int nextInt(final int bound) { - //if (bound <= 0) { + final int newBound; + if (bound <= 0) { + newBound = 1; //throw new RuntimeException("BadBound"); - //} + } + else { + newBound = bound; + } /*int r = next(31); int m = bound - 1; @@ -234,7 +239,7 @@ public class XSTR extends Random { this.last ^= (this.last >>> 35); this.last ^= (this.last << 4); this.seed = this.last; - final int out = (int) this.last % bound; + final int out = (int) this.last % newBound; return (out < 0) ? -out : out; } @Override |