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

Function GetAircraftEngineInfoString

src/engine_gui.cpp:221–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static std::string GetAircraftEngineInfoString(const Engine &e)
222{
223 std::stringstream res;
224
225 res << GetString(STR_ENGINE_PREVIEW_COST_MAX_SPEED, e.GetCost(), PackVelocity(e.GetDisplayMaxSpeed(), e.type));
226 res << '\n';
227
228 if (uint16_t range = e.GetRange(); range > 0) {
229 res << GetString(STR_ENGINE_PREVIEW_TYPE_RANGE, e.GetAircraftTypeText(), range);
230 res << '\n';
231 } else {
232 res << GetString(STR_ENGINE_PREVIEW_TYPE, e.GetAircraftTypeText());
233 res << '\n';
234 }
235
236 res << GetPreviewRunningCostString(e);
237 res << '\n';
238
239 CargoType cargo = e.GetDefaultCargoType();
240 uint16_t mail_capacity;
241 uint capacity = e.GetDisplayDefaultCapacity(&mail_capacity);
242 if (mail_capacity > 0) {
243 res << GetString(STR_ENGINE_PREVIEW_CAPACITY_2, cargo, capacity, GetCargoTypeByLabel(CT_MAIL), mail_capacity);
244 } else {
245 res << GetString(STR_ENGINE_PREVIEW_CAPACITY, cargo, capacity);
246 }
247
248 return res.str();
249}
250
251static std::string GetRoadVehEngineInfoString(const Engine &e)
252{

Callers 1

GetEngineInfoStringFunction · 0.85

Calls 11

PackVelocityFunction · 0.85
GetCargoTypeByLabelFunction · 0.85
GetAircraftTypeTextMethod · 0.80
GetDefaultCargoTypeMethod · 0.80
GetStringFunction · 0.70
GetCostMethod · 0.45
GetDisplayMaxSpeedMethod · 0.45
GetRangeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected