mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
C client: don't die when tick queue is too large, just clear it
This commit is contained in:
parent
391874d08d
commit
4406207ea4
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user