# HG changeset patch # User unc0rr # Date 1211668120 0 # Node ID 5d49a92c240ad3b2845c70de3e289da0b1afdbd9 # Parent 4e0c3ad89483c968b7b9ac270acd06a8feb0810d Fix chat behavior diff -r 4e0c3ad89483 -r 5d49a92c240a QTfrontend/binds.cpp --- 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 + * Copyright (c) 2005-2008 Andrey Korotaev * * 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 diff -r 4e0c3ad89483 -r 5d49a92c240a QTfrontend/binds.h --- 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 + * Copyright (c) 2005-2008 Andrey Korotaev * * 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 diff -r 4e0c3ad89483 -r 5d49a92c240a hedgewars/uChat.pas --- 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 diff -r 4e0c3ad89483 -r 5d49a92c240a hedgewars/uKeys.pas --- 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