Fix getTextureRaw to always return an image that is not in the texture atlas and...
authorPerttu Ahola <celeron55@gmail.com>
Thu, 1 Dec 2011 11:00:27 +0000 (13:00 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Thu, 1 Dec 2011 11:00:27 +0000 (13:00 +0200)
src/tile.cpp

index 29c6b3e671d476238fbd3850ca72052525037e28..27454c3213e52291fa9914668fa4ab323dcbc93c 100644 (file)
@@ -332,7 +332,7 @@ public:
        // Gets a separate texture
        video::ITexture* getTextureRaw(const std::string &name)
        {
-               AtlasPointer ap = getTexture(name);
+               AtlasPointer ap = getTexture(name + "^[forcesingle");
                return ap.atlas;
        }
 
@@ -1170,6 +1170,15 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
                */
                if(part_of_name == "[forcesingle")
                {
+                       // If base image is NULL, create a random color
+                       if(baseimg == NULL)
+                       {
+                               core::dimension2d<u32> dim(1,1);
+                               baseimg = driver->createImage(video::ECF_A8R8G8B8, dim);
+                               assert(baseimg);
+                               baseimg->setPixel(0,0, video::SColor(255,myrand()%256,
+                                               myrand()%256,myrand()%256));
+                       }
                }
                /*
                        [crackN