(svn r21516) -Codechange: Add IsGroundVehicle function to the Vehicle class.

This commit is contained in:
terkhen
2010-12-14 21:26:03 +00:00
parent 57790abb75
commit 47c9189002
9 changed files with 27 additions and 18 deletions

View File

@@ -216,7 +216,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
OrderUnloadFlags unload = order->GetUnloadType();
SetDParam(0, STR_ORDER_GO_TO_STATION);
SetDParam(1, STR_ORDER_GO_TO + ((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? order->GetNonStopType() : 0));
SetDParam(1, STR_ORDER_GO_TO + (v->IsGroundVehicle() ? order->GetNonStopType() : 0));
SetDParam(2, order->GetDestination());
if (timetable) {
@@ -382,7 +382,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
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);
if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_END);
return order;
}
@@ -572,7 +572,7 @@ private:
order.next = NULL;
order.index = 0;
order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS,
_settings_client.gui.new_nonstop && (this->vehicle->type == VEH_TRAIN || this->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
_settings_client.gui.new_nonstop && this->vehicle->IsGroundVehicle() ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
@@ -647,7 +647,7 @@ private:
*/
void OrderClick_Nonstop(int non_stop)
{
if (this->vehicle->type != VEH_TRAIN && this->vehicle->type != VEH_ROAD) return;
if (!this->vehicle->IsGroundVehicle()) return;
VehicleOrderID sel_ord = this->OrderGetSel();
const Order *order = this->vehicle->GetOrder(sel_ord);
@@ -1605,6 +1605,6 @@ void ShowOrdersWindow(const Vehicle *v)
if (v->owner != _local_company) {
new OrdersWindow(&_other_orders_desc, v);
} else {
new OrdersWindow((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? &_orders_train_desc : &_orders_desc, v);
new OrdersWindow(v->IsGroundVehicle() ? &_orders_train_desc : &_orders_desc, v);
}
}