1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)

* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex
This commit is contained in:
Loïc Blot 2017-08-19 14:25:35 +02:00 committed by GitHub
parent 1992db1395
commit 7528986e44
28 changed files with 363 additions and 443 deletions

View file

@ -45,7 +45,8 @@ struct RollbackNode
}
bool operator != (const RollbackNode &other) { return !(*this == other); }
RollbackNode() {}
RollbackNode() = default;
RollbackNode(Map *map, v3s16 p, IGameDef *gamedef);
};
@ -56,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;
@ -72,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_)
@ -88,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;
@ -121,7 +118,7 @@ public:
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
// <seconds> in history