diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/tile.cpp | 46 | ||||
-rw-r--r-- | src/client/tile.h | 6 |
2 files changed, 23 insertions, 29 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 150e621d9..a2284eed3 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -484,43 +484,35 @@ u32 TextureSource::getTextureId(const std::string &name) /* Get texture */ - if (std::this_thread::get_id() == m_main_thread) - { + if (std::this_thread::get_id() == m_main_thread) { return generateTexture(name); } - else - { - infostream<<"getTextureId(): Queued: name=\""<<name<<"\""<<std::endl; - // We're gonna ask the result to be put into here - static ResultQueue<std::string, u32, u8, u8> result_queue; - // Throw a request in - m_get_texture_queue.add(name, 0, 0, &result_queue); + infostream<<"getTextureId(): Queued: name=\""<<name<<"\""<<std::endl; - /*infostream<<"Waiting for texture from main thread, name=\"" - <<name<<"\""<<std::endl;*/ + // We're gonna ask the result to be put into here + static ResultQueue<std::string, u32, u8, u8> result_queue; - try - { - while(true) { - // Wait result for a second - GetResult<std::string, u32, u8, u8> - result = result_queue.pop_front(1000); + // Throw a request in + m_get_texture_queue.add(name, 0, 0, &result_queue); - if (result.key == name) { - return result.item; - } + try { + while(true) { + // Wait result for a second + GetResult<std::string, u32, u8, u8> + result = result_queue.pop_front(1000); + + if (result.key == name) { + return result.item; } } - catch(ItemNotFoundException &e) - { - errorstream<<"Waiting for texture " << name << " timed out."<<std::endl; - return 0; - } + } catch(ItemNotFoundException &e) { + errorstream << "Waiting for texture " << name << " timed out." << std::endl; + return 0; } - infostream<<"getTextureId(): Failed"<<std::endl; + infostream << "getTextureId(): Failed" << std::endl; return 0; } @@ -673,7 +665,7 @@ Palette* TextureSource::getPalette(const std::string &name) // Only the main thread may load images sanity_check(std::this_thread::get_id() == m_main_thread); - if (name == "") + if (name.empty()) return NULL; auto it = m_palettes.find(name); diff --git a/src/client/tile.h b/src/client/tile.h index 8a8c5bd47..d4e25ea6a 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -237,6 +237,8 @@ struct TileLayer case TILE_MATERIAL_LIQUID_TRANSPARENT: material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; break; + default: + break; } material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING) != 0; if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) { @@ -304,8 +306,8 @@ struct TileLayer struct TileSpec { TileSpec() { - for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) - layers[layer] = TileLayer(); + for (auto &layer : layers) + layer = TileLayer(); } /*! |