mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
Fix crashing in singleplayer, fix multiplayer maps with over 256 custom blocks still screwing up
This commit is contained in:
parent
48d394f8d0
commit
035f5cedd8
@ -135,6 +135,7 @@ void* Mem_Realloc(void* mem, cc_uint32 numElems, cc_uint32 elemsSize, const char
|
||||
#if defined CC_BUILD_WIN
|
||||
void* Mem_TryAlloc(cc_uint32 numElems, cc_uint32 elemsSize) {
|
||||
cc_uint32 numBytes = numElems * elemsSize; /* TODO: avoid overflow here */
|
||||
if (numBytes >= 128 * 64 * 128) return NULL;
|
||||
return HeapAlloc(heap, 0, numBytes);
|
||||
}
|
||||
|
||||
|
@ -107,9 +107,10 @@ static int Program_Run(int argc, char** argv) {
|
||||
int argsCount = Platform_GetCommandLineArgs(argc, argv, args);
|
||||
#ifdef _MSC_VER
|
||||
/* NOTE: Make sure to comment this out before pushing a commit */
|
||||
String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565");
|
||||
//String rawArgs = String_FromConst("UnknownShadow200 40f6ae6f5ba44ce9765b388103a8365a 207.180.232.193 25556");
|
||||
//String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565");
|
||||
//String rawArgs = String_FromConst("UnknownShadow200");
|
||||
argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4);
|
||||
//argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4);
|
||||
#endif
|
||||
|
||||
if (argsCount == 0) {
|
||||
|
@ -516,7 +516,7 @@ static void Classic_LevelFinalise(cc_uint8* data) {
|
||||
WoM_CheckSendWomID();
|
||||
|
||||
#ifdef EXTENDED_BLOCKS
|
||||
if (map2.allocFailed) { FreeMapStates(); return; }
|
||||
if (map2.allocFailed) FreeMapStates();
|
||||
#endif
|
||||
|
||||
width = Stream_GetU16_BE(data + 0);
|
||||
|
@ -146,6 +146,8 @@ static void SPConnection_BeginConnect(void) {
|
||||
|
||||
Random_SeedFromCurrentTime(&rnd);
|
||||
World_SetDimensions(128, 64, 128);
|
||||
World_NewMap();
|
||||
|
||||
Gen_Vanilla = true;
|
||||
Gen_Seed = Random_Next(&rnd, Int32_MaxValue);
|
||||
GeneratingScreen_Show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user