hedgewars/uChat.pas
changeset 6893 69cc0166be8d
parent 6854 873929cbd54b
child 6898 344b0dbd9690
--- a/hedgewars/uChat.pas	Thu Apr 19 18:15:03 2012 +0200
+++ b/hedgewars/uChat.pas	Thu Apr 19 23:36:20 2012 +0400
@@ -52,7 +52,8 @@
     ChatReady: boolean;
     showAll: boolean;
 
-const colors: array[#1..#6] of TSDL_Color = (
+const colors: array[#0..#6] of TSDL_Color = (
+    (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything
     (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
     (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
     (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
@@ -272,7 +273,7 @@
 end;
 
 procedure KeyPressChat(Key: Longword);
-const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
+const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0);
 var i, btw: integer;
     utf8: shortstring;
 begin
@@ -322,7 +323,7 @@
         Key:= Key shr 6
         end;
 
-    utf8:= char(Key or firstByteMark[btw]) + utf8;
+    utf8:= char(Key or firstByteMark[Pred(btw)]) + utf8;
 
     if byte(InputStr.s[0]) + btw > 240 then
         exit;