From 3ad61e76498d4c5c026c14a8cd489bbe189dd2e1 Mon Sep 17 00:00:00 2001 From: Jens Fischer Date: Wed, 3 Jun 2015 18:31:14 +0200 Subject: [PATCH] Print an error when second byte of "swap buffers" is not 0 As discussed in #42 --- CHANGELOG.md | 3 ++- src/rv/comm/drawing/commands/DrawOption.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 374e99e4..e45d77f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,7 +80,8 @@ * logfiles are now saved in a `logfiles/` subdirectory * more helpful "disconnected" overlay in live mode (displays server IP and port) * major improvements to the behavior of windows with multi-monitor setups (among other things, dialogs are now displayed relative the the main window as opposed to always being on the primiary monitor) - * added a way to select players with the drawing API + * added a select players command to the drawing API: `| 3 | 0 | Agent/Team |` + * the swap buffers command now prints an error when the second byte does not equal 0 instead of ignoring it, making the behavior consistent with the rest of the drawing API * added a black outline for the player numbers texts * moved `config.txt` out of `resources/` into the root directory for easier access * moved build scripts to the `scripts/` subdirectory diff --git a/src/rv/comm/drawing/commands/DrawOption.java b/src/rv/comm/drawing/commands/DrawOption.java index 2bd4a5b4..6fb03c34 100644 --- a/src/rv/comm/drawing/commands/DrawOption.java +++ b/src/rv/comm/drawing/commands/DrawOption.java @@ -35,9 +35,16 @@ public class DrawOption extends Command { public DrawOption(ByteBuffer buf, Viewer viewer) { this.drawings = viewer.getDrawings(); - // currently only one type of draw option (swap buffers) int type = ByteUtil.uValue(buf.get()); - setName = getString(buf); + + switch (type) { + case SWAP_BUFFERS: + setName = getString(buf); + break; + default: + System.err.println("Unknown draw option : " + type); + setName = null; + } } @Override