varinspector: Lazily initialize var arrays
Varcs is set during cache load, so we race it while starting
This commit is contained in:
@@ -89,22 +89,18 @@ class VarInspector extends JFrame
|
|||||||
|
|
||||||
private int lastTick = 0;
|
private int lastTick = 0;
|
||||||
|
|
||||||
private final int[] oldVarps;
|
private int[] oldVarps = null;
|
||||||
private final int[] oldVarps2;
|
private int[] oldVarps2 = null;
|
||||||
private int numVarbits = 10000;
|
private int numVarbits = 10000;
|
||||||
|
|
||||||
private final int[] oldIntVarcs;
|
private int[] oldIntVarcs = null;
|
||||||
private final String[] oldStrVarcs;
|
private String[] oldStrVarcs = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VarInspector(Client client, EventBus eventBus)
|
VarInspector(Client client, EventBus eventBus)
|
||||||
{
|
{
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
oldVarps = new int[client.getVarps().length];
|
|
||||||
oldVarps2 = new int[client.getVarps().length];
|
|
||||||
oldIntVarcs = new int[client.getIntVarcs().length];
|
|
||||||
oldStrVarcs = new String[client.getStrVarcs().length];
|
|
||||||
|
|
||||||
setTitle("RuneLite Var Inspector");
|
setTitle("RuneLite Var Inspector");
|
||||||
setIconImage(ClientUI.ICON);
|
setIconImage(ClientUI.ICON);
|
||||||
@@ -330,6 +326,14 @@ class VarInspector extends JFrame
|
|||||||
|
|
||||||
public void open()
|
public void open()
|
||||||
{
|
{
|
||||||
|
if (oldVarps == null)
|
||||||
|
{
|
||||||
|
oldVarps = new int[client.getVarps().length];
|
||||||
|
oldVarps2 = new int[client.getVarps().length];
|
||||||
|
oldIntVarcs = new int[client.getIntVarcs().length];
|
||||||
|
oldStrVarcs = new String[client.getStrVarcs().length];
|
||||||
|
}
|
||||||
|
|
||||||
System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length);
|
System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length);
|
||||||
System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length);
|
System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length);
|
||||||
System.arraycopy(client.getIntVarcs(), 0, oldIntVarcs, 0, oldIntVarcs.length);
|
System.arraycopy(client.getIntVarcs(), 0, oldIntVarcs, 0, oldIntVarcs.length);
|
||||||
|
|||||||
Reference in New Issue
Block a user