| 230 | } |
| 231 | |
| 232 | void TransactionScreen::populateControlsAgentEquipment() |
| 233 | { |
| 234 | static const std::list<AEquipmentType::Type> agTypes = { |
| 235 | AEquipmentType::Type::Grenade, |
| 236 | AEquipmentType::Type::Weapon, |
| 237 | // Ammo means everything else |
| 238 | AEquipmentType::Type::Ammo, |
| 239 | AEquipmentType::Type::Armor, |
| 240 | AEquipmentType::Type::Loot, |
| 241 | }; |
| 242 | int leftIndex = getLeftIndex(); |
| 243 | int rightIndex = getRightIndex(); |
| 244 | for (auto &t : agTypes) |
| 245 | { |
| 246 | for (auto &ae : state->agent_equipment) |
| 247 | { |
| 248 | if (ae.second->bioStorage) |
| 249 | { |
| 250 | continue; |
| 251 | } |
| 252 | if (ae.second->type == AEquipmentType::Type::Ammo) |
| 253 | { |
| 254 | continue; |
| 255 | } |
| 256 | if (t == AEquipmentType::Type::Ammo) |
| 257 | { |
| 258 | if (std::find(agTypes.begin(), agTypes.end(), ae.second->type) != agTypes.end()) |
| 259 | { |
| 260 | continue; |
| 261 | } |
| 262 | } |
| 263 | else |
| 264 | { |
| 265 | if (ae.second->type != t) |
| 266 | { |
| 267 | continue; |
| 268 | } |
| 269 | } |
| 270 | // Add equipment |
| 271 | if (state->economy.find(ae.first) != state->economy.end()) |
| 272 | { |
| 273 | auto control = TransactionControl::createControl( |
| 274 | *state, StateRef<AEquipmentType>{state.get(), ae.first}, leftIndex, rightIndex); |
| 275 | if (control) |
| 276 | { |
| 277 | control->addCallback(FormEventType::ScrollBarChange, onScrollChange); |
| 278 | control->addCallback(FormEventType::MouseMove, onHover); |
| 279 | transactionControls[type].push_back(control); |
| 280 | } |
| 281 | } |
| 282 | // Add ammo |
| 283 | for (auto &ammo : ae.second->ammo_types) |
| 284 | { |
| 285 | if (state->economy.find(ammo.id) != state->economy.end()) |
| 286 | { |
| 287 | auto controlAmmo = |
| 288 | TransactionControl::createControl(*state, ammo, leftIndex, rightIndex); |
| 289 | if (controlAmmo) |
nothing calls this directly
no test coverage detected