Clearing property list will now free all stat objects

This commit is contained in:
Collin Smith 2019-04-24 02:25:15 -07:00
parent 069add223d
commit e3c07e0934
2 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,7 @@ public class PropertyList implements Iterable<Stat> {
}
public void clear() {
for (Stat stat : props.values()) Stat.free(stat);
props.clear();
}

View File

@ -3,6 +3,7 @@ package com.riiablo.item;
import com.google.common.primitives.UnsignedInts;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.Pools;
import com.riiablo.CharData;
@ -475,6 +476,14 @@ public class Stat implements Comparable<Stat>, Pool.Poolable {
return POOL.obtain()._obtain(src);
}
static void free(Stat stat) {
POOL.free(stat);
}
static void freeAll(Array<Stat> stats) {
POOL.freeAll(stats);
}
public int id;
public int param;
public ItemStatCost.Entry entry;