Reorganize CityMania client custom settings

This commit is contained in:
dP
2021-08-19 23:27:22 +03:00
parent 0c3bfa92f4
commit 28429e1f57
17 changed files with 65 additions and 73 deletions

View File

@@ -74,6 +74,13 @@ This is usable for any OpenTTD servers
== CHANGELOG ==
*** 12.0-beta2 (19 Aug 2021) ***
- Fixed crash when building airport with no valid airport type selected.
- Renamed a bunch of setttings in the config file adding cm_* prefix to distinguish them from vanilla ones.
- Removed setting to show train length in old format in the depot (new one is more usable now).
- Removed setting to disable ending the polyrail with double click (it's always disabled).
- Removed setting to disable starting-stopping vehicles with ctrl-click (seems pointless).
*** 1.11.2 (3 May 2021) ***
- OpenTTD update.

View File

@@ -955,7 +955,7 @@ static void SetStationSelectionHighlight(const TileInfo *ti, TileHighlight &th)
void CalcCBAcceptanceBorders(TileHighlight &th, TileIndex tile, SpriteID border_pal, SpriteID ground_pal) {
int tx = TileX(tile), ty = TileY(tile);
uint16 radius = _settings_client.gui.cb_distance_check;
uint16 radius = _settings_client.gui.cm_cb_distance;
bool in_zone = false;
ZoningBorder border = ZoningBorder::NONE;
_town_kdtree.FindContained(
@@ -1112,7 +1112,7 @@ TileHighlight GetTileHighlight(const TileInfo *ti) {
if (z) th.ground_pal = th.structure_pal = GetTintBySelectionColour(pal[z]);
}
if (_settings_client.gui.show_industry_forbidden_tiles &&
if (_settings_client.gui.cm_show_industry_forbidden_tiles &&
_industry_forbidden_tiles != INVALID_INDUSTRYTYPE) {
auto b = CalcTileBorders(ti->tile, [](TileIndex t) { return !CanBuildIndustryOnTileCached(_industry_forbidden_tiles, t); });
th.add_border(b.first, SPR_PALETTE_ZONING_RED);
@@ -1384,7 +1384,7 @@ ZoningBorder GetAnyStationCatchmentBorder(TileIndex tile) {
}
void SetIndustryForbiddenTilesHighlight(IndustryType type) {
if (_settings_client.gui.show_industry_forbidden_tiles &&
if (_settings_client.gui.cm_show_industry_forbidden_tiles &&
_industry_forbidden_tiles != type) {
MarkWholeScreenDirty();
}

View File

@@ -286,7 +286,7 @@ SpriteID TileZoneCheckNewCBBorders(TileIndex tile) {
//Check CB town acceptance area
SpriteID TileZoneCheckCBBorders(TileIndex tile) {
for (Town *town : Town::Iterate()) {
if (DistanceMax(town->xy, tile) <= _settings_client.gui.cb_distance_check)
if (DistanceMax(town->xy, tile) <= _settings_client.gui.cm_cb_distance)
return SPR_PALETTE_ZONING_LIGHT_BLUE;
}
return INVALID_SPRITE_ID; // no town

View File

@@ -305,16 +305,9 @@ struct DepotWindow : Window {
this->sel, EIT_IN_DEPOT, free_wagon ? 0 : this->hscroll->GetPosition(), this->vehicle_over);
/* Length of consist in tiles with 1 fractional digit (rounded up) */
if (_settings_client.gui.old_depot_train_length_calc) {
SetDParam(0, CeilDiv(u->gcache.cached_total_length, 8));
SetDParam(1, 1);
DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_COMA, TC_FROMSTRING, SA_RIGHT); // Draw the counter
}
else {
SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE));
SetDParam(1, 1);
DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter
}
SetDParam(0, CeilDiv(u->gcache.cached_total_length * 10, TILE_SIZE));
SetDParam(1, 1);
DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_DECIMAL, TC_FROMSTRING, SA_RIGHT); // Draw the counter
break;
}

View File

@@ -203,7 +203,7 @@ struct BuildDocksToolbarWindow : Window {
case WID_DT_DEPOT: // Build depot button
DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks);
if (citymania::_fn_mod == _settings_client.gui.persistent_depottools)
if (citymania::_fn_mod == _settings_client.gui.cm_keep_depot_tools)
ResetObjectToPlace();
break;

View File

@@ -1121,7 +1121,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
/* Increase town's counter for all goods types only if delivered near town*/
if(CB_Enabled()){
if (_settings_client.gui.cb_distance_check == 0 || (DistanceManhattan(st->town->xy, st->xy) <= _settings_client.gui.cb_distance_check)) {
if (_settings_client.gui.cm_cb_distance == 0 || (DistanceManhattan(st->town->xy, st->xy) <= _settings_client.gui.cm_cb_distance)) {
st->town->cb.delivered[cargo_type] += accepted_total;
InvalidateWindowData(WC_CB_TOWN, st->town->index);
}

View File

@@ -365,7 +365,7 @@ class BuildIndustryWindow : public Window {
{
this->SetWidgetDisabledState(WID_DPI_FUND_WIDGET, !this->funding_enabled || (this->selected_type != INVALID_INDUSTRYTYPE && !this->enabled[this->selected_index]));
this->SetWidgetDisabledState(WID_DPI_DISPLAY_WIDGET, this->selected_type == INVALID_INDUSTRYTYPE && this->enabled[this->selected_index]);
this->LowerWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
this->LowerWidget(_settings_client.gui.cm_show_industry_forbidden_tiles + WID_DPI_FT_OFF);
}
/**
@@ -727,9 +727,9 @@ public:
case WID_DPI_FT_OFF:
case WID_DPI_FT_ON:
this->RaiseWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
_settings_client.gui.show_industry_forbidden_tiles = (widget != WID_DPI_FT_OFF);
this->LowerWidget(_settings_client.gui.show_industry_forbidden_tiles + WID_DPI_FT_OFF);
this->RaiseWidget(_settings_client.gui.cm_show_industry_forbidden_tiles + WID_DPI_FT_OFF);
_settings_client.gui.cm_show_industry_forbidden_tiles = (widget != WID_DPI_FT_OFF);
this->LowerWidget(_settings_client.gui.cm_show_industry_forbidden_tiles + WID_DPI_FT_OFF);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
this->SetDirty();
MarkWholeScreenDirty();

View File

@@ -1,3 +1,4 @@
##name English (UK)
##ownname English (UK)
##isocode en_GB
@@ -1830,7 +1831,6 @@ STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Change s
STR_CONFIG_SETTING_VEHICLES_CTRL :{ORANGE}Controls & Orders
STR_CONFIG_SETTING_ORDER_SHORTCUTS :{ORANGE}Order's Shortcuts
STR_CONFIG_SETTING_CTRL_ENABLE_CTRLCLICK_STARTSTOP :Allow ctrl+left-click vehicles to start or stop them: {STRING2}
STR_CONFIG_SETTING_AUTOSET_NOLOAD_ON_TRANSFER :"Transfer" orders are "No Loading" by default: {STRING2}
STR_CONFIG_SETTING_AUTOSET_NOLOAD_ON_UNLOAD :"Unload all" orders are "No Loading" by default: {STRING2}
@@ -5455,7 +5455,6 @@ STR_TOOLBAR_CARGOS_NAME :{BLACK}{STRING}
#towns
STR_TOWN_DIRECTORY_TOWN_COLOUR :{ORANGE}{TOWN}{BLACK} ({COMMA}->{COMMA}) {YELLOW}{COMMA} {P "house" "houses"}
STR_TOWN_DIRECTORY_CITY_COLOUR :{YELLOW}{TOWN}{BLACK} ({COMMA}->{COMMA}) {YELLOW}{COMMA} {P "house" "houses"}
STR_OLD_DEPOT_TRAINT_LENGTH :Old depot length format: {STRING2}
STR_SMALLMAP_TOWN_LARGE :{TINY_FONT}{YELLOW}{TOWN}
STR_SORT_BY_HOUSES :Houses

View File

@@ -1763,7 +1763,7 @@ void CheckOrders(const Vehicle *v)
} else if (v->type == VEH_AIRCRAFT &&
(AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
(st->airport.GetFTA()->flags & AirportFTAClass::SHORT_STRIP) &&
_settings_client.gui.runway_too_short_warn &&
_settings_client.gui.cm_runway_too_short_warning &&
!_cheats.no_jetcrash.value &&
message == INVALID_STRING_ID) {
message = STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY;

View File

@@ -222,7 +222,7 @@ static OrdersFromSettings GetOrdersFromSettings(const Vehicle *v, uint8 setting)
case GOFS_UNLOAD:
res.unload = OUFB_UNLOAD;
if (_settings_client.gui.auto_noload_on_unloadall)
if (_settings_client.gui.cm_no_loading_on_unload_order)
res.load = OLFB_NO_LOAD;
break;
@@ -234,7 +234,7 @@ static OrdersFromSettings GetOrdersFromSettings(const Vehicle *v, uint8 setting)
case GOFS_XFER:
res.unload = OUFB_TRANSFER;
if (_settings_client.gui.auto_noload_on_transfer)
if (_settings_client.gui.cm_no_loading_on_transfer_order)
res.load = OLFB_NO_LOAD;
break;
@@ -506,20 +506,20 @@ static std::pair<Order, FeederOrderMod> GetOrderCmdFromTile(const Vehicle *v, Ti
uint8 os = 0xff;
if (_ctrl_pressed) {
if (_shift_pressed)
os = _settings_client.gui.goto_shortcuts_ctrlshift_lclick;
os = _settings_client.gui.cm_ctrl_shift_order_mod;
else if (_alt_pressed)
os = _settings_client.gui.goto_shortcuts_altctrl_lclick;
os = _settings_client.gui.cm_alt_ctrl_order_mod;
else
os = _settings_client.gui.goto_shortcuts_ctrl_lclick;
os = _settings_client.gui.cm_ctrl_order_mod;
}
else if (_shift_pressed) {
if (_alt_pressed)
os = _settings_client.gui.goto_shortcuts_altshift_lclick;
os = _settings_client.gui.cm_alt_shift_order_mod;
else
os = _settings_client.gui.goto_shortcuts_shift_lclick;
os = _settings_client.gui.cm_ctrl_order_mod;
}
else if (_alt_pressed)
os = _settings_client.gui.goto_shortcuts_alt_lclick;
os = _settings_client.gui.cm_alt_order_mod;
auto feeder_mod = FeederOrderMod::NONE;
if (os != 0xff) {
@@ -765,10 +765,10 @@ private:
bool set_no_load = false;
if (unload_type == OUFB_TRANSFER){
set_no_load = _settings_client.gui.auto_noload_on_transfer;
set_no_load = _settings_client.gui.cm_no_loading_on_transfer_order;
}
else if (unload_type == OUFB_UNLOAD){
set_no_load = _settings_client.gui.auto_noload_on_unloadall;
set_no_load = _settings_client.gui.cm_no_loading_on_unload_order;
}
/* Transfer orders with leave empty as default */
if (set_no_load) {

View File

@@ -817,7 +817,7 @@ struct BuildRailToolbarWindow : Window {
DoCommandP(tile, _cur_railtype, ddir,
CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT),
CcRailDepot);
if (citymania::_fn_mod == _settings_client.gui.persistent_depottools)
if (citymania::_fn_mod == _settings_client.gui.cm_keep_depot_tools)
ResetObjectToPlace();
break;

View File

@@ -574,7 +574,7 @@ struct BuildRoadToolbarWindow : Window {
}
DoCommandP(tile, _cur_roadtype << 2 | ddir, 0,
CMD_BUILD_ROAD_DEPOT | CMD_MSG(this->rti->strings.err_depot), CcRoadDepot);
if (citymania::_fn_mod == _settings_client.gui.persistent_depottools)
if (citymania::_fn_mod == _settings_client.gui.cm_keep_depot_tools)
ResetObjectToPlace();
break;

View File

@@ -3212,7 +3212,7 @@ bool AfterLoadGame()
AfterLoadFindBTProCBInfo();
citymania::InitializeZoningMap();
if ((!_networking || _network_server ) && _settings_client.gui.pause_after_load) _pause_mode = PM_PAUSED_NORMAL;
if ((!_networking || _network_server ) && _settings_client.gui.cm_pause_after_load) _pause_mode = PM_PAUSED_NORMAL;
return true;
}

View File

@@ -1640,12 +1640,10 @@ static SettingsContainer &GetSettingsTree()
viewports->Add(new SettingEntry("gui.measure_tooltip"));
viewports->Add(new SettingEntry("gui.loading_indicators"));
viewports->Add(new SettingEntry("gui.show_track_reservation"));
viewports->Add(new SettingEntry("gui.cb_distance_check"));
viewports->Add(new SettingEntry("gui.old_depot_train_length_calc"));
viewports->Add(new SettingEntry("gui.cm_cb_distance"));
viewports->Add(new SettingEntry("gui.cm_land_tooltips_for_industries"));
viewports->Add(new SettingEntry("gui.cm_land_tooltips_for_stations"));
viewports->Add(new SettingEntry("gui.cm_land_tooltips_for_houses"));
// viewports->Add(new SettingEntry("gui.polyrail_double_click"));
}
SettingsPage *construction = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
@@ -1670,8 +1668,8 @@ static SettingsContainer &GetSettingsTree()
interface->Add(new SettingEntry("gui.timetable_in_ticks"));
interface->Add(new SettingEntry("gui.timetable_arrival_departure"));
interface->Add(new SettingEntry("gui.expenses_layout"));
interface->Add(new SettingEntry("gui.powerfund_money"));
interface->Add(new SettingEntry("gui.powerfund_houses"));
interface->Add(new SettingEntry("gui.cm_powerfund_money"));
interface->Add(new SettingEntry("gui.cm_powerfund_houses"));
interface->Add(new SettingEntry("gui.show_newgrf_name"));
interface->Add(new SettingEntry("gui.cm_graph_background"));
}
@@ -1690,7 +1688,7 @@ static SettingsContainer &GetSettingsTree()
advisors->Add(new SettingEntry("gui.order_review_system"));
advisors->Add(new SettingEntry("gui.vehicle_income_warn"));
advisors->Add(new SettingEntry("gui.lost_vehicle_warn"));
advisors->Add(new SettingEntry("gui.runway_too_short_warn"));
advisors->Add(new SettingEntry("gui.cm_runway_too_short_warning"));
advisors->Add(new SettingEntry("gui.show_finances"));
advisors->Add(new SettingEntry("news_display.economy"));
advisors->Add(new SettingEntry("news_display.subsidies"));
@@ -1739,21 +1737,20 @@ static SettingsContainer &GetSettingsTree()
/** Vehicle control page */
SettingsPage *veh_control = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_CTRL));
{
veh_control->Add(new SettingEntry("gui.enable_ctrl_click_start_stop"));
veh_control->Add(new SettingEntry("gui.new_nonstop"));
veh_control->Add(new SettingEntry("gui.auto_noload_on_transfer"));
veh_control->Add(new SettingEntry("gui.auto_noload_on_unloadall"));
veh_control->Add(new SettingEntry("gui.cm_no_loading_on_transfer_order"));
veh_control->Add(new SettingEntry("gui.cm_no_loading_on_unload_order"));
}
/** Order Shorcuts page */
SettingsPage *orders = veh_control->Add(new SettingsPage(STR_CONFIG_SETTING_ORDER_SHORTCUTS));
{
orders->Add(new SettingEntry("gui.goto_shortcuts_ctrl_lclick"));
orders->Add(new SettingEntry("gui.goto_shortcuts_shift_lclick"));
orders->Add(new SettingEntry("gui.goto_shortcuts_ctrlshift_lclick"));
orders->Add(new SettingEntry("gui.goto_shortcuts_alt_lclick"));
orders->Add(new SettingEntry("gui.goto_shortcuts_altshift_lclick"));
orders->Add(new SettingEntry("gui.goto_shortcuts_altctrl_lclick"));
orders->Add(new SettingEntry("gui.cm_ctrl_order_mod"));
orders->Add(new SettingEntry("gui.cm_shift_order_mod"));
orders->Add(new SettingEntry("gui.cm_ctrl_shift_order_mod"));
orders->Add(new SettingEntry("gui.cm_alt_order_mod"));
orders->Add(new SettingEntry("gui.cm_alt_shift_order_mod"));
orders->Add(new SettingEntry("gui.cm_alt_ctrl_order_mod"));
}
SettingsPage *physics = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_PHYSICS));

View File

@@ -109,15 +109,14 @@ struct GUISettings {
bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning
bool show_finances; ///< show finances at end of year
bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames
bool enable_ctrl_click_start_stop; ///< allow ctrl+click to start or stop vehicles
uint8 goto_shortcuts_ctrl_lclick; ///< goto action shortcut CTRL+LEFT-CLICK
uint8 goto_shortcuts_shift_lclick; ///< goto action shortcut SHIFT+LEFT-CLICK
uint8 goto_shortcuts_ctrlshift_lclick; ///< goto action shortcut CTRL+SHIFT+LEFT-CLICK
uint8 goto_shortcuts_alt_lclick; ///< goto action shortcut ALT+LEFT-CLICK
uint8 goto_shortcuts_altshift_lclick; ///< goto action shortcut ALT+SHIFT+LEFT-CLICK
uint8 goto_shortcuts_altctrl_lclick; ///< goto action shortcut ALT+CTRL+LEFT-CLICK
bool auto_noload_on_transfer; ///< automatically set no-loading when ordering to transfer all cargo
bool auto_noload_on_unloadall; ///< automatically set no-loading when ordering to unload all cargo
uint8 cm_ctrl_order_mod; ///< goto action shortcut CTRL+LEFT-CLICK
uint8 cm_shift_order_mod; ///< goto action shortcut SHIFT+LEFT-CLICK
uint8 cm_ctrl_shift_order_mod; ///< goto action shortcut CTRL+SHIFT+LEFT-CLICK
uint8 cm_alt_order_mod; ///< goto action shortcut ALT+LEFT-CLICK
uint8 cm_alt_shift_order_mod; ///< goto action shortcut ALT+SHIFT+LEFT-CLICK
uint8 cm_alt_ctrl_order_mod; ///< goto action shortcut ALT+CTRL+LEFT-CLICK
bool cm_no_loading_on_transfer_order; ///< automatically set no-loading when ordering to transfer all cargo
bool cm_no_loading_on_unload_order; ///< automatically set no-loading when ordering to unload all cargo
bool new_nonstop; ///< ttdpatch compatible nonstop handling
uint8 stop_location; ///< what is the default stop location of trains?
uint8 auto_scrolling; ///< scroll when moving mouse to the edge (see #ViewportAutoscrolling)
@@ -149,7 +148,7 @@ struct GUISettings {
byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
bool population_in_label; ///< show the population of a town in its label?
uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking?
bool pause_after_load; ///< CM should we pause the game after loading save?
bool cm_pause_after_load; ///< CM should we pause the game after loading save?
uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel?
uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS?
bool timetable_arrival_departure; ///< show arrivals and departures in vehicle timetables
@@ -172,7 +171,7 @@ struct GUISettings {
bool station_dragdrop; ///< whether drag and drop is enabled for stations
bool station_show_coverage; ///< whether to highlight coverage area
bool persistent_buildingtools; ///< keep the building tools active after usage
bool persistent_depottools; ///< keep the depot building tools active after usage
bool cm_keep_depot_tools; ///< keep the depot building tools active after usage
bool cm_use_improved_station_join; ///< use ctrl-clicking station tiles to join instead of popup window
bool expenses_layout; ///< layout of expenses window
uint32 last_newgrf_count; ///< the numbers of NewGRFs we found during the last scan
@@ -204,14 +203,12 @@ struct GUISettings {
bool newgrf_show_old_versions; ///< whether to show old versions in the NewGRF list
uint8 newgrf_default_palette; ///< default palette to use for NewGRFs without action 14 palette information
bool old_depot_train_length_calc; ///< display vehicle length in whole numbers - old style
uint8 cb_distance_check; ///< zoning cb distance
bool polyrail_double_click; ///< finish polyrail with mouse double click
bool show_industry_forbidden_tiles; ///< higlight areas where industry placement is forbidden regardless of terrain
bool runway_too_short_warn; ///< warn about aircrafts using too short runways
uint8 cm_cb_distance; ///< zoning cb distance
bool cm_show_industry_forbidden_tiles; ///< higlight areas where industry placement is forbidden regardless of terrain
bool cm_runway_too_short_warning; ///< warn about aircrafts using too short runways
uint32 powerfund_money; ///< minimum amount of money for powerfund to work
uint16 powerfund_houses; ///< powerfunding maximum houses limit
uint32 cm_powerfund_money; ///< minimum amount of money for powerfund to work
uint16 cm_powerfund_houses; ///< powerfunding maximum houses limit
bool cm_open_vehicle_for_shared_clone;
bool cm_open_orders_for_new_vehicles;

View File

@@ -863,8 +863,8 @@ bool TownNeedsFunding(Town *t) {
bool fund_regularly = HasBit(t->fund_regularly, _local_company);
bool do_powerfund = HasBit(t->do_powerfund, _local_company);
if (do_powerfund && (_settings_client.gui.powerfund_money > Company::Get(_local_company)->money ||
_settings_client.gui.powerfund_houses < t->cache.num_houses)) {
if (do_powerfund && (_settings_client.gui.cm_powerfund_money > Company::Get(_local_company)->money ||
_settings_client.gui.cm_powerfund_houses < t->cache.num_houses)) {
do_powerfund = false;
}

View File

@@ -2426,8 +2426,7 @@ bool HandleViewportClicked(const Viewport *vp, int x, int y, bool double_click)
if (IsCompanyBuildableVehicleType(v)) {
v = v->First();
if (citymania::_fn_mod && v->owner == _local_company) {
if (_settings_client.gui.enable_ctrl_click_start_stop)
StartStopVehicle(v, true);
StartStopVehicle(v, true);
} else {
ShowVehicleViewWindow(v);
}