aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/game.cpp b/src/game.cpp
index e27ec37dd..7e3ab802c 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -87,11 +87,11 @@ struct TextDestNodeMetadata : public TextDest {
std::string ntext = wide_to_narrow(text);
infostream << "Submitting 'text' field of node at (" << m_p.X << ","
<< m_p.Y << "," << m_p.Z << "): " << ntext << std::endl;
- std::map<std::string, std::string> fields;
+ StringMap fields;
fields["text"] = ntext;
m_client->sendNodemetaFields(m_p, "", fields);
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
m_client->sendNodemetaFields(m_p, "", fields);
}
@@ -111,7 +111,7 @@ struct TextDestPlayerInventory : public TextDest {
m_client = client;
m_formname = formname;
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
m_client->sendInventoryFields(m_formname, fields);
}
@@ -138,7 +138,7 @@ struct LocalFormspecHandler : public TextDest {
errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
}
- void gotText(std::map<std::string, std::string> fields)
+ void gotText(const StringMap &fields)
{
if (m_formname == "MT_PAUSE_MENU") {
if (fields.find("btn_sound") != fields.end()) {
@@ -180,9 +180,9 @@ struct LocalFormspecHandler : public TextDest {
if ((fields.find("btn_send") != fields.end()) ||
(fields.find("quit") != fields.end())) {
- if (fields.find("f_text") != fields.end()) {
- m_client->typeChatMessage(narrow_to_wide(fields["f_text"]));
- }
+ StringMap::const_iterator it = fields.find("f_text");
+ if (it != fields.end())
+ m_client->typeChatMessage(narrow_to_wide(it->second));
return;
}
@@ -210,12 +210,14 @@ struct LocalFormspecHandler : public TextDest {
return;
}
- errorstream << "LocalFormspecHandler::gotText unhandled >" << m_formname << "< event" << std::endl;
- int i = 0;
+ errorstream << "LocalFormspecHandler::gotText unhandled >"
+ << m_formname << "< event" << std::endl;
- for (std::map<std::string, std::string>::iterator iter = fields.begin();
- iter != fields.end(); iter++) {
- errorstream << "\t" << i << ": " << iter->first << "=" << iter->second << std::endl;
+ int i = 0;
+ StringMap::const_iterator it;
+ for (it = fields.begin(); it != fields.end(); ++it) {
+ errorstream << "\t" << i << ": " << it->first
+ << "=" << it->second << std::endl;
i++;
}
}