#ifndef MACROMINE_H_INCLUDED
#define MACROMINE_H_INCLUDED

#define CASE_NOT_EMPTY(x, defaults) \
case x: if (GET.pCust->pVetArg[x] == NO_ITEM) return defaults; else return GET.pCust->pVetArg[x]; break

#define SWITCH(value) \
switch (value) {

#define SWITCH_END }

#define CASE_R(x, rtrn) \
case x: return rtrn

#define CASE_RDC(x, rtrn) \
case x: logger.for_value("CASE_RDC: Debug Customize SoundFX Returned: ", rtrn); return rtrn

#define CASE_RDD(x, rtrn) \
case x: logger.for_value("CASE_RDD: Debug Default SoundFX Returned: ", rtrn); return rtrn

#define CASE(x, rtrn, value) \
case x: rtrn = value; break

#define CASE_C(x, rtrn) \
case x: rtrn = getCustomizeFootstep(x); break

#define CASE_CR(x, value, value_check, rtrn) \
case x: if (value == value_check) return rtrn; else return false; break

#define CASE_D2(rtrn, rtrn2) \
default: rtrn; rtrn2; break

#define CASE_D1(rtrn) \
default: rtrn; break

// Moveable Return.
#define CASE_MR(x) \
case x: if (dest->object_number == x) result = dest; break

#define MALLOC_INIT(x, structure) x = (structure*)malloc(sizeof(structure));
#define MALLOC_FREE(x) if (x != nullptr) free(x);

#define JZON_LOAD(rtrn_var, from, name, to) if (from.has(name)) to = (rtrn_var)from.get(name).toInt()

// with check if not NULL
#define DOUBLE_VALUE(value, defaults) (((value) != NULL) ? (value) : (defaults))
#define DOUBLE_VALUE_2(check, value, defaults) (((check) != 0) ? (value) : (defaults))
#define DOUBLE_VALUE_ITEM(value, defaults) (((value) != NO_ITEM) ? (value) : (defaults))
#define DOUBLE_VALUE_VALUE(var, check, value1, value2) (((var) == (check)) ? (value1) : (value2))
#define DOUBLE_VALUE_ANIM(anim_var, anim, value, defaults) (((anim_var) == (anim)) ? (value) : (defaults))

#define CHECK_INV_ITEM(from, slot, check_func) \
if (from == slot) \
{ \
    if (check_func)\
        return true;\
}

#define DELETE_INV_ITEM(from, slot, check_func, delete_func) \
if (from == slot) \
{ \
    if (check_func)\
        delete_func;\
}

#endif