OSDN Git Service

Add artifact, Orb of Fate.
[hengband/hengband.git] / src / main-win.c
index 9b6eae2..835fe8e 100644 (file)
@@ -1236,6 +1236,8 @@ static void load_prefs_aux(int i)
        int wid, hgt, posx, posy;
        int dispx = GetSystemMetrics( SM_CXVIRTUALSCREEN);
        int dispy = GetSystemMetrics( SM_CYVIRTUALSCREEN);
+       posx=0;
+       posy=0;
        
        /* Make section name */
        sprintf(sec_name, "Term-%d", i);
@@ -2279,7 +2281,7 @@ static errr Term_xtra_win_sound(int v)
        if (i == 0) return (1);
 
        /* Build the path */
-       path_build(buf, 1024, ANGBAND_DIR_XTRA_SOUND, sound_file[v][Rand_simple(i)]);
+       path_build(buf, 1024, ANGBAND_DIR_XTRA_SOUND, sound_file[v][Rand_external(i)]);
 
 #ifdef WIN32
 
@@ -5337,6 +5339,19 @@ static void init_stuff(void)
        /* validate_dir(ANGBAND_DIR_XTRA_HELP); */
 }
 
+bool is_already_running()
+{
+       bool result = FALSE;
+       HANDLE hMutex;
+
+       hMutex = CreateMutex(NULL, TRUE, VERSION_NAME);
+       if (GetLastError() == ERROR_ALREADY_EXISTS)
+       {
+               result = TRUE;
+       }
+       return result;
+}
+
 
 int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
                       LPSTR lpCmdLine, int nCmdShow)
@@ -5352,6 +5367,17 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
 
        /* Save globally */
        hInstance = hInst;
+       
+       
+       /* Prevent multiple run */
+       if (is_already_running())
+       {
+               MessageBox(NULL,
+                               _("ÊѶòÈÚÅܤϤ¹¤Ç¤Ëµ¯Æ°¤·¤Æ¤¤¤Þ¤¹¡£", "Hengband is already running."), 
+                               _("¥¨¥é¡¼¡ª", "Error") ,
+                               MB_ICONEXCLAMATION | MB_OK | MB_ICONSTOP);
+               return FALSE;
+       }
 
        /* Initialize */
        if (hPrevInst == NULL)