src/settings_gui.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
   113 		SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
   113 		SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
   114 		w->SetWidgetLoweredState(28, _fullscreen);
   114 		w->SetWidgetLoweredState(28, _fullscreen);
   115 
   115 
   116 		w->DrawWidgets();
   116 		w->DrawWidgets();
   117 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen
   117 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen
   118 	}	break;
   118 	} break;
   119 
   119 
   120 	case WE_CLICK:
   120 	case WE_CLICK:
   121 		switch (e->we.click.widget) {
   121 		switch (e->we.click.widget) {
   122 		case 4: case 5: /* Setup currencies dropdown */
   122 		case 4: case 5: /* Setup currencies dropdown */
   123 			w->ShowDropDownMenu(BuildCurrencyDropdown(), _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);;
   123 			w->ShowDropDownMenu(BuildCurrencyDropdown(), _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);;
   223 
   223 
   224 }
   224 }
   225 
   225 
   226 /** Change the side of the road vehicles drive on (server only).
   226 /** Change the side of the road vehicles drive on (server only).
   227  * @param tile unused
   227  * @param tile unused
       
   228  * @param flags operation to perform
   228  * @param p1 the side of the road; 0 = left side and 1 = right side
   229  * @param p1 the side of the road; 0 = left side and 1 = right side
   229  * @param p2 unused
   230  * @param p2 unused
   230  */
   231  */
   231 int32 CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   232 int32 CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   232 {
   233 {
   322 	{  0,   1,  1, STR_682E_STEADY},
   323 	{  0,   1,  1, STR_682E_STEADY},
   323 	{  0,   1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS},
   324 	{  0,   1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS},
   324 	{  0,   1,  1, STR_6836_OFF},
   325 	{  0,   1,  1, STR_6836_OFF},
   325 	{  0,   2,  1, STR_6839_PERMISSIVE},
   326 	{  0,   2,  1, STR_6839_PERMISSIVE},
   326 };
   327 };
   327 
       
   328 static inline bool GetBitAndShift(uint32 *b)
       
   329 {
       
   330 	uint32 x = *b;
       
   331 	*b >>= 1;
       
   332 	return HASBIT(x, 0);
       
   333 }
       
   334 
   328 
   335 /*
   329 /*
   336  * A: competitors
   330  * A: competitors
   337  * B: start time in months / 3
   331  * B: start time in months / 3
   338  * C: town count (2 = high, 0 = low)
   332  * C: town count (2 = high, 0 = low)
   428 		 * that bit is set. If it is set, the button is disabled */
   422 		 * that bit is set. If it is set, the button is disabled */
   429 		disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
   423 		disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
   430 
   424 
   431 		y = GAMEDIFF_WND_TOP_OFFSET;
   425 		y = GAMEDIFF_WND_TOP_OFFSET;
   432 		for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
   426 		for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
   433 			DrawFrameRect( 5, y,  5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? FR_LOWERED : FR_NONE);
   427 			DrawFrameRect( 5, y,  5 + 8, y + 8, 3, HASBIT(click_a, i) ? FR_LOWERED : FR_NONE);
   434 			DrawFrameRect(15, y, 15 + 8, y + 8, 3, GetBitAndShift(&click_b) ? FR_LOWERED : FR_NONE);
   428 			DrawFrameRect(15, y, 15 + 8, y + 8, 3, HASBIT(click_b, i) ? FR_LOWERED : FR_NONE);
   435 			if (GetBitAndShift(&disabled) || (_networking && !_network_server)) {
   429 			if (HASBIT(disabled, i) || (_networking && !_network_server)) {
   436 				int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
   430 				int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
   437 				GfxFillRect( 6, y + 1,  6 + 8, y + 8, color);
   431 				GfxFillRect( 6, y + 1,  6 + 8, y + 8, color);
   438 				GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
   432 				GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
   439 			}
   433 			}
   440 
   434 
   498 				SETBIT(_difficulty_click_a, btn);
   492 				SETBIT(_difficulty_click_a, btn);
   499 			}
   493 			}
   500 
   494 
   501 			// save value in temporary variable
   495 			// save value in temporary variable
   502 			((int*)&_opt_mod_temp.diff)[btn] = val;
   496 			((int*)&_opt_mod_temp.diff)[btn] = val;
       
   497 			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
   503 			SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
   498 			SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
       
   499 			w->LowerWidget(_opt_mod_temp.diff_level + 3);
   504 			w->SetDirty();
   500 			w->SetDirty();
   505 		}	break;
   501 		} break;
   506 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
   502 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
   507 			// temporarily change difficulty level
   503 			// temporarily change difficulty level
   508 			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
   504 			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
   509 			SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
   505 			SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
   510 			w->LowerWidget(_opt_mod_temp.diff_level + 3);
   506 			w->LowerWidget(_opt_mod_temp.diff_level + 3);
   637 	"ending_year",
   633 	"ending_year",
   638 	"smooth_economy",
   634 	"smooth_economy",
   639 	"allow_shares",
   635 	"allow_shares",
   640 	"town_growth_rate",
   636 	"town_growth_rate",
   641 	"larger_towns",
   637 	"larger_towns",
       
   638 	"initial_city_size",
   642 };
   639 };
   643 
   640 
   644 static const char *_patches_ai[] = {
   641 static const char *_patches_ai[] = {
   645 	"ainew_active",
   642 	"ainew_active",
   646 	"ai_in_multiplayer",
   643 	"ai_in_multiplayer",