VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
weaponListCommandSpecParam.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2026 MAK Technologies, Inc.
3  * All rights reserved.
4  ******************************************************************************/
5 
6 #pragma once
7 
8 #include "commandSpecJob.h"
9 #include <atomic>
10 #include <json/json.h>
11 #include <boost/signals2/connection.hpp>
13 
14 class DtScenarioManager;
15 
24 {
25 public:
26  explicit DtWeaponListCommandSpecParamBuilder(const Json::Value& staticParams, const std::string& entityName, DtScenarioManager& scnMgr,
27  const Json::Value& typeModifiers, bool displayWeapons = true, bool displayMunitions = false);
29 
30 protected:
32  bool addOptions();
33 
35  bool hasValidResult() const;
36 
39  bool addWeaponOptions();
40 
43  bool addMunitionAsChoice();
48 
49  void requestData();
50 
51  void parseTypeModifiers();
52 
53  virtual void slot_receivedWeaponList(const DtUUID& entity);
54 
55  virtual bool isReady() const override { return myReady; }
56  virtual Json::Value result() const override { return myResult; }
57 
58  // Checks the specified weapon against the TypeModifiers and returns true if this weapon should be included in the choice list.
59  virtual bool includeWeapon(const WeaponSystem& weapon) const;
60 
61 protected:
62  virtual bool getTypeModifier(std::string name, std::string& result) const;
63 
64 private:
67  std::atomic<bool> myReady;
69  boost::signals2::connection myConnection;
71  bool myDisplayWeapons = true;
72  bool myDisplayMunitions = true;
74 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtWeaponListCommandSpecParamBuilder(const Json::Value &staticParams, const std::string &entityName, DtScenarioManager &scnMgr, const Json::Value &typeModifiers, bool displayWeapons=true, bool displayMunitions=false)
The class that is the interface between the remote controller and the back-end.
Definition: remoteControlWeaponListRequestor.h:27
Definition: scenarioManager.h:40
Json::Value myTypeModifiers
Definition: weaponListCommandSpecParam.h:70
DtUUID myEntityUuid
Definition: weaponListCommandSpecParam.h:66
boost::signals2::connection myConnection
Definition: weaponListCommandSpecParam.h:69
virtual bool includeWeapon(const WeaponSystem &weapon) const
bool addMunitionAsChoice()
Returns true if the requestor has munition options for this entity, and adds them as a single choice ...
DtRemoteControlWeaponListRequestor & myWeaponListRequestor
Definition: weaponListCommandSpecParam.h:68
bool myDisplayMunitions
Definition: weaponListCommandSpecParam.h:72
virtual bool isReady() const override
Returns true once result() can be safely called.
Definition: weaponListCommandSpecParam.h:55
Awaitable result handle for asynchronous command spec building.
virtual Json::Value result() const override
Returns the fully populated JSON descriptor for this parameter. Only valid after isReady() returns tr...
Definition: weaponListCommandSpecParam.h:56
bool hasValidResult() const
returns true if the result has been populated with choices or collections, false if data was not yet ...
std::atomic< bool > myReady
Definition: weaponListCommandSpecParam.h:67
Json::Value myResult
Definition: weaponListCommandSpecParam.h:65
IMGUI_API void Value(const char *prefix, bool b)
DtWeaponListCommandSpecParamBuilder.
Definition: weaponListCommandSpecParam.h:23
bool addMunitionAsCollection()
Returns true if the requestor has munition options for this entity, and adds them as a collection int...
Abstract base for a single-parameter command spec builder.
Definition: commandSpecParamBuilder.h:25
DtScenarioManager & myScenarioManager
Definition: weaponListCommandSpecParam.h:73
bool addWeaponOptions()
If the requestor has options for this entity, add them to the result. Returns true if choices were po...
virtual bool getTypeModifier(std::string name, std::string &result) const
Definition: weaponListResponseAdmin.h:27
bool myDisplayWeapons
Definition: weaponListCommandSpecParam.h:71
bool addOptions()
adds either weapons or munitions, depending on what type of request this handles
virtual void slot_receivedWeaponList(const DtUUID &entity)

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)