summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-03-05 21:03:09 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-03-05 21:03:09 -0500
commitc86c8e440af09e3b1a8b1286f1fb837cba25a302 (patch)
tree249d66dc166931037e425d122af1fa138e93af18
parenta0f6cd976b8661eb608794ae169185b45b1b0a88 (diff)
downloadfourpuzzle-c86c8e440af09e3b1a8b1286f1fb837cba25a302.tar.gz
fourpuzzle-c86c8e440af09e3b1a8b1286f1fb837cba25a302.tar.bz2
fourpuzzle-c86c8e440af09e3b1a8b1286f1fb837cba25a302.zip
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.
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/window/SystemGraphic.java5
1 files changed, 4 insertions, 1 deletions
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 {
74 if (color < 10) 74 if (color < 10)
75 { 75 {
76 return systemGraphic.getSubimage(color*16, 48, 16, 16); 76 return systemGraphic.getSubimage(color*16, 48, 16, 16);
77 } else if (color < 20)
78 {
79 return systemGraphic.getSubimage((color-10)*16, 64, 16, 16);
77 } else { 80 } else {
78 return systemGraphic.getSubimage(color*16, 64, 16, 16); 81 throw new IllegalArgumentException("Color must be in the range of 0 to 19");
79 } 82 }
80 } 83 }
81 84