diff --git a/src/surfacecollection.cpp b/src/surfacecollection.cpp index 7434edd..6d8d755 100644 --- a/src/surfacecollection.cpp +++ b/src/surfacecollection.cpp @@ -28,9 +28,9 @@ using std::endl; using std::string; -SurfaceCollection::SurfaceCollection(bool defaultAlpha, const string &skin) { - this->defaultAlpha = defaultAlpha; - setSkin(skin); +SurfaceCollection::SurfaceCollection() + : skin("default") +{ } SurfaceCollection::~SurfaceCollection() {} @@ -68,7 +68,7 @@ Surface *SurfaceCollection::add(Surface *s, const string &path) { return s; } -Surface *SurfaceCollection::add(const string &path, bool alpha) { +Surface *SurfaceCollection::add(const string &path) { DEBUG("Adding surface: '%s'\n", path.c_str()); if (exists(path)) del(path); @@ -80,12 +80,12 @@ Surface *SurfaceCollection::add(const string &path, bool alpha) { return NULL; } else if (!fileExists(filePath)) return NULL; - Surface *s = new Surface(filePath, "", alpha); + Surface *s = new Surface(filePath, ""); surfaces[path] = s; return s; } -Surface *SurfaceCollection::addSkinRes(const string &path, bool alpha) { +Surface *SurfaceCollection::addSkinRes(const string &path) { DEBUG("Adding skin surface: '%s'\n", path.c_str()); if (path.empty()) return NULL; @@ -94,7 +94,7 @@ Surface *SurfaceCollection::addSkinRes(const string &path, bool alpha) { string skinpath = getSkinFilePath(path); if (skinpath.empty()) return NULL; - Surface *s = new Surface(skinpath, "", alpha); + Surface *s = new Surface(skinpath, "", true); if (s != NULL) surfaces[path] = s; return s; @@ -125,7 +125,7 @@ void SurfaceCollection::move(const string &from, const string &to) { Surface *SurfaceCollection::operator[](const string &key) { SurfaceHash::iterator i = surfaces.find(key); if (i == surfaces.end()) - return add(key, defaultAlpha); + return add(key); else return i->second; } @@ -135,7 +135,7 @@ Surface *SurfaceCollection::skinRes(const string &key) { SurfaceHash::iterator i = surfaces.find(key); if (i == surfaces.end()) - return addSkinRes(key, defaultAlpha); + return addSkinRes(key); else return i->second; } diff --git a/src/surfacecollection.h b/src/surfacecollection.h index 48386e1..c7b0766 100644 --- a/src/surfacecollection.h +++ b/src/surfacecollection.h @@ -33,13 +33,8 @@ Hash Map of surfaces that loads surfaces not already loaded and reuses already l @author Massimiliano Torromeo */ class SurfaceCollection { -private: - SurfaceHash surfaces; - std::string skin; - public: - SurfaceCollection( - bool defaultAlpha = true, const std::string &skin = "default"); + SurfaceCollection(); ~SurfaceCollection(); void setSkin(const std::string &skin); @@ -49,8 +44,8 @@ public: void debug(); Surface *add(Surface *s, const std::string &path); - Surface *add(const std::string &path, bool alpha=true); - Surface *addSkinRes(const std::string &path, bool alpha=true); + Surface *add(const std::string &path); + Surface *addSkinRes(const std::string &path); void del(const std::string &path); void clear(); void move(const std::string &from, const std::string &to); @@ -58,6 +53,10 @@ public: Surface *operator[](const std::string &); Surface *skinRes(const std::string &); + +private: + SurfaceHash surfaces; + std::string skin; }; #endif