mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Some minor code cleanups
This commit is contained in:
parent
7689f1f0fd
commit
03affa1bbb
15 changed files with 29 additions and 98 deletions
|
@ -103,7 +103,7 @@ void MapblockMeshGenerator::getSpecialTile(int index, TileSpec *tile_ret, bool a
|
|||
|
||||
for (auto &layernum : tile_ret->layers) {
|
||||
TileLayer *layer = &layernum;
|
||||
if (layer->texture_id == 0)
|
||||
if (layer->empty())
|
||||
continue;
|
||||
top_layer = layer;
|
||||
if (!layer->has_color)
|
||||
|
|
|
@ -347,7 +347,7 @@ void getNodeTileN(MapNode mn, const v3s16 &p, u8 tileindex, MeshMakeData *data,
|
|||
tile = f.tiles[tileindex];
|
||||
bool has_crack = p == data->m_crack_pos_relative;
|
||||
for (TileLayer &layer : tile.layers) {
|
||||
if (layer.texture_id == 0)
|
||||
if (layer.empty())
|
||||
continue;
|
||||
if (!layer.has_color)
|
||||
mn.getColor(f, &(layer.color));
|
||||
|
|
|
@ -12,7 +12,7 @@ void MeshCollector::append(const TileSpec &tile, const video::S3DVertex *vertice
|
|||
{
|
||||
for (int layernum = 0; layernum < MAX_TILE_LAYERS; layernum++) {
|
||||
const TileLayer *layer = &tile.layers[layernum];
|
||||
if (layer->texture_id == 0)
|
||||
if (layer->empty())
|
||||
continue;
|
||||
append(*layer, vertices, numVertices, indices, numIndices, layernum,
|
||||
tile.world_aligned);
|
||||
|
|
|
@ -897,6 +897,8 @@ video::IImage* CGUITTFont::createTextureFromChar(const char32_t& ch)
|
|||
|
||||
// Acquire a read-only lock of the corresponding page texture.
|
||||
void* ptr = tex->lock(video::ETLM_READ_ONLY);
|
||||
if (!ptr)
|
||||
return nullptr;
|
||||
|
||||
video::ECOLOR_FORMAT format = tex->getColorFormat();
|
||||
core::dimension2du tex_size = tex->getOriginalSize();
|
||||
|
|
|
@ -200,9 +200,13 @@ namespace gui
|
|||
//! Updates the texture atlas with new glyphs.
|
||||
void updateTexture()
|
||||
{
|
||||
if (!dirty) return;
|
||||
if (!dirty)
|
||||
return;
|
||||
|
||||
void* ptr = texture->lock();
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
video::ECOLOR_FORMAT format = texture->getColorFormat();
|
||||
core::dimension2du size = texture->getOriginalSize();
|
||||
video::IImage* pageholder = driver->createImageFromData(format, size, ptr, true, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue