1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
kwolekr 2015-05-19 02:24:14 -04:00
parent 603297cc35
commit da34a2b33e
25 changed files with 180 additions and 193 deletions

View file

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapnode.h"
#include "nodedef.h"
#include "nameidmapping.h"
#include <map>
#include "util/string.h"
/*
Legacy node content type IDs
@ -218,14 +218,13 @@ public:
}
std::string get(const std::string &old)
{
std::map<std::string, std::string>::const_iterator i;
i = old_to_new.find(old);
if(i == old_to_new.end())
StringMap::const_iterator it = old_to_new.find(old);
if (it == old_to_new.end())
return "";
return i->second;
return it->second;
}
private:
std::map<std::string, std::string> old_to_new;
StringMap old_to_new;
};
NewNameGetter newnamegetter;