diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-01-11 22:48:14 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-01-13 21:56:24 +0100 |
commit | ef0aa7d5b543b6561e1b7292b2d0a0ac43add55d (patch) | |
tree | f5c396ec87193c2a2ea4ef4c1672939dc506507a /src/serverenvironment.cpp | |
parent | e2dd96b432f057cd8a3886314c78a79138a99c5e (diff) | |
download | minetest-ef0aa7d5b543b6561e1b7292b2d0a0ac43add55d.tar.gz minetest-ef0aa7d5b543b6561e1b7292b2d0a0ac43add55d.tar.bz2 minetest-ef0aa7d5b543b6561e1b7292b2d0a0ac43add55d.zip |
Optimize SAO getStaticData by using std::string pointer instead of return copy
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
Diffstat (limited to 'src/serverenvironment.cpp')
-rw-r--r-- | src/serverenvironment.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index e1962bcff..d3b85a430 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -1694,7 +1694,8 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, { // Add static object to active static list of the block v3f objectpos = object->getBasePosition(); - std::string staticdata = object->getStaticData(); + std::string staticdata = ""; + object->getStaticData(&staticdata); StaticObject s_obj(object->getType(), objectpos, staticdata); // Add to the block where the object is located in v3s16 blockpos = getNodeBlockPos(floatToInt(objectpos, BS)); @@ -1980,7 +1981,8 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) <<std::endl; continue; } - std::string staticdata_new = obj->getStaticData(); + std::string staticdata_new = ""; + obj->getStaticData(&staticdata_new); StaticObject s_obj(obj->getType(), objectpos, staticdata_new); block->m_static_objects.insert(id, s_obj); obj->m_static_block = blockpos_o; @@ -2020,7 +2022,8 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) if(obj->isStaticAllowed()) { // Create new static object - std::string staticdata_new = obj->getStaticData(); + std::string staticdata_new = ""; + obj->getStaticData(&staticdata_new); StaticObject s_obj(obj->getType(), objectpos, staticdata_new); bool stays_in_same_block = false; |