Debian Codegraph @

plugins/dm.conversation/Conversation.h

raw
1 #pragma once
2
3 #include <string>
4 #include <map>
5 #include <vector>
6
7 #include "ConversationCommand.h"
8
9 namespace conversation
10 {
11
12 /**
13 * Data object representing a single Conversation.
14 */
15 class Conversation
16 {
17 public:
18
19 // The (unique) name of this conversation
20 std::string name;
21
22 float talkDistance;
23 bool actorsMustBeWithinTalkdistance;
24 bool actorsAlwaysFaceEachOther;
25 int maxPlayCount;
26
27 // Indexed list of commands
28 typedef std::map<int, ConversationCommandPtr> CommandMap;
29 CommandMap commands;
30
31 // Indexed list of actors (by name)
32 typedef std::map<int, std::string> ActorMap;
33 ActorMap actors;
34
35 // Constructor
36 Conversation() :
37 talkDistance(60),
38 actorsMustBeWithinTalkdistance(true),
39 actorsAlwaysFaceEachOther(true),
40 maxPlayCount(-1)
41 {}
42
43 // Copy Constructor
44 Conversation(const Conversation& other) :
45 name(other.name),
46 talkDistance(other.talkDistance),
47 actorsMustBeWithinTalkdistance(other.actorsMustBeWithinTalkdistance),
48 actorsAlwaysFaceEachOther(other.actorsAlwaysFaceEachOther),
49 maxPlayCount(other.maxPlayCount),
50 actors(other.actors)
51 {
52 // Copy all commands, one by one
53 for (CommandMap::const_iterator i = other.commands.begin();
54 i != other.commands.end(); ++i)
55 {
56 // Copy-construct a new conversation command
57 ConversationCommandPtr copy(new ConversationCommand(*i->second));
58
59 // Insert this into our own map
60 commands[i->first] = copy;
61 }
62 }
63 };
64
65 /**
66 * Conversation map type.
67 */
68 typedef std::map<int, Conversation> ConversationMap;
69
70 }