Merge branch 'smartcmd:main' into main

This commit is contained in:
IsraelProyects 2026-03-04 08:54:04 -07:00 committed by GitHub
commit 2356cc5970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 24 deletions

View file

@ -52,7 +52,7 @@ Chunk::Chunk(Level *level, LevelRenderer::rteMap &globalRenderableTileEntities,
: globalRenderableTileEntities( &globalRenderableTileEntities ), globalRenderableTileEntities_cs(&globalRenderableTileEntities_cs) : globalRenderableTileEntities( &globalRenderableTileEntities ), globalRenderableTileEntities_cs(&globalRenderableTileEntities_cs)
{ {
clipChunk->visible = false; clipChunk->visible = false;
bb = NULL; bb = nullptr;
id = 0; id = 0;
this->level = level; this->level = level;
@ -101,15 +101,15 @@ void Chunk::setPos(int x, int y, int z)
float g = 6.0f; float g = 6.0f;
// 4J - changed to just set the value rather than make a new one, if we've already created storage // 4J - changed to just set the value rather than make a new one, if we've already created storage
if( bb == NULL ) if( !bb )
{ {
bb = AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g); bb = shared_ptr<AABB>(AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g));
} }
else else
{ {
// 4J MGH - bounds are relative to the position now, so the AABB will be setup already, either above, or from the tesselator bounds. // 4J MGH - bounds are relative to the position now, so the AABB will be setup already, either above, or from the tesselator bounds.
// bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g); // bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g);
} }
clipChunk->aabb[0] = bb->x0 + x; clipChunk->aabb[0] = bb->x0 + x;
clipChunk->aabb[1] = bb->y0 + y; clipChunk->aabb[1] = bb->y0 + y;
clipChunk->aabb[2] = bb->z0 + z; clipChunk->aabb[2] = bb->z0 + z;
@ -154,6 +154,7 @@ void Chunk::translateToPos()
Chunk::Chunk() Chunk::Chunk()
{ {
bb = nullptr;
} }
void Chunk::makeCopyForRebuild(Chunk *source) void Chunk::makeCopyForRebuild(Chunk *source)
@ -998,7 +999,7 @@ int Chunk::getList(int layer)
void Chunk::cull(Culler *culler) void Chunk::cull(Culler *culler)
{ {
clipChunk->visible = culler->isVisible(bb); clipChunk->visible = culler->isVisible(bb.get());
} }
void Chunk::renderBB() void Chunk::renderBB()
@ -1027,10 +1028,7 @@ void Chunk::clearDirty()
#endif #endif
} }
Chunk::~Chunk() Chunk::~Chunk() = default;
{
delete bb;
}
bool Chunk::emptyFlagSet(int layer) bool Chunk::emptyFlagSet(int layer)
{ {

View file

@ -46,11 +46,11 @@ public:
int xRender, yRender, zRender; int xRender, yRender, zRender;
int xRenderOffs, yRenderOffs, zRenderOffs; int xRenderOffs, yRenderOffs, zRenderOffs;
int xm, ym, zm; int xm, ym, zm;
AABB *bb; shared_ptr<AABB> bb;
ClipChunk *clipChunk; ClipChunk *clipChunk;
int id; int id;
//public: //public:
// vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed // vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed

View file

@ -40,16 +40,36 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
m_buttonListItems.init(eControl_Items); m_buttonListItems.init(eControl_Items);
// Sort items alphabetically
std::vector<std::pair<std::wstring, unsigned int>> sortedItems;
for (size_t i = 0; i < Item::items.length; ++i)
{
if (Item::items[i] != NULL)
{
sortedItems.emplace_back(std::wstring(app.GetString(Item::items[i]->getDescriptionId())), i);
}
}
for (size_t i = 1; i < sortedItems.size(); ++i)
{
auto key = sortedItems[i];
int j = i - 1;
while (j >= 0 && sortedItems[j].first > key.first)
{
sortedItems[j + 1] = sortedItems[j];
--j;
}
sortedItems[j + 1] = key;
}
// Populate the list in sorted order
int listId = 0; int listId = 0;
for(unsigned int i = 0; i < Item::items.length; ++i) for (const auto& entry : sortedItems)
{ {
if(Item::items[i] != NULL) m_itemIds.push_back(entry.second);
{ m_buttonListItems.addItem(entry.first.c_str(), listId);
m_itemIds.push_back(i); ++listId;
m_buttonListItems.addItem(app.GetString(Item::items[i]->getDescriptionId()), listId); }
++listId;
}
}
m_buttonListEnchantments.init(eControl_Enchantments); m_buttonListEnchantments.init(eControl_Enchantments);