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
This commit is contained in:
hendricks266 2014-01-27 10:29:29 +00:00
parent 3a85134e31
commit fedfcd81e3

View file

@ -9857,6 +9857,20 @@ static void E_RecalcPicSiz(void)
} while (0) } while (0)
// Allocate per-map ART backup array and back up the original! // Allocate per-map ART backup array and back up the original!
#ifdef __cplusplus
template <typename origar_t, typename bakar_t>
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 { \ #define ALLOC_MAPART_ARRAY(origar, bakar) do { \
bakar = Bmalloc(MAXUSERTILES*sizeof(origar[0])); \ bakar = Bmalloc(MAXUSERTILES*sizeof(origar[0])); \
if (bakar == NULL) \ if (bakar == NULL) \
@ -9867,6 +9881,7 @@ static void E_RecalcPicSiz(void)
} \ } \
Bmemcpy(bakar, origar, MAXUSERTILES*sizeof(origar[0])); \ Bmemcpy(bakar, origar, MAXUSERTILES*sizeof(origar[0])); \
} while (0) } while (0)
#endif
void E_MapArt_Clear(void) void E_MapArt_Clear(void)
{ {