1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Remere's Map Editor is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//////////////////////////////////////////////////////////////////////
17
18#ifndef _RME_NETWORK_ACTION_H_
19#define _RME_NETWORK_ACTION_H_
20
21#include "action.h"
22
23class NetworkedActionQueue;
24
25class NetworkedAction : public Action {
26protected:
27 NetworkedAction(Editor& editor, ActionIdentifier ident);
28 ~NetworkedAction();
29
30public:
31 uint32_t owner;
32
33 friend class NetworkedActionQueue;
34};
35
36class NetworkedBatchAction : public BatchAction {
37 NetworkedActionQueue& queue;
38
39protected:
40 NetworkedBatchAction(Editor& editor, NetworkedActionQueue& queue, ActionIdentifier ident);
41 ~NetworkedBatchAction();
42
43public:
44 void addAndCommitAction(Action* action);
45
46protected:
47 void commit();
48 void undo();
49 void redo();
50
51 friend class NetworkedActionQueue;
52};
53
54class NetworkedActionQueue : public ActionQueue {
55public:
56 NetworkedActionQueue(Editor& editor);
57 ~NetworkedActionQueue();
58
59 Action* createAction(ActionIdentifier ident);
60 BatchAction* createBatch(ActionIdentifier ident);
61
62protected:
63 void broadcast(DirtyList& dirty_list);
64
65 friend class NetworkedBatchAction;
66};
67
68#endif
69