Use raw varp array for get/set value in devtools

It was decided the current indirection isn't necessary
This commit is contained in:
Adam
2020-11-30 17:57:17 -05:00
parent 97f4ebf985
commit 38c9e084ed
2 changed files with 4 additions and 24 deletions

View File

@@ -773,28 +773,6 @@ public interface Client extends GameEngine
@VisibleForDevtools @VisibleForDevtools
int getVarbitValue(int[] varps, int varbitId); int getVarbitValue(int[] varps, int varbitId);
/**
* Gets the value of a given VarPlayer.
*
* @param varps passed varps
* @param varpId the VarpPlayer id
* @return the value
* @see VarPlayer#id
*/
@VisibleForDevtools
int getVarpValue(int[] varps, int varpId);
/**
* Sets the value of a given VarPlayer.
*
* @param varps passed varps
* @param varpId the VarpPlayer id
* @param value the value
* @see VarPlayer#id
*/
@VisibleForDevtools
void setVarpValue(int[] varps, int varpId, int value);
/** /**
* Sets the value of a given variable. * Sets the value of a given variable.
* *

View File

@@ -256,7 +256,8 @@ public class DevToolsPlugin extends Plugin
case "getvarp": case "getvarp":
{ {
int varp = Integer.parseInt(args[0]); int varp = Integer.parseInt(args[0]);
int value = client.getVarpValue(client.getVarps(), varp); int[] varps = client.getVarps();
int value = varps[varp];
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "VarPlayer " + varp + ": " + value, null); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "VarPlayer " + varp + ": " + value, null);
break; break;
} }
@@ -264,7 +265,8 @@ public class DevToolsPlugin extends Plugin
{ {
int varp = Integer.parseInt(args[0]); int varp = Integer.parseInt(args[0]);
int value = Integer.parseInt(args[1]); int value = Integer.parseInt(args[1]);
client.setVarpValue(client.getVarps(), varp, value); int[] varps = client.getVarps();
varps[varp] = value;
client.queueChangedVarp(varp); client.queueChangedVarp(varp);
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null);
VarbitChanged varbitChanged = new VarbitChanged(); VarbitChanged varbitChanged = new VarbitChanged();