aboutsummaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 0f9c82c3c..c85876a75 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -931,7 +931,8 @@ void Map::updateLighting(std::map<v3s16, MapBlock*> & a_blocks,
/*
*/
void Map::addNodeAndUpdate(v3s16 p, MapNode n,
- std::map<v3s16, MapBlock*> &modified_blocks)
+ std::map<v3s16, MapBlock*> &modified_blocks,
+ bool remove_metadata)
{
INodeDefManager *ndef = m_gamedef->ndef();
@@ -1018,8 +1019,9 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
/*
Remove node metadata
*/
-
- removeNodeMetadata(p);
+ if (remove_metadata) {
+ removeNodeMetadata(p);
+ }
/*
Set the node on the map
@@ -1319,17 +1321,17 @@ void Map::removeNodeAndUpdate(v3s16 p,
}
}
-bool Map::addNodeWithEvent(v3s16 p, MapNode n)
+bool Map::addNodeWithEvent(v3s16 p, MapNode n, bool remove_metadata)
{
MapEditEvent event;
- event.type = MEET_ADDNODE;
+ event.type = remove_metadata ? MEET_ADDNODE : MEET_SWAPNODE;
event.p = p;
event.n = n;
bool succeeded = true;
try{
std::map<v3s16, MapBlock*> modified_blocks;
- addNodeAndUpdate(p, n, modified_blocks);
+ addNodeAndUpdate(p, n, modified_blocks, remove_metadata);
// Copy modified_blocks to event
for(std::map<v3s16, MapBlock*>::iterator