2
0
Эх сурвалжийг харах

show error if shorten id already exists

dmuratshin 9 жил өмнө
parent
commit
9f94ff65da

+ 2 - 1
oxygine/src/res/ResAtlas.h

@@ -30,8 +30,9 @@ namespace oxygine
         ~ResAtlas();
         ~ResAtlas();
 
 
         void addAtlas(TextureFormat tf, const std::string& base, const std::string& alpha, int w, int h);
         void addAtlas(TextureFormat tf, const std::string& base, const std::string& alpha, int w, int h);
+
         const atlas& getAtlas(int i) const {return _atlasses[i];}
         const atlas& getAtlas(int i) const {return _atlasses[i];}
-        int getNum() const { return (int)_atlasses.size(); }
+        int          getNum() const { return (int)_atlasses.size(); }
 
 
     protected:
     protected:
         void _restore(Restorable* r, void* user);
         void _restore(Restorable* r, void* user);

+ 8 - 1
oxygine/src/res/Resources.cpp

@@ -318,8 +318,15 @@ namespace oxygine
         {
         {
             std::string shortName = path::extractFileName(name);
             std::string shortName = path::extractFileName(name);
             if (shortName != name)
             if (shortName != name)
-            { 
+            {
+#ifdef OX_DEBUG
                 OX_ASSERT(_resourcesMap.find(shortName) == _resourcesMap.end());
                 OX_ASSERT(_resourcesMap.find(shortName) == _resourcesMap.end());
+                if (_resourcesMap.find(shortName) != _resourcesMap.end())
+                {
+                    log::error("short resource name '%s' conflicts with '%s'", r->getName().c_str(), _resourcesMap[shortName]->getName().c_str());
+                }
+#endif
+
                 _resourcesMap[shortName] = r;
                 _resourcesMap[shortName] = r;
             }            
             }            
         }
         }