X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Frollback_interface.h;h=8dd429d7669473e9f767fd7f63c1293910e13c40;hb=8e5b33d3590719ff2cf1138f563e928d05754d7a;hp=0f0a11885afa64f48f6b1ba587753ada748c3c87;hpb=0190f9b077dcb2b8cb41c622dd91ffc1e04dacac;p=oweals%2Fminetest.git diff --git a/src/rollback_interface.h b/src/rollback_interface.h index 0f0a11885..8dd429d76 100644 --- a/src/rollback_interface.h +++ b/src/rollback_interface.h @@ -65,6 +65,7 @@ struct RollbackAction int unix_time; std::string actor; + bool actor_is_guess; v3s16 p; RollbackNode n_old; @@ -77,7 +78,9 @@ struct RollbackAction std::string inventory_stack; RollbackAction(): - type(TYPE_NOTHING) + type(TYPE_NOTHING), + unix_time(0), + actor_is_guess(false) {} void setSetNode(v3s16 p_, const RollbackNode &n_old_, @@ -107,6 +110,8 @@ struct RollbackAction // Eg. flowing water level changes are not important bool isImportant(IGameDef *gamedef) const; + + bool getPosition(v3s16 *dst) const; bool applyRevert(Map *map, InventoryManager *imgr, IGameDef *gamedef) const; }; @@ -117,29 +122,35 @@ public: virtual ~IRollbackReportSink(){} virtual void reportAction(const RollbackAction &action) = 0; virtual std::string getActor() = 0; - virtual void setActor(const std::string &actor) = 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; }; class RollbackScopeActor { public: - RollbackScopeActor(IRollbackReportSink *sink, const std::string &actor): + RollbackScopeActor(IRollbackReportSink *sink, const std::string &actor, + bool is_guess=false): m_sink(sink) { if(m_sink){ m_actor_was = m_sink->getActor(); - m_sink->setActor(actor); + m_actor_was_guess = m_sink->isActorGuess(); + m_sink->setActor(actor, is_guess); } } ~RollbackScopeActor() { if(m_sink){ - m_sink->setActor(m_actor_was); + m_sink->setActor(m_actor_was, m_actor_was_guess); } } private: IRollbackReportSink *m_sink; std::string m_actor_was; + bool m_actor_was_guess; }; #endif