src/misc_gui.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
equal deleted inserted replaced
9912:1ac8aac92385 9913:e79cd19772dd
    33 #include "tgp.h"
    33 #include "tgp.h"
    34 #include "settings.h"
    34 #include "settings.h"
    35 #include "date.h"
    35 #include "date.h"
    36 #include "cargotype.h"
    36 #include "cargotype.h"
    37 #include "player_face.h"
    37 #include "player_face.h"
    38 
    38 #include "fileio.h"
       
    39 
       
    40 #include "fileio.h"
    39 #include "fios.h"
    41 #include "fios.h"
    40 /* Variables to display file lists */
    42 /* Variables to display file lists */
    41 FiosItem *_fios_list;
    43 FiosItem *_fios_list;
    42 int _saveload_mode;
    44 int _saveload_mode;
    43 
    45 
   118 	SetDParam(0, STR_01A6_N_A);
   120 	SetDParam(0, STR_01A6_N_A);
   119 	if (td.owner != OWNER_NONE && td.owner != OWNER_WATER) GetNameOfOwner(td.owner, tile);
   121 	if (td.owner != OWNER_NONE && td.owner != OWNER_WATER) GetNameOfOwner(td.owner, tile);
   120 	GetString(_landinfo_data[1], STR_01A7_OWNER, lastof(_landinfo_data[1]));
   122 	GetString(_landinfo_data[1], STR_01A7_OWNER, lastof(_landinfo_data[1]));
   121 
   123 
   122 	str = STR_01A4_COST_TO_CLEAR_N_A;
   124 	str = STR_01A4_COST_TO_CLEAR_N_A;
   123 	if (!CmdFailed(costclear)) {
   125 	if (CmdSucceeded(costclear)) {
   124 		SetDParam(0, costclear);
   126 		SetDParam(0, costclear);
   125 		str = STR_01A5_COST_TO_CLEAR;
   127 		str = STR_01A5_COST_TO_CLEAR;
   126 	}
   128 	}
   127 	GetString(_landinfo_data[2], str, lastof(_landinfo_data[2]));
   129 	GetString(_landinfo_data[2], str, lastof(_landinfo_data[2]));
   128 
   130 
  1394 
  1396 
  1395 	SetDParam(0, p->name_1);
  1397 	SetDParam(0, p->name_1);
  1396 	SetDParam(1, p->name_2);
  1398 	SetDParam(1, p->name_2);
  1397 	SetDParam(2, _date);
  1399 	SetDParam(2, _date);
  1398 	GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
  1400 	GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
       
  1401 	SanitizeFilename(_edit_str_buf);
  1399 }
  1402 }
  1400 
  1403 
  1401 extern void StartupEngines();
  1404 extern void StartupEngines();
  1402 
  1405 
  1403 static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
  1406 static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
  1404 {
  1407 {
  1405 	static FiosItem o_dir;
  1408 	static FiosItem o_dir;
  1406 
  1409 
  1407 	switch (e->event) {
  1410 	switch (e->event) {
  1408 	case WE_CREATE: { // Set up OPENTTD button
  1411 	case WE_CREATE: // Set up OPENTTD button
  1409 		o_dir.type = FIOS_TYPE_DIRECT;
  1412 		o_dir.type = FIOS_TYPE_DIRECT;
  1410 		switch (_saveload_mode) {
  1413 		switch (_saveload_mode) {
  1411 			case SLD_SAVE_GAME:
  1414 			case SLD_SAVE_GAME:
  1412 			case SLD_LOAD_GAME:
  1415 			case SLD_LOAD_GAME:
  1413 				ttd_strlcpy(&o_dir.name[0], _paths.save_dir, sizeof(o_dir.name));
  1416 				FioGetDirectory(o_dir.name, lengthof(o_dir.name), SAVE_DIR);
  1414 				break;
  1417 				break;
  1415 
  1418 
  1416 			case SLD_SAVE_SCENARIO:
  1419 			case SLD_SAVE_SCENARIO:
  1417 			case SLD_LOAD_SCENARIO:
  1420 			case SLD_LOAD_SCENARIO:
  1418 				ttd_strlcpy(&o_dir.name[0], _paths.scenario_dir, sizeof(o_dir.name));
  1421 				FioGetDirectory(o_dir.name, lengthof(o_dir.name), SCENARIO_DIR);
  1419 				break;
  1422 				break;
  1420 
  1423 
  1421 			case SLD_LOAD_HEIGHTMAP:
  1424 			case SLD_LOAD_HEIGHTMAP:
  1422 				ttd_strlcpy(&o_dir.name[0], _paths.heightmap_dir, sizeof(o_dir.name));
  1425 				FioGetDirectory(o_dir.name, lengthof(o_dir.name), HEIGHTMAP_DIR);
  1423 				break;
  1426 				break;
  1424 
  1427 
  1425 			default:
  1428 			default:
  1426 				ttd_strlcpy(&o_dir.name[0], _paths.personal_dir, sizeof(o_dir.name));
  1429 				ttd_strlcpy(o_dir.name, _personal_dir, lengthof(o_dir.name));
  1427 		}
  1430 		}
  1428 		break;
  1431 		break;
  1429 		}
       
  1430 
  1432 
  1431 	case WE_PAINT: {
  1433 	case WE_PAINT: {
  1432 		int pos;
  1434 		int pos;
  1433 		int y;
  1435 		int y;
  1434 
  1436