Resolve a number of TODOs.

This commit is contained in:
Major-
2015-03-03 07:43:45 +00:00
parent f2130076b7
commit 7a6132d856
9 changed files with 14 additions and 16 deletions
@@ -122,13 +122,13 @@ public final class NpcDefinitionDecoder {
buffer.getShort(); buffer.getShort();
} else if (opcode == 106) { } else if (opcode == 106) {
@SuppressWarnings("unused") @SuppressWarnings("unused")
int morphVariableBitsIndex = wrapMorphism(buffer.getShort()); int morphVariableBitsIndex = wrap(buffer.getShort());
@SuppressWarnings("unused") @SuppressWarnings("unused")
int morphismCount = wrapMorphism(buffer.getShort()); int morphismCount = wrap(buffer.getShort());
int count = buffer.get() & 0xFF; int count = buffer.get() & 0xFF;
int[] morphisms = new int[count + 1]; int[] morphisms = new int[count + 1];
Arrays.setAll(morphisms, index -> wrapMorphism(buffer.getShort())); Arrays.setAll(morphisms, index -> wrap(buffer.getShort()));
} else if (opcode == 107) { } else if (opcode == 107) {
@SuppressWarnings("unused") @SuppressWarnings("unused")
boolean clickable = false; boolean clickable = false;
@@ -137,12 +137,12 @@ public final class NpcDefinitionDecoder {
} }
/** /**
* Wraps a morphism value around, returning -1 if the specified value is 65,535. TODO name * Wraps a morphism value around, returning -1 if the specified value is 65,535.
* *
* @param value The value. * @param value The value.
* @return -1 if {@code value} is 65,535, otherwise {@code value}. * @return -1 if {@code value} is 65,535, otherwise {@code value}.
*/ */
private static int wrapMorphism(int value) { private static int wrap(int value) {
return value == 65_535 ? -1 : value; return value == 65_535 ? -1 : value;
} }
+3 -4
View File
@@ -119,7 +119,7 @@ public final class World {
private final Map<Long, Player> players = new HashMap<>(); private final Map<Long, Player> players = new HashMap<>();
/** /**
* The {@link PluginManager}. TODO: better place than here!! * The {@link PluginManager}.
*/ */
private PluginManager pluginManager; private PluginManager pluginManager;
@@ -184,7 +184,7 @@ public final class World {
} }
/** /**
* Gets the plugin manager. TODO should this be here? * Gets the plugin manager.
* *
* @return The plugin manager. * @return The plugin manager.
*/ */
@@ -252,8 +252,7 @@ public final class World {
scheduler.schedule(npcMovement); scheduler.schedule(npcMovement);
manager.start(); manager.start();
pluginManager = manager; // TODO move!! pluginManager = manager;
} }
/** /**
@@ -388,7 +388,7 @@ public final class ItemDefinition {
public void toNote() { public void toNote() {
if (isNote()) { if (isNote()) {
if (description != null && description.startsWith("Swap this note at any bank for ")) { if (description != null && description.startsWith("Swap this note at any bank for ")) {
return; // already converted TODO better way of checking? return; // already converted.
} }
ItemDefinition infoDef = lookup(noteInfoId); ItemDefinition infoDef = lookup(noteInfoId);
+1 -1
View File
@@ -686,7 +686,7 @@ public final class Player extends Mob {
*/ */
public void sendInitialMessages() { public void sendInitialMessages() {
blockSet.add(SynchronizationBlock.createAppearanceBlock(this)); blockSet.add(SynchronizationBlock.createAppearanceBlock(this));
send(new IdAssignmentMessage(index, members)); // TODO should this be sent when we reconnect? send(new IdAssignmentMessage(index, members));
sendMessage("Welcome to RuneScape."); sendMessage("Welcome to RuneScape.");
int[] tabs = InterfaceConstants.DEFAULT_INVENTORY_TABS; int[] tabs = InterfaceConstants.DEFAULT_INVENTORY_TABS;
+1 -1
View File
@@ -51,7 +51,7 @@ public final class Inventory {
/** /**
* A flag indicating if events are being fired. * A flag indicating if events are being fired.
*/ */
private boolean firingEvents = true; // TODO: make this reentrant private boolean firingEvents = true;
/** /**
* The items in this inventory. * The items in this inventory.
@@ -38,7 +38,7 @@ public final class PhasedSynchronizationTask extends SynchronizationTask {
public void run() { public void run() {
try { try {
task.run(); task.run();
} catch (Exception e) { // TODO better solution... } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// The executor suppresses any exceptions thrown as part of the task, so we catch and print here as // The executor suppresses any exceptions thrown as part of the task, so we catch and print here as
// rethrowing them does nothing. // rethrowing them does nothing.
@@ -18,7 +18,6 @@ public final class ThirdObjectActionMessageDecoder extends MessageDecoder<ThirdO
@Override @Override
public ThirdObjectActionMessage decode(GamePacket packet) { public ThirdObjectActionMessage decode(GamePacket packet) {
// TODO ripped out of some Winterlove-based server, so probably wrong
GamePacketReader reader = new GamePacketReader(packet); GamePacketReader reader = new GamePacketReader(packet);
int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE); int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int y = (int) reader.getUnsigned(DataType.SHORT); int y = (int) reader.getUnsigned(DataType.SHORT);
+1 -1
View File
@@ -13,7 +13,7 @@ public abstract class Session {
/** /**
* The channel. * The channel.
*/ */
private final Channel channel; protected final Channel channel;
/** /**
* Creates a session for the specified channel. * Creates a session for the specified channel.
@@ -34,7 +34,7 @@ public final class UpdateSession extends Session {
@Override @Override
public void destroy() { public void destroy() {
// TODO implement channel.close();
} }
@Override @Override