Merge remote-tracking branch 'upstream/master' into 13.0
This commit is contained in:
+18
-5
@@ -94,10 +94,10 @@ int RoadVehicle::GetDisplayImageWidth(Point *offset) const
|
||||
int reference_width = ROADVEHINFO_DEFAULT_VEHICLE_WIDTH;
|
||||
|
||||
if (offset != nullptr) {
|
||||
offset->x = ScaleGUITrad(reference_width) / 2;
|
||||
offset->x = ScaleSpriteTrad(reference_width) / 2;
|
||||
offset->y = 0;
|
||||
}
|
||||
return ScaleGUITrad(this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH);
|
||||
return ScaleSpriteTrad(this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH);
|
||||
}
|
||||
|
||||
static void GetRoadVehIcon(EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result)
|
||||
@@ -175,8 +175,8 @@ void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs
|
||||
Rect rect;
|
||||
seq.GetBounds(&rect);
|
||||
|
||||
width = UnScaleGUI(rect.right - rect.left + 1);
|
||||
height = UnScaleGUI(rect.bottom - rect.top + 1);
|
||||
width = UnScaleGUI(rect.Width());
|
||||
height = UnScaleGUI(rect.Height());
|
||||
xoffs = UnScaleGUI(rect.left);
|
||||
yoffs = UnScaleGUI(rect.top);
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ struct RoadDriveEntry {
|
||||
|
||||
#include "table/roadveh_movement.h"
|
||||
|
||||
static bool RoadVehLeaveDepot(RoadVehicle *v, bool first)
|
||||
bool RoadVehLeaveDepot(RoadVehicle *v, bool first)
|
||||
{
|
||||
/* Don't leave unless v and following wagons are in the depot. */
|
||||
for (const RoadVehicle *u = v; u != nullptr; u = u->Next()) {
|
||||
@@ -1753,3 +1753,16 @@ Trackdir RoadVehicle::GetVehicleTrackdir() const
|
||||
* otherwise transform it into a valid track direction */
|
||||
return (Trackdir)((IsReversingRoadTrackdir((Trackdir)this->state)) ? (this->state - 6) : this->state);
|
||||
}
|
||||
|
||||
uint16 RoadVehicle::GetMaxWeight() const
|
||||
{
|
||||
uint16 weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->GetEngine()->DetermineCapacity(this));
|
||||
|
||||
/* Vehicle weight is not added for articulated parts. */
|
||||
if (!this->IsArticulatedPart()) {
|
||||
/* Road vehicle weight is in units of 1/4 t. */
|
||||
weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user