summaryrefslogtreecommitdiff
path: root/src/client/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/client.h')
-rw-r--r--src/client/client.h31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/client/client.h b/src/client/client.h
index 1291b944c..733634db1 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -82,34 +82,24 @@ public:
void add(u16 command)
{
- std::map<u16, u16>::iterator n = m_packets.find(command);
- if(n == m_packets.end())
- {
+ auto n = m_packets.find(command);
+ if (n == m_packets.end())
m_packets[command] = 1;
- }
else
- {
n->second++;
- }
}
void clear()
{
- for (auto &m_packet : m_packets) {
- m_packet.second = 0;
- }
+ m_packets.clear();
}
- void print(std::ostream &o)
- {
- for (const auto &m_packet : m_packets) {
- o << "cmd "<< m_packet.first <<" count "<< m_packet.second << std::endl;
- }
- }
+ u32 sum() const;
+ void print(std::ostream &o) const;
private:
// command, count
- std::map<u16, u16> m_packets;
+ std::map<u16, u32> m_packets;
};
class ClientScripting;
@@ -232,6 +222,7 @@ public:
void handleCommand_FormspecPrepend(NetworkPacket *pkt);
void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt);
void handleCommand_PlayerSpeed(NetworkPacket *pkt);
+ void handleCommand_MediaPush(NetworkPacket *pkt);
void ProcessData(NetworkPacket *pkt);
@@ -386,7 +377,8 @@ public:
// The following set of functions is used by ClientMediaDownloader
// Insert a media file appropriately into the appropriate manager
- bool loadMedia(const std::string &data, const std::string &filename);
+ bool loadMedia(const std::string &data, const std::string &filename,
+ bool from_media_push = false);
// Send a request for conventional media transfer
void request_media(const std::vector<std::string> &file_requests);
@@ -498,6 +490,7 @@ private:
Camera *m_camera = nullptr;
Minimap *m_minimap = nullptr;
bool m_minimap_disabled_by_server = false;
+
// Server serialization version
u8 m_server_ser_ver;
@@ -539,7 +532,6 @@ private:
AuthMechanism m_chosen_auth_mech;
void *m_auth_data = nullptr;
-
bool m_access_denied = false;
bool m_access_denied_reconnect = false;
std::string m_access_denied_reason = "";
@@ -548,7 +540,10 @@ private:
bool m_nodedef_received = false;
bool m_activeobjects_received = false;
bool m_mods_loaded = false;
+
ClientMediaDownloader *m_media_downloader;
+ // Set of media filenames pushed by server at runtime
+ std::unordered_set<std::string> m_media_pushed_files;
// time_of_day speed approximation for old protocol
bool m_time_of_day_set = false;