Fix chat behavior
authorunc0rr
Sat, 24 May 2008 22:28:40 +0000
changeset 948 5d49a92c240a
parent 947 4e0c3ad89483
child 949 866729775535
Fix chat behavior
QTfrontend/binds.cpp
QTfrontend/binds.h
hedgewars/uChat.pas
hedgewars/uKeys.pas
--- a/QTfrontend/binds.cpp	Sat May 24 21:10:49 2008 +0000
+++ b/QTfrontend/binds.cpp	Sat May 24 22:28:40 2008 +0000
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2005-2008 Andrey Korotaev <unC0Rr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/QTfrontend/binds.h	Sat May 24 21:10:49 2008 +0000
+++ b/QTfrontend/binds.h	Sat May 24 22:28:40 2008 +0000
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a worms-like game
- * Copyright (c) 2005, 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2005-2008 Andrey Korotaev <unC0Rr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/hedgewars/uChat.pas	Sat May 24 21:10:49 2008 +0000
+++ b/hedgewars/uChat.pas	Sat May 24 22:28:40 2008 +0000
@@ -25,7 +25,7 @@
 procedure KeyPressChat(Key: Longword);
 
 implementation
-uses uMisc, uStore, uConsts, SDLh, uConsole;
+uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys;
 
 const MaxStrIndex = 7;
 
@@ -119,13 +119,14 @@
 				InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
 				SetLine(InputStr, InputStr.s)
 				end;
-		13,271: begin
+		13, 271: begin
 			if Length(InputStr.s) > 0 then
 				begin
 				AddChatString(InputStr.s);
 				ParseCommand('/say ' + InputStr.s, true);
-				SetLine(InputStr, '');
+				SetLine(InputStr, '')
 				end;
+			FreezeEnterKey;
 			GameState:= gsGame
 			end
 	else
--- a/hedgewars/uKeys.pas	Sat May 24 21:10:49 2008 +0000
+++ b/hedgewars/uKeys.pas	Sat May 24 22:28:40 2008 +0000
@@ -26,6 +26,7 @@
 function KeyNameToCode(name: string): word;
 procedure ProcessKbd;
 procedure ResetKbd;
+procedure FreezeEnterKey;
 procedure InitKbdKeyTable;
 
 procedure SetBinds(var binds: TBinds);
@@ -72,7 +73,8 @@
 	if (i > 3) and (pkbd^[i] <> 0) then KbdKeyPressed:= true;
 	if (tkbd[i] = 0) and (pkbd^[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted)
 	else if (CurrentBinds[i][1] = '+')
-			and (pkbd^[i] = 0)and(tkbd[i] <> 0) then
+			and (pkbd^[i] = 0)
+			and (tkbd[i] <> 0) then
 			begin
 			s:= CurrentBinds[i];
 			s[1]:= '-';
@@ -118,6 +120,7 @@
 DefaultBinds[104]:= 'findhh';
 DefaultBinds[112]:= 'pause';
 DefaultBinds[115]:= '+speedup';
+DefaultBinds[116]:= 'chat';
 DefaultBinds[127]:= 'rotmask';
 SetDefaultBinds
 end;
@@ -132,6 +135,11 @@
 CurrentBinds:= DefaultBinds
 end;
 
+procedure FreezeEnterKey;
+begin
+tkbd[13]:= 1;
+tkbd[271]:= 1
+end;
 
 initialization