From c86c8e440af09e3b1a8b1286f1fb837cba25a302 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Thu, 5 Mar 2009 21:03:09 -0500 Subject: Engine: Imposed text color limit Previously, if the client provided a message escape with an invalid color number (a.k.a. it wasn't between 0 and 19) FourPuzzle would crash with a confusing error message. This has been replaced with a more helpful message. Also, previously, the colors between 10 and 19 could not be accessed, but this has been fixed. --- src/com/fourisland/fourpuzzle/window/SystemGraphic.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/com/fourisland') diff --git a/src/com/fourisland/fourpuzzle/window/SystemGraphic.java b/src/com/fourisland/fourpuzzle/window/SystemGraphic.java index aa0b593..163f097 100755 --- a/src/com/fourisland/fourpuzzle/window/SystemGraphic.java +++ b/src/com/fourisland/fourpuzzle/window/SystemGraphic.java @@ -74,8 +74,11 @@ public class SystemGraphic { if (color < 10) { return systemGraphic.getSubimage(color*16, 48, 16, 16); + } else if (color < 20) + { + return systemGraphic.getSubimage((color-10)*16, 64, 16, 16); } else { - return systemGraphic.getSubimage(color*16, 64, 16, 16); + throw new IllegalArgumentException("Color must be in the range of 0 to 19"); } } -- cgit 1.4.1