]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
WarpZones:
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index 8067e63f5f7f4d9f62c0b2a219870f7039d444db..5958dcbf88da0eac127dcb129373a6a836bc2cc2 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -279,14 +279,14 @@ void M_ToggleMenu(int mode)
 
        if ((key_dest != key_menu && key_dest != key_menu_grabbed) || m_state != m_main)
        {
-               if(mode == 1)
-                       return;
+               if(mode == 0)
+                       return; // the menu is off, and we want it off
                M_Menu_Main_f ();
        }
        else
        {
-               if(mode == 0)
-                       return;
+               if(mode == 1)
+                       return; // the menu is on, and we want it on
                key_dest = key_game;
                m_state = m_none;
        }
@@ -817,12 +817,13 @@ static int                loadable[MAX_SAVEGAMES];
 
 static void M_ScanSaves (void)
 {
-       int             i, j, len;
+       int             i, j;
+       size_t  len;
        char    name[MAX_OSPATH];
        char    buf[SAVEGAME_COMMENT_LENGTH + 256];
        const char *t;
        qfile_t *f;
-       int             version;
+//     int             version;
 
        for (i=0 ; i<MAX_SAVEGAMES ; i++)
        {
@@ -834,11 +835,12 @@ static void M_ScanSaves (void)
                        continue;
                // read enough to get the comment
                len = FS_Read(f, buf, sizeof(buf) - 1);
-               buf[sizeof(buf) - 1] = 0;
+               len = min(len, sizeof(buf)-1);
+               buf[len] = 0;
                t = buf;
                // version
                COM_ParseToken_Simple(&t, false, false);
-               version = atoi(com_token);
+               //version = atoi(com_token);
                // description
                COM_ParseToken_Simple(&t, false, false);
                strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));