src/order_gui.cpp
changeset 10158 e4e8e74d96c7
parent 10157 c6c508d9e164
child 10168 24907819f29b
equal deleted inserted replaced
10157:c6c508d9e164 10158:e4e8e74d96c7
   235 		/* delete */
   235 		/* delete */
   236 		w->SetWidgetDisabledState(ORDER_WIDGET_DELETE,
   236 		w->SetWidgetDisabledState(ORDER_WIDGET_DELETE,
   237 				(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
   237 				(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
   238 
   238 
   239 		/* non-stop only for trains */
   239 		/* non-stop only for trains */
   240 		w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP,  v->type != VEH_TRAIN || order == NULL);
   240 		w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP,  (v->type != VEH_TRAIN && v->type != VEH_ROAD) || order == NULL);
   241 		w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load
   241 		w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load
   242 		w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD,    order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload
   242 		w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD,    order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload
   243 		/* Disable list of vehicles with the same shared orders if there is no list */
   243 		/* Disable list of vehicles with the same shared orders if there is no list */
   244 		w->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL);
   244 		w->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL);
   245 		w->SetWidgetDisabledState(ORDER_WIDGET_REFIT,     order == NULL); // Refit
   245 		w->SetWidgetDisabledState(ORDER_WIDGET_REFIT,     order == NULL); // Refit
   323 				case OT_GOTO_STATION: {
   323 				case OT_GOTO_STATION: {
   324 					OrderLoadFlags load = order->GetLoadType();
   324 					OrderLoadFlags load = order->GetLoadType();
   325 					OrderUnloadFlags unload = order->GetUnloadType();
   325 					OrderUnloadFlags unload = order->GetUnloadType();
   326 
   326 
   327 					SetDParam(1, STR_GO_TO_STATION);
   327 					SetDParam(1, STR_GO_TO_STATION);
   328 					SetDParam(2, STR_ORDER_GO_TO + (v->type == VEH_TRAIN ? order->GetNonStopType() : 0));
   328 					SetDParam(2, STR_ORDER_GO_TO + ((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? order->GetNonStopType() : 0));
   329 					SetDParam(3, order->GetDestination());
   329 					SetDParam(3, order->GetDestination());
   330 					SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]);
   330 					SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]);
   331 				} break;
   331 				} break;
   332 
   332 
   333 				case OT_GOTO_DEPOT:
   333 				case OT_GOTO_DEPOT:
   429 				break;
   429 				break;
   430 
   430 
   431 			case MP_ROAD:
   431 			case MP_ROAD:
   432 				if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
   432 				if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
   433 					order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
   433 					order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
       
   434 					if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
   434 					return order;
   435 					return order;
   435 				}
   436 				}
   436 				break;
   437 				break;
   437 
   438 
   438 			case MP_STATION:
   439 			case MP_STATION:
   479 			(facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
   480 			(facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
   480 			(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
   481 			(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
   481 			(facil = FACIL_TRUCK_STOP, 1);
   482 			(facil = FACIL_TRUCK_STOP, 1);
   482 			if (st->facilities & facil) {
   483 			if (st->facilities & facil) {
   483 				order.MakeGoToStation(st_index);
   484 				order.MakeGoToStation(st_index);
   484 				if (_patches.new_nonstop && v->type == VEH_TRAIN) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
   485 				if (_patches.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
   485 				return order;
   486 				return order;
   486 			}
   487 			}
   487 		}
   488 		}
   488 	}
   489 	}
   489 
   490 
  1167 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
  1168 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
  1168 
  1169 
  1169 	if (v->owner != _local_player) {
  1170 	if (v->owner != _local_player) {
  1170 		w = AllocateWindowDescFront(&_other_orders_desc, veh);
  1171 		w = AllocateWindowDescFront(&_other_orders_desc, veh);
  1171 	} else {
  1172 	} else {
  1172 		w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh);
  1173 		w = AllocateWindowDescFront((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? &_orders_train_desc : &_orders_desc, veh);
  1173 	}
  1174 	}
  1174 
  1175 
  1175 	if (w != NULL) {
  1176 	if (w != NULL) {
  1176 		w->caption_color = v->owner;
  1177 		w->caption_color = v->owner;
  1177 		w->vscroll.cap = 6;
  1178 		w->vscroll.cap = 6;