mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
fix: mitigate entity id overflow and crash for max chunk updates
This commit is contained in:
parent
5444ad63cf
commit
8fb071fcdf
|
|
@ -146,7 +146,8 @@ void ServerPlayer::flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFou
|
|||
if( ( *removedFound ) == false )
|
||||
{
|
||||
*removedFound = true;
|
||||
memset(flags, 0, 2048/32);
|
||||
// before this left 192 bytes uninitialized!!!!!
|
||||
memset(flags, 0, (2048 / 32) * sizeof(unsigned int));
|
||||
}
|
||||
|
||||
for(int index : entitiesToRemove)
|
||||
|
|
|
|||
|
|
@ -96,9 +96,20 @@ int Entity::getSmallId()
|
|||
puiUsedFlags++;
|
||||
}
|
||||
|
||||
#ifdef MINECRAFT_SERVER_BUILD
|
||||
// in mc server dedi, a server with 8+ playerrs can cause this to go wack
|
||||
int fallbackId = Entity::entityCounter++;
|
||||
|
||||
if (entityCounter == 0x7ffffff)
|
||||
{
|
||||
entityCounter = 2048;
|
||||
}
|
||||
return fallbackId;
|
||||
#else
|
||||
app.DebugPrintf("Out of small entity Ids... possible leak?\n");
|
||||
__debugbreak();
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Entity::countFlagsForPIX()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,12 @@ using namespace std;
|
|||
|
||||
// 4J Stu - This value should be big enough that we don't get any crashes causes by memory overwrites,
|
||||
// however it does seem way too large for what is actually needed. Needs further investigation
|
||||
#ifdef MINECRAFT_SERVER_BUILD
|
||||
// fixes a crash when 8+ players are present
|
||||
#define LEVEL_CHUNKS_TO_UPDATE_MAX (32*32*8)
|
||||
#else
|
||||
#define LEVEL_CHUNKS_TO_UPDATE_MAX (19*19*8)
|
||||
#endif
|
||||
|
||||
class Vec3;
|
||||
class ChunkSource;
|
||||
|
|
|
|||
Loading…
Reference in a new issue