(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)

This commit is contained in:
rubidium 2009-01-04 14:51:49 +00:00
parent 183f8df552
commit e62e12e7f5
5 changed files with 24 additions and 2 deletions

View File

@ -1144,6 +1144,7 @@ STR_CONFIG_PATCHES_LOADING_INDICATORS_OWN :Own company
STR_CONFIG_PATCHES_LOADING_INDICATORS_ALL :All companies
STR_CONFIG_PATCHES_TIMETABLE_ALLOW :{LTBLUE}Enable timetabling for vehicles: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS :{LTBLUE}Show timetable in ticks rather than days: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_QUICKGOTO :{LTBLUE}Quick creation of vehicle orders: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE :{LTBLUE}Default rail type (after new game/game load): {ORANGE}{STRING1}
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_RAIL :Normal Rail
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_ELRAIL :Electrified Rail

View File

@ -305,6 +305,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_company)) {
if (IsRailDepot(tile)) {
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order;
}
@ -314,6 +315,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_ROAD:
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_company)) {
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order;
}
@ -323,6 +325,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_company)) {
order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS);
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
return order;
}
break;
@ -333,6 +336,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
TileIndex tile2 = GetOtherShipDepotTile(tile);
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE));
return order;
}
@ -346,7 +350,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
v->type == VEH_TRAIN &&
IsTileOwner(tile, _local_company)) {
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
return order;
}
@ -363,6 +367,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
(facil = FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
order.MakeGoToStation(st_index);
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);
if (_settings_client.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order;
}
@ -631,6 +636,18 @@ public:
this->resize.step_height = 10;
this->selected_order = -1;
this->vehicle = v;
if (_settings_client.gui.quick_goto) {
/* If there are less than 2 station, make Go To active. */
int station_orders = 0;
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
if (order->IsType(OT_GOTO_STATION)) station_orders++;
}
if (station_orders < 2) OrderClick_Goto(this, 0);
}
if (_settings_game.order.timetabling) {
this->widget[ORDER_WIDGET_CAPTION].right -= 61;
} else {
@ -1071,7 +1088,8 @@ public:
if (!cmd.IsValid()) return;
if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), cmd.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
ResetObjectToPlace();
/* With quick goto the Go To button stays active */
if (!_settings_client.gui.quick_goto) ResetObjectToPlace();
}
}
}

View File

@ -1439,6 +1439,7 @@ const SettingDesc _patch_settings[] = {
SDTC_BOOL(gui.pause_on_newgame, S, 0, false, STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME, NULL),
SDTC_VAR(gui.advanced_vehicle_list, SLE_UINT8, S, MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS, NULL),
SDTC_BOOL(gui.timetable_in_ticks, S, 0, false, STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS, NULL),
SDTC_BOOL(gui.quick_goto, S, 0, false, STR_CONFIG_PATCHES_QUICKGOTO, NULL),
SDTC_VAR(gui.loading_indicators, SLE_UINT8, S, MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS, RedrawScreen),
SDTC_VAR(gui.default_rail_type, SLE_UINT8, S, MS, 4, 0, 6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE, NULL),
SDTC_BOOL(gui.enable_signal_gui, S, 0, false, STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI, CloseSignalGUI),

View File

@ -635,6 +635,7 @@ static const char *_patches_ui[] = {
"gui.advanced_vehicle_list",
"gui.loading_indicators",
"gui.timetable_in_ticks",
"gui.quick_goto",
"gui.default_rail_type",
"gui.always_build_infrastructure",
"gui.show_track_reservation",

View File

@ -72,6 +72,7 @@ struct GUISettings {
bool enable_signal_gui; ///< show the signal GUI when the signal button is pressed
Year colored_news_year; ///< when does newspaper become colored?
bool timetable_in_ticks; ///< whether to show the timetable in ticks rather than days
bool quick_goto; ///< Allow quick access to 'goto button' in vehicle orders window
bool bridge_pillars; ///< show bridge pillars for high bridges
bool auto_euro; ///< automatically switch to euro in 2002
byte drag_signals_density; ///< many signals density