From fedfcd81e31aec66f2630869175e75c223385ee1 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 27 Jan 2014 10:29:29 +0000 Subject: [PATCH] MapArt: Fix a harmless C++ warning. (malloc casting, for those interested) EDuke32 has me so accustomed to straight C... using a template and pass-by-reference makes my day. git-svn-id: https://svn.eduke32.com/eduke32@4267 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) {