OSDN Git Service

In init_saved_floors(), only check for out-of-date save floor files if savefile is...
authorEric Branlund <ebranlund@fastmail.com>
Fri, 10 Apr 2020 06:21:40 +0000 (23:21 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Fri, 10 Apr 2020 06:21:40 +0000 (23:21 -0700)
src/floors.c

index 3965c80..e3d7200 100644 (file)
@@ -42,53 +42,55 @@ void init_saved_floors(void)
        {
                saved_floor_type *sf_ptr = &saved_floors[i];
 
-               /* File name */
-               sprintf(floor_savefile, "%s.F%02d", savefile, i);
+               if (savefile[0]) {
+                       /* File name */
+                       sprintf(floor_savefile, "%s.F%02d", savefile, i);
 
-               /* Grab permissions */
-               safe_setuid_grab();
+                       /* Grab permissions */
+                       safe_setuid_grab();
 
-               /* Try to create the file */
-               fd = fd_make(floor_savefile, mode);
+                       /* Try to create the file */
+                       fd = fd_make(floor_savefile, mode);
 
-               /* Drop permissions */
-               safe_setuid_drop();
+                       /* Drop permissions */
+                       safe_setuid_drop();
 
-               /* Failed! */
-               if (fd < 0)
-               {
-                       if (!force)
+                       /* Failed! */
+                       if (fd < 0)
                        {
+                               if (!force)
+                               {
 #ifdef JP
-                               msg_print("¥¨¥é¡¼¡§¸Å¤¤¥Æ¥ó¥Ý¥é¥ê¡¦¥Õ¥¡¥¤¥ë¤¬»Ä¤Ã¤Æ¤¤¤Þ¤¹¡£");
-                               msg_print("ÊѶòÈÚÅܤòÆó½Å¤Ëµ¯Æ°¤·¤Æ¤¤¤Ê¤¤¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£");
-                               msg_print("²áµî¤ËÊѶòÈÚÅܤ¬¥¯¥é¥Ã¥·¥å¤·¤¿¾ì¹ç¤Ï°ì»þ¥Õ¥¡¥¤¥ë¤ò");
-                               msg_print("¶¯À©Åª¤Ëºï½ü¤·¤Æ¼Â¹Ô¤ò³¤±¤é¤ì¤Þ¤¹¡£");
-                               if (!get_check("¶¯À©Åª¤Ëºï½ü¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) quit("¼Â¹ÔÃæ»ß");
+                                       msg_print("¥¨¥é¡¼¡§¸Å¤¤¥Æ¥ó¥Ý¥é¥ê¡¦¥Õ¥¡¥¤¥ë¤¬»Ä¤Ã¤Æ¤¤¤Þ¤¹¡£");
+                                       msg_print("ÊѶòÈÚÅܤòÆó½Å¤Ëµ¯Æ°¤·¤Æ¤¤¤Ê¤¤¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£");
+                                       msg_print("²áµî¤ËÊѶòÈÚÅܤ¬¥¯¥é¥Ã¥·¥å¤·¤¿¾ì¹ç¤Ï°ì»þ¥Õ¥¡¥¤¥ë¤ò");
+                                       msg_print("¶¯À©Åª¤Ëºï½ü¤·¤Æ¼Â¹Ô¤ò³¤±¤é¤ì¤Þ¤¹¡£");
+                                       if (!get_check("¶¯À©Åª¤Ëºï½ü¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) quit("¼Â¹ÔÃæ»ß");
 #else
-                               msg_print("Error: There are old temporal files.");
-                               msg_print("Make sure you are not running two game processes simultaneously.");
-                               msg_print("If the temporal files are garbages of old crashed process, ");
-                               msg_print("you can delete it safely.");
-                               if (!get_check("Do you delete old temporal files? ")) quit("Aborted.");
+                                       msg_print("Error: There are old temporal files.");
+                                       msg_print("Make sure you are not running two game processes simultaneously.");
+                                       msg_print("If the temporal files are garbages of old crashed process, ");
+                                       msg_print("you can delete it safely.");
+                                       if (!get_check("Do you delete old temporal files? ")) quit("Aborted.");
 #endif
-                               force = TRUE;
+                                       force = TRUE;
+                               }
+                       }
+                       else
+                       {
+                               /* Close the "fd" */
+                               (void)fd_close(fd);
                        }
-               }
-               else
-               {
-                       /* Close the "fd" */
-                       (void)fd_close(fd);
-               }
 
-               /* Grab permissions */
-               safe_setuid_grab();
+                       /* Grab permissions */
+                       safe_setuid_grab();
 
-               /* Simply kill the temporal file */ 
-               (void)fd_kill(floor_savefile);
+                       /* Simply kill the temporal file */
+                       (void)fd_kill(floor_savefile);
 
-               /* Drop permissions */
-               safe_setuid_drop();
+                       /* Drop permissions */
+                       safe_setuid_drop();
+               }
 
                sf_ptr->floor_id = 0;
        }