Merge tag '13.0-beta1' into jgrpp
This commit is contained in:
@@ -74,9 +74,14 @@ void LinkGraph::Compress()
|
||||
for (NodeID node2 = 0; node2 < this->Size(); ++node2) {
|
||||
BaseEdge &edge = this->edges[node1][node2];
|
||||
if (edge.capacity > 0) {
|
||||
edge.capacity = std::max(1U, edge.capacity / 2);
|
||||
uint new_capacity = std::max(1U, edge.capacity / 2);
|
||||
if (edge.capacity < (1 << 16)) {
|
||||
edge.travel_time_sum = edge.travel_time_sum * new_capacity / edge.capacity;
|
||||
} else if (edge.travel_time_sum != 0) {
|
||||
edge.travel_time_sum = std::max(1ULL, edge.travel_time_sum / 2);
|
||||
}
|
||||
edge.capacity = new_capacity;
|
||||
edge.usage /= 2;
|
||||
edge.travel_time_sum = std::max(1ULL, edge.travel_time_sum / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -232,6 +232,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next, uint8 flag
|
||||
StationID next_station = next->GetDestination();
|
||||
Station *st = Station::GetIfValid(cur->GetDestination());
|
||||
if (st != nullptr && next_station != INVALID_STATION && next_station != st->index) {
|
||||
Station *st_to = Station::Get(next_station);
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
/* Refresh the link and give it a minimum capacity. */
|
||||
|
||||
@@ -240,21 +241,21 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next, uint8 flag
|
||||
uint cargo_quantity = this->capacities[c];
|
||||
if (cargo_quantity == 0) continue;
|
||||
|
||||
if (this->vehicle->GetDisplayMaxSpeed() == 0) continue;
|
||||
|
||||
/* If not allowed to merge link graphs, make sure the stations are
|
||||
* already in the same link graph. */
|
||||
if (!this->allow_merge && st->goods[c].link_graph != Station::Get(next_station)->goods[c].link_graph) {
|
||||
if (!this->allow_merge && st->goods[c].link_graph != st_to->goods[c].link_graph) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* A link is at least partly restricted if a vehicle can't load at its source. */
|
||||
EdgeUpdateMode restricted_mode = (cur->GetCargoLoadType(c) & OLFB_NO_LOAD) == 0 ?
|
||||
EUM_UNRESTRICTED : EUM_RESTRICTED;
|
||||
Station *st_to = Station::GetIfValid(next_station);
|
||||
/* This estimates the travel time of the link as the time needed
|
||||
* to travel between the stations at half the max speed of the consist.
|
||||
* The result is in tiles/tick (= 2048 km-ish/h). */
|
||||
uint32 time_estimate = (st_to != nullptr) ?
|
||||
DistanceManhattan(st->xy, st_to->xy) * 4096U / this->vehicle->GetDisplayMaxSpeed() : 0;
|
||||
uint32 time_estimate = DistanceManhattan(st->xy, st_to->xy) * 4096U / this->vehicle->GetDisplayMaxSpeed();
|
||||
|
||||
if (HasBit(flags, AIRCRAFT)) restricted_mode |= EUM_AIRCRAFT;
|
||||
|
||||
|
Reference in New Issue
Block a user