From: DeaDDooMER Date: Mon, 8 Apr 2019 15:00:17 +0000 (+0300) Subject: added warnings for bind/unbind X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3fa8762396f68dff9cbdc9eff6109ded0060a89b;p=d2df-sdl.git added warnings for bind/unbind --- diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 59174bf..f1b82c3 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -636,7 +636,7 @@ begin case cmd of 'bind': // bind [down [up]] - if Length(p) >= 2 then + if (Length(p) >= 2) and (Length(p) <= 4) then begin i := 0; key := LowerCase(p[1]); @@ -645,14 +645,18 @@ begin begin if Length(p) = 2 then g_Console_Add('"' + e_KeyNames[i] + '" = "' + GetCommandString(gInputBinds[i].down) + '" "' + GetCommandString(gInputBinds[i].up) + '"') - else if Length(p) >= 4 then - g_Console_BindKey(i, p[2], p[3]) - else + else if Length(p) = 3 then g_Console_BindKey(i, p[2], '') + else (* len = 4 *) + g_Console_BindKey(i, p[2], p[3]) end + else + g_Console_Add('bind: "' + p[1] + '" is not a key') end else - g_Console_Add('bind [up action]'); + begin + g_Console_Add('bind [up action]') + end; 'bindlist': for i := 0 to e_MaxInputKeys - 1 do if (gInputBinds[i].down <> nil) or (gInputBinds[i].up <> nil) then @@ -666,6 +670,8 @@ begin while (i < e_MaxInputKeys) and (key <> LowerCase(e_KeyNames[i])) do inc(i); if i < e_MaxInputKeys then g_Console_BindKey(i, '') + else + g_Console_Add('unbind: "' + p[1] + '" is not a key') end else g_Console_Add('unbind ');