summaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-08-15 14:03:36 -0400
committerkwolekr <kwolekr@minetest.net>2015-08-16 15:55:07 -0400
commitbcf38a2ad19116b50d0456bdd6f79d0d218e39d1 (patch)
treed56db4bc83c85d00a13dab8615c5661665b78922 /src/environment.cpp
parent5556ba168fb8bb3c234311564de36c4b130c8ab1 (diff)
downloadminetest-bcf38a2ad19116b50d0456bdd6f79d0d218e39d1.tar.gz
minetest-bcf38a2ad19116b50d0456bdd6f79d0d218e39d1.tar.bz2
minetest-bcf38a2ad19116b50d0456bdd6f79d0d218e39d1.zip
SEnv: Remove static_exists from ActiveObjects in deleted blocks
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 5bed11476..dbbfc6f1f 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -1424,6 +1424,33 @@ void ServerEnvironment::getRemovedActiveObjects(v3s16 pos, s16 radius,
}
}
+void ServerEnvironment::setStaticForActiveObjectsInBlock(
+ v3s16 blockpos, bool static_exists, v3s16 static_block)
+{
+ MapBlock *block = m_map->getBlockNoCreateNoEx(blockpos);
+ if (!block)
+ return;
+
+ for (std::map<u16, StaticObject>::iterator
+ so_it = block->m_static_objects.m_active.begin();
+ so_it != block->m_static_objects.m_active.end(); ++so_it) {
+ // Get the ServerActiveObject counterpart to this StaticObject
+ std::map<u16, ServerActiveObject *>::iterator ao_it;
+ ao_it = m_active_objects.find(so_it->first);
+ if (ao_it == m_active_objects.end()) {
+ // If this ever happens, there must be some kind of nasty bug.
+ errorstream << "ServerEnvironment::setStaticForObjectsInBlock(): "
+ "Object from MapBlock::m_static_objects::m_active not found "
+ "in m_active_objects";
+ continue;
+ }
+
+ ServerActiveObject *sao = ao_it->second;
+ sao->m_static_exists = static_exists;
+ sao->m_static_block = static_block;
+ }
+}
+
ActiveObjectMessage ServerEnvironment::getActiveObjectMessage()
{
if(m_active_object_messages.empty())
@@ -1960,7 +1987,6 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
}
}
-
#ifndef SERVER
#include "clientsimpleobject.h"