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)
76 for (
Vehicle *v = this->vehicle; v != NULL; v = v->
Next()) {
78 if (v->refit_cap > 0) this->
capacities[v->cargo_type] += v->refit_cap;
89 this->
cargo = refit_cargo;
91 bool any_refit =
false;
94 if (!
HasBit(e->info.refit_mask, this->cargo)) {
101 CargoID temp_cid = v->cargo_type;
102 byte temp_subtype = v->cargo_subtype;
103 v->cargo_type = this->
cargo;
106 uint16 mail_capacity = 0;
110 v->cargo_type = temp_cid;
111 v->cargo_subtype = temp_subtype;
114 if (this->
cargo != refit_it->cargo && refit_it->remaining > 0) {
115 this->
capacities[refit_it->cargo] -= refit_it->remaining;
116 refit_it->remaining = 0;
117 }
else if (amount < refit_it->remaining) {
118 this->
capacities[refit_it->cargo] -= refit_it->remaining - amount;
119 refit_it->remaining = amount;
121 refit_it->capacity = amount;
122 refit_it->cargo = this->
cargo;
128 if (mail_capacity < refit_it->remaining) {
129 this->
capacities[refit_it->cargo] -= refit_it->remaining - mail_capacity;
130 refit_it->remaining = mail_capacity;
132 refit_it->capacity = mail_capacity;
145 if (it->remaining == it->capacity)
continue;
146 this->
capacities[it->cargo] += it->capacity - it->remaining;
147 it->remaining = it->capacity;
172 if (next->
IsType(OT_CONDITIONAL)) {
202 if (st != NULL && next_station != INVALID_STATION && next_station != st->
index) {
203 for (CapacitiesMap::const_iterator i = this->
capacities.begin(); i != this->
capacities.end(); ++i) {
206 if (i->second == 0)
continue;
226 this->vehicle->orders.list->GetTotalDuration() >
258 while (next != NULL) {
286 if (next == NULL)
break;
298 if (!next->
IsType(OT_GOTO_STATION) && !next->
IsType(OT_IMPLICIT))
continue;
306 if (cur->
IsType(OT_GOTO_STATION) || cur->
IsType(OT_IMPLICIT)) {