From 9749d9fee6db99da1ab861dc04ec63ef973db3e0 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 5 Mar 2015 15:34:39 +0100 Subject: Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp * Also change some std::list to std::vector for ClientMap::renderMap * Remove disabled code in ClientMap::renderMap, disabled since a long time --- src/clientmap.cpp | 85 +++++++++++-------------------------------------------- 1 file changed, 17 insertions(+), 68 deletions(-) (limited to 'src/clientmap.cpp') diff --git a/src/clientmap.cpp b/src/clientmap.cpp index b9516fcbe..1c420b5f9 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -391,12 +391,12 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) struct MeshBufList { video::SMaterial m; - std::list bufs; + std::vector bufs; }; struct MeshBufListList { - std::list lists; + std::vector lists; void clear() { @@ -405,7 +405,7 @@ struct MeshBufListList void add(scene::IMeshBuffer *buf) { - for(std::list::iterator i = lists.begin(); + for(std::vector::iterator i = lists.begin(); i != lists.end(); ++i){ MeshBufList &l = *i; video::SMaterial &m = buf->getMaterial(); @@ -595,25 +595,20 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) } } - std::list &lists = drawbufs.lists; + std::vector &lists = drawbufs.lists; int timecheck_counter = 0; - for(std::list::iterator i = lists.begin(); - i != lists.end(); ++i) - { - { - timecheck_counter++; - if(timecheck_counter > 50) - { - timecheck_counter = 0; - int time2 = time(0); - if(time2 > time1 + 4) - { - infostream<<"ClientMap::renderMap(): " - "Rendering takes ages, returning." - <::iterator i = lists.begin(); + i != lists.end(); ++i) { + timecheck_counter++; + if(timecheck_counter > 50) { + timecheck_counter = 0; + int time2 = time(0); + if(time2 > time1 + 4) { + infostream << "ClientMap::renderMap(): " + "Rendering takes ages, returning." + << std::endl; + return; } } @@ -621,60 +616,14 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) driver->setMaterial(list.m); - for(std::list::iterator j = list.bufs.begin(); - j != list.bufs.end(); ++j) - { + for(std::vector::iterator j = list.bufs.begin(); + j != list.bufs.end(); ++j) { scene::IMeshBuffer *buf = *j; driver->drawMeshBuffer(buf); vertex_count += buf->getVertexCount(); meshbuffer_count++; } -#if 0 - /* - Draw the faces of the block - */ - { - //JMutexAutoLock lock(block->mesh_mutex); - - MapBlockMesh *mapBlockMesh = block->mesh; - assert(mapBlockMesh); - - scene::SMesh *mesh = mapBlockMesh->getMesh(); - assert(mesh); - u32 c = mesh->getMeshBufferCount(); - bool stuff_actually_drawn = false; - for(u32 i=0; igetMeshBuffer(i); - const video::SMaterial& material = buf->getMaterial(); - video::IMaterialRenderer* rnd = - driver->getMaterialRenderer(material.MaterialType); - bool transparent = (rnd && rnd->isTransparent()); - // Render transparent on transparent pass and likewise. - if(transparent == is_transparent_pass) - { - if(buf->getVertexCount() == 0) - errorstream<<"Block ["<setMaterial(buf->getMaterial()); - driver->drawMeshBuffer(buf); - vertex_count += buf->getVertexCount(); - meshbuffer_count++; - stuff_actually_drawn = true; - } - } - if(stuff_actually_drawn) - blocks_had_pass_meshbuf++; - else - blocks_without_stuff++; - } -#endif } } // ScopeProfiler -- cgit v1.2.3