From: Holger Z. <hz...@us...> - 2004-08-19 20:56:50
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21198/src/jake2/client Modified Files: Key.java Log Message: command line completion remove references to GameBase.gi from Cmd Index: Key.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Key.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Key.java 23 Jul 2004 10:02:49 -0000 1.5 --- Key.java 19 Aug 2004 20:56:41 -0000 1.6 *************** *** 26,40 **** package jake2.client; - import java.io.IOException; - import java.io.RandomAccessFile; - import jake2.Defines; import jake2.Globals; import jake2.game.Cmd; import jake2.qcommon.*; - import jake2.qcommon.Cbuf; - import jake2.qcommon.Com; import jake2.util.Lib; /** * Key --- 26,39 ---- package jake2.client; import jake2.Defines; import jake2.Globals; import jake2.game.Cmd; import jake2.qcommon.*; import jake2.util.Lib; + import java.io.IOException; + import java.io.RandomAccessFile; + import java.util.Vector; + /** * Key *************** *** 674,697 **** } static void CompleteCommand() { ! // 00166 char *cmd, *s; ! // 00167 ! // 00168 s = key_lines[edit_line]+1; ! // 00169 if (*s == '\\' || *s == '/') ! // 00170 s++; ! // 00171 ! // 00172 cmd = Cmd_CompleteCommand (s); ! // 00173 if (!cmd) ! // 00174 cmd = Cvar_CompleteVariable (s); ! // 00175 if (cmd) ! // 00176 { ! // 00177 key_lines[edit_line][1] = '/'; ! // 00178 strcpy (key_lines[edit_line]+2, cmd); ! // 00179 key_linepos = strlen(cmd)+2; ! // 00180 key_lines[edit_line][key_linepos] = ' '; ! // 00181 key_linepos++; ! // 00182 key_lines[edit_line][key_linepos] = 0; ! // 00183 return; ! // 00184 } } --- 673,719 ---- } + private static void printCompletions(String type, Vector compl) { + Com.Printf(type); + for (int i = 0; i < compl.size(); i++) { + Com.Printf((String)compl.get(i) + " "); + } + Com.Printf("\n"); + } + static void CompleteCommand() { ! ! int start = 1; ! if (key_lines[edit_line][start] == '\\' || key_lines[edit_line][start] == '/') ! start++; ! ! int end = start; ! while (key_lines[edit_line][end] != 0) end++; ! ! String s = new String(key_lines[edit_line], start, end-start); ! ! Vector cmds = Cmd.CompleteCommand(s); ! Vector vars = Cvar.CompleteVariable(s); ! ! int c = cmds.size(); ! int v = vars.size(); ! ! if ((c + v) > 1) { ! if (c > 0) printCompletions("\nCommands:\n", cmds); ! if (v > 0) printCompletions("\nVariables:\n", vars); ! return; ! } else if (c == 1) { ! s = (String)cmds.get(0); ! } else if (v == 1) { ! s = (String)vars.get(0); ! } else return; ! ! key_lines[edit_line][1] = '/'; ! byte[] bytes = s.getBytes(); ! System.arraycopy(bytes, 0, key_lines[edit_line], 2, bytes.length); ! key_linepos = bytes.length + 2; ! key_lines[edit_line][key_linepos++] = ' '; ! key_lines[edit_line][key_linepos] = 0; ! ! return; } |