-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmakstr.h
58 lines (50 loc) · 1.71 KB
/
makstr.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
50
51
52
53
54
55
56
57
58
#pragma once
#include <string>
#include <tuple>
#include "defs.h"
#include "room.h"
enum class SpeechType
{
kVerb,
kPrep,
kAdj,
kBuzz,
};
void add_inqobj(const ObjectP &obj);
WordP make_word(SpeechType st, std::string_view val);
void add_question(const char *str, const std::initializer_list<QuestionValue> &vector);
void add_demon(const HackP &x);
PrepP find_prep(std::string_view prep);
VerbP find_verb(std::string_view verb);
const ActionP &find_action(std::string_view action);
direction find_dir(const std::string &dir);
// Actions
// Object support flags.
class nrobj {};
class robjs {};
class reach {};
class obj {};
class aobjs {};
class have {};
class no_take {};
class try_ {}; // Added underscore to avoid using "try" keyword
class take {};
class driver {};
class flip {};
typedef std::variant<std::monostate, int, reach, robjs, aobjs, no_take, have, try_, take, Bits, std::list<Bits>> ALType;
typedef std::list<ALType> AL;
class AVSyntax : private std::tuple<std::string_view, rapplic>
{
public:
AVSyntax(std::string_view name, rapplic fn) : std::tuple<std::string_view, rapplic>(name, fn) {}
std::string_view verb() const { return std::get<0>(*this); }
rapplic fn() const { return std::get<1>(*this); }
};
typedef std::variant<const char *, obj, nrobj, AL, AVSyntax, driver, flip> ParseItem;
typedef std::vector<ParseItem> AnyV;
typedef std::vector<AnyV> ActionVec;
void oneadd_action(const char *str1, const char *str2, rapplic atm);
void onenradd_action(const char *str1, const char *str2, rapplic atm);
void add_action(const char *nam, const char *str, const ActionVec &decl);
void add_action(const char* nam, const char* str, const AnyV& av);
void sadd_action(const char *name, rapplic action);