aboutsummaryrefslogtreecommitdiff
path: root/src/rollback_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rollback_interface.h')
-rw-r--r--src/rollback_interface.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/rollback_interface.h b/src/rollback_interface.h
index 94b800579..827593782 100644
--- a/src/rollback_interface.h
+++ b/src/rollback_interface.h
@@ -38,22 +38,22 @@ struct RollbackNode
int param2 = 0;
std::string meta;
- bool operator == (const RollbackNode &other)
+ bool operator==(const RollbackNode &other)
{
return (name == other.name && param1 == other.param1 &&
param2 == other.param2 && meta == other.meta);
}
- bool operator != (const RollbackNode &other) { return !(*this == other); }
+ bool operator!=(const RollbackNode &other) { return !(*this == other); }
RollbackNode() = default;
RollbackNode(Map *map, v3s16 p, IGameDef *gamedef);
};
-
struct RollbackAction
{
- enum Type{
+ enum Type
+ {
TYPE_NOTHING,
TYPE_SET_NODE,
TYPE_MODIFY_INVENTORY_STACK,
@@ -75,8 +75,7 @@ struct RollbackAction
RollbackAction() = default;
- void setSetNode(v3s16 p_, const RollbackNode &n_old_,
- const RollbackNode &n_new_)
+ void setSetNode(v3s16 p_, const RollbackNode &n_old_, const RollbackNode &n_new_)
{
type = TYPE_SET_NODE;
p = p_;
@@ -85,8 +84,8 @@ struct RollbackAction
}
void setModifyInventoryStack(const std::string &inventory_location_,
- const std::string &inventory_list_, u32 index_,
- bool add_, const ItemStack &inventory_stack_)
+ const std::string &inventory_list_, u32 index_, bool add_,
+ const ItemStack &inventory_stack_)
{
type = TYPE_MODIFY_INVENTORY_STACK;
inventory_location = inventory_location_;
@@ -107,7 +106,6 @@ struct RollbackAction
bool applyRevert(Map *map, InventoryManager *imgr, IGameDef *gamedef) const;
};
-
class IRollbackManager
{
public:
@@ -115,27 +113,27 @@ public:
virtual std::string getActor() = 0;
virtual bool isActorGuess() = 0;
virtual void setActor(const std::string &actor, bool is_guess) = 0;
- virtual std::string getSuspect(v3s16 p, float nearness_shortcut,
- float min_nearness) = 0;
+ virtual std::string getSuspect(
+ v3s16 p, float nearness_shortcut, float min_nearness) = 0;
- virtual ~IRollbackManager() = default;;
+ virtual ~IRollbackManager() = default;
+ ;
virtual void flush() = 0;
// Get all actors that did something to position p, but not further than
// <seconds> in history
- virtual std::list<RollbackAction> getNodeActors(v3s16 pos, int range,
- time_t seconds, int limit) = 0;
+ virtual std::list<RollbackAction> getNodeActors(
+ v3s16 pos, int range, time_t seconds, int limit) = 0;
// Get actions to revert <seconds> of history made by <actor>
- virtual std::list<RollbackAction> getRevertActions(const std::string &actor,
- time_t seconds) = 0;
+ virtual std::list<RollbackAction> getRevertActions(
+ const std::string &actor, time_t seconds) = 0;
};
-
class RollbackScopeActor
{
public:
- RollbackScopeActor(IRollbackManager * rollback_,
- const std::string & actor, bool is_guess = false) :
- rollback(rollback_)
+ RollbackScopeActor(IRollbackManager *rollback_, const std::string &actor,
+ bool is_guess = false) :
+ rollback(rollback_)
{
if (rollback) {
old_actor = rollback->getActor();
@@ -151,7 +149,7 @@ public:
}
private:
- IRollbackManager * rollback;
+ IRollbackManager *rollback;
std::string old_actor;
bool old_actor_guess;
};