settings_gui.c
changeset 1093 4fdc46eaf423
parent 1037 4fbbb01cf87b
child 1095 b59632d9df1b
equal deleted inserted replaced
1092:e3b4a131db7c 1093:4fdc46eaf423
    15 static uint32 _difficulty_click_a;
    15 static uint32 _difficulty_click_a;
    16 static uint32 _difficulty_click_b;
    16 static uint32 _difficulty_click_b;
    17 static byte _difficulty_timeout;
    17 static byte _difficulty_timeout;
    18 
    18 
    19 extern const StringID _currency_string_list[];
    19 extern const StringID _currency_string_list[];
    20 extern uint GetMaskOfAllowedCurrencies();
    20 extern uint GetMaskOfAllowedCurrencies(void);
    21 
    21 
    22 static const StringID _distances_dropdown[] = {
    22 static const StringID _distances_dropdown[] = {
    23 	STR_0139_IMPERIAL_MILES,
    23 	STR_0139_IMPERIAL_MILES,
    24 	STR_013A_METRIC_KILOMETERS,
    24 	STR_013A_METRIC_KILOMETERS,
    25 	INVALID_STRING_ID
    25 	INVALID_STRING_ID
    53 	while (--num>=0) *p++ = base++;
    53 	while (--num>=0) *p++ = base++;
    54 	*p = INVALID_STRING_ID;
    54 	*p = INVALID_STRING_ID;
    55 	return buf;
    55 	return buf;
    56 }
    56 }
    57 
    57 
    58 static int GetCurRes()
    58 static int GetCurRes(void)
    59 {
    59 {
    60 	int i;
    60 	int i;
    61 	for(i = 0; i != _num_resolutions; i++)
    61 	for(i = 0; i != _num_resolutions; i++)
    62 		if (_resolutions[i][0] == _screen.width &&
    62 		if (_resolutions[i][0] == _screen.width &&
    63 				_resolutions[i][1] == _screen.height)
    63 				_resolutions[i][1] == _screen.height)
   267 	_game_options_widgets,
   267 	_game_options_widgets,
   268 	GameOptionsWndProc
   268 	GameOptionsWndProc
   269 };
   269 };
   270 
   270 
   271 
   271 
   272 void ShowGameOptions()
   272 void ShowGameOptions(void)
   273 {
   273 {
   274 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   274 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   275 	AllocateWindowDesc(&_game_options_desc);
   275 	AllocateWindowDesc(&_game_options_desc);
   276 }
   276 }
   277 
   277 
   326 		for(i = 0; i != GAME_DIFFICULTY_NUM; i++)
   326 		for(i = 0; i != GAME_DIFFICULTY_NUM; i++)
   327 			((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i];
   327 			((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i];
   328 	}
   328 	}
   329 }
   329 }
   330 
   330 
   331 extern void StartupEconomy();
   331 extern void StartupEconomy(void);
   332 
   332 
   333 enum {
   333 enum {
   334 	GAMEDIFF_WND_TOP_OFFSET = 45,
   334 	GAMEDIFF_WND_TOP_OFFSET = 45,
   335 	GAMEDIFF_WND_ROWSIZE    = 9
   335 	GAMEDIFF_WND_ROWSIZE    = 9
   336 };
   336 };
   504 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   504 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   505 	_game_difficulty_widgets,
   505 	_game_difficulty_widgets,
   506 	GameDifficultyWndProc
   506 	GameDifficultyWndProc
   507 };
   507 };
   508 
   508 
   509 void ShowGameDifficulty()
   509 void ShowGameDifficulty(void)
   510 {
   510 {
   511 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   511 	DeleteWindowById(WC_GAME_OPTIONS, 0);
   512 	/*	copy current settings to temporary holding place
   512 	/*	copy current settings to temporary holding place
   513 	 *	change that when setting stuff, copy back on clicking 'OK'
   513 	 *	change that when setting stuff, copy back on clicking 'OK'
   514 	 */
   514 	 */
   713 	{_patches_stations,			lengthof(_patches_stations) },
   713 	{_patches_stations,			lengthof(_patches_stations) },
   714 	{_patches_economy,			lengthof(_patches_economy) },
   714 	{_patches_economy,			lengthof(_patches_economy) },
   715 	{_patches_ai,						lengthof(_patches_ai) },
   715 	{_patches_ai,						lengthof(_patches_ai) },
   716 };
   716 };
   717 
   717 
   718 extern uint GetCurrentCurrencyRate();
   718 extern uint GetCurrentCurrencyRate(void);
   719 
   719 
   720 static int32 ReadPE(const PatchEntry*pe)
   720 static int32 ReadPE(const PatchEntry*pe)
   721 {
   721 {
   722 	switch(pe->type) {
   722 	switch(pe->type) {
   723 	case PE_BOOL:   return *(bool*)pe->variable;
   723 	case PE_BOOL:   return *(bool*)pe->variable;
  1152 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1152 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
  1153 	_patches_selection_widgets,
  1153 	_patches_selection_widgets,
  1154 	PatchesSelectionWndProc,
  1154 	PatchesSelectionWndProc,
  1155 };
  1155 };
  1156 
  1156 
  1157 void ShowPatchesSelection()
  1157 void ShowPatchesSelection(void)
  1158 {
  1158 {
  1159 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1159 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1160 	AllocateWindowDesc(&_patches_selection_desc);
  1160 	AllocateWindowDesc(&_patches_selection_desc);
  1161 }
  1161 }
  1162 
  1162 
  1279 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  1279 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  1280 	_newgrf_widgets,
  1280 	_newgrf_widgets,
  1281 	NewgrfWndProc,
  1281 	NewgrfWndProc,
  1282 };
  1282 };
  1283 
  1283 
  1284 void ShowNewgrf()
  1284 void ShowNewgrf(void)
  1285 {
  1285 {
  1286 	Window *w;
  1286 	Window *w;
  1287 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1287 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1288 	w = AllocateWindowDesc(&_newgrf_desc);
  1288 	w = AllocateWindowDesc(&_newgrf_desc);
  1289 
  1289 
  1507 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  1507 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
  1508 	_cust_currency_widgets,
  1508 	_cust_currency_widgets,
  1509 	CustCurrencyWndProc,
  1509 	CustCurrencyWndProc,
  1510 };
  1510 };
  1511 
  1511 
  1512 void ShowCustCurrency()
  1512 void ShowCustCurrency(void)
  1513 {
  1513 {
  1514 	Window *w;
  1514 	Window *w;
  1515 
  1515 
  1516 	str_separator[0] = _currency_specs[23].separator;
  1516 	str_separator[0] = _currency_specs[23].separator;
  1517 	str_separator[1] = '\0';
  1517 	str_separator[1] = '\0';