| 65 | } |
| 66 | |
| 67 | void VehicleSheet::displayImplementation(sp<Vehicle> vehicle, sp<VehicleType> vehicleType) |
| 68 | { |
| 69 | form->findControlTyped<Label>("ITEM_NAME")->setText(""); |
| 70 | form->findControlTyped<TextEdit>("TEXT_VEHICLE_NAME") |
| 71 | ->setText(vehicle ? vehicle->name : vehicleType->name); |
| 72 | form->findControlTyped<Graphic>("SELECTED_IMAGE")->setImage(vehicleType->equip_icon_small); |
| 73 | |
| 74 | form->findControlTyped<Label>("LABEL_1_L")->setText(tr("Constitution")); |
| 75 | form->findControlTyped<Label>("LABEL_2_L")->setText(tr("Armor")); |
| 76 | form->findControlTyped<Label>("LABEL_3_L")->setText(tr("Accuracy")); |
| 77 | form->findControlTyped<Label>("LABEL_4_L")->setText(tr("Top Speed")); |
| 78 | form->findControlTyped<Label>("LABEL_5_L")->setText(tr("Acceleration")); |
| 79 | form->findControlTyped<Label>("LABEL_6_L")->setText(tr("Weight")); |
| 80 | form->findControlTyped<Label>("LABEL_7_L")->setText(tr("Fuel")); |
| 81 | form->findControlTyped<Label>("LABEL_8_L")->setText(tr("Passengers")); |
| 82 | form->findControlTyped<Label>("LABEL_9_L")->setText(tr("Cargo")); |
| 83 | |
| 84 | std::list<sp<VEquipmentType>> defaultEquipment; |
| 85 | for (auto &e : vehicleType->initial_equipment_list) |
| 86 | { |
| 87 | defaultEquipment.push_back(e.second.getSp()); |
| 88 | } |
| 89 | auto it1 = defaultEquipment.begin(); |
| 90 | auto it2 = defaultEquipment.end(); |
| 91 | |
| 92 | form->findControlTyped<Label>("LABEL_1_R") |
| 93 | ->setText(vehicle |
| 94 | ? format("%d / %d", vehicle->getConstitution(), vehicle->getMaxConstitution()) |
| 95 | : format("%d", vehicleType->getMaxConstitution(it1, it2))); |
| 96 | |
| 97 | form->findControlTyped<Label>("LABEL_2_R") |
| 98 | ->setText(format("%d", vehicle ? vehicle->getArmor() : vehicleType->getArmor(it1, it2))); |
| 99 | |
| 100 | form->findControlTyped<Label>("LABEL_3_R") |
| 101 | ->setText( |
| 102 | format("%d%%", vehicle ? vehicle->getAccuracy() : vehicleType->getAccuracy(it1, it2))); |
| 103 | form->findControlTyped<Label>("LABEL_4_R") |
| 104 | ->setText( |
| 105 | format("%d", vehicle ? vehicle->getTopSpeed() : vehicleType->getTopSpeed(it1, it2))); |
| 106 | form->findControlTyped<Label>("LABEL_5_R") |
| 107 | ->setText(format("%d", vehicle ? vehicle->getAcceleration() |
| 108 | : vehicleType->getAcceleration(it1, it2))); |
| 109 | form->findControlTyped<Label>("LABEL_6_R") |
| 110 | ->setText(format("%d", vehicle ? vehicle->getWeight() : vehicleType->getWeight(it1, it2))); |
| 111 | form->findControlTyped<Label>("LABEL_7_R") |
| 112 | ->setText(vehicle ? format("%dk / %dk", vehicle->getFuel(), vehicle->getMaxFuel()) |
| 113 | : format("%dk", vehicleType->getMaxFuel(it1, it2))); |
| 114 | form->findControlTyped<Label>("LABEL_8_R") |
| 115 | ->setText(vehicle ? format("%d / %d", vehicle->getPassengers(), vehicle->getMaxPassengers()) |
| 116 | : format("%d", vehicleType->getMaxPassengers(it1, it2))); |
| 117 | if (!config().getBool("OpenApoc.NewFeature.EnforceCargoLimits")) |
| 118 | { |
| 119 | form->findControlTyped<Label>("LABEL_9_R") |
| 120 | ->setText(vehicle ? format("%d", vehicle->getCargo()) |
| 121 | : format("%d", vehicleType->getMaxCargo(it1, it2))); |
| 122 | } |
| 123 | else |
| 124 | { |
nothing calls this directly
no test coverage detected