#include "util/serialize.h"
#include "util/string.h"
#include "util/numeric.h"
+#include "util/basic_macros.h"
#include "map.h"
#include "gamedef.h"
#include "nodedef.h"
#include "inventory.h"
#include "mapblock.h"
-#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
-
RollbackNode::RollbackNode(Map *map, v3s16 p, IGameDef *gamedef)
{
} else {
NodeMetadata *meta = map->getNodeMetadata(p);
if (!meta) {
- meta = new NodeMetadata(gamedef);
+ meta = new NodeMetadata(gamedef->idef());
if (!map->setNodeMetadata(p, meta)) {
delete meta;
infostream << "RollbackAction::applyRevert(): "
case TYPE_MODIFY_INVENTORY_STACK: {
InventoryLocation loc;
loc.deSerialize(inventory_location);
- std::string real_name = gamedef->idef()->getAlias(inventory_stack.name);
Inventory *inv = imgr->getInventory(loc);
if (!inv) {
infostream << "RollbackAction::applyRevert(): Could not get "
<< inventory_index << " too large in "
<< "inventory list \"" << inventory_list << "\" in "
<< inventory_location << std::endl;
+ return false;
}
+
// If item was added, take away item, otherwise add removed item
if (inventory_add) {
// Silently ignore different current item
- if (list->getItem(inventory_index).name != real_name)
+ if (list->getItem(inventory_index).name !=
+ gamedef->idef()->getAlias(inventory_stack.name))
return false;
list->takeItem(inventory_index, inventory_stack.count);
} else {