180 if (_remove_button_clicked) { |
180 if (_remove_button_clicked) { |
181 VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_REMOVE_STATION); |
181 VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_REMOVE_STATION); |
182 VpSetPlaceSizingLimit(-1); |
182 VpSetPlaceSizingLimit(-1); |
183 } else if (_railstation.dragdrop) { |
183 } else if (_railstation.dragdrop) { |
184 VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); |
184 VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); |
185 VpSetPlaceSizingLimit(_settings.station.station_spread); |
185 VpSetPlaceSizingLimit(_settings_game.station.station_spread); |
186 } else { |
186 } else { |
187 DoCommandP(tile, |
187 DoCommandP(tile, |
188 _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), |
188 _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), |
189 _cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
189 _cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation, |
190 CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
190 CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
225 SB(p1, 4, 1, _cur_signal_variant); |
225 SB(p1, 4, 1, _cur_signal_variant); |
226 SB(p1, 5, 2, _cur_signal_type); |
226 SB(p1, 5, 2, _cur_signal_type); |
227 SB(p1, 7, 1, _convert_signal_button); |
227 SB(p1, 7, 1, _convert_signal_button); |
228 } else { |
228 } else { |
229 SB(p1, 3, 1, _ctrl_pressed); |
229 SB(p1, 3, 1, _ctrl_pressed); |
230 SB(p1, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); |
230 SB(p1, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); |
231 SB(p1, 5, 2, SIGTYPE_NORMAL); |
231 SB(p1, 5, 2, SIGTYPE_NORMAL); |
232 SB(p1, 7, 1, 0); |
232 SB(p1, 7, 1, 0); |
233 } |
233 } |
234 |
234 |
235 DoCommandP(tile, p1, 0, CcPlaySound1E, CMD_BUILD_SIGNALS | |
235 DoCommandP(tile, p1, 0, CcPlaySound1E, CMD_BUILD_SIGNALS | |
427 * @param w Build-rail toolbar window |
427 * @param w Build-rail toolbar window |
428 * @see BuildRailToolbWndProc() |
428 * @see BuildRailToolbWndProc() |
429 */ |
429 */ |
430 static void BuildRailClick_AutoSignals(Window *w) |
430 static void BuildRailClick_AutoSignals(Window *w) |
431 { |
431 { |
432 if (_settings.gui.enable_signal_gui != _ctrl_pressed) { |
432 if (_settings_client.gui.enable_signal_gui != _ctrl_pressed) { |
433 if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w); |
433 if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w); |
434 } else { |
434 } else { |
435 HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
435 HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
436 } |
436 } |
437 } |
437 } |
482 int x = _railstation.numtracks; |
482 int x = _railstation.numtracks; |
483 int y = _railstation.platlength; |
483 int y = _railstation.platlength; |
484 if (_railstation.orientation == 0) Swap(x, y); |
484 if (_railstation.orientation == 0) Swap(x, y); |
485 SetTileSelectSize(x, y); |
485 SetTileSelectSize(x, y); |
486 } else { |
486 } else { |
487 VpSetPlaceSizingLimit(_settings.station.station_spread); |
487 VpSetPlaceSizingLimit(_settings_game.station.station_spread); |
488 } |
488 } |
489 } |
489 } |
490 } |
490 } |
491 } |
491 } |
492 |
492 |
545 if (w != NULL) { |
545 if (w != NULL) { |
546 /* signal GUI is used */ |
546 /* signal GUI is used */ |
547 SB(p2, 3, 1, 0); |
547 SB(p2, 3, 1, 0); |
548 SB(p2, 4, 1, _cur_signal_variant); |
548 SB(p2, 4, 1, _cur_signal_variant); |
549 SB(p2, 6, 1, _ctrl_pressed); |
549 SB(p2, 6, 1, _ctrl_pressed); |
550 SB(p2, 24, 8, _settings.gui.drag_signals_density); |
550 SB(p2, 24, 8, _settings_client.gui.drag_signals_density); |
551 } else { |
551 } else { |
552 SB(p2, 3, 1, 0); |
552 SB(p2, 3, 1, 0); |
553 SB(p2, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); |
553 SB(p2, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); |
554 SB(p2, 6, 1, _ctrl_pressed); |
554 SB(p2, 6, 1, _ctrl_pressed); |
555 SB(p2, 24, 8, _settings.gui.drag_signals_density); |
555 SB(p2, 24, 8, _settings_client.gui.drag_signals_density); |
556 } |
556 } |
557 |
557 |
558 /* _settings.gui.drag_signals_density is given as a parameter such that each user |
558 /* _settings_client.gui.drag_signals_density is given as a parameter such that each user |
559 * in a network game can specify his/her own signal density */ |
559 * in a network game can specify his/her own signal density */ |
560 DoCommandP( |
560 DoCommandP( |
561 TileVirtXY(thd->selstart.x, thd->selstart.y), |
561 TileVirtXY(thd->selstart.x, thd->selstart.y), |
562 TileVirtXY(thd->selend.x, thd->selend.y), |
562 TileVirtXY(thd->selend.x, thd->selend.y), |
563 p2, |
563 p2, |
615 BuildRailToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
615 BuildRailToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
616 { |
616 { |
617 this->DisableWidget(RTW_REMOVE); |
617 this->DisableWidget(RTW_REMOVE); |
618 |
618 |
619 this->FindWindowPlacementAndResize(desc); |
619 this->FindWindowPlacementAndResize(desc); |
620 if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this); |
620 if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); |
621 } |
621 } |
622 |
622 |
623 ~BuildRailToolbarWindow() |
623 ~BuildRailToolbarWindow() |
624 { |
624 { |
625 if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
625 if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
626 } |
626 } |
627 |
627 |
628 void UpdateRemoveWidgetStatus(int clicked_widget) |
628 void UpdateRemoveWidgetStatus(int clicked_widget) |
629 { |
629 { |
630 switch (clicked_widget) { |
630 switch (clicked_widget) { |
1006 if (_railstation.orientation == 0) Swap(x, y); |
1006 if (_railstation.orientation == 0) Swap(x, y); |
1007 if (!_remove_button_clicked) |
1007 if (!_remove_button_clicked) |
1008 SetTileSelectSize(x, y); |
1008 SetTileSelectSize(x, y); |
1009 } |
1009 } |
1010 |
1010 |
1011 int rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; |
1011 int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; |
1012 |
1012 |
1013 if (_station_show_coverage) |
1013 if (_station_show_coverage) |
1014 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
1014 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
1015 |
1015 |
1016 for (uint bits = 0; bits < 7; bits++) { |
1016 for (uint bits = 0; bits < 7; bits++) { |
1017 bool disable = bits >= _settings.station.station_spread; |
1017 bool disable = bits >= _settings_game.station.station_spread; |
1018 if (statspec == NULL) { |
1018 if (statspec == NULL) { |
1019 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable); |
1019 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable); |
1020 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable); |
1020 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable); |
1021 } else { |
1021 } else { |
1022 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); |
1022 this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable); |
1388 { |
1388 { |
1389 this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); |
1389 this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); |
1390 |
1390 |
1391 this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button); |
1391 this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button); |
1392 |
1392 |
1393 this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings.gui.drag_signals_density == 1); |
1393 this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1); |
1394 this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings.gui.drag_signals_density == 20); |
1394 this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20); |
1395 |
1395 |
1396 this->DrawWidgets(); |
1396 this->DrawWidgets(); |
1397 |
1397 |
1398 /* The 'hardcoded' off sets are needed because they are reused sprites. */ |
1398 /* The 'hardcoded' off sets are needed because they are reused sprites. */ |
1399 this->DrawSignalSprite(BSW_SEMAPHORE_NORM, SPR_IMG_SIGNAL_SEMAPHORE_NORM, 0, 12); // xsize of sprite + 1 == 9 |
1399 this->DrawSignalSprite(BSW_SEMAPHORE_NORM, SPR_IMG_SIGNAL_SEMAPHORE_NORM, 0, 12); // xsize of sprite + 1 == 9 |
1404 this->DrawSignalSprite(BSW_ELECTRIC_ENTRY, SPR_IMG_SIGNAL_ELECTRIC_ENTRY, -2, 6); |
1404 this->DrawSignalSprite(BSW_ELECTRIC_ENTRY, SPR_IMG_SIGNAL_ELECTRIC_ENTRY, -2, 6); |
1405 this->DrawSignalSprite(BSW_ELECTRIC_EXIT, SPR_IMG_SIGNAL_ELECTRIC_EXIT, -2, 6); |
1405 this->DrawSignalSprite(BSW_ELECTRIC_EXIT, SPR_IMG_SIGNAL_ELECTRIC_EXIT, -2, 6); |
1406 this->DrawSignalSprite(BSW_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_COMBO, -2, 6); |
1406 this->DrawSignalSprite(BSW_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_COMBO, -2, 6); |
1407 |
1407 |
1408 /* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */ |
1408 /* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */ |
1409 SetDParam(0, _settings.gui.drag_signals_density); |
1409 SetDParam(0, _settings_client.gui.drag_signals_density); |
1410 DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right - |
1410 DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right - |
1411 this->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1, |
1411 this->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1, |
1412 this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE); |
1412 this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE); |
1413 } |
1413 } |
1414 |
1414 |
1432 case BSW_CONVERT: |
1432 case BSW_CONVERT: |
1433 _convert_signal_button = !_convert_signal_button; |
1433 _convert_signal_button = !_convert_signal_button; |
1434 break; |
1434 break; |
1435 |
1435 |
1436 case BSW_DRAG_SIGNALS_DENSITY_DECREASE: |
1436 case BSW_DRAG_SIGNALS_DENSITY_DECREASE: |
1437 if (_settings.gui.drag_signals_density > 1) { |
1437 if (_settings_client.gui.drag_signals_density > 1) { |
1438 _settings.gui.drag_signals_density--; |
1438 _settings_client.gui.drag_signals_density--; |
1439 SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); |
1439 SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); |
1440 } |
1440 } |
1441 break; |
1441 break; |
1442 |
1442 |
1443 case BSW_DRAG_SIGNALS_DENSITY_INCREASE: |
1443 case BSW_DRAG_SIGNALS_DENSITY_INCREASE: |
1444 if (_settings.gui.drag_signals_density < 20) { |
1444 if (_settings_client.gui.drag_signals_density < 20) { |
1445 _settings.gui.drag_signals_density++; |
1445 _settings_client.gui.drag_signals_density++; |
1446 SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); |
1446 SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); |
1447 } |
1447 } |
1448 break; |
1448 break; |
1449 |
1449 |
1450 default: break; |
1450 default: break; |
1699 static void SetDefaultRailGui() |
1699 static void SetDefaultRailGui() |
1700 { |
1700 { |
1701 if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; |
1701 if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; |
1702 |
1702 |
1703 extern RailType _last_built_railtype; |
1703 extern RailType _last_built_railtype; |
1704 RailType rt = (RailType)_settings.gui.default_rail_type; |
1704 RailType rt = (RailType)_settings_client.gui.default_rail_type; |
1705 if (rt >= RAILTYPE_END) { |
1705 if (rt >= RAILTYPE_END) { |
1706 if (rt == RAILTYPE_END + 2) { |
1706 if (rt == RAILTYPE_END + 2) { |
1707 /* Find the most used rail type */ |
1707 /* Find the most used rail type */ |
1708 RailType count[RAILTYPE_END]; |
1708 RailType count[RAILTYPE_END]; |
1709 memset(count, 0, sizeof(count)); |
1709 memset(count, 0, sizeof(count)); |
1751 * @param 0 needed to be called when a patch setting changes |
1751 * @param 0 needed to be called when a patch setting changes |
1752 * @return success, needed for patch settings |
1752 * @return success, needed for patch settings |
1753 */ |
1753 */ |
1754 int32 ResetSignalVariant(int32 = 0) |
1754 int32 ResetSignalVariant(int32 = 0) |
1755 { |
1755 { |
1756 SignalVariant new_variant = (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); |
1756 SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); |
1757 |
1757 |
1758 if (new_variant != _cur_signal_variant) { |
1758 if (new_variant != _cur_signal_variant) { |
1759 Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); |
1759 Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); |
1760 if (w != NULL) { |
1760 if (w != NULL) { |
1761 w->SetDirty(); |
1761 w->SetDirty(); |