1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2003-2005 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2003-2005 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
32 | */ |
32 | */ |
33 | |
33 | |
34 | #ifndef DEFINE_H |
34 | #ifndef DEFINE_H |
35 | #define DEFINE_H |
35 | #define DEFINE_H |
36 | |
36 | |
37 | /* |
|
|
38 | * Crossfire requires ANSI-C, but some compilers "forget" to define it. |
|
|
39 | * Thus the prototypes made by cextract don't get included correctly. |
|
|
40 | */ |
|
|
41 | #if !defined(__STDC__) |
|
|
42 | |
|
|
43 | /* Removed # from start of following line. makedepend was picking it up. |
|
|
44 | * The following should still hopefully result in an error. |
|
|
45 | */ |
|
|
46 | error - Your ANSI C compiler should be defining __STDC__; |
|
|
47 | #endif |
|
|
48 | |
|
|
49 | #include <autoconf.h> |
37 | #include <autoconf.h> |
50 | |
38 | |
51 | #define FONTDIR "" |
39 | #define FONTDIR "" |
52 | #define FONTNAME "" |
40 | #define FONTNAME "" |
53 | |
41 | |
54 | /* Decstations have trouble with fabs()... */ |
42 | /* Decstations have trouble with fabs()... */ |
55 | #define FABS(x) ((x)<0?-(x):(x)) |
43 | #define FABS(x) fabs (x) |
56 | |
44 | |
57 | #ifdef __NetBSD__ |
45 | #ifdef __NetBSD__ |
58 | # include <sys/param.h> |
46 | # include <sys/param.h> |
59 | #endif |
47 | #endif |
60 | #ifndef MIN |
48 | #ifndef MIN |
… | |
… | |
94 | |
82 | |
95 | #define MAX_NAME 48 |
83 | #define MAX_NAME 48 |
96 | #define MAX_EXT_TITLE 98 |
84 | #define MAX_EXT_TITLE 98 |
97 | |
85 | |
98 | /* Fatal variables: */ |
86 | /* Fatal variables: */ |
|
|
87 | //TODO: remove all calls to fatal and replace them by cleanup |
99 | #define OUT_OF_MEMORY 0 |
88 | #define OUT_OF_MEMORY 0 |
100 | #define MAP_ERROR 1 |
89 | #define MAP_ERROR 1 |
101 | #define ARCHTABLE_TOO_SMALL 2 |
90 | #define ARCHTABLE_TOO_SMALL 2 // unused |
102 | #define TOO_MANY_ERRORS 3 |
91 | #define TOO_MANY_ERRORS 3 |
103 | |
92 | |
104 | /* TYPE DEFINES */ |
93 | /* TYPE DEFINES */ |
105 | |
94 | |
106 | /* Only add new values to this list if somewhere in the program code, |
95 | /* Only add new values to this list if somewhere in the program code, |
… | |
… | |
587 | #define FLAG_IS_WATER 107 |
576 | #define FLAG_IS_WATER 107 |
588 | #define FLAG_CONTENT_ON_GEN 108 |
577 | #define FLAG_CONTENT_ON_GEN 108 |
589 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated */ |
578 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated */ |
590 | #define FLAG_IS_BUILDABLE 110 /* Can build on item */ |
579 | #define FLAG_IS_BUILDABLE 110 /* Can build on item */ |
591 | #define FLAG_DESTROY_ON_DEATH 111 /* Object will be destroyed when env dies */ |
580 | #define FLAG_DESTROY_ON_DEATH 111 /* Object will be destroyed when env dies */ |
592 | #define FLAG_NO_SAVE 112 // item doesn't get saved with map |
581 | #define FLAG_NO_MAP_SAVE 112 // item doesn't get saved with map |
593 | |
582 | |
594 | #define NUM_FLAGS 113 /* Should always be equal to the last |
583 | #define NUM_FLAGS 113 /* Should always be equal to the last |
595 | * defined flag + 1. If you change this, |
584 | * defined flag + 1. If you change this, |
596 | * make sure you update the flag_links |
585 | * make sure you update the flag_links |
597 | * in common/loader.l |
586 | * in common/loader.l |
… | |
… | |
933 | #define CAN_APPLY_UNAPPLY_CHOICE 0x40 |
922 | #define CAN_APPLY_UNAPPLY_CHOICE 0x40 |
934 | |
923 | |
935 | /* Cut off point of when an object is put on the active list or not */ |
924 | /* Cut off point of when an object is put on the active list or not */ |
936 | #define MIN_ACTIVE_SPEED 1e-5 |
925 | #define MIN_ACTIVE_SPEED 1e-5 |
937 | |
926 | |
938 | /* |
|
|
939 | * random() is much better than rand(). If you have random(), use it instead. |
|
|
940 | * You shouldn't need to change any of this |
|
|
941 | * |
|
|
942 | * 0.93.3: It looks like linux has random (previously, it was set below |
|
|
943 | * to use rand). Perhaps old version of linux lack rand? IF you run into |
|
|
944 | * problems, add || defined(__linux__) the #if immediately below. |
|
|
945 | * |
|
|
946 | * 0.94.2 - you probably shouldn't need to change any of the rand stuff |
|
|
947 | * here. |
|
|
948 | */ |
|
|
949 | |
|
|
950 | #define RANDOM() (rndm.next () & 0x7fffffffU) |
927 | #define RANDOM() (rndm.next () & 0xffffffU) |
951 | #define SRANDOM(xyz) //TODO, get rid of |
928 | #define SRANDOM(xyz) rndm.seed (xyz) //TODO, get rid of |
952 | |
929 | |
953 | /* Returns the weight of the given object. Note: it does not take the number of |
930 | /* Returns the weight of the given object. Note: it does not take the number of |
954 | * items (nrof) into account. |
931 | * items (nrof) into account. |
955 | */ |
932 | */ |
956 | #define WEIGHT(op) (op->nrof?op->weight:op->weight+op->carrying) |
933 | #define WEIGHT(op) (op->nrof?op->weight:op->weight+op->carrying) |