Better compatibility with old MSVC

This commit is contained in:
UnknownShadow200 2024-07-26 20:19:01 +10:00
parent 22d001462f
commit 1d217b67c5
2 changed files with 9 additions and 5 deletions

View file

@ -23,10 +23,12 @@ Copyright 2014-2023 ClassiCube | Licensed under BSD-3
#if _MSC_VER <= 1500
#define CC_INLINE
#define CC_NOINLINE
#else
#define CC_INLINE inline
#endif
#define CC_INLINE inline
#define CC_NOINLINE __declspec(noinline)
#endif
#ifndef CC_API
#define CC_API __declspec(dllexport, noinline)
#define CC_VAR __declspec(dllexport)
@ -62,6 +64,7 @@ Copyright 2014-2023 ClassiCube | Licensed under BSD-3
#define CC_INLINE inline
#define CC_NOINLINE __attribute__((noinline))
#ifndef CC_API
#ifdef _WIN32
#define CC_API __attribute__((dllexport, noinline))
@ -71,6 +74,7 @@ Copyright 2014-2023 ClassiCube | Licensed under BSD-3
#define CC_VAR __attribute__((visibility("default")))
#endif
#endif
#define CC_HAS_MISC
#ifdef __BIG_ENDIAN__
#define CC_BIG_ENDIAN

View file

@ -368,14 +368,14 @@ static void CalculateChunkLightingAll(int chunkIndex, int cx, int cy, int cz) {
neighborBlockBrightness = GetBlockBrightness(World_GetBlock(neighborCoords.x, neighborCoords.y, neighborCoords.z), isLamp); \
/* This spot is a light caster, mark this spot as needing to be re-spread */ \
if (neighborBlockBrightness > 0) { \
otherNode = (struct LightNode){ { neighborCoords.x, neighborCoords.y, neighborCoords.z }, neighborBlockBrightness }; \
LightNode_Init(otherNode, neighborCoords.x, neighborCoords.y, neighborCoords.z, neighborBlockBrightness); \
Queue_Enqueue(&lightQueue, &otherNode); \
} \
if (neighborBrightness > 0) { \
/* This neighbor is darker than cur spot, darken it*/ \
if (neighborBrightness < curNode.brightness) { \
SetBrightness(0, neighborCoords.x, neighborCoords.y, neighborCoords.z, isLamp, true); \
otherNode = (struct LightNode){ { neighborCoords.x, neighborCoords.y, neighborCoords.z }, neighborBrightness }; \
LightNode_Init(otherNode, neighborCoords.x, neighborCoords.y, neighborCoords.z, neighborBrightness); \
Queue_Enqueue(&unlightQueue, &otherNode); \
} \
/* This neighbor is brighter or same, mark this spot as needing to be re-spread */ \
@ -449,7 +449,7 @@ static void CalcBlockChange(int x, int y, int z, BlockID oldBlock, BlockID newBl
/* Cell is darker than the new block, only brighter case */
if (oldLightLevelHere < newBlockLightLevel) {
/* brighten this spot, recalculate lighting */
entry = (struct LightNode){ { x, y, z }, newBlockLightLevel };
LightNode_Init(entry, x, y, z, newBlockLightLevel);
Queue_Enqueue(&lightQueue, &entry);
FlushLightQueue(isLamp, true);
return;