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:
parent
1992db1395
commit
7528986e44
28 changed files with 363 additions and 443 deletions
|
@ -577,35 +577,34 @@ const std::list<RollbackAction> RollbackManager::rollbackActionsFromActionRows(
|
|||
{
|
||||
std::list<RollbackAction> actions;
|
||||
|
||||
for (std::list<ActionRow>::const_iterator it = rows.begin();
|
||||
it != rows.end(); ++it) {
|
||||
for (const ActionRow &row : rows) {
|
||||
RollbackAction action;
|
||||
action.actor = (it->actor) ? getActorName(it->actor) : "";
|
||||
action.unix_time = it->timestamp;
|
||||
action.type = static_cast<RollbackAction::Type>(it->type);
|
||||
action.actor = (row.actor) ? getActorName(row.actor) : "";
|
||||
action.unix_time = row.timestamp;
|
||||
action.type = static_cast<RollbackAction::Type>(row.type);
|
||||
|
||||
switch (action.type) {
|
||||
case RollbackAction::TYPE_MODIFY_INVENTORY_STACK:
|
||||
action.inventory_location = it->location.c_str();
|
||||
action.inventory_list = it->list;
|
||||
action.inventory_index = it->index;
|
||||
action.inventory_add = it->add;
|
||||
action.inventory_stack = it->stack;
|
||||
action.inventory_location = row.location;
|
||||
action.inventory_list = row.list;
|
||||
action.inventory_index = row.index;
|
||||
action.inventory_add = row.add;
|
||||
action.inventory_stack = row.stack;
|
||||
if (action.inventory_stack.name.empty()) {
|
||||
action.inventory_stack.name = getNodeName(it->stack.id);
|
||||
action.inventory_stack.name = getNodeName(row.stack.id);
|
||||
}
|
||||
break;
|
||||
|
||||
case RollbackAction::TYPE_SET_NODE:
|
||||
action.p = v3s16(it->x, it->y, it->z);
|
||||
action.n_old.name = getNodeName(it->oldNode);
|
||||
action.n_old.param1 = it->oldParam1;
|
||||
action.n_old.param2 = it->oldParam2;
|
||||
action.n_old.meta = it->oldMeta;
|
||||
action.n_new.name = getNodeName(it->newNode);
|
||||
action.n_new.param1 = it->newParam1;
|
||||
action.n_new.param2 = it->newParam2;
|
||||
action.n_new.meta = it->newMeta;
|
||||
action.p = v3s16(row.x, row.y, row.z);
|
||||
action.n_old.name = getNodeName(row.oldNode);
|
||||
action.n_old.param1 = row.oldParam1;
|
||||
action.n_old.param2 = row.oldParam2;
|
||||
action.n_old.meta = row.oldMeta;
|
||||
action.n_new.name = getNodeName(row.newNode);
|
||||
action.n_new.param1 = row.newParam1;
|
||||
action.n_new.param2 = row.newParam2;
|
||||
action.n_new.meta = row.newMeta;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -870,7 +869,7 @@ void RollbackManager::setActor(const std::string & actor, bool is_guess)
|
|||
std::string RollbackManager::getSuspect(v3s16 p, float nearness_shortcut,
|
||||
float min_nearness)
|
||||
{
|
||||
if (current_actor != "") {
|
||||
if (!current_actor.empty()) {
|
||||
return current_actor;
|
||||
}
|
||||
int cur_time = time(0);
|
||||
|
@ -883,7 +882,7 @@ std::string RollbackManager::getSuspect(v3s16 p, float nearness_shortcut,
|
|||
if (i->unix_time < first_time) {
|
||||
break;
|
||||
}
|
||||
if (i->actor == "") {
|
||||
if (i->actor.empty()) {
|
||||
continue;
|
||||
}
|
||||
// Find position of suspect or continue
|
||||
|
@ -919,7 +918,7 @@ void RollbackManager::flush()
|
|||
for (iter = action_todisk_buffer.begin();
|
||||
iter != action_todisk_buffer.end();
|
||||
++iter) {
|
||||
if (iter->actor == "") {
|
||||
if (iter->actor.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue