mirror of https://github.com/OpenTTD/OpenTTD
(svn r13205) -Codechange: Remove unnecessary code-style-buggering-up macro.
parent
621e205f74
commit
510c0acb4a
|
@ -1953,10 +1953,9 @@ int WhoCanServiceIndustry(Industry* ind)
|
||||||
bool c_accepts = false;
|
bool c_accepts = false;
|
||||||
bool c_produces = false;
|
bool c_produces = false;
|
||||||
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
||||||
const Vehicle *u = v;
|
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
|
||||||
BEGIN_ENUM_WAGONS(u)
|
|
||||||
CanCargoServiceIndustry(u->cargo_type, ind, &c_accepts, &c_produces);
|
CanCargoServiceIndustry(u->cargo_type, ind, &c_accepts, &c_produces);
|
||||||
END_ENUM_WAGONS(u)
|
}
|
||||||
} else if (v->type == VEH_ROAD || v->type == VEH_SHIP || v->type == VEH_AIRCRAFT) {
|
} else if (v->type == VEH_ROAD || v->type == VEH_SHIP || v->type == VEH_AIRCRAFT) {
|
||||||
CanCargoServiceIndustry(v->cargo_type, ind, &c_accepts, &c_produces);
|
CanCargoServiceIndustry(v->cargo_type, ind, &c_accepts, &c_produces);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2807,10 +2807,10 @@ static void SetVehicleCrashed(Vehicle *v)
|
||||||
|
|
||||||
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
|
||||||
|
|
||||||
BEGIN_ENUM_WAGONS(v)
|
for (; v != NULL; v = v->Next()) {
|
||||||
v->vehstatus |= VS_CRASHED;
|
v->vehstatus |= VS_CRASHED;
|
||||||
MarkSingleVehicleDirty(v);
|
MarkSingleVehicleDirty(v);
|
||||||
END_ENUM_WAGONS(v)
|
}
|
||||||
|
|
||||||
/* must be updated after the train has been marked crashed */
|
/* must be updated after the train has been marked crashed */
|
||||||
if (crossing != INVALID_TILE) UpdateLevelCrossing(crossing);
|
if (crossing != INVALID_TILE) UpdateLevelCrossing(crossing);
|
||||||
|
@ -2819,9 +2819,11 @@ static void SetVehicleCrashed(Vehicle *v)
|
||||||
static uint CountPassengersInTrain(const Vehicle *v)
|
static uint CountPassengersInTrain(const Vehicle *v)
|
||||||
{
|
{
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
BEGIN_ENUM_WAGONS(v)
|
|
||||||
|
for (; v != NULL; v = v->Next()) {
|
||||||
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) num += v->cargo.Count();
|
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) num += v->cargo.Count();
|
||||||
END_ENUM_WAGONS(v)
|
}
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3651,9 +3653,7 @@ void ConnectMultiheadedTrains()
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
||||||
Vehicle *u = v;
|
for (Vehicle *u = v; u != NULL; u = u->Next()) {
|
||||||
|
|
||||||
BEGIN_ENUM_WAGONS(u) {
|
|
||||||
if (u->u.rail.other_multiheaded_part != NULL) continue; // we already linked this one
|
if (u->u.rail.other_multiheaded_part != NULL) continue; // we already linked this one
|
||||||
|
|
||||||
if (IsMultiheaded(u)) {
|
if (IsMultiheaded(u)) {
|
||||||
|
@ -3678,7 +3678,7 @@ void ConnectMultiheadedTrains()
|
||||||
ClearMultiheaded(u);
|
ClearMultiheaded(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} END_ENUM_WAGONS(u)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3699,9 +3699,7 @@ void ConvertOldMultiheadToNew()
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == VEH_TRAIN) {
|
if (v->type == VEH_TRAIN) {
|
||||||
if (HasBit(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
|
if (HasBit(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
|
||||||
Vehicle *u = v;
|
for (Vehicle *u = v; u != NULL; u = u->Next()) {
|
||||||
|
|
||||||
BEGIN_ENUM_WAGONS(u) {
|
|
||||||
const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
|
const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
|
||||||
|
|
||||||
ClrBit(u->subtype, 7);
|
ClrBit(u->subtype, 7);
|
||||||
|
@ -3740,7 +3738,7 @@ void ConvertOldMultiheadToNew()
|
||||||
break;
|
break;
|
||||||
default: NOT_REACHED(); break;
|
default: NOT_REACHED(); break;
|
||||||
}
|
}
|
||||||
} END_ENUM_WAGONS(u)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,9 +564,6 @@ struct InvalidVehicle : public Vehicle {
|
||||||
void Tick() {}
|
void Tick() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BEGIN_ENUM_WAGONS(v) do {
|
|
||||||
#define END_ENUM_WAGONS(v) } while ((v = v->Next()) != NULL);
|
|
||||||
|
|
||||||
static inline VehicleID GetMaxVehicleIndex()
|
static inline VehicleID GetMaxVehicleIndex()
|
||||||
{
|
{
|
||||||
/* TODO - This isn't the real content of the function, but
|
/* TODO - This isn't the real content of the function, but
|
||||||
|
|
|
@ -819,19 +819,15 @@ static void FloodVehicle(Vehicle *v)
|
||||||
|
|
||||||
if (v->z_pos != airport->delta_z + 1) return;
|
if (v->z_pos != airport->delta_z + 1) return;
|
||||||
}
|
}
|
||||||
Vehicle *u;
|
|
||||||
|
|
||||||
if (v->type != VEH_AIRCRAFT) v = v->First();
|
if (v->type != VEH_AIRCRAFT) v = v->First();
|
||||||
u = v;
|
|
||||||
|
|
||||||
/* crash all wagons, and count passengers */
|
/* crash all wagons, and count passengers */
|
||||||
BEGIN_ENUM_WAGONS(v)
|
for (Vehicle *u = v; u != NULL; u = u->Next()) {
|
||||||
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo.Count();
|
if (IsCargoInClass(u->cargo_type, CC_PASSENGERS)) pass += u->cargo.Count();
|
||||||
v->vehstatus |= VS_CRASHED;
|
u->vehstatus |= VS_CRASHED;
|
||||||
MarkSingleVehicleDirty(v);
|
MarkSingleVehicleDirty(u);
|
||||||
END_ENUM_WAGONS(v)
|
}
|
||||||
|
|
||||||
v = u;
|
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
|
Loading…
Reference in New Issue