Atrinik Server  4.0
Macros
Destroyed objects check

Macros

#define _OBJECTS_DESTROYED_DEFINE(obj)
 
#define _OBJECTS_DESTROYED(obj)   (OBJECT_DESTROYED(obj, __tag_##obj))
 
#define _OBJECTS_DESTROYED_ANY(obj)   _OBJECTS_DESTROYED(obj) ||
 
#define _OBJECTS_DESTROYED_ALL(obj)   _OBJECTS_DESTROYED(obj) &&
 
#define OBJECTS_DESTROYED_BEGIN(...)
 
#define OBJECTS_DESTROYED_ANY(...)   (FOR_EACH(_OBJECTS_DESTROYED_ANY, __VA_ARGS__) 0)
 
#define OBJECTS_DESTROYED_ALL(...)   (FOR_EACH(_OBJECTS_DESTROYED_ALL, __VA_ARGS__) 1)
 
#define OBJECTS_DESTROYED(obj)   (_OBJECTS_DESTROYED(obj))
 
#define OBJECTS_DESTROYED_END()   } while (0)
 

Detailed Description

Macro that tracks and checks the destroyed state of multiple objects simultaneously.

Example usage:

// Do something with op and/or hitter
if (OBJECTS_DESTROYED_ANY(op, hitter)) {
// End processing
return;
}
// Do something more with op and/or hitter

Macro Definition Documentation

#define _OBJECTS_DESTROYED (   obj)    (OBJECT_DESTROYED(obj, __tag_##obj))

Helper macro for OBJECTS_DESTROYED(); used internally.

Definition at line 746 of file object.h.

#define _OBJECTS_DESTROYED_ALL (   obj)    _OBJECTS_DESTROYED(obj) &&

Helper macro for OBJECTS_DESTROYED_ALL(); used internally.

Definition at line 756 of file object.h.

#define _OBJECTS_DESTROYED_ANY (   obj)    _OBJECTS_DESTROYED(obj) ||

Helper macro for OBJECTS_DESTROYED_ANY(); used internally.

Definition at line 751 of file object.h.

#define _OBJECTS_DESTROYED_DEFINE (   obj)
Value:
HARD_ASSERT(!OBJECT_FREE(obj)); \
tag_t __tag_##obj = obj->count;
Definition: object.h:94
#define OBJECT_FREE(_ob_)
Definition: object.h:554
tag_t count
Definition: object.h:142

Helper macro for OBJECTS_DESTROYED_BEGIN(); used internally.

Definition at line 740 of file object.h.

#define OBJECTS_DESTROYED (   obj)    (_OBJECTS_DESTROYED(obj))

Check if the specified object tracked by a previous use of OBJECTS_DESTROYED_BEGIN() has been destroyed.

It is preferable to use this macro when checking a single object, instead of using OBJECTS_DESTROYED_ALL/OBJECTS_DESTROYED_ANY with a single argument.

Parameters
objThe object to check.

Definition at line 811 of file object.h.

#define OBJECTS_DESTROYED_ALL (   ...)    (FOR_EACH(_OBJECTS_DESTROYED_ALL, __VA_ARGS__) 1)

Check if all of the objects tracked by OBJECTS_DESTROYED_BEGIN() have been destroyed.

When specifying all of the objects that were tracked by a previous use of OBJECTS_DESTROYED_BEGIN(), it is recommended that they be in the same order.

Parameters
...The objects to check. MUST be one (or more) of the objects that were tracked by a previous OBJECTS_DESTROYED_BEGIN(). The specified order does not have to be the same as the one defined previously for OBJECTS_DESTROYED_BEGIN().

Definition at line 798 of file object.h.

#define OBJECTS_DESTROYED_ANY (   ...)    (FOR_EACH(_OBJECTS_DESTROYED_ANY, __VA_ARGS__) 0)

Check if any of the objects tracked by OBJECTS_DESTROYED_BEGIN() have been destroyed.

When specifying all of the objects that were tracked by a previous use of OBJECTS_DESTROYED_BEGIN(), it is recommended that they be in the same order.

Parameters
...The objects to check. MUST be one (or more) of the objects that were tracked by a previous OBJECTS_DESTROYED_BEGIN(). The specified order does not have to be the same as the one defined previously for OBJECTS_DESTROYED_BEGIN().

Definition at line 782 of file object.h.

#define OBJECTS_DESTROYED_BEGIN (   ...)
Value:
do { \
FOR_EACH(_OBJECTS_DESTROYED_DEFINE, __VA_ARGS__)
#define _OBJECTS_DESTROYED_DEFINE(obj)
Definition: object.h:740

Begin tracking objects for destruction checks. This creates a new scope, which MUST be closed with OBJECTS_DESTROYED_END().

Parameters
...The objects to track.

Definition at line 765 of file object.h.

#define OBJECTS_DESTROYED_END ( )    } while (0)

Closes the scope created by OBJECTS_DESTROYED_BEGIN().

Definition at line 816 of file object.h.