#include "AppHdr.h"
#include "store.h"
#include "dlua.h"
#include "externs.h"
#include "libutil.h"
#include "monster.h"
#include "tags.h"
#include "travel.h"
#include <algorithm>
Defines | |
#define | COPY_PTR(ptr_type) |
#define | GET_VAL(x, _type, field, value) |
#define | GET_VAL_PTR(x, _type, value) |
#define | GET_CONST_SETUP(x) |
#define | CONST_INT_CAST() |
#define | INT_OPERATOR_UNARY(op) |
#define CONST_INT_CAST | ( | ) |
#define COPY_PTR | ( | ptr_type | ) |
Value:
{ \ ptr_type *ptr = static_cast<ptr_type*>(val.ptr); \ if (ptr != NULL) \ delete ptr; \ ptr = static_cast<ptr_type*>(other.val.ptr); \ val.ptr = (void*) new ptr_type (*ptr); \ }
#define GET_CONST_SETUP | ( | x | ) |
Value:
ASSERT(!(flags & SFLAG_UNSET)); \ ASSERT(type == (x));
#define GET_VAL | ( | x, | |||
_type, | |||||
field, | |||||
value | ) |
#define GET_VAL_PTR | ( | x, | |||
_type, | |||||
value | ) |
Value:
ASSERT((flags & SFLAG_UNSET) || !(flags & SFLAG_CONST_VAL)); \ if (type != (x) || (flags & SFLAG_UNSET)) \ { \ if (type == SV_NONE) \ { \ type = (x); \ val.ptr = (value); \ } \ else \ { \ unset(); \ val.ptr = (value); \ type = (x); \ } \ } \ else \ delete (value); \ flags &= ~SFLAG_UNSET; \ return *((_type) val.ptr);
#define INT_OPERATOR_UNARY | ( | op | ) |
Value:
switch (type) \ { \ case SV_BYTE: \ { \ char &temp = get_byte(); \ temp op; \ return temp; \ } \ \ case SV_SHORT: \ { \ short &temp = get_short(); \ temp op; \ return temp; \ } \ case SV_INT: \ { \ int &temp = get_int(); \ temp op; \ return temp; \ } \ \ default: \ die("unknown stored value type"); \ return 0; \ }