Merge pull request #482 from proller/liquid
[oweals/minetest.git] / src / rollback.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef ROLLBACK_HEADER
21 #define ROLLBACK_HEADER
22
23 #include <string>
24 #include "irr_v3d.h"
25 #include "rollback_interface.h"
26 #include <list>
27
28 class IGameDef;
29
30 class IRollbackManager: public IRollbackReportSink
31 {
32 public:
33         // IRollbackReportManager
34         virtual void reportAction(const RollbackAction &action) = 0;
35         virtual std::string getActor() = 0;
36         virtual bool isActorGuess() = 0;
37         virtual void setActor(const std::string &actor, bool is_guess) = 0;
38         virtual std::string getSuspect(v3s16 p, float nearness_shortcut,
39                         float min_nearness) = 0;
40
41         virtual ~IRollbackManager(){}
42         virtual void flush() = 0;
43         // Get last actor that did something to position p, but not further than
44         // <seconds> in history
45         virtual std::string getLastNodeActor(v3s16 p, int range, int seconds,
46                         v3s16 *act_p, int *act_seconds) = 0;
47         // Get actions to revert <seconds> of history made by <actor>
48         virtual std::list<RollbackAction> getRevertActions(const std::string &actor,
49                         int seconds) = 0;
50 };
51
52 IRollbackManager *createRollbackManager(const std::string &filepath, IGameDef *gamedef);
53
54 #endif