mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix last commit accidentally undoing out of memory handling improvements in Protocol.c
This commit is contained in:
parent
209a4046fb
commit
636bada0c8
@ -423,8 +423,7 @@ static void MapState_Read(struct MapState* m) {
|
||||
}
|
||||
|
||||
static void Classic_StartLoading(void) {
|
||||
World_Reset();
|
||||
Event_RaiseVoid(&WorldEvents.NewMap);
|
||||
World_NewMap();
|
||||
Stream_ReadonlyMemory(&map_part, NULL, 0);
|
||||
|
||||
LoadingScreen_Show(&Server.Name, &Server.MOTD);
|
||||
@ -515,9 +514,8 @@ static void Classic_LevelFinalise(cc_uint8* data) {
|
||||
map_begunLoading = false;
|
||||
WoM_CheckSendWomID();
|
||||
|
||||
if (map.allocFailed) return;
|
||||
#ifdef EXTENDED_BLOCKS
|
||||
if (map2.allocFailed) { FreeMapStates(); return; }
|
||||
if (map2.allocFailed) FreeMapStates();
|
||||
#endif
|
||||
|
||||
width = Stream_GetU16_BE(data + 0);
|
||||
@ -528,17 +526,13 @@ static void Classic_LevelFinalise(cc_uint8* data) {
|
||||
Chat_AddRaw("&cFailed to load map, try joining a different map");
|
||||
Chat_AddRaw(" &cBlocks array size does not match volume of map");
|
||||
FreeMapStates();
|
||||
return;
|
||||
}
|
||||
|
||||
World_SetNewMap(map.blocks, width, height, length);
|
||||
|
||||
#ifdef EXTENDED_BLOCKS
|
||||
/* defer allocation of second map array if possible */
|
||||
if (cpe_extBlocks && map2.blocks) {
|
||||
World_SetMapUpper(map2.blocks);
|
||||
}
|
||||
if (cpe_extBlocks && map2.blocks) World_SetMapUpper(map2.blocks);
|
||||
#endif
|
||||
Event_RaiseVoid(&WorldEvents.MapLoaded);
|
||||
World_SetNewMap(map.blocks, width, height, length);
|
||||
}
|
||||
|
||||
static void Classic_SetBlock(cc_uint8* data) {
|
||||
@ -1434,7 +1428,7 @@ static void CPE_Tick(void) {
|
||||
*------------------------------------------------------Custom blocks------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void BlockDefs_OnBlockUpdated(BlockID block, cc_bool didBlockLight) {
|
||||
if (!World.Blocks) return;
|
||||
if (!World.Loaded) return;
|
||||
/* Need to refresh lighting when a block's light blocking state changes */
|
||||
if (Blocks.BlocksLight[block] != didBlockLight) Lighting_Refresh();
|
||||
}
|
||||
@ -1609,4 +1603,4 @@ void Protocol_Tick(void) {
|
||||
Classic_Tick();
|
||||
CPE_Tick();
|
||||
WoM_Tick();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user