src/os2.cpp
branchnoai
changeset 9629 66dde6412125
parent 9601 b499fdd106d5
child 9694 e72987579514
equal deleted inserted replaced
9628:b5c2449616b5 9629:66dde6412125
    10 #include "gfx.h"
    10 #include "gfx.h"
    11 #include "gui.h"
    11 #include "gui.h"
    12 #include "functions.h"
    12 #include "functions.h"
    13 #include "macros.h"
    13 #include "macros.h"
    14 #include "fileio.h"
    14 #include "fileio.h"
       
    15 #include "fios.h" // opendir/readdir/closedir
    15 
    16 
    16 #include <dirent.h>
    17 #include <dirent.h>
    17 #include <unistd.h>
    18 #include <unistd.h>
    18 #include <sys/stat.h>
    19 #include <sys/stat.h>
    19 #include <stdlib.h>
    20 #include <stdlib.h>
   122 bool FiosIsHiddenFile(const struct dirent *ent)
   123 bool FiosIsHiddenFile(const struct dirent *ent)
   123 {
   124 {
   124 	return ent->d_name[0] == '.';
   125 	return ent->d_name[0] == '.';
   125 }
   126 }
   126 
   127 
   127 void ShowInfo(const unsigned char *str)
   128 void ShowInfo(const char *str)
   128 {
   129 {
   129 	HAB hab;
   130 	HAB hab;
   130 	HMQ hmq;
   131 	HMQ hmq;
   131 	ULONG rc;
   132 	ULONG rc;
   132 
   133 
   133 	// init PM env.
   134 	// init PM env.
   134 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   135 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   135 
   136 
   136 	// display the box
   137 	// display the box
   137 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
   138 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, (const unsigned char *)str, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
   138 
   139 
   139 	// terminate PM env.
   140 	// terminate PM env.
   140 	WinDestroyMsgQueue(hmq);
   141 	WinDestroyMsgQueue(hmq);
   141 	WinTerminate(hab);
   142 	WinTerminate(hab);
   142 }
   143 }
   143 
   144 
   144 void ShowOSErrorBox(const unsigned char *buf)
   145 void ShowOSErrorBox(const char *buf)
   145 {
   146 {
   146 	HAB hab;
   147 	HAB hab;
   147 	HMQ hmq;
   148 	HMQ hmq;
   148 	ULONG rc;
   149 	ULONG rc;
   149 
   150 
   150 	// init PM env.
   151 	// init PM env.
   151 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   152 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   152 
   153 
   153 	// display the box
   154 	// display the box
   154 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
   155 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, (const unsigned char *)buf, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
   155 
   156 
   156 	// terminate PM env.
   157 	// terminate PM env.
   157 	WinDestroyMsgQueue(hmq);
   158 	WinDestroyMsgQueue(hmq);
   158 	WinTerminate(hab);
   159 	WinTerminate(hab);
   159 }
   160 }