src/settings_gui.cpp
changeset 6472 f1e70dc23fac
parent 6471 91a11d496369
child 6483 ae78fc3c6b20
equal deleted inserted replaced
6471:91a11d496369 6472:f1e70dc23fac
   322 	{  0,   1,  1, STR_682E_STEADY},
   322 	{  0,   1,  1, STR_682E_STEADY},
   323 	{  0,   1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS},
   323 	{  0,   1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS},
   324 	{  0,   1,  1, STR_6836_OFF},
   324 	{  0,   1,  1, STR_6836_OFF},
   325 	{  0,   2,  1, STR_6839_PERMISSIVE},
   325 	{  0,   2,  1, STR_6839_PERMISSIVE},
   326 };
   326 };
   327 
       
   328 static inline bool GetBitAndShift(uint32 *b)
       
   329 {
       
   330 	uint32 x = *b;
       
   331 	*b >>= 1;
       
   332 	return HASBIT(x, 0);
       
   333 }
       
   334 
   327 
   335 /*
   328 /*
   336  * A: competitors
   329  * A: competitors
   337  * B: start time in months / 3
   330  * B: start time in months / 3
   338  * C: town count (2 = high, 0 = low)
   331  * C: town count (2 = high, 0 = low)
   428 		 * that bit is set. If it is set, the button is disabled */
   421 		 * that bit is set. If it is set, the button is disabled */
   429 		disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
   422 		disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
   430 
   423 
   431 		y = GAMEDIFF_WND_TOP_OFFSET;
   424 		y = GAMEDIFF_WND_TOP_OFFSET;
   432 		for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
   425 		for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
   433 			DrawFrameRect( 5, y,  5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? FR_LOWERED : FR_NONE);
   426 			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);
   427 			DrawFrameRect(15, y, 15 + 8, y + 8, 3, HASBIT(click_b, i) ? FR_LOWERED : FR_NONE);
   435 			if (GetBitAndShift(&disabled) || (_networking && !_network_server)) {
   428 			if (HASBIT(disabled, i) || (_networking && !_network_server)) {
   436 				int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
   429 				int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
   437 				GfxFillRect( 6, y + 1,  6 + 8, y + 8, color);
   430 				GfxFillRect( 6, y + 1,  6 + 8, y + 8, color);
   438 				GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
   431 				GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
   439 			}
   432 			}
   440 
   433