summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-19 02:24:14 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-19 16:10:49 -0400
commitda34a2b33e1f600ec11172f599384b9a92835403 (patch)
treef09a158be783f0486447d0c61750a7509760d83b /src/client.cpp
parent603297cc352cab685dd01dcd645999624ad17c0b (diff)
downloadminetest-da34a2b33e1f600ec11172f599384b9a92835403.tar.gz
minetest-da34a2b33e1f600ec11172f599384b9a92835403.tar.bz2
minetest-da34a2b33e1f600ec11172f599384b9a92835403.zip
Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style Replace by-value parameter passing with const refs when possible Fix post-increment of iterators
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 1d0245c45..de8131875 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1102,7 +1102,7 @@ void Client::sendRemovedSounds(std::vector<s32> &soundList)
}
void Client::sendNodemetaFields(v3s16 p, const std::string &formname,
- const std::map<std::string, std::string> &fields)
+ const StringMap &fields)
{
size_t fields_size = fields.size();
@@ -1112,10 +1112,10 @@ void Client::sendNodemetaFields(v3s16 p, const std::string &formname,
pkt << p << formname << (u16) (fields_size & 0xFFFF);
- for(std::map<std::string, std::string>::const_iterator
- i = fields.begin(); i != fields.end(); i++) {
- const std::string &name = i->first;
- const std::string &value = i->second;
+ StringMap::const_iterator it;
+ for (it = fields.begin(); it != fields.end(); ++it) {
+ const std::string &name = it->first;
+ const std::string &value = it->second;
pkt << name;
pkt.putLongString(value);
}
@@ -1124,7 +1124,7 @@ void Client::sendNodemetaFields(v3s16 p, const std::string &formname,
}
void Client::sendInventoryFields(const std::string &formname,
- const std::map<std::string, std::string> &fields)
+ const StringMap &fields)
{
size_t fields_size = fields.size();
FATAL_ERROR_IF(fields_size > 0xFFFF, "Unsupported number of inventory fields");
@@ -1132,10 +1132,10 @@ void Client::sendInventoryFields(const std::string &formname,
NetworkPacket pkt(TOSERVER_INVENTORY_FIELDS, 0);
pkt << formname << (u16) (fields_size & 0xFFFF);
- for(std::map<std::string, std::string>::const_iterator
- i = fields.begin(); i != fields.end(); i++) {
- const std::string &name = i->first;
- const std::string &value = i->second;
+ StringMap::const_iterator it;
+ for (it = fields.begin(); it != fields.end(); ++it) {
+ const std::string &name = it->first;
+ const std::string &value = it->second;
pkt << name;
pkt.putLongString(value);
}
@@ -1918,14 +1918,13 @@ ParticleManager* Client::getParticleManager()
scene::IAnimatedMesh* Client::getMesh(const std::string &filename)
{
- std::map<std::string, std::string>::const_iterator i =
- m_mesh_data.find(filename);
- if(i == m_mesh_data.end()){
- errorstream<<"Client::getMesh(): Mesh not found: \""<<filename<<"\""
- <<std::endl;
+ StringMap::const_iterator it = m_mesh_data.find(filename);
+ if (it == m_mesh_data.end()) {
+ errorstream << "Client::getMesh(): Mesh not found: \"" << filename
+ << "\"" << std::endl;
return NULL;
}
- const std::string &data = i->second;
+ const std::string &data = it->second;
scene::ISceneManager *smgr = m_device->getSceneManager();
// Create the mesh, remove it from cache and return it