From 4f6bec19bc0d838db6d1236e7815c0113bd05e81 Mon Sep 17 00:00:00 2001
From: Kahrl <kahrl@gmx.net>
Date: Tue, 4 Jun 2013 07:44:19 +0200
Subject: [PATCH] Only add ^[forcesingle to get raw texture if atlas is used

---
 src/tile.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/tile.cpp b/src/tile.cpp
index 098a963a8..f176d1549 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -364,14 +364,14 @@ class TextureSource : public IWritableTextureSource
 	// Gets a separate texture
 	video::ITexture* getTextureRaw(const std::string &name)
 	{
-		AtlasPointer ap = getTexture(name + "^[forcesingle");
+		AtlasPointer ap = getTexture(name + m_forcesingle_suffix);
 		return ap.atlas;
 	}
 
 	// Gets a separate texture atlas pointer
 	AtlasPointer getTextureRawAP(const AtlasPointer &ap)
 	{
-		return getTexture(getTextureName(ap.id) + "^[forcesingle");
+		return getTexture(getTextureName(ap.id) + m_forcesingle_suffix);
 	}
 
 	// Returns a pointer to the irrlicht device
@@ -437,6 +437,7 @@ class TextureSource : public IWritableTextureSource
 	// Main texture atlas. This is filled at startup and is then not touched.
 	video::IImage *m_main_atlas_image;
 	video::ITexture *m_main_atlas_texture;
+	std::string m_forcesingle_suffix;
 
 	// Queued texture fetches (to be processed by the main thread)
 	RequestQueue<std::string, u32, u8, u8> m_get_texture_queue;
@@ -1137,6 +1138,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef)
 			<<atlaspath<<std::endl;
 	fs::RecursiveDelete(atlaspath);
 	driver->writeImageToFile(atlas_img, atlaspath.c_str());*/
+
+	m_forcesingle_suffix = "^[forcesingle";
 }
 
 video::IImage* generate_image_from_scratch(std::string name,
-- 
GitLab