From 0d1eedcccc8b83fd5f5a9a75389fe8ac97d2c697 Mon Sep 17 00:00:00 2001
From: Loic Blot <loic.blot@unix-experience.fr>
Date: Thu, 5 Mar 2015 11:52:57 +0100
Subject: [PATCH] Replace std::list to std::vector into tile.cpp
 (m_texture_trash) and move tile.hpp to src/client/

---
 build/android/jni/Android.mk | 4 ++--
 src/CMakeLists.txt           | 1 -
 src/camera.h                 | 2 +-
 src/client/CMakeLists.txt    | 3 ++-
 src/{ => client}/tile.cpp    | 7 +++----
 src/{ => client}/tile.h      | 0
 src/content_cao.cpp          | 2 +-
 src/content_cso.cpp          | 2 +-
 src/content_mapblock.cpp     | 2 +-
 src/game.cpp                 | 2 +-
 src/guiChatConsole.cpp       | 2 +-
 src/guiEngine.cpp            | 2 +-
 src/guiEngine.h              | 2 +-
 src/guiFormSpecMenu.cpp      | 2 +-
 src/guiTable.cpp             | 2 +-
 src/hud.cpp                  | 2 +-
 src/itemdef.cpp              | 2 +-
 src/mapblock_mesh.h          | 2 +-
 src/nodedef.cpp              | 2 +-
 src/nodedef.h                | 2 +-
 src/particles.cpp            | 2 +-
 src/particles.h              | 2 +-
 src/shader.cpp               | 2 +-
 src/sky.cpp                  | 2 +-
 src/subgame.cpp              | 2 +-
 src/touchscreengui.h         | 2 +-
 src/wieldmesh.cpp            | 2 +-
 27 files changed, 29 insertions(+), 30 deletions(-)
 rename src/{ => client}/tile.cpp (99%)
 rename src/{ => client}/tile.h (100%)

diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk
index c3982c370..a35084433 100644
--- a/build/android/jni/Android.mk
+++ b/build/android/jni/Android.mk
@@ -196,7 +196,6 @@ LOCAL_SRC_FILES :=                                \
 		jni/src/staticobject.cpp                  \
 		jni/src/subgame.cpp                       \
 		jni/src/test.cpp                          \
-		jni/src/tile.cpp                          \
 		jni/src/tool.cpp                          \
 		jni/src/treegen.cpp                       \
 		jni/src/version.cpp                       \
@@ -214,7 +213,8 @@ LOCAL_SRC_FILES :=                                \
 		jni/src/database-leveldb.cpp              \
 		jni/src/settings.cpp                      \
 		jni/src/wieldmesh.cpp                     \
-		jni/src/client/clientlauncher.cpp
+		jni/src/client/clientlauncher.cpp         \
+		jni/src/client/tile.cpp
 
 # Network
 LOCAL_SRC_FILES +=                                \
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6aa1a35a1..d56ec18c0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -499,7 +499,6 @@ set(minetest_SRCS
 	particles.cpp
 	shader.cpp
 	sky.cpp
-	tile.cpp
 	wieldmesh.cpp
 	${minetest_SCRIPT_SRCS}
 )
diff --git a/src/camera.h b/src/camera.h
index 3f10b87d7..b53738860 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_extrabloated.h"
 #include "inventory.h"
 #include "mesh.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "util/numeric.h"
 #include <ICameraSceneNode.h>
 
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index 8cd981aca..288acf14c 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -1,4 +1,5 @@
 set(client_SRCS
 	${CMAKE_CURRENT_SOURCE_DIR}/clientlauncher.cpp
+	${CMAKE_CURRENT_SOURCE_DIR}/tile.cpp
 	PARENT_SCOPE
-)
\ No newline at end of file
+)
diff --git a/src/tile.cpp b/src/client/tile.cpp
similarity index 99%
rename from src/tile.cpp
rename to src/client/tile.cpp
index 81b362d61..e5d02de7c 100644
--- a/src/tile.cpp
+++ b/src/client/tile.cpp
@@ -407,7 +407,7 @@ class TextureSource : public IWritableTextureSource
 
 	// Textures that have been overwritten with other ones
 	// but can't be deleted because the ITexture* might still be used
-	std::list<video::ITexture*> m_texture_trash;
+	std::vector<video::ITexture*> m_texture_trash;
 
 	// Cached settings needed for making textures from meshes
 	bool m_setting_trilinear_filter;
@@ -455,10 +455,9 @@ TextureSource::~TextureSource()
 	}
 	m_textureinfo_cache.clear();
 
