Departures: Fix indentation/whitespace issues.

This commit is contained in:
Jonathan G Rennison
2015-08-21 23:06:52 +01:00
parent f2d0c3a441
commit c6f38acbd6
2 changed files with 57 additions and 57 deletions

View File

@@ -111,7 +111,7 @@ DepartureList* MakeDepartureList(StationID station, bool show_vehicle_types[5],
continue; continue;
} }
/* MAX_COMPANIES is probably the wrong thing to put here, but it works. GenerateVehicleSortList doesn't check the company when the type of list is VL_STATION_LIST (r20801). */ /* MAX_COMPANIES is probably the wrong thing to put here, but it works. GenerateVehicleSortList doesn't check the company when the type of list is VL_STATION_LIST (r20801). */
if (!GenerateVehicleSortList(&vehicles, VehicleListIdentifier(VL_STATION_LIST, (VehicleType)(VEH_TRAIN + i), MAX_COMPANIES, station).Pack())) { if (!GenerateVehicleSortList(&vehicles, VehicleListIdentifier(VL_STATION_LIST, (VehicleType)(VEH_TRAIN + i), MAX_COMPANIES, station).Pack())) {
/* Something went wrong: panic! */ /* Something went wrong: panic! */
return result; return result;
@@ -417,45 +417,45 @@ DepartureList* MakeDepartureList(StationID station, bool show_vehicle_types[5],
if (found_terminus) { if (found_terminus) {
/* Add the departure to the result list. */ /* Add the departure to the result list. */
bool duplicate = false; bool duplicate = false;
if (_settings_client.gui.departure_merge_identical) { if (_settings_client.gui.departure_merge_identical) {
for (uint i = 0; i < result->Length(); ++i) { for (uint i = 0; i < result->Length(); ++i) {
if (*d == **(result->Get(i))) { if (*d == **(result->Get(i))) {
duplicate = true; duplicate = true;
break; break;
} }
} }
} }
if (!duplicate) { if (!duplicate) {
*(result->Append(1)) = d; *(result->Append(1)) = d;
if (_settings_client.gui.departure_smart_terminus && type == D_DEPARTURE) { if (_settings_client.gui.departure_smart_terminus && type == D_DEPARTURE) {
for (uint i = 0; i < result->Length()-1; ++i) { for (uint i = 0; i < result->Length()-1; ++i) {
Departure *d_first = *(result->Get(i)); Departure *d_first = *(result->Get(i));
uint k = d_first->calling_at.Length()-2; uint k = d_first->calling_at.Length()-2;
for (uint j = d->calling_at.Length(); j > 0; --j) { for (uint j = d->calling_at.Length(); j > 0; --j) {
CallAt c = CallAt(*(d->calling_at.Get(j-1))); CallAt c = CallAt(*(d->calling_at.Get(j-1)));
if (d_first->terminus >= c && d_first->calling_at.Length() >= 2) { if (d_first->terminus >= c && d_first->calling_at.Length() >= 2) {
d_first->terminus = CallAt(*(d_first->calling_at.Get(k))); d_first->terminus = CallAt(*(d_first->calling_at.Get(k)));
if (k == 0) break; if (k == 0) break;
k--; k--;
} }
} }
} }
} }
/* If the vehicle is expected to be late, we want to know what time it will arrive rather than depart. */ /* If the vehicle is expected to be late, we want to know what time it will arrive rather than depart. */
/* This is done because it looked silly to me to have a vehicle not be expected for another few days, yet it be at the same time pulling into the station. */ /* This is done because it looked silly to me to have a vehicle not be expected for another few days, yet it be at the same time pulling into the station. */
if (d->status != D_ARRIVED && if (d->status != D_ARRIVED &&
d->lateness > 0) { d->lateness > 0) {
d->lateness -= least_order->order->GetWaitTime(); d->lateness -= least_order->order->GetWaitTime();
} }
} }
} }
} else { } else {
/* Computing arrivals: */ /* Computing arrivals: */
@@ -521,20 +521,20 @@ DepartureList* MakeDepartureList(StationID station, bool show_vehicle_types[5],
d->terminus = CallAt((StationID)candidate_origin->GetDestination()); d->terminus = CallAt((StationID)candidate_origin->GetDestination());
if (found_origin) { if (found_origin) {
bool duplicate = false; bool duplicate = false;
if (_settings_client.gui.departure_merge_identical) { if (_settings_client.gui.departure_merge_identical) {
for (uint i = 0; i < result->Length(); ++i) { for (uint i = 0; i < result->Length(); ++i) {
if (*d == **(result->Get(i))) { if (*d == **(result->Get(i))) {
duplicate = true; duplicate = true;
break; break;
} }
} }
} }
if (!duplicate) { if (!duplicate) {
*(result->Append(1)) = d; *(result->Append(1)) = d;
} }
} }
} }

View File

@@ -80,20 +80,20 @@ typedef struct Departure {
calling_at.Reset(); calling_at.Reset();
} }
inline bool operator==(const Departure& d) const { inline bool operator==(const Departure& d) const {
if (this->calling_at.Length() != d.calling_at.Length()) return false; if (this->calling_at.Length() != d.calling_at.Length()) return false;
for (uint i = 0; i < this->calling_at.Length(); ++i) { for (uint i = 0; i < this->calling_at.Length(); ++i) {
if (*(this->calling_at.Get(i)) != *(d.calling_at.Get(i))) return false; if (*(this->calling_at.Get(i)) != *(d.calling_at.Get(i))) return false;
} }
return return
(this->scheduled_date / DATE_UNIT_SIZE) == (d.scheduled_date / DATE_UNIT_SIZE) && (this->scheduled_date / DATE_UNIT_SIZE) == (d.scheduled_date / DATE_UNIT_SIZE) &&
this->vehicle->type == d.vehicle->type && this->vehicle->type == d.vehicle->type &&
this->via == d.via && this->via == d.via &&
this->type == d.type this->type == d.type
; ;
} }
} Departure; } Departure;
typedef SmallVector<Departure*, 32> DepartureList; typedef SmallVector<Departure*, 32> DepartureList;