| 176 | } |
| 177 | |
| 178 | static std::string GetTrainEngineInfoString(const Engine &e) |
| 179 | { |
| 180 | std::stringstream res; |
| 181 | |
| 182 | res << GetString(STR_ENGINE_PREVIEW_COST_WEIGHT, e.GetCost(), e.GetDisplayWeight()); |
| 183 | res << '\n'; |
| 184 | |
| 185 | if (e.VehInfo<RailVehicleInfo>().railtypes.Count() > 1) { |
| 186 | std::string railtypes{}; |
| 187 | std::string_view list_separator = GetListSeparator(); |
| 188 | |
| 189 | for (const auto &rt : _sorted_railtypes) { |
| 190 | if (!e.VehInfo<RailVehicleInfo>().railtypes.Test(rt)) continue; |
| 191 | |
| 192 | if (!railtypes.empty()) railtypes += list_separator; |
| 193 | AppendStringInPlace(railtypes, GetRailTypeInfo(rt)->strings.name); |
| 194 | } |
| 195 | res << GetString(STR_ENGINE_PREVIEW_RAILTYPES, railtypes); |
| 196 | res << '\n'; |
| 197 | } |
| 198 | |
| 199 | bool is_maglev = true; |
| 200 | for (RailType rt : e.VehInfo<RailVehicleInfo>().railtypes) { |
| 201 | is_maglev &= GetRailTypeInfo(rt)->acceleration_type == VehicleAccelerationModel::Maglev; |
| 202 | } |
| 203 | |
| 204 | if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && !is_maglev) { |
| 205 | res << GetString(STR_ENGINE_PREVIEW_SPEED_POWER_MAX_TE, PackVelocity(e.GetDisplayMaxSpeed(), e.type), e.GetPower(), e.GetDisplayMaxTractiveEffort()); |
| 206 | res << '\n'; |
| 207 | } else { |
| 208 | res << GetString(STR_ENGINE_PREVIEW_SPEED_POWER, PackVelocity(e.GetDisplayMaxSpeed(), e.type), e.GetPower()); |
| 209 | res << '\n'; |
| 210 | } |
| 211 | |
| 212 | res << GetPreviewRunningCostString(e); |
| 213 | res << '\n'; |
| 214 | |
| 215 | uint capacity = GetTotalCapacityOfArticulatedParts(e.index); |
| 216 | res << GetString(STR_ENGINE_PREVIEW_CAPACITY, capacity == 0 ? INVALID_CARGO : e.GetDefaultCargoType(), capacity); |
| 217 | |
| 218 | return res.str(); |
| 219 | } |
| 220 | |
| 221 | static std::string GetAircraftEngineInfoString(const Engine &e) |
| 222 | { |
no test coverage detected