404 static bool ShipAccelerate(Vehicle *v) |
404 static bool ShipAccelerate(Vehicle *v) |
405 { |
405 { |
406 uint spd; |
406 uint spd; |
407 byte t; |
407 byte t; |
408 |
408 |
409 spd = min(v->cur_speed + 1, v->max_speed); |
409 spd = min(v->cur_speed + 1, GetVehicleProperty(v, 0x0B, v->max_speed)); |
410 |
410 |
411 /*updates statusbar only if speed have changed to save CPU time */ |
411 /*updates statusbar only if speed have changed to save CPU time */ |
412 if (spd != v->cur_speed) { |
412 if (spd != v->cur_speed) { |
413 v->cur_speed = spd; |
413 v->cur_speed = spd; |
414 if (_patches.vehicle_speed) |
414 if (_patches.vehicle_speed) |
549 /** returns the track to choose on the next tile, or -1 when it's better to |
549 /** returns the track to choose on the next tile, or -1 when it's better to |
550 * reverse. The tile given is the tile we are about to enter, enterdir is the |
550 * reverse. The tile given is the tile we are about to enter, enterdir is the |
551 * direction in which we are entering the tile */ |
551 * direction in which we are entering the tile */ |
552 static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) |
552 static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) |
553 { |
553 { |
554 assert(enterdir>=0 && enterdir<=3); |
554 assert(enterdir >= 0 && enterdir <= 3); |
555 |
555 |
556 if (_patches.yapf.ship_use_yapf) { |
556 if (_patches.yapf.ship_use_yapf) { |
557 Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks); |
557 Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks); |
558 return (trackdir != INVALID_TRACKDIR) ? TrackdirToTrack(trackdir) : INVALID_TRACK; |
558 return (trackdir != INVALID_TRACKDIR) ? TrackdirToTrack(trackdir) : INVALID_TRACK; |
559 } else if (_patches.new_pathfinding_all) { |
559 } else if (_patches.new_pathfinding_all) { |
1063 |
1063 |
1064 dep = FindClosestShipDepot(v); |
1064 dep = FindClosestShipDepot(v); |
1065 if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT); |
1065 if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT); |
1066 |
1066 |
1067 if (flags & DC_EXEC) { |
1067 if (flags & DC_EXEC) { |
|
1068 if (v->current_order.type == OT_LOADING) v->LeaveStation(); |
|
1069 |
1068 v->dest_tile = dep->xy; |
1070 v->dest_tile = dep->xy; |
1069 v->current_order.type = OT_GOTO_DEPOT; |
1071 v->current_order.type = OT_GOTO_DEPOT; |
1070 v->current_order.flags = OF_NON_STOP; |
1072 v->current_order.flags = OF_NON_STOP; |
1071 if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); |
1073 if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); |
1072 v->current_order.refit_cargo = CT_INVALID; |
1074 v->current_order.refit_cargo = CT_INVALID; |