| 17 | class MultilistBox; |
| 18 | |
| 19 | class AgentAssignment : public Form |
| 20 | { |
| 21 | private: |
| 22 | sp<Agent> agent; |
| 23 | sp<Vehicle> vehicle; |
| 24 | sp<Building> building; |
| 25 | sp<GameState> state; |
| 26 | |
| 27 | Colour HoverColour, SelectedColour; |
| 28 | Vec2<int> renderOffset{32, 0}; |
| 29 | |
| 30 | // List of dragged agents. |
| 31 | sp<MultilistBox> draggedList; |
| 32 | // The agents MultilistBox which selected agents was taken from. |
| 33 | sp<MultilistBox> sourceRaisedBy; |
| 34 | // Handle the mouse's drag&drop sensibility. |
| 35 | int positionX = 0, positionY = 0, insensibility = 5 * 5; |
| 36 | // State of dragged action. |
| 37 | bool isDragged = false; |
| 38 | // Update the vehicle's icon |
| 39 | std::function<void(sp<Control>)> funcVehicleUpdate; |
| 40 | // Update the agent's icon |
| 41 | std::function<void(sp<Control>)> funcAgentUpdate; |
| 42 | // Select/deselect individual agent |
| 43 | std::function<bool(Event *, sp<Control>, bool)> funcHandleAgentSelection; |
| 44 | // Select/deselect agents inside vehicle |
| 45 | std::function<bool(Event *, sp<Control>, bool)> funcHandleVehicleSelection; |
| 46 | // Selection render |
| 47 | std::function<void(sp<Control>)> funcSelectionItemRender; |
| 48 | // Hover render |
| 49 | std::function<void(sp<Control>)> funcHoverItemRender; |
| 50 | |
| 51 | void addAgentsToList(sp<MultilistBox> list, const int listOffset); |
| 52 | |
| 53 | void addVehiclesToList(sp<MultilistBox> list, const int listOffset); |
| 54 | |
| 55 | void addBuildingToRightList(sp<Building> building, sp<MultilistBox> list, const int listOffset); |
| 56 | |
| 57 | public: |
| 58 | static const UString AGENT_SELECT_BOX; |
| 59 | static const UString AGENT_LIST_NAME; |
| 60 | static const UString VEHICLE_LIST_NAME; |
| 61 | |
| 62 | std::list<sp<Agent>> agents; |
| 63 | std::list<sp<Vehicle>> vehicles; |
| 64 | std::list<sp<Building>> buildings; |
| 65 | |
| 66 | sp<Agent> currentAgent; |
| 67 | sp<Vehicle> currentVehicle; |
| 68 | |
| 69 | AgentAssignment(sp<GameState> state); |
| 70 | |
| 71 | void init(sp<Form> form, Vec2<int> location, Vec2<int> size); |
| 72 | |
| 73 | // Call when selected agent. |
| 74 | void setLocation(sp<Agent> agent); |
| 75 | // Call when selected vehicle. |
| 76 | void setLocation(sp<Vehicle> vehicle); |
nothing calls this directly
no outgoing calls
no test coverage detected