forked from canidae/saiph
/
Command.h
49 lines (40 loc) · 1.17 KB
/
Command.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
41
42
43
44
45
46
47
48
49
#ifndef COMMAND_H
#define COMMAND_H
#include <iostream>
#include <string>
/* unique priorities */
#define ILLEGAL_PRIORITY -1
#define PRIORITY_CONTINUE_ACTION 1007
#define PRIORITY_SELECT_ITEM 1006
#define PRIORITY_CLOSE_SELECT_PAGE 1005
#define PRIORITY_LIST_PLAYER_ATTRIBUTES 1004
#define PRIORITY_LIST_PLAYER_SKILLS 1003
#define PRIORITY_LIST_INVENTORY 1002
#define PRIORITY_NAME_ITEM 1001
#define PRIORITY_LOOK 1000
#define PRIORITY_TURN_MAX 999
/* loot priority (when picking up, not moving to), due to centralized handling of looting */
#define PRIORITY_LOOT 300
/* some common answers */
#define CLOSE_PAGE ' '
#define DESELECT_PAGE '\\'
#define HANDS '-'
#define NO 'n'
#define QUIT "#quit\n"
#define SELECT_PAGE ','
#define YES 'y'
class Command {
public:
Command(const std::string& command = "", int priority = ILLEGAL_PRIORITY);
Command(unsigned char key, int priority);
const std::string& command() const;
const std::string& command(const std::string& command);
int priority() const;
int priority(int priority);
bool operator==(const Command& c) const;
private:
std::string _command;
int _priority;
};
std::ostream& operator<<(std::ostream& os, const Command& c);
#endif