Emergency 20 Dokumentation  4.2.0
MoveCommand.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/command/Command.h"
14 #include "em5/ai/MovementModes.h"
15 
16 
17 //[-------------------------------------------------------]
18 //[ Namespace ]
19 //[-------------------------------------------------------]
20 namespace em5
21 {
22 
23 
24  //[-------------------------------------------------------]
25  //[ Classes ]
26  //[-------------------------------------------------------]
31  class MoveCommand : public Command
32  {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Public definitions ]
37  //[-------------------------------------------------------]
38  public:
39  static const uint32 PLUGINABLE_ID;
40 
41 
42  //[-------------------------------------------------------]
43  //[ Public methods ]
44  //[-------------------------------------------------------]
45  public:
46  static void computeMultiSelectionTargetPositionForOrdering(qsf::Entity& caller, int index_, int numOrder_, glm::vec3& position);
47  static bool computeAvailableTargetPosition(qsf::Entity& caller, glm::vec3& position);
48  static bool computeAvailableTargetPosition(qsf::Entity& caller, glm::vec3& position, const float searchRadius);
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public methods ]
53  //[-------------------------------------------------------]
54  public:
59  explicit MoveCommand(qsf::game::CommandManager* commandManager);
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public virtual em5::Command methods ]
64  //[-------------------------------------------------------]
65  public:
66  virtual bool checkAvailable() override;
67  virtual bool checkCaller(qsf::Entity& caller) override;
68  virtual bool checkContext(const qsf::game::CommandContext& context) override;
69  virtual void execute(const qsf::game::CommandContext& context) override;
70  virtual bool highlightTarget() const override;
71 
72 
73  //[-------------------------------------------------------]
74  //[ Private methods ]
75  //[-------------------------------------------------------]
76  private:
77  MovementModes::Modes getMovementMode(qsf::Entity& entity) const;
78 
79  static void computeMultiSelectionTargetPosition(qsf::Entity& caller, const std::vector<qsf::Entity*> callers, glm::vec3& position);
80  static bool isTargetPositionBlockedByPolygons(qsf::Entity& caller, const glm::vec3& position);
81 
82 
83  //[-------------------------------------------------------]
84  //[ Private definitions ]
85  //[-------------------------------------------------------]
86  private:
87  static const uint32 ACTION_PRIORITY;
88 
89 
90  //[-------------------------------------------------------]
91  //[ CAMP reflection system ]
92  //[-------------------------------------------------------]
93  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
94 
95 
96  };
97 
98 
99 //[-------------------------------------------------------]
100 //[ Namespace ]
101 //[-------------------------------------------------------]
102 } // em5
103 
104 
105 //[-------------------------------------------------------]
106 //[ CAMP reflection system ]
107 //[-------------------------------------------------------]
Command manager implementation.
Definition: CommandManager.h:49
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
static void computeMultiSelectionTargetPositionForOrdering(qsf::Entity &caller, int index_, int numOrder_, glm::vec3 &position)
static bool computeAvailableTargetPosition(qsf::Entity &caller, glm::vec3 &position)
Abstract EMERGENCY 5 command base class.
Definition: Command.h:44
static const uint32 PLUGINABLE_ID
"em5::MoveCommand" unique command pluginable ID
Definition: MoveCommand.h:39
EMERGENCY 5 move command implementation.
Definition: MoveCommand.h:31
Modes
Definition: MovementModes.h:44
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
virtual bool checkContext(const qsf::game::CommandContext &context) override
Check whether the command can be executed with the given context.
virtual bool highlightTarget() const override
Indicates if target highlighting for this command is enabled/disabled.
virtual void execute(const qsf::game::CommandContext &context) override
Execute command for given context.
MoveCommand(qsf::game::CommandManager *commandManager)
Constructor.
virtual bool checkAvailable() override
Check whether the command is currently available at all.
Command context base class.
Definition: CommandContext.h:48
virtual bool checkCaller(qsf::Entity &caller) override
Check whether the command can be executed by the given caller entity.