C client: don't die when tick queue is too large, just clear it

This commit is contained in:
UnknownShadow200 2018-08-27 07:19:07 +10:00
parent 391874d08d
commit 4406207ea4
3 changed files with 7 additions and 4 deletions

View File

@ -12,6 +12,7 @@
#include "Game.h"
#include "ErrorHandler.h"
#include "Vectors.h"
#include "Chat.h"
/* Data for a resizable queue, used for liquid physic tick entries. */
struct TickQueue {
@ -40,7 +41,9 @@ static void TickQueue_Clear(struct TickQueue* queue) {
static void TickQueue_Resize(struct TickQueue* queue) {
if (queue->BufferSize >= (Int32_MaxValue / 4)) {
ErrorHandler_Fail("TickQueue - too large to resize.");
Chat_AddRaw("&cTickQueue too large, clearing");
TickQueue_Clear(queue);
return;
}
UInt32 capacity = queue->BufferSize * 2;

View File

@ -158,8 +158,8 @@ Int32 Searcher_FindReachableBlocks(struct Entity* entity, struct AABB* entityBB,
UInt32 elements = (max.X - min.X + 1) * (max.Y - min.Y + 1) * (max.Z - min.Z + 1);
if (elements > Searcher_StatesMax) {
Searcher_Free();
Searcher_StatesCount = elements;
Searcher_States = Mem_Alloc(elements, sizeof(struct SearcherState), "collision search states");
Searcher_StatesMax = elements;
Searcher_States = Mem_Alloc(elements, sizeof(struct SearcherState), "collision search states");
}
/* Order loops so that we minimise cache misses */

View File

@ -127,7 +127,7 @@ void* Mem_Realloc(void* mem, UInt32 numElems, UInt32 elemsSize, const UChar* pla
}
void Mem_Free(void* mem) {
if (mem) free(*mem);
if (mem) free(mem);
}
#endif