diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-03-08 03:15:16 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-03-08 03:16:40 -0400 |
commit | 969413b9fa5f1bbba9e6f238574869f1fe7f029e (patch) | |
tree | e9bb71cc31bd598977360c9ab8fb47844ebb1afd /src | |
parent | c788b1732225ed0c118ed11b184bb5d3b35e1f7c (diff) | |
download | minetest-969413b9fa5f1bbba9e6f238574869f1fe7f029e.tar.gz minetest-969413b9fa5f1bbba9e6f238574869f1fe7f029e.tar.bz2 minetest-969413b9fa5f1bbba9e6f238574869f1fe7f029e.zip |
Make the dummy backend only look up blocks once
Diffstat (limited to 'src')
-rw-r--r-- | src/database-dummy.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database-dummy.cpp b/src/database-dummy.cpp index 71f60d81c..2e5de5ed1 100644 --- a/src/database-dummy.cpp +++ b/src/database-dummy.cpp @@ -33,10 +33,10 @@ bool Database_Dummy::saveBlock(const v3s16 &pos, const std::string &data) std::string Database_Dummy::loadBlock(const v3s16 &pos) { s64 i = getBlockAsInteger(pos); - if (m_database.count(i)) - return m_database[i]; - else + std::map<s64, std::string>::iterator it = m_database.find(i); + if (it == m_database.end()) return ""; + return it->second; } bool Database_Dummy::deleteBlock(const v3s16 &pos) |