-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathCondition.h
40 lines (31 loc) · 815 Bytes
/
Condition.h
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
#pragma once
#include "Common.h"
class CCBot;
namespace ConditionTypes
{
enum { UnaryString, UnaryInt, UnaryUnitType, BinaryComp, BinaryBool, BinaryInt, Invalid };
}
namespace ConditionOperators
{
enum { LT, GT, EQ, NEQ, LTE, GTE, OR, AND, PLUS, MINUS, MULT, DIV, Invalid };
}
class Condition
{
CCBot * m_bot;
int m_type;
int m_player;
Condition * m_lhs;
Condition * m_rhs;
int m_op;
std::string m_strValue;
int m_intValue;
json m_json;
static int GetOperator(const std::string & op);
static int GetPlayer(const std::string & op);
static int GetType(const std::string & op);
public:
Condition();
Condition(const json & j, CCBot & bot);
bool eval() const;
int intEval() const;
};