mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Fixed StatList#add where stat did not exist
This commit is contained in:
parent
61ba1248e1
commit
ecd6946ffe
@ -268,9 +268,23 @@ public final class StatList {
|
||||
// max
|
||||
}
|
||||
|
||||
public int add(int list, StatGetter stat) {
|
||||
final int index = indexOf(list, stat.id(), stat.param());
|
||||
return add(index >= 0 ? index : ~index, stat.value());
|
||||
public int add(int list, StatGetter src) {
|
||||
final short stat = src.id();
|
||||
final int param = src.param();
|
||||
final int index = indexOf(list, stat, param);
|
||||
if (log.debugEnabled()) log.debug(
|
||||
"add(stat: {} ({}), this: {}, src: {})",
|
||||
stat, entry(stat), index >= 0 ? asString(index) : "null", src.debugString());
|
||||
if (index >= 0) {
|
||||
values[index] += src.value();
|
||||
return index;
|
||||
} else {
|
||||
/** TODO: possibility to speed this up with {@link #insertAt} */
|
||||
final int putIndex = put(list, stat, param, src.value());
|
||||
assert putIndex == ~index : "index(" + putIndex + ") != expected index(" + ~index + ")";
|
||||
return putIndex;
|
||||
}
|
||||
// max
|
||||
}
|
||||
|
||||
public int addAll(int list, StatList src, int srcList) {
|
||||
|
Loading…
Reference in New Issue
Block a user