MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetRoadVehEngineInfoString

Function GetRoadVehEngineInfoString

src/engine_gui.cpp:251–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251static std::string GetRoadVehEngineInfoString(const Engine &e)
252{
253 std::stringstream res;
254
255 if (_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL) {
256 res << GetString(STR_ENGINE_PREVIEW_COST_MAX_SPEED, e.GetCost(), PackVelocity(e.GetDisplayMaxSpeed(), e.type));
257 res << '\n';
258 } else {
259 res << GetString(STR_ENGINE_PREVIEW_COST_WEIGHT, e.GetCost(), e.GetDisplayWeight());
260 res << '\n';
261 res << GetString(STR_ENGINE_PREVIEW_SPEED_POWER_MAX_TE, PackVelocity(e.GetDisplayMaxSpeed(), e.type), e.GetPower(), e.GetDisplayMaxTractiveEffort());
262 res << '\n';
263 }
264
265 res << GetPreviewRunningCostString(e);
266 res << '\n';
267
268 uint capacity = GetTotalCapacityOfArticulatedParts(e.index);
269 res << GetString(STR_ENGINE_PREVIEW_CAPACITY, capacity == 0 ? INVALID_CARGO : e.GetDefaultCargoType(), capacity);
270
271 return res.str();
272}
273
274static std::string GetShipEngineInfoString(const Engine &e)
275{

Callers 1

GetEngineInfoStringFunction · 0.85

Calls 11

PackVelocityFunction · 0.85
GetDisplayWeightMethod · 0.80
GetDefaultCargoTypeMethod · 0.80
GetStringFunction · 0.70
GetCostMethod · 0.45
GetDisplayMaxSpeedMethod · 0.45
GetPowerMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected