]> skyeroc.xyz Git - dgamelaunch/commitdiff
When doing '/' in watching-menu, match player names without case, and try to find...
authorPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 17:52:12 +0000 (17:52 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 17:52:12 +0000 (17:52 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@499 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 95962e9de29c229c3a317ed949e1684113244e34..c984c61a3939cb1b74b1e8319a8add5174bcf13f 100644 (file)
@@ -504,17 +504,23 @@ inprogressmenu (int gameid)
        case '/':
            {
                int match = -1;
+              int firstmatch = -1;
+              int nmatches = 0;
                char findname[21];
               if (len <= 0) break;
                findname[0] = '\0';
               mvprintw ((btm+2+top_banner_hei), 1, "Watch which player? =>                 "); /* stupid... */
               mvaddstr ((btm+2+top_banner_hei), 1, "Watch which player? => ");
                if ((mygetnstr(findname, 20, 1) == OK) && (strlen(findname) > 1)) {
+                  int mlen = strlen(findname);
                    for (i = 0; i < len; i++)
-                       if (!strcmp(games[i]->name, findname)) {
+                       if (!strncasecmp(games[i]->name, findname, mlen)) {
+                          if (firstmatch == -1) firstmatch = i;
                            match = i;
-                           break;
+                          nmatches++;
                        }
+                  if (nmatches > 1)
+                      match = firstmatch;
                    if (match > -1) {
                       if (!strcmp(games[match]->ttyrec_fn + strlen (games[match]->ttyrec_fn) - 6, ".nhext")) break;
                       idx = match;