os2.c
changeset 915 013cb2d74800
parent 818 906f21e653b2
child 1301 313804601383
equal deleted inserted replaced
914:c3ad2a35b937 915:013cb2d74800
    54 
    54 
    55 static DIR *my_opendir(char *path, char *file)
    55 static DIR *my_opendir(char *path, char *file)
    56 {
    56 {
    57 	char paths[MAX_PATH];
    57 	char paths[MAX_PATH];
    58 
    58 
    59 	append_path(paths, path, file);		
    59 	append_path(paths, path, file);
    60 	return opendir(paths);
    60 	return opendir(paths);
    61 }
    61 }
    62 
    62 
    63 static void append_path(char *out, char *path, char *file)
    63 static void append_path(char *out, char *path, char *file)
    64 {
    64 {
   177 
   177 
   178 		for (disk = 1; disk < 27; ++disk)
   178 		for (disk = 1; disk < 27; ++disk)
   179 		{
   179 		{
   180 			_dos_setdrive(disk, &total);
   180 			_dos_setdrive(disk, &total);
   181 			_dos_getdrive(&disk2);
   181 			_dos_getdrive(&disk2);
   182 			
   182 
   183 			if (disk == disk2)
   183 			if (disk == disk2)
   184 			{
   184 			{
   185 				fios = FiosAlloc();
   185 				fios = FiosAlloc();
   186 				fios->type = FIOS_TYPE_DRIVE;
   186 				fios->type = FIOS_TYPE_DRIVE;
   187 				fios->title[0] = disk + 'A'-1;
   187 				fios->title[0] = disk + 'A'-1;
   297 
   297 
   298 		for (disk = 1; disk < 27; ++disk)
   298 		for (disk = 1; disk < 27; ++disk)
   299 		{
   299 		{
   300 			_dos_setdrive(disk, &total);
   300 			_dos_setdrive(disk, &total);
   301 			_dos_getdrive(&disk2);
   301 			_dos_getdrive(&disk2);
   302 			
   302 
   303 			if (disk == disk2)
   303 			if (disk == disk2)
   304 			{
   304 			{
   305 				fios = FiosAlloc();
   305 				fios = FiosAlloc();
   306 				fios->type = FIOS_TYPE_DRIVE;
   306 				fios->type = FIOS_TYPE_DRIVE;
   307 				fios->title[0] = disk + 'A'-1;
   307 				fios->title[0] = disk + 'A'-1;
   382 //  string describing the path.
   382 //  string describing the path.
   383 StringID FiosGetDescText(const char **path)
   383 StringID FiosGetDescText(const char **path)
   384 {
   384 {
   385 	struct diskfree_t free;
   385 	struct diskfree_t free;
   386 	char drive;
   386 	char drive;
   387 	
   387 
   388 	*path = _fios_path;
   388 	*path = _fios_path;
   389 	drive = *path[0] - 'A'+1;
   389 	drive = *path[0] - 'A'+1;
   390 
   390 
   391 	_getdiskfree(drive, &free);
   391 	_getdiskfree(drive, &free);
   392 
   392 
   484 void ShowInfo(const char *str)
   484 void ShowInfo(const char *str)
   485 {
   485 {
   486 	HAB hab;
   486 	HAB hab;
   487 	HMQ hmq;
   487 	HMQ hmq;
   488 	ULONG rc;
   488 	ULONG rc;
   489    
   489 
   490 	// init PM env.
   490 	// init PM env.
   491 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   491 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   492 
   492 
   493 	// display the box
   493 	// display the box
   494 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
   494 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
   501 void ShowOSErrorBox(const char *buf)
   501 void ShowOSErrorBox(const char *buf)
   502 {
   502 {
   503 	HAB hab;
   503 	HAB hab;
   504 	HMQ hmq;
   504 	HMQ hmq;
   505 	ULONG rc;
   505 	ULONG rc;
   506    
   506 
   507 	// init PM env.
   507 	// init PM env.
   508 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   508 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
   509 
   509 
   510 	// display the box
   510 	// display the box
   511 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
   511 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
   577 	_path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir);
   577 	_path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir);
   578 	_path.scenario_dir = str_fmt("%sscenario", _path.personal_dir);
   578 	_path.scenario_dir = str_fmt("%sscenario", _path.personal_dir);
   579 	_path.gm_dir = str_fmt("%sgm\\", _path.game_data_dir);
   579 	_path.gm_dir = str_fmt("%sgm\\", _path.game_data_dir);
   580 	_path.data_dir = str_fmt("%sdata\\", _path.game_data_dir);
   580 	_path.data_dir = str_fmt("%sdata\\", _path.game_data_dir);
   581 	_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
   581 	_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
   582 	
   582 
   583 #if defined CUSTOM_LANG_DIR
   583 #if defined CUSTOM_LANG_DIR
   584 	// sets the search path for lng files to the custom one
   584 	// sets the search path for lng files to the custom one
   585 	_path.lang_dir = malloc( MAX_PATH );
   585 	_path.lang_dir = malloc( MAX_PATH );
   586 	ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
   586 	ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
   587 #else
   587 #else