aboutsummaryrefslogtreecommitdiff
path: root/src/client/client.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-03-26 14:00:57 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-03-26 14:00:57 +0100
commit880c9768a9323800ca8d44cc4b73e92278e58743 (patch)
treecf5b0b340e7a02bff8e13ae364901b324114228b /src/client/client.cpp
parent83d09ffaf688aac9f2de67d06420572e4d0664dc (diff)
parent437d01196899f85bbc77d71123018aa26be337da (diff)
downloaddragonfireclient-880c9768a9323800ca8d44cc4b73e92278e58743.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'src/client/client.cpp')
-rw-r--r--src/client/client.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index f9ecb20c6..e0493e973 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -666,12 +666,15 @@ bool Client::loadMedia(const std::string &data, const std::string &filename,
io::IFileSystem *irrfs = RenderingEngine::get_filesystem();
video::IVideoDriver *vdrv = RenderingEngine::get_video_driver();
+#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
+ io::IReadFile *rfile = irrfs->createMemoryReadFile(
+ data.c_str(), data.size(), "_tempreadfile");
+#else
// Silly irrlicht's const-incorrectness
Buffer<char> data_rw(data.c_str(), data.size());
-
- // Create an irrlicht memory file
io::IReadFile *rfile = irrfs->createMemoryReadFile(
*data_rw, data_rw.getSize(), "_tempreadfile");
+#endif
FATAL_ERROR_IF(!rfile, "Could not create irrlicht memory file.");
@@ -1944,13 +1947,20 @@ scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache)
// Create the mesh, remove it from cache and return it
// This allows unique vertex colors and other properties for each instance
+#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
+ io::IReadFile *rfile = RenderingEngine::get_filesystem()->createMemoryReadFile(
+ data.c_str(), data.size(), filename.c_str());
+#else
Buffer<char> data_rw(data.c_str(), data.size()); // Const-incorrect Irrlicht
- io::IReadFile *rfile = RenderingEngine::get_filesystem()->createMemoryReadFile(
+ io::IReadFile *rfile = RenderingEngine::get_filesystem()->createMemoryReadFile(
*data_rw, data_rw.getSize(), filename.c_str());
+#endif
FATAL_ERROR_IF(!rfile, "Could not create/open RAM file");
scene::IAnimatedMesh *mesh = RenderingEngine::get_scene_manager()->getMesh(rfile);
rfile->drop();
+ if (!mesh)
+ return nullptr;
mesh->grab();
if (!cache)
RenderingEngine::get_mesh_cache()->removeMesh(mesh);