12 #include "../stdafx.h"
13 #include "../core/bitmath_func.hpp"
14 #include "../station_func.h"
15 #include "../engine_base.h"
16 #include "../vehicle_func.h"
20 #include "../safeguards.h"
35 if (first == NULL)
return;
38 LinkRefresher refresher(v, &seen_hops, allow_merge, is_full_loading);
52 }
else if (this->
from > other.
from) {
55 if (this->
to < other.
to) {
57 }
else if (this->
to > other.
to) {
72 vehicle(vehicle), seen_hops(seen_hops),
cargo(
CT_INVALID), allow_merge(allow_merge),
73 is_full_loading(is_full_loading)
78 for (
Vehicle *v = this->vehicle; v != NULL; v = v->
Next()) {
80 if (v->refit_cap > 0) {
82 this->
capacities[v->cargo_type] += v->refit_cap;
94 this->
cargo = refit_cargo;
96 bool any_refit =
false;
99 if (!
HasBit(e->info.refit_mask, this->cargo)) {
106 CargoID temp_cid = v->cargo_type;
107 byte temp_subtype = v->cargo_subtype;
108 v->cargo_type = this->
cargo;
111 uint16 mail_capacity = 0;
115 v->cargo_type = temp_cid;
116 v->cargo_subtype = temp_subtype;
119 if (this->
cargo != refit_it->cargo && refit_it->remaining > 0) {
120 this->
capacities[refit_it->cargo] -= refit_it->remaining;
121 refit_it->remaining = 0;
122 }
else if (amount < refit_it->remaining) {
123 this->
capacities[refit_it->cargo] -= refit_it->remaining - amount;
124 refit_it->remaining = amount;
126 refit_it->capacity = amount;
127 refit_it->cargo = this->
cargo;
133 if (mail_capacity < refit_it->remaining) {
134 this->
capacities[refit_it->cargo] -= refit_it->remaining - mail_capacity;
135 refit_it->remaining = mail_capacity;
137 refit_it->capacity = mail_capacity;
150 if (it->remaining == it->capacity)
continue;
151 this->
capacities[it->cargo] += it->capacity - it->remaining;
152 it->remaining = it->capacity;
177 if (next->
IsType(OT_CONDITIONAL)) {
207 if (st != NULL && next_station != INVALID_STATION && next_station != st->
index) {
212 if (cargo_quantity == 0)
continue;
231 this->vehicle->orders.list->GetTotalDuration() >
263 while (next != NULL) {
291 if (next == NULL)
break;
303 if (!next->
IsType(OT_GOTO_STATION) && !next->
IsType(OT_IMPLICIT))
continue;
311 if (cur->
IsType(OT_GOTO_STATION) || cur->
IsType(OT_IMPLICIT)) {