| 1320 | } |
| 1321 | |
| 1322 | void OnQueryTextFinished(std::optional<std::string> str) override |
| 1323 | { |
| 1324 | if (!str.has_value() || str->empty()) return; |
| 1325 | |
| 1326 | VehicleOrderID sel = this->OrderGetSel(); |
| 1327 | auto value = ParseInteger(*str, 10, true); |
| 1328 | if (!value.has_value()) return; |
| 1329 | |
| 1330 | switch (this->vehicle->GetOrder(sel)->GetConditionVariable()) { |
| 1331 | case OrderConditionVariable::MaxSpeed: |
| 1332 | value = ConvertDisplaySpeedToSpeed(*value, this->vehicle->type); |
| 1333 | break; |
| 1334 | |
| 1335 | case OrderConditionVariable::Reliability: |
| 1336 | case OrderConditionVariable::MaxReliability: |
| 1337 | case OrderConditionVariable::LoadPercentage: |
| 1338 | value = Clamp(*value, 0, 100); |
| 1339 | break; |
| 1340 | |
| 1341 | default: |
| 1342 | break; |
| 1343 | } |
| 1344 | Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel, MOF_COND_VALUE, Clamp(*value, 0, 2047)); |
| 1345 | } |
| 1346 | |
| 1347 | void OnDropdownSelect(WidgetID widget, int index, int) override |
| 1348 | { |
nothing calls this directly
no test coverage detected