1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Remove or restrict some client settings (#15633)

This commit is contained in:
sfan5 2025-01-08 10:56:45 +01:00 committed by GitHub
parent 41f7031e49
commit e5542e5b02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 48 additions and 128 deletions

View file

@ -73,6 +73,12 @@ MapBlock::~MapBlock()
porting::TrackFreedMemory(sizeof(MapNode) * nodecount);
}
static inline size_t get_max_objects_per_block()
{
u16 ret = g_settings->getU16("max_objects_per_block");
return MYMAX(256, ret);
}
bool MapBlock::onObjectsActivation()
{
// Ignore if no stored objects (to not set changed flag)
@ -84,7 +90,7 @@ bool MapBlock::onObjectsActivation()
<< "activating " << count << " objects in block " << getPos()
<< std::endl;
if (count > g_settings->getU16("max_objects_per_block")) {
if (count > get_max_objects_per_block()) {
errorstream << "suspiciously large amount of objects detected: "
<< count << " in " << getPos() << "; removing all of them."
<< std::endl;
@ -99,7 +105,7 @@ bool MapBlock::onObjectsActivation()
bool MapBlock::saveStaticObject(u16 id, const StaticObject &obj, u32 reason)
{
if (m_static_objects.getStoredSize() >= g_settings->getU16("max_objects_per_block")) {
if (m_static_objects.getStoredSize() >= get_max_objects_per_block()) {
warningstream << "MapBlock::saveStaticObject(): Trying to store id = " << id
<< " statically but block " << getPos() << " already contains "
<< m_static_objects.getStoredSize() << " objects."