refactor: remove unnecessary Client#getSettings(), use Client#getVarps()

These two methods would return the same values for a majority (if not all) of the time. The backing
arrays for both of these are synchronized when the server sends the packet to set a varp value.
This commit is contained in:
Joshua Filby
2018-03-21 17:36:31 -05:00
parent 8c7beffb46
commit 8ee3de283c
3 changed files with 2 additions and 26 deletions

View File

@@ -152,8 +152,6 @@ public interface Client extends GameEngine
int[][] getXteaKeys();
int[] getSettings();
int[] getVarps();
int getSetting(Setting setting);

View File

@@ -34,7 +34,6 @@ public class SettingsTracker
{
private final Client client;
private int[] clientSettings;
private int[] widgetSettings;
public SettingsTracker(Client client)
@@ -44,32 +43,16 @@ public class SettingsTracker
public void snapshot(ActionEvent e)
{
if (clientSettings == null || widgetSettings == null)
if (widgetSettings == null)
{
clientSettings = copy(client.getSettings());
widgetSettings = copy(client.getVarps());
log.info("Snapshotted client and widget settings");
return;
}
int[] newClientSettings = client.getSettings();
int[] newWidgetSettings = client.getVarps();
for (int i = 0; i < Math.min(clientSettings.length, newClientSettings.length); ++i)
{
int before = clientSettings[i];
int after = newClientSettings[i];
if (before == after)
{
continue;
}
log.info("Client setting index {} has changed from {} to {}: {} -> {}",
i, before, after, prettyPrintInt(before), prettyPrintInt(after));
}
for (int i = 0; i < Math.min(widgetSettings.length, newWidgetSettings.length); ++i)
{
int before = widgetSettings[i];
@@ -84,13 +67,12 @@ public class SettingsTracker
i, before, after, prettyPrintInt(before), prettyPrintInt(after));
}
clientSettings = copy(newClientSettings);
widgetSettings = copy(newWidgetSettings);
}
public void clear(ActionEvent e)
{
clientSettings = widgetSettings = null;
widgetSettings = null;
}
private static int[] copy(int[] array)

View File

@@ -77,10 +77,6 @@ public interface RSClient extends RSGameEngine, Client
@Override
byte[][][] getTileSettings();
@Import("serverVarps")
@Override
int[] getSettings();
@Import("clientVarps")
@Override
int[] getVarps();