-	for (std::list<video::ITexture*>::iterator iter =
+	for (std::vector<video::ITexture*>::iterator iter =
 			m_texture_trash.begin(); iter != m_texture_trash.end();
-			iter++)
-	{
+			iter++) {
 		video::ITexture *t = *iter;
 
 		//cleanup trashed texture
diff --git a/src/tile.h b/src/client/tile.h
similarity index 100%
rename from src/tile.h
rename to src/client/tile.h
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index ddfa3b032..5c3c7b54c 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/numeric.h" // For IntervalLimiter
 #include "util/serialize.h"
 #include "util/mathconstants.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "environment.h"
 #include "collision.h"
 #include "settings.h"
diff --git a/src/content_cso.cpp b/src/content_cso.cpp
index 4779b20d1..c337472ff 100644
--- a/src/content_cso.cpp
+++ b/src/content_cso.cpp
@@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "content_cso.h"
 #include <IBillboardSceneNode.h>
-#include "tile.h"
+#include "client/tile.h"
 #include "environment.h"
 #include "gamedef.h"
 #include "log.h"
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index 54b9ac99f..5bb787d01 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock_mesh.h" // For MapBlock_LightColor() and MeshCollector
 #include "settings.h"
 #include "nodedef.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "mesh.h"
 #include <IMeshManipulator.h>
 #include "gamedef.h"
diff --git a/src/game.cpp b/src/game.cpp
index 1fe1c4163..af76d2e02 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -51,7 +51,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodemetadata.h"
 #include "main.h" // For g_settings
 #include "itemdef.h"
-#include "tile.h" // For TextureSource
+#include "client/tile.h" // For TextureSource
 #include "shader.h" // For ShaderSource
 #include "logoutputbuffer.h"
 #include "subgame.h"
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 8210e0bf4..b52589044 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "settings.h"
 #include "main.h"  // for g_settings
 #include "porting.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "fontengine.h"
 #include "log.h"
 #include "gettext.h"
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp
index de6f44134..b45011c2c 100644
--- a/src/guiEngine.cpp
+++ b/src/guiEngine.cpp
@@ -38,7 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "fontengine.h"
 
 #ifdef __ANDROID__
-#include "tile.h"
+#include "client/tile.h"
 #include <GLES/gl.h>
 #endif
 
diff --git a/src/guiEngine.h b/src/guiEngine.h
index 0be8634dd..e57573220 100644
--- a/src/guiEngine.h
+++ b/src/guiEngine.h
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "modalMenu.h"
 #include "guiFormSpecMenu.h"
 #include "sound.h"
-#include "tile.h"
+#include "client/tile.h"
 
 /******************************************************************************/
 /* Typedefs and macros                                                        */
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index a3cc03131..581da894b 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <IGUITabControl.h>
 #include <IGUIComboBox.h>
 #include "log.h"
-#include "tile.h" // ITextureSource
+#include "client/tile.h" // ITextureSource
 #include "hud.h" // drawItemStack
 #include "filesys.h"
 #include "gettime.h"
diff --git a/src/guiTable.cpp b/src/guiTable.cpp
index 05db228da..a7a53f581 100644
--- a/src/guiTable.cpp
+++ b/src/guiTable.cpp
@@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <IGUIScrollBar.h>
 #include "debug.h"
 #include "log.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "gettime.h"
 #include "util/string.h"
 #include "util/numeric.h"
diff --git a/src/hud.cpp b/src/hud.cpp
index 29ebb8103..aabaa066c 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "gamedef.h"
 #include "itemdef.h"
 #include "inventory.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "localplayer.h"
 #include "camera.h"
 #include "porting.h"
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index 3b4d2596a..381773bb4 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock_mesh.h"
 #include "mesh.h"
 #include "wieldmesh.h"
-#include "tile.h"
+#include "client/tile.h"
 #endif
 #include "log.h"
 #include "main.h" // g_settings
diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h
index 98af92c74..b334ce469 100644
--- a/src/mapblock_mesh.h
+++ b/src/mapblock_mesh.h
@@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define MAPBLOCK_MESH_HEADER
 
 #include "irrlichttypes_extrabloated.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "voxel.h"
 #include <map>
 
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index bcf51a072..ac49b4f3c 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "main.h" // For g_settings
 #include "itemdef.h"
 #ifndef SERVER
-#include "tile.h"
+#include "client/tile.h"
 #include "mesh.h"
 #include <IMeshManipulator.h>
 #endif
diff --git a/src/nodedef.h b/src/nodedef.h
index 7280bb8ea..52ef29e50 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <list>
 #include "mapnode.h"
 #ifndef SERVER
-#include "tile.h"
+#include "client/tile.h"
 #include "shader.h"
 #endif
 #include "itemgroup.h"
diff --git a/src/particles.cpp b/src/particles.cpp
index 64b8936bd..a137aaaba 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "debug.h"
 #include "main.h" // For g_profiler and g_settings
 #include "settings.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "gamedef.h"
 #include "collision.h"
 #include <stdlib.h>
diff --git a/src/particles.h b/src/particles.h
index d7f1147f1..2bc2e7bfa 100644
--- a/src/particles.h
+++ b/src/particles.h
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <iostream>
 #include "irrlichttypes_extrabloated.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "localplayer.h"
 #include "environment.h"
 
diff --git a/src/shader.cpp b/src/shader.cpp
index 167045804..8c572ed49 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "log.h"
 #include "gamedef.h"
 #include "strfnd.h" // trim()
-#include "tile.h"
+#include "client/tile.h"
 
 /*
 	A cache from shader name to shader path
diff --git a/src/sky.cpp b/src/sky.cpp
index 664ed694b..ac8e2cbf6 100644
--- a/src/sky.cpp
+++ b/src/sky.cpp
@@ -3,7 +3,7 @@
 #include "ISceneManager.h"
 #include "ICameraSceneNode.h"
 #include "S3DVertex.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "noise.h" // easeCurve
 #include "main.h" // g_profiler
 #include "profiler.h"
diff --git a/src/subgame.cpp b/src/subgame.cpp
index fd2679eae..ccf477e8f 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "log.h"
 #include "strfnd.h"
 #ifndef SERVER
-#include "tile.h" // getImagePath
+#include "client/tile.h" // getImagePath
 #endif
 #include "util/string.h"
 
diff --git a/src/touchscreengui.h b/src/touchscreengui.h
index 4fe731513..a00df5c47 100644
--- a/src/touchscreengui.h
+++ b/src/touchscreengui.h
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <map>
 
 #include "game.h"
-#include "tile.h"
+#include "client/tile.h"
 
 using namespace irr;
 using namespace irr::core;
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index 7c16bddcb..a2be55544 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodedef.h"
 #include "mesh.h"
 #include "mapblock_mesh.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "log.h"
 #include "util/numeric.h"
 #include <map>
-- 
GitLab