Skip to content

Instantly share code, notes, and snippets.

@xyzz
Created November 28, 2012 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyzz/4163048 to your computer and use it in GitHub Desktop.
Save xyzz/4163048 to your computer and use it in GitHub Desktop.
diff --cc src/client.cpp
index e47bce1,e47bce1..b2861ed
@@@ -2411,6 -2411,6 +2411,11 @@@ void Client::afterContentReceived(
// remove the information about which checksum each texture
// ought to have
++ for (core::map<std::string, std::string>::Iterator i = m_media_name_sha1_map.getIterator();
++ !i.atEnd();
++ i++) {
++ m_media_name_set.insert(i.getNode()->getKey());
++ }
m_media_name_sha1_map.clear();
// Rebuild inherited images and recreate textures
diff --cc src/client.h
index 154c8bb,154c8bb..c1c7388
@@@ -33,6 -33,6 +33,7 @@@ with this program; if not, write to th
#include "filesys.h"
#include "filecache.h"
#include "localplayer.h"
++#include "tile.h"
#include "util/pointedthing.h"
struct MeshMakeData;
@@@ -300,6 -300,6 +301,11 @@@ public
float getRTT(void);
++ bool mediaExists(const std::string &name) {
++ return m_media_name_set.find(name) != m_media_name_set.end()
++ || getTexturePath(name) != "";
++ }
++
// IGameDef interface
virtual IItemDefManager* getItemDefManager();
virtual INodeDefManager* getNodeDefManager();
@@@ -371,6 -371,6 +377,7 @@@ private
FileCache m_media_cache;
// Mapping from media file name to SHA1 checksum
core::map<std::string, std::string> m_media_name_sha1_map;
++ std::set<std::string> m_media_name_set;
float m_media_receive_progress;
bool m_media_received;
bool m_itemdef_received;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment