forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_commonevent.h
119 lines (101 loc) · 2.65 KB
/
game_commonevent.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_GAME_COMMONEVENT_H
#define EP_GAME_COMMONEVENT_H
// Headers
#include <string>
#include <vector>
#include "game_interpreter_map.h"
#include <lcf/rpg/commonevent.h>
#include <lcf/rpg/saveeventexecstate.h>
#include "async_op.h"
#include "string_view.h"
/**
* Game_CommonEvent class.
*/
class Game_CommonEvent {
public:
/**
* Constructor.
*
* @param common_event_id database common event ID.
*/
explicit Game_CommonEvent(int common_event_id);
/**
* Set savegame data.
*
* @param data savegame data.
*/
void SetSaveData(const lcf::rpg::SaveEventExecState& data);
/**
* Updates common event parallel interpreter.
*
* @param resume_async If we're resuming from an async operation.
* @return async operation if we should suspend, otherwise returns AsyncOp::eNone
*/
AsyncOp Update(bool resume_async);
/**
* Gets common event index.
*
* @return common event index in list.
*/
int GetIndex() const;
/**
* Gets common event name.
*
* @return event name.
*/
StringView GetName() const;
/**
* Gets trigger condition.
*
* @return trigger condition.
*/
int GetTrigger() const;
/**
* Gets if an event has a switch.
*
* @return flag if that event has a switch.
*/
bool GetSwitchFlag() const;
/**
* Gets trigger switch ID.
*
* @return trigger switch ID.
*/
int GetSwitchId() const;
/**
* Gets event commands list.
*
* @return event commands list.
*/
std::vector<lcf::rpg::EventCommand>& GetList();
lcf::rpg::SaveEventExecState GetSaveData();
/** @return true if waiting for foreground execution */
bool IsWaitingForegroundExecution() const;
/**
* @param force_run force the event to execute even if conditions not met.
* @return true if waiting for background execution
*/
bool IsWaitingBackgroundExecution(bool force_run) const;
private:
int common_event_id;
/** Interpreter for parallel common events. */
std::unique_ptr<Game_Interpreter_Map> interpreter;
friend class Scene_Debug;
};
#endif