X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Frollback_interface.h;h=94b800579ca1a20aac1f27ea3ff46c8477e104e6;hb=22df02d25bb1ddb1de48e645c5256621ce9a9ed9;hp=a5f0c34fc2b52612d21fba2f2665f881c16893a8;hpb=4faaadc8d50d6ab7a19d22bd5a760c4b8321a51f;p=dragonfireclient.git diff --git a/src/rollback_interface.h b/src/rollback_interface.h index a5f0c34fc..94b800579 100644 --- a/src/rollback_interface.h +++ b/src/rollback_interface.h @@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef ROLLBACK_INTERFACE_HEADER -#define ROLLBACK_INTERFACE_HEADER +#pragma once #include "irr_v3d.h" #include @@ -46,7 +45,8 @@ struct RollbackNode } bool operator != (const RollbackNode &other) { return !(*this == other); } - RollbackNode() {} + RollbackNode() = default; + RollbackNode(Map *map, v3s16 p, IGameDef *gamedef); }; @@ -57,11 +57,11 @@ struct RollbackAction TYPE_NOTHING, TYPE_SET_NODE, TYPE_MODIFY_INVENTORY_STACK, - } type; + } type = TYPE_NOTHING; - time_t unix_time; + time_t unix_time = 0; std::string actor; - bool actor_is_guess; + bool actor_is_guess = false; v3s16 p; RollbackNode n_old; @@ -73,11 +73,7 @@ struct RollbackAction bool inventory_add; ItemStack inventory_stack; - RollbackAction(): - type(TYPE_NOTHING), - unix_time(0), - actor_is_guess(false) - {} + RollbackAction() = default; void setSetNode(v3s16 p_, const RollbackNode &n_old_, const RollbackNode &n_new_) @@ -89,7 +85,7 @@ struct RollbackAction } void setModifyInventoryStack(const std::string &inventory_location_, - const std::string &inventory_list_, int index_, + const std::string &inventory_list_, u32 index_, bool add_, const ItemStack &inventory_stack_) { type = TYPE_MODIFY_INVENTORY_STACK; @@ -122,7 +118,7 @@ class IRollbackManager virtual std::string getSuspect(v3s16 p, float nearness_shortcut, float min_nearness) = 0; - virtual ~IRollbackManager() {}; + virtual ~IRollbackManager() = default;; virtual void flush() = 0; // Get all actors that did something to position p, but not further than // in history @@ -159,5 +155,3 @@ class RollbackScopeActor std::string old_actor; bool old_actor_guess; }; - -#endif