summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-08-16 08:53:52 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-08-16 08:53:52 +0200
commit816bca32ac69f58b7de881d68689c6a1e3897a0e (patch)
tree55fa5ff005a7147c33b8104361f269b427d5ed4f /src/client.h
parent90dfafcda2d4bc33356983c7145bf10202c26bbd (diff)
downloadminetest-816bca32ac69f58b7de881d68689c6a1e3897a0e.tar.gz
minetest-816bca32ac69f58b7de881d68689c6a1e3897a0e.tar.bz2
minetest-816bca32ac69f58b7de881d68689c6a1e3897a0e.zip
client.cpp: modernize code
* Range based for loops * Empty operator on stl containers
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/client.h b/src/client.h
index adac83e5c..05f3ab9ea 100644
--- a/src/client.h
+++ b/src/client.h
@@ -204,9 +204,7 @@ struct ClientEvent
class PacketCounter
{
public:
- PacketCounter()
- {
- }
+ PacketCounter() = default;
void add(u16 command)
{
@@ -223,23 +221,15 @@ public:
void clear()
{
- for(std::map<u16, u16>::iterator
- i = m_packets.begin();
- i != m_packets.end(); ++i)
- {
- i->second = 0;
+ for (auto &m_packet : m_packets) {
+ m_packet.second = 0;
}
}
void print(std::ostream &o)
{
- for(std::map<u16, u16>::iterator
- i = m_packets.begin();
- i != m_packets.end(); ++i)
- {
- o<<"cmd "<<i->first
- <<" count "<<i->second
- <<std::endl;
+ for (const auto &m_packet : m_packets) {
+ o << "cmd "<< m_packet.first <<" count "<< m_packet.second << std::endl;
}
}
@@ -544,12 +534,12 @@ public:
m_client_event_queue.push(event);
}
- void showGameChat(const bool show = true);
- void showGameHud(const bool show = true);
- void showMinimap(const bool show = true);
- void showProfiler(const bool show = true);
- void showGameFog(const bool show = true);
- void showGameDebug(const bool show = true);
+ void showGameChat(bool show = true);
+ void showGameHud(bool show = true);
+ void showMinimap(bool show = true);
+ void showProfiler(bool show = true);
+ void showGameFog(bool show = true);
+ void showGameDebug(bool show = true);
const Address getServerAddress()
{