mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -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 "Game.h"
|
||||||
#include "ErrorHandler.h"
|
#include "ErrorHandler.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
#include "Chat.h"
|
||||||
|
|
||||||
/* Data for a resizable queue, used for liquid physic tick entries. */
|
/* Data for a resizable queue, used for liquid physic tick entries. */
|
||||||
struct TickQueue {
|
struct TickQueue {
|
||||||
@ -40,7 +41,9 @@ static void TickQueue_Clear(struct TickQueue* queue) {
|
|||||||
|
|
||||||
static void TickQueue_Resize(struct TickQueue* queue) {
|
static void TickQueue_Resize(struct TickQueue* queue) {
|
||||||
if (queue->BufferSize >= (Int32_MaxValue / 4)) {
|
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;
|
UInt32 capacity = queue->BufferSize * 2;
|
||||||
|
@ -158,7 +158,7 @@ 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);
|
UInt32 elements = (max.X - min.X + 1) * (max.Y - min.Y + 1) * (max.Z - min.Z + 1);
|
||||||
if (elements > Searcher_StatesMax) {
|
if (elements > Searcher_StatesMax) {
|
||||||
Searcher_Free();
|
Searcher_Free();
|
||||||
Searcher_StatesCount = elements;
|
Searcher_StatesMax = elements;
|
||||||
Searcher_States = Mem_Alloc(elements, sizeof(struct SearcherState), "collision search states");
|
Searcher_States = Mem_Alloc(elements, sizeof(struct SearcherState), "collision search states");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ void* Mem_Realloc(void* mem, UInt32 numElems, UInt32 elemsSize, const UChar* pla
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mem_Free(void* mem) {
|
void Mem_Free(void* mem) {
|
||||||
if (mem) free(*mem);
|
if (mem) free(mem);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user