ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/define.h
(Generate patch)

Comparing deliantra/server/include/define.h (file contents):
Revision 1.14 by pippijn, Mon Dec 11 19:46:46 2006 UTC vs.
Revision 1.18 by root, Mon Dec 18 02:35:01 2006 UTC

16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 20
21 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at crossfire@schmorp.de
22*/ 22*/
23 23
24/* This file is best viewed with a window width of about 100 character */ 24/* This file is best viewed with a window width of about 100 character */
25 25
26/* This file is really too large. With all the .h files 26/* This file is really too large. With all the .h files
425 * flags[2] is 64 to 95 425 * flags[2] is 64 to 95
426 * flags[3] is 96 to 127 426 * flags[3] is 96 to 127
427 */ 427 */
428 428
429/* Basic routines to do above */ 429/* Basic routines to do above */
430#define SET_FLAG(xyz, p) \ 430#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1
431 ((xyz)->flags[p/32] |= (1U << (p % 32))) 431#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0
432#define CLEAR_FLAG(xyz, p) \ 432#define QUERY_FLAG(obj, flag) (obj)->flags[flag]
433 ((xyz)->flags[p/32] &= ~(1U << (p % 32)))
434#define QUERY_FLAG(xyz, p) \
435 ((xyz)->flags[p/32] & (1U << (p % 32)))
436#define COMPARE_FLAGS(p,q) \
437 ( \
438 ((p)->flags[0] == (q)->flags[0]) && \
439 ((p)->flags[1] == (q)->flags[1]) && \
440 ((p)->flags[2] == (q)->flags[2]) && \
441 ((p)->flags[3] == (q)->flags[3]) \
442 )
443 433
444/* convenience macros to determine what kind of things we are dealing with */ 434/* convenience macros to determine what kind of things we are dealing with */
445 435
446#define IS_WEAPON(op) \ 436#define IS_WEAPON(op) \
447 (op->type == ARROW || op->type == BOW || op->type == WEAPON) 437 (op->type == ARROW || op->type == BOW || op->type == WEAPON)
1030 * 1020 *
1031 * 0.94.2 - you probably shouldn't need to change any of the rand stuff 1021 * 0.94.2 - you probably shouldn't need to change any of the rand stuff
1032 * here. 1022 * here.
1033 */ 1023 */
1034 1024
1035#ifdef HAVE_SRANDOM
1036# define RANDOM() random() 1025#define RANDOM() random()
1037# define SRANDOM(xyz) srandom(xyz) 1026#define SRANDOM(xyz) srandom(xyz)
1038#else
1039# ifdef HAVE_SRAND48
1040# define RANDOM() lrand48()
1041# define SRANDOM(xyz) srand48(xyz)
1042# else
1043# ifdef HAVE_SRAND
1044# define RANDOM() rand()
1045# define SRANDOM(xyz) srand(xyz)
1046# else
1047# error "Could not find a usable random routine"
1048# endif
1049# endif
1050#endif
1051 1027
1052/* Returns the weight of the given object. Note: it does not take the number of 1028/* Returns the weight of the given object. Note: it does not take the number of
1053 * items (nrof) into account. 1029 * items (nrof) into account.
1054 */ 1030 */
1055#define WEIGHT(op) (op->nrof?op->weight:op->weight+op->carrying) 1031#define WEIGHT(op) (op->nrof?op->weight:op->weight+op->carrying)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines