hedgewars/uChat.pas
changeset 949 866729775535
parent 948 5d49a92c240a
child 950 feb18ec0c5c2
--- a/hedgewars/uChat.pas	Sat May 24 22:28:40 2008 +0000
+++ b/hedgewars/uChat.pas	Sun May 25 14:09:44 2008 +0000
@@ -24,6 +24,8 @@
 procedure DrawChat;
 procedure KeyPressChat(Key: Longword);
 
+var UserNick: shortstring = '';
+
 implementation
 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys;
 
@@ -35,7 +37,6 @@
 		Tex: PTexture;
 		end;
 
-
 var Strs: array[0 .. MaxStrIndex] of TChatLine;
 	lastStr: Longword = 0;
 	visibleCount: Longword = 0;
@@ -110,7 +111,7 @@
 procedure KeyPressChat(Key: Longword);
 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
 var i, btw: integer;
-    utf8: shortstring;
+    utf8, s: shortstring;
 begin
 if Key <> 0 then
 	case Key of
@@ -122,8 +123,9 @@
 		13, 271: begin
 			if Length(InputStr.s) > 0 then
 				begin
-				AddChatString(InputStr.s);
-				ParseCommand('/say ' + InputStr.s, true);
+				s:= UserNick + ': ' + InputStr.s;
+				AddChatString(s);
+				ParseCommand('/say ' + s, true);
 				SetLine(InputStr, '')
 				end;
 			FreezeEnterKey;