| 1 |
#ifndef CONVERSATION_COMMAND_INFO_H_ |
| 2 |
#define CONVERSATION_COMMAND_INFO_H_ |
| 3 |
|
| 4 |
#include "ieclass.h" |
| 5 |
#include <vector> |
| 6 |
|
| 7 |
namespace conversation { |
| 8 |
|
| 9 |
// Information about a single conversation command argument |
| 10 |
struct ArgumentInfo |
| 11 |
{ |
| 12 |
enum ArgumentType { |
| 13 |
ARGTYPE_INT, |
| 14 |
ARGTYPE_FLOAT, |
| 15 |
ARGTYPE_STRING, |
| 16 |
ARGTYPE_VECTOR, |
| 17 |
ARGTYPE_SOUNDSHADER, |
| 18 |
ARGTYPE_ACTOR, |
| 19 |
ARGTYPE_ENTITY, |
| 20 |
ARGTYPE_BOOL, |
| 21 |
NUM_ARGTYPES, |
| 22 |
}; |
| 23 |
|
| 24 |
ArgumentType type; |
| 25 |
|
| 26 |
std::string description; |
| 27 |
std::string title; |
| 28 |
|
| 29 |
bool required; |
| 30 |
}; |
| 31 |
|
| 32 |
/** |
| 33 |
* greebo: This structure holds information about a certain |
| 34 |
* Conversation Command Type (e.g. "WaitSeconds") and its arguments. |
| 35 |
* |
| 36 |
* As the number and type of arguments varies, the CommandEditor GUI |
| 37 |
* needs this structure to build the variable interface. |
| 38 |
*/ |
| 39 |
class ConversationCommandInfo |
| 40 |
{ |
| 41 |
public: |
| 42 |
// The unique id of this conversation command. |
| 43 |
int id; |
| 44 |
|
| 45 |
// The internal name, like "WaitSeconds" or "InteractWithEntity" |
| 46 |
std::string name; |
| 47 |
|
| 48 |
// Whether the "wait until finished" checkbox is displayed |
| 49 |
bool waitUntilFinishedAllowed; |
| 50 |
|
| 51 |
// The "human readable" sentence format (with placeholders) |
| 52 |
std::string sentence; |
| 53 |
|
| 54 |
typedef std::vector<ArgumentInfo> ArgumentInfoList; |
| 55 |
ArgumentInfoList arguments; |
| 56 |
|
| 57 |
ConversationCommandInfo() : |
| 58 |
id(++_highestId), |
| 59 |
waitUntilFinishedAllowed(true) |
| 60 |
{} |
| 61 |
|
| 62 |
// Fills the member variables from the given entityDef |
| 63 |
void parseFromEntityClass(const IEntityClassPtr& eclass); |
| 64 |
|
| 65 |
private: |
| 66 |
// Highest ID so far |
| 67 |
static int _highestId; |
| 68 |
}; |
| 69 |
typedef std::shared_ptr<ConversationCommandInfo> ConversationCommandInfoPtr; |
| 70 |
|
| 71 |
// A mapping between command typenames ("WalkToActor") to actual information structures |
| 72 |
typedef std::map<std::string, ConversationCommandInfoPtr> ConversationCommandInfoMap; |
| 73 |
|
| 74 |
} // namespace conversation |
| 75 |
|
| 76 |
#endif /* CONVERSATION_COMMAND_INFO_H_ */ |