diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index cd35c562c7..ee7dfe0a83 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -360,18 +360,36 @@ namespace OpenRA get { return LobbyInfo.Clients.FirstOrDefault(c => c.Index == orderManager.Connection.LocalClientId); } } + static Dictionary RemapKeys = new Dictionary + { + { '!', '1' }, + { '@', '2' }, + { '#', '3' }, + { '$', '4' }, + { '%', '5' }, + { '^', '6' }, + { '&', '7' }, + { '*', '8' }, + { '(', '9' }, + { ')', '0' }, + }; + public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers ) { int sync = Game.world.SyncHash(); if( e.KeyChar == '\r' ) Game.chat.Toggle(); - else if( Game.chat.isChatting ) - Game.chat.TypeChar( e.KeyChar ); + else if (Game.chat.isChatting) + Game.chat.TypeChar(e.KeyChar); else - if( e.KeyChar >= '0' && e.KeyChar <= '9' ) - Game.controller.selection.DoControlGroup( world, - e.KeyChar - '0', modifiers ); + { + var c = RemapKeys.ContainsKey(e.KeyChar) ? RemapKeys[e.KeyChar] : e.KeyChar; + + if (c >= '0' && c <= '9') + Game.controller.selection.DoControlGroup(world, + c - '0', modifiers); + } if( sync != Game.world.SyncHash() ) throw new InvalidOperationException( "Desync in OnKeyPress" );