diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 30667499e..4e36e9f4a 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9857,6 +9857,20 @@ static void E_RecalcPicSiz(void) } while (0) // Allocate per-map ART backup array and back up the original! +#ifdef __cplusplus +template +static inline void ALLOC_MAPART_ARRAY(origar_t &origar, bakar_t &bakar) +{ + bakar = (bakar_t) Bmalloc(MAXUSERTILES*sizeof(origar[0])); + if (bakar == NULL) + { + initprintf("OUT OF MEMORY allocating per-map ART backup arrays!\n"); + uninitengine(); + exit(12); + } + Bmemcpy(bakar, origar, MAXUSERTILES*sizeof(origar[0])); +} +#else #define ALLOC_MAPART_ARRAY(origar, bakar) do { \ bakar = Bmalloc(MAXUSERTILES*sizeof(origar[0])); \ if (bakar == NULL) \ @@ -9867,6 +9881,7 @@ static void E_RecalcPicSiz(void) } \ Bmemcpy(bakar, origar, MAXUSERTILES*sizeof(origar[0])); \ } while (0) +#endif void E_MapArt_Clear(void) {