407 * that bit is set. If it is set, the button is disabled */ |
408 * that bit is set. If it is set, the button is disabled */ |
408 disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
409 disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
409 |
410 |
410 y = GAMEDIFF_WND_TOP_OFFSET; |
411 y = GAMEDIFF_WND_TOP_OFFSET; |
411 for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
412 for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
412 DrawFrameRect( 5, y, 5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? FR_LOWERED : 0); |
413 DrawFrameRect( 5, y, 5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? FR_LOWERED : FR_NONE); |
413 DrawFrameRect(15, y, 15 + 8, y + 8, 3, GetBitAndShift(&click_b) ? FR_LOWERED : 0); |
414 DrawFrameRect(15, y, 15 + 8, y + 8, 3, GetBitAndShift(&click_b) ? FR_LOWERED : FR_NONE); |
414 if (GetBitAndShift(&disabled) || (_networking && !_network_server)) { |
415 if (GetBitAndShift(&disabled) || (_networking && !_network_server)) { |
415 int color = PALETTE_MODIFIER_GREYOUT | _colour_gradient[COLOUR_YELLOW][2]; |
416 int color = PALETTE_MODIFIER_GREYOUT | _colour_gradient[COLOUR_YELLOW][2]; |
416 GfxFillRect( 6, y + 1, 6 + 8, y + 8, color); |
417 GfxFillRect( 6, y + 1, 6 + 8, y + 8, color); |
417 GfxFillRect(16, y + 1, 16 + 8, y + 8, color); |
418 GfxFillRect(16, y + 1, 16 + 8, y + 8, color); |
418 } |
419 } |
497 val = ((int*)&_opt_mod_temp.diff)[btn]; |
498 val = ((int*)&_opt_mod_temp.diff)[btn]; |
498 // if setting has changed, change it |
499 // if setting has changed, change it |
499 if (val != ((int*)&_opt_ptr->diff)[btn]) |
500 if (val != ((int*)&_opt_ptr->diff)[btn]) |
500 DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
501 DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
501 } |
502 } |
502 DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
503 DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
503 DeleteWindow(w); |
504 DeleteWindow(w); |
504 // If we are in the editor, we should reload the economy. |
505 // If we are in the editor, we should reload the economy. |
505 // This way when you load a game, the max loan and interest rate |
506 // This way when you load a game, the max loan and interest rate |
506 // are loaded correctly. |
507 // are loaded correctly. |
507 if (_game_mode == GM_EDITOR) |
508 if (_game_mode == GM_EDITOR) |
732 if (sdb->cmd == SDT_BOOLX) { |
733 if (sdb->cmd == SDT_BOOLX) { |
733 static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}}; |
734 static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}}; |
734 /* Draw checkbox for boolean-value either on/off */ |
735 /* Draw checkbox for boolean-value either on/off */ |
735 bool on = (*(bool*)var); |
736 bool on = (*(bool*)var); |
736 |
737 |
737 DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : 0); |
738 DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); |
738 SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
739 SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
739 } else { |
740 } else { |
740 int32 value; |
741 int32 value; |
741 |
742 |
742 value = (int32)ReadValue(var, sd->save.conv); |
743 value = (int32)ReadValue(var, sd->save.conv); |
928 */ |
929 */ |
929 void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right) |
930 void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right) |
930 { |
931 { |
931 int color = PALETTE_MODIFIER_GREYOUT | _colour_gradient[COLOUR_YELLOW][2]; |
932 int color = PALETTE_MODIFIER_GREYOUT | _colour_gradient[COLOUR_YELLOW][2]; |
932 |
933 |
933 DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : 0); |
934 DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : FR_NONE); |
934 DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : 0); |
935 DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE); |
935 DrawStringCentered(x + 5, y + 1, STR_6819, 0); // [<] |
936 DrawStringCentered(x + 5, y + 1, STR_6819, 0); // [<] |
936 DrawStringCentered(x + 15, y + 1, STR_681A, 0); // [>] |
937 DrawStringCentered(x + 15, y + 1, STR_681A, 0); // [>] |
937 |
938 |
938 /* Grey out the buttons that aren't clickable */ |
939 /* Grey out the buttons that aren't clickable */ |
939 if (!clickable_left) |
940 if (!clickable_left) |
959 SetDParam(1, 1); |
960 SetDParam(1, 1); |
960 DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); |
961 DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); |
961 y += 12; |
962 y += 12; |
962 |
963 |
963 // separator |
964 // separator |
964 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 2, 2) ? FR_LOWERED : 0); |
965 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 2, 2) ? FR_LOWERED : FR_NONE); |
965 x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, 0); |
966 x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, 0); |
966 DoDrawString(_str_separator, x + 4, y + 1, 6); |
967 DoDrawString(_str_separator, x + 4, y + 1, 6); |
967 y += 12; |
968 y += 12; |
968 |
969 |
969 // prefix |
970 // prefix |
970 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 4, 2) ? FR_LOWERED : 0); |
971 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 4, 2) ? FR_LOWERED : FR_NONE); |
971 x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, 0); |
972 x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, 0); |
972 DoDrawString(_custom_currency.prefix, x + 4, y + 1, 6); |
973 DoDrawString(_custom_currency.prefix, x + 4, y + 1, 6); |
973 y += 12; |
974 y += 12; |
974 |
975 |
975 // suffix |
976 // suffix |
976 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 6, 2) ? FR_LOWERED : 0); |
977 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 6, 2) ? FR_LOWERED : FR_NONE); |
977 x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, 0); |
978 x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, 0); |
978 DoDrawString(_custom_currency.suffix, x + 4, y + 1, 6); |
979 DoDrawString(_custom_currency.suffix, x + 4, y + 1, 6); |
979 y += 12; |
980 y += 12; |
980 |
981 |
981 // switch to euro |
982 // switch to euro |