Rev 171 | Rev 175 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 171 | Rev 174 | ||
|---|---|---|---|
| Line 26... | Line 26... | ||
| 26 | 26 | ||
| 27 | engineprogram_t *program;  | 
            27 | engineprogram_t *program;  | 
          
| 28 | wchar_t current_path[MAX_PATH];  | 
            28 | wchar_t current_path[MAX_PATH];  | 
          
| 29 | wchar_t widechar_buffer[1024];  | 
            29 | wchar_t widechar_buffer[1024];  | 
          
| 30 |    SYSTEM_INFO sysinfo; | 
            30 |    SYSTEM_INFO sysinfo; | 
          
| - | 31 | int attempt_index;  | 
          |
| 31 | FILE *fp;  | 
            32 | FILE *fp;  | 
          
| 32 | 33 | ||
| 33 |    // reset stuff first | 
            34 |    // reset stuff first | 
          
| 34 | player->wants_hint = false;  | 
            35 | player->wants_hint = false;  | 
          
| 35 | 36 | ||
| Line 43... | Line 44... | ||
| 43 |    // start the engine behind a bidirectional I/O pipe | 
            44 |    // start the engine behind a bidirectional I/O pipe | 
          
| 44 | GetCurrentDirectory (WCHAR_SIZEOF (current_path), current_path); // save current directory  | 
            45 | GetCurrentDirectory (WCHAR_SIZEOF (current_path), current_path); // save current directory  | 
          
| 45 | SetCurrentDirectory (chessengine_path); // temporarily set chess engine's startup directory as current directory  | 
            46 | SetCurrentDirectory (chessengine_path); // temporarily set chess engine's startup directory as current directory  | 
          
| 46 | fpipe = pipe_open (chessengine_shellcommand, L"r+");  | 
            47 | fpipe = pipe_open (chessengine_shellcommand, L"r+");  | 
          
| 47 | SetCurrentDirectory (current_path); // restore current directory  | 
            48 | SetCurrentDirectory (current_path); // restore current directory  | 
          
| - | 49 | for (attempt_index = 0; attempt_index < 10; attempt_index++)  | 
          |
| 48 | if (  | 
            50 | if (!pipe_isalive (fpipe))  | 
          
| - | 51 | Sleep (100); // wait for the pipe to come to life, stop as soon as it's alive  | 
          |
| - | 52 |       else | 
          |
| - | 53 | break; // wait for the pipe to come to life  | 
          |
| - | 54 | if ((fpipe == NULL) || (attempt_index == 10))  | 
          |
| 49 |    { | 
            55 |    { | 
          
| 50 | messagebox.hWndParent = hMainWnd;  | 
            56 | messagebox.hWndParent = hMainWnd;  | 
          
| 51 | wcscpy_s (messagebox.title, WCHAR_SIZEOF (messagebox.title), LOCALIZE (L"ImportantMessage"));  | 
            57 | wcscpy_s (messagebox.title, WCHAR_SIZEOF (messagebox.title), LOCALIZE (L"ImportantMessage"));  | 
          
| 52 | wcscpy_s (messagebox.text, WCHAR_SIZEOF (messagebox.text), LOCALIZE (L"Error_ChessEngineInitializationFailed"));  | 
            58 | wcscpy_s (messagebox.text, WCHAR_SIZEOF (messagebox.text), LOCALIZE (L"Error_ChessEngineInitializationFailed"));  | 
          
| 53 | messagebox.flags = MB_ICONWARNING | MB_OK;  | 
            59 | messagebox.flags = MB_ICONWARNING | MB_OK;  |