summaryrefslogtreecommitdiff
path: root/src/database/database-sqlite3.cpp
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-04-06 09:52:29 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-04-06 10:52:29 +0200
commit91615f9588420fd716978552fdacf1323b8df11c (patch)
tree951b1c139c09056d0d31bc4b8e0d13fd2d69c8bb /src/database/database-sqlite3.cpp
parent7e3f88f539109955b21a129e4203a1cadb913483 (diff)
downloadminetest-91615f9588420fd716978552fdacf1323b8df11c.tar.gz
minetest-91615f9588420fd716978552fdacf1323b8df11c.tar.bz2
minetest-91615f9588420fd716978552fdacf1323b8df11c.zip
Add player:get_meta(), deprecate player attributes (#7202)
* Add player:get_meta(), deprecate player attributes
Diffstat (limited to 'src/database/database-sqlite3.cpp')
-rw-r--r--src/database/database-sqlite3.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/database/database-sqlite3.cpp b/src/database/database-sqlite3.cpp
index 78c182f86..76935ada4 100644
--- a/src/database/database-sqlite3.cpp
+++ b/src/database/database-sqlite3.cpp
@@ -520,7 +520,7 @@ void PlayerDatabaseSQLite3::savePlayer(RemotePlayer *player)
sqlite3_vrfy(sqlite3_step(m_stmt_player_metadata_remove), SQLITE_DONE);
sqlite3_reset(m_stmt_player_metadata_remove);
- const PlayerAttributes &attrs = sao->getExtendedAttributes();
+ const StringMap &attrs = sao->getMeta().getStrings();
for (const auto &attr : attrs) {
str_to_sqlite(m_stmt_player_metadata_add, 1, player->getName());
str_to_sqlite(m_stmt_player_metadata_add, 2, attr.first);
@@ -528,6 +528,7 @@ void PlayerDatabaseSQLite3::savePlayer(RemotePlayer *player)
sqlite3_vrfy(sqlite3_step(m_stmt_player_metadata_add), SQLITE_DONE);
sqlite3_reset(m_stmt_player_metadata_add);
}
+ sao->getMeta().setModified(false);
endSave();
}
@@ -578,8 +579,9 @@ bool PlayerDatabaseSQLite3::loadPlayer(RemotePlayer *player, PlayerSAO *sao)
std::string attr = sqlite_to_string(m_stmt_player_metadata_load, 0);
std::string value = sqlite_to_string(m_stmt_player_metadata_load, 1);
- sao->setExtendedAttribute(attr, value);
+ sao->getMeta().setString(attr, value);
}
+ sao->getMeta().setModified(false);
sqlite3_reset(m_stmt_player_metadata_load);
return true;
}