1922 } |
1922 } |
1923 |
1923 |
1924 /** Send a train to a depot |
1924 /** Send a train to a depot |
1925 * @param tile unused |
1925 * @param tile unused |
1926 * @param p1 train to send to the depot |
1926 * @param p1 train to send to the depot |
1927 * @param p2 unused |
1927 * @param p2 if bit 0 is set, then the train will only service at the depot. 0 Makes it stop inside |
1928 */ |
1928 */ |
1929 int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1929 int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
1930 { |
1930 { |
1931 Vehicle *v; |
1931 Vehicle *v; |
1932 TrainFindDepotData tfdd; |
1932 TrainFindDepotData tfdd; |
1958 return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO); |
1958 return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO); |
1959 |
1959 |
1960 if (flags & DC_EXEC) { |
1960 if (flags & DC_EXEC) { |
1961 v->dest_tile = tfdd.tile; |
1961 v->dest_tile = tfdd.tile; |
1962 v->current_order.type = OT_GOTO_DEPOT; |
1962 v->current_order.type = OT_GOTO_DEPOT; |
1963 v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD; |
1963 v->current_order.flags = OF_NON_STOP; |
|
1964 if (!HASBIT(p2,0)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); |
1964 v->current_order.dest.depot = GetDepotByTile(tfdd.tile)->index; |
1965 v->current_order.dest.depot = GetDepotByTile(tfdd.tile)->index; |
1965 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); |
1966 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); |
1966 /* If there is no depot in front, reverse automatically */ |
1967 /* If there is no depot in front, reverse automatically */ |
1967 if (tfdd.reverse) |
1968 if (tfdd.reverse) |
1968 DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION); |
1969 DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION); |