mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21858) -Codechange: Give more similar names to ArticulatedPart functions.
This commit is contained in:
parent
10a7678beb
commit
cfbbcf1597
|
@ -28,7 +28,7 @@ static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts
|
||||||
* @param mirrored Returns whether the part shall be flipped.
|
* @param mirrored Returns whether the part shall be flipped.
|
||||||
* @return engine to add or INVALID_ENGINE
|
* @return engine to add or INVALID_ENGINE
|
||||||
*/
|
*/
|
||||||
static EngineID GetNextArticPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
|
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
|
||||||
{
|
{
|
||||||
assert(front == NULL || front->engine_type == front_type);
|
assert(front == NULL || front->engine_type == front_type);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
|
||||||
|
|
||||||
uint i;
|
uint i;
|
||||||
for (i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
for (i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||||
if (GetNextArticPart(i, engine_type, v) == INVALID_ENGINE) break;
|
if (GetNextArticulatedPart(i, engine_type, v) == INVALID_ENGINE) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete v;
|
delete v;
|
||||||
|
@ -113,7 +113,7 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
|
||||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
|
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
|
||||||
|
|
||||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||||
if (artic_engine == INVALID_ENGINE) break;
|
if (artic_engine == INVALID_ENGINE) break;
|
||||||
|
|
||||||
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
|
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
|
||||||
|
@ -138,7 +138,7 @@ bool IsArticulatedVehicleRefittable(EngineID engine)
|
||||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
|
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
|
||||||
|
|
||||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||||
if (artic_engine == INVALID_ENGINE) break;
|
if (artic_engine == INVALID_ENGINE) break;
|
||||||
|
|
||||||
if (IsEngineRefittable(artic_engine)) return true;
|
if (IsEngineRefittable(artic_engine)) return true;
|
||||||
|
@ -165,7 +165,7 @@ void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type,
|
||||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
|
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
|
||||||
|
|
||||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||||
if (artic_engine == INVALID_ENGINE) break;
|
if (artic_engine == INVALID_ENGINE) break;
|
||||||
|
|
||||||
veh_cargos = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
|
veh_cargos = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
|
||||||
|
@ -223,7 +223,7 @@ bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *carg
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
case VEH_TRAIN:
|
case VEH_TRAIN:
|
||||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticPart() : NULL;
|
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VEH_ROAD:
|
case VEH_ROAD:
|
||||||
|
@ -270,7 +270,7 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
case VEH_TRAIN:
|
case VEH_TRAIN:
|
||||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticPart() : NULL;
|
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VEH_ROAD:
|
case VEH_ROAD:
|
||||||
|
@ -306,7 +306,7 @@ void AddArticulatedParts(Vehicle *first)
|
||||||
Vehicle *v = first;
|
Vehicle *v = first;
|
||||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||||
bool flip_image;
|
bool flip_image;
|
||||||
EngineID engine_type = GetNextArticPart(i, first->engine_type, first, &flip_image);
|
EngineID engine_type = GetNextArticulatedPart(i, first->engine_type, first, &flip_image);
|
||||||
if (engine_type == INVALID_ENGINE) return;
|
if (engine_type == INVALID_ENGINE) return;
|
||||||
|
|
||||||
/* In the (very rare) case the GRF reported wrong number of articulated parts
|
/* In the (very rare) case the GRF reported wrong number of articulated parts
|
||||||
|
|
|
@ -267,7 +267,7 @@ struct Train : public GroundVehicle<Train, VEH_TRAIN> {
|
||||||
* Result is undefined for normal engine.
|
* Result is undefined for normal engine.
|
||||||
* @return next part of articulated engine
|
* @return next part of articulated engine
|
||||||
*/
|
*/
|
||||||
FORCEINLINE Train *GetNextArticPart() const
|
FORCEINLINE Train *GetNextArticulatedPart() const
|
||||||
{
|
{
|
||||||
assert(this->HasArticulatedPart());
|
assert(this->HasArticulatedPart());
|
||||||
return this->Next();
|
return this->Next();
|
||||||
|
@ -302,7 +302,7 @@ struct Train : public GroundVehicle<Train, VEH_TRAIN> {
|
||||||
FORCEINLINE Train *GetLastEnginePart()
|
FORCEINLINE Train *GetLastEnginePart()
|
||||||
{
|
{
|
||||||
Train *v = this;
|
Train *v = this;
|
||||||
while (v->HasArticulatedPart()) v = v->GetNextArticPart();
|
while (v->HasArticulatedPart()) v = v->GetNextArticulatedPart();
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ struct Train : public GroundVehicle<Train, VEH_TRAIN> {
|
||||||
FORCEINLINE Train *GetNextVehicle() const
|
FORCEINLINE Train *GetNextVehicle() const
|
||||||
{
|
{
|
||||||
const Train *v = this;
|
const Train *v = this;
|
||||||
while (v->HasArticulatedPart()) v = v->GetNextArticPart();
|
while (v->HasArticulatedPart()) v = v->GetNextArticulatedPart();
|
||||||
|
|
||||||
/* v now contains the last artic part in the engine */
|
/* v now contains the last artic part in the engine */
|
||||||
return v->Next();
|
return v->Next();
|
||||||
|
|
|
@ -2373,7 +2373,7 @@ void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8 num_vehicles)
|
||||||
u = u->GetFirstEnginePart();
|
u = u->GetFirstEnginePart();
|
||||||
while (u->index != v->index) {
|
while (u->index != v->index) {
|
||||||
set.Include(u->index);
|
set.Include(u->index);
|
||||||
u = u->GetNextArticPart();
|
u = u->GetNextArticulatedPart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -764,7 +764,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->type == VEH_TRAIN && Train::From(w)->HasArticulatedPart()) {
|
if (w->type == VEH_TRAIN && Train::From(w)->HasArticulatedPart()) {
|
||||||
w = Train::From(w)->GetNextArticPart();
|
w = Train::From(w)->GetNextArticulatedPart();
|
||||||
} else if (w->type == VEH_ROAD && RoadVehicle::From(w)->HasArticulatedPart()) {
|
} else if (w->type == VEH_ROAD && RoadVehicle::From(w)->HasArticulatedPart()) {
|
||||||
w = w->Next();
|
w = w->Next();
|
||||||
} else {
|
} else {
|
||||||
|
@ -780,7 +780,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->type == VEH_TRAIN && Train::From(v)->HasArticulatedPart()) {
|
if (v->type == VEH_TRAIN && Train::From(v)->HasArticulatedPart()) {
|
||||||
v = Train::From(v)->GetNextArticPart();
|
v = Train::From(v)->GetNextArticulatedPart();
|
||||||
} else if (v->type == VEH_ROAD && RoadVehicle::From(v)->HasArticulatedPart()) {
|
} else if (v->type == VEH_ROAD && RoadVehicle::From(v)->HasArticulatedPart()) {
|
||||||
v = v->Next();
|
v = v->Next();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue