forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollective_action.cpp
43 lines (33 loc) · 1.21 KB
/
collective_action.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "stdafx.h"
#include "collective_action.h"
vector<CollectiveAction::Type> vectorTypes { CollectiveAction::GO_TO, CollectiveAction::POSSESS };
vector<CollectiveAction::Type> intTypes { CollectiveAction::ROOM_BUTTON, CollectiveAction::TECHNOLOGY };
vector<CollectiveAction::Type> creatureTypes { CollectiveAction::CREATURE_BUTTON,
CollectiveAction::CREATURE_DESCRIPTION };
CollectiveAction::CollectiveAction(Type t, Vec2 p) : type(t), pos(p) {
CHECK(contains(vectorTypes, t));
}
CollectiveAction::CollectiveAction(Type t, int n) : type(t), num(n) {
CHECK(contains(intTypes, t));
}
CollectiveAction::CollectiveAction(Type t, const Creature* c) : type(t), creature(c) {
CHECK(contains(creatureTypes, t));
}
CollectiveAction::CollectiveAction(Type t) : type(t) {
CHECK(!contains(intTypes, t) && !contains(vectorTypes, t) && !contains(creatureTypes, t));
}
CollectiveAction::Type CollectiveAction::getType() {
return type;
}
Vec2 CollectiveAction::getPosition() {
CHECK(contains(vectorTypes, type));
return pos;
}
int CollectiveAction::getNum() {
CHECK(contains(intTypes, type));
return num;
}
const Creature* CollectiveAction::getCreature() {
CHECK(contains(creatureTypes, type));
return creature;
}