 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
32 #include <sys/types.h>
42 #ifdef CF_MXE_CROSS_COMPILE
43 # define ffs(word) (__builtin_constant_p (word) \
44 ? __builtin_ffs (word) \
45 : ({ int __cnt, __tmp; \
46 __asm__ __volatile__ \
49 : "=&r" (__cnt), "=r" (__tmp) \
50 : "rm" (word), "1" (-1)); \
56 static void permute(
int *,
int,
int);
76 "spell_small_fireball",
77 "spell_medium_fireball",
78 "spell_large_fireball",
79 "spell_burning_hands",
81 "spell_large_lightning",
82 "spell_magic_missile",
85 "spell_summon_fire_elemental",
86 "spell_summon_earth_elemental",
87 "spell_summon_water_elemental",
88 "spell_summon_air_elemental",
89 "spell_dimension_door",
90 "spell_create_earth_wall",
93 "spell_magic_mapping",
99 "spell_perceive_self",
100 "spell_word_of_recall",
102 "spell_invisible_to_undead",
104 "spell_lg_magic_bullet",
105 "spell_improved_invisibility",
107 "spell_minor_healing",
108 "spell_medium_healing",
109 "spell_major_healing",
112 "spell_earth_to_dust",
116 "spell_constitution",
118 "spell_create_fire_wall",
119 "spell_create_frost_wall",
120 "spell_protection_from_cold",
121 "spell_protection_from_electricity",
122 "spell_protection_from_fire",
123 "spell_protection_from_poison",
124 "spell_protection_from_slow",
125 "spell_protection_from_paralysis",
126 "spell_protection_from_draining",
127 "spell_protection_from_magic",
128 "spell_protection_from_attack",
130 "spell_small_speedball",
131 "spell_large_speedball",
133 "spell_dragonbreath",
134 "spell_large_icestorm",
137 "spell_cancellation",
139 "spell_mass_confusion",
140 "spell_summon_pet_monster",
142 "spell_regenerate_spellpoints",
144 "spell_protection_from_confusion",
145 "spell_protection_from_cancellation",
146 "spell_protection_from_depletion",
148 "spell_remove_curse",
149 "spell_remove_damnation",
151 "spell_detect_magic",
152 "spell_detect_monster",
154 "spell_detect_curse",
162 "spell_face_of_death",
163 "spell_ball_lightning",
164 "spell_meteor_swarm",
168 "spell_resurrection",
169 "spell_reincarnation",
179 "spell_invulnerability",
181 "spell_rune_of_fire",
182 "spell_rune_of_frost",
183 "spell_rune_of_shocking",
184 "spell_rune_of_blasting",
185 "spell_rune_of_death",
186 "spell_marking_rune",
187 "spell_build_director",
188 "spell_create_pool_of_chaos",
189 "spell_build_bullet_wall",
190 "spell_build_lightning_wall",
191 "spell_build_fireball_wall",
193 "spell_rune_of_magic_drain",
194 "spell_antimagic_rune",
195 "spell_rune_of_transference",
196 "spell_transference",
198 "spell_counterspell",
200 "spell_cure_confusion",
204 "spell_cause_light_wounds",
205 "spell_cause_medium_wounds",
206 "spell_cause_heavy_wounds",
207 "spell_charm_monsters",
209 "spell_create_missile",
210 "spell_show_invisible",
215 "spell_command_undead",
217 "spell_summon_avatar",
218 "spell_holy_possession",
221 "spell_regeneration",
223 "spell_summon_cult_monsters",
224 "spell_cause_critical_wounds",
226 "spell_retributive_strike",
227 "spell_finger_of_death",
228 "spell_insect_plague",
229 "spell_call_holy_servant",
230 "spell_wall_of_thorns",
231 "spell_staff_to_snake",
238 "spell_cure_blindness",
240 "spell_bullet_swarm",
241 "spell_bullet_storm",
242 "spell_cause_many_wounds",
243 "spell_small_snowstorm",
244 "spell_medium_snowstorm",
245 "spell_large_snowstorm",
246 "spell_cure_disease",
247 "spell_cause_red_death",
249 "spell_cause_black_death",
250 "spell_cause_leprosy",
251 "spell_cause_smallpox",
252 "spell_cause_white_death",
253 "spell_cause_anthrax",
254 "spell_cause_typhoid",
256 "spell_small_manaball",
257 "spell_medium_manaball",
258 "spell_large_manaball",
260 "spell_dancing_sword",
261 "spell_animate_weapon",
263 "spell_divine_shock",
270 "spell_forked_lightning",
272 "spell_flaming_aura",
274 "spell_vitriol_splash",
276 "spell_wrathful_eye",
278 "spell_missile_swarm",
279 "spell_cause_rabies",
300 0, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1,
301 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1
306 0, -1, -1, 0, 1, 1, 1, 0, -1, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2,
307 -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3
312 0, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45,
313 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
318 0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8,
319 1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8
340 for (
int i = 1; i <
STARTMAX-1; i++) {
372 for (wants_field = wants->
key_values; wants_field != NULL; wants_field = wants_field->
next) {
378 if (has_field == NULL) {
435 if (ob1 == ob2 || ob1->
type != ob2->
type)
459 if (ob1->
inv || ob2->
inv) {
493 || ((ob1->
flags[3]&~0x84) != (ob2->
flags[3]&~0x84))
575 sum += inv->carrying+inv->weight*
NROF(inv);
578 sum = (sum*(100-op->
stats.
Str))/100;
591 while (op->
env != NULL)
625 if (op->
owner == NULL)
653 if (op->
arch != NULL) {
780 for (op =
objects; op != NULL; ) {
805 if (op->
owner == NULL)
870 if (op->
owner != NULL)
916 if (op->
enemy == enemy) {
922 LOG(
llevDebug,
"object_set_enemy: %s(%lu)->enemy=%s(%lu)\n", op->
name, op->
count, enemy == NULL ?
"NONE" : enemy->
name, enemy == NULL ? 0 : enemy->
count);
961 for (i = op->
key_values; i != NULL; i = next) {
996 if (op->
name != NULL)
1000 if (op->
title != NULL)
1002 if (op->
race != NULL)
1006 if (op->
skill != NULL)
1008 if (op->
msg != NULL)
1010 if (op->
lore != NULL)
1068 if (dest_ob->
name != NULL)
1074 if (dest_ob->
title != NULL)
1076 if (dest_ob->
race != NULL)
1080 if (dest_ob->
skill != NULL)
1082 if (dest_ob->
msg != NULL)
1084 if (dest_ob->
lore != NULL)
1097 (void)memcpy((
void *)((
char *)dest_ob+
offsetof(
object,
name)),
1107 if (dest_ob->
name != NULL)
1113 if (dest_ob->
title != NULL)
1115 if (dest_ob->
race != NULL)
1119 if (dest_ob->
skill != NULL)
1121 if (dest_ob->
lore != NULL)
1123 if (dest_ob->
msg != NULL)
1136 if (dest_ob->
arch != NULL) {
1141 if (src_ob->
speed < 0)
1154 new_link->
next = NULL;
1159 new_link->
value = NULL;
1166 tail->
next = new_link;
1223 #ifndef MEMORY_DEBUG
1241 add[0].
next = &add[1],
1246 add[i].
next = &add[i+1],
1247 add[i].
prev = &add[i-1],
1281 op =
static_cast<object *
>(calloc(1,
sizeof(
object)));
1435 int update_now = 0,
flags;
1436 MoveType move_on, move_off, move_block, move_slow;
1441 LOG(
llevDebug,
"object_update() called for NULL object.\n");
1445 if (op->
env != NULL) {
1461 LOG(
llevError,
"object_update() called for object out of map!\n");
1488 if ((move_on|op->
move_on) != move_on)
1490 if ((move_off|op->
move_off) != move_off)
1497 if ((move_slow|op->
move_slow) != move_slow)
1536 LOG(
llevError,
"object_update called with invalid action: %d\n", action);
1544 if (op->
more != NULL)
1570 object *inv = ob->
inv;
1597 LOG(
llevError,
"Free object called with non removed object\n");
1618 LOG(
llevError,
"Trying to free freed object.\n%s\n", diff);
1659 for (part = ob; part; part = part->
more) {
1663 partcount =
RANDOM()%partcount;
1664 for (part = ob; partcount > 0; partcount--) {
1684 if (ob->
more != NULL) {
1697 if (ob->
prev == NULL) {
1703 if (ob->
next != NULL)
1808 while (op != NULL) {
1834 object *last = NULL;
1848 LOG(
llevError,
"Trying to remove removed object.\n%s\n", diff);
1852 if (op->
more != NULL)
1862 if (op->
env != NULL) {
1899 if (op->
above != NULL)
1904 if (op->
below != NULL)
1931 if (op->
map == NULL)
1942 LOG(
llevError,
"object_remove called when object was on map but appears to not be within valid coordinates? %s (%d,%d)\n", op->
map->
path, op->
x, op->
y);
1946 LOG(
llevError,
"object_remove: Object not really on map it claimed to be on? %s != %s, %d,%d != %d,%d\n", op->
map->
path,
m->path, op->
x, op->
y, x, y);
1971 LOG(
llevError,
"object_remove: GET_MAP_OB on %s does not return object to be removed even though it appears to be on the bottom?\n%s\n",
m->path, diff);
1995 if (tmp->type ==
PLAYER && tmp != op) {
2000 if (tmp->container == op) {
2002 tmp->container = NULL;
2006 tmp->contr->socket->update_look = 1;
2010 && ((op->
move_type&tmp->move_off) && (op->
move_type&~tmp->move_off&~tmp->move_block) == 0)) {
2013 LOG(
llevError,
"BUG: object_remove(): name %s, archname %s destroyed leaving object\n", tmp->name, tmp->arch->name);
2018 if (tmp->above == tmp)
2056 for (top = op; top != NULL && top->
above != NULL; top = top->
above)
2104 for (tmp = op; tmp; tmp = tmp->
more) {
2147 if (op->
type == tmp->type
2148 && op->
subtype == tmp->subtype
2151 && op->
range == tmp->range
2152 && op->
stats.
wc == tmp->stats.wc
2153 && op->
level == tmp->level
2155 && op->
speed == tmp->speed
2157 && (tmp->speed_left+tmp->speed) < 0.0
2198 && op->
spell_tags[i] != tmp->spell_tags[i]) {
2206 if ((!op->
spell_tags[i] && tmp->spell_tags[i])
2207 || (op->
spell_tags[i] && !tmp->spell_tags[i])) {
2227 && tmp->spell_tags[i]
2237 tmp->spell_tags = NULL;
2274 if (tmp->duration != op->
duration) {
2278 int tmp_dam = tmp->stats.dam*(tmp->duration+1)+
2298 object *
floor = NULL;
2314 object *last = NULL;
2362 object *tmp, *top, *
floor = NULL;
2376 LOG(
llevError,
"Trying to insert in null-map!\n%s\n", diff);
2387 LOG(
llevError,
"Trying to insert object outside the map.\n%s\n", diff);
2405 LOG(
llevError,
"Trying to insert (map) inserted object.\n%s\n", diff);
2409 if (op->
more != NULL) {
2412 object *more = op->
more;
2424 }
else if (!more->
map) {
2433 LOG(
llevError,
"BUG: object_insert_in_map(): inserting op->more killed op\n");
2445 if (op->
map == NULL) {
2456 op->
nrof += spot->nrof;
2495 if (originator->
map != op->
map
2496 || originator->
x != op->
x
2497 || originator->
y != op->
y) {
2498 LOG(
llevError,
"object_insert_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n");
2501 op->
above = originator;
2508 originator->
below = op;
2527 if (op->
above == NULL)
2581 for (tmp = op->
more; tmp != NULL; tmp = tmp->
more)
2603 if (!strcmp(tmp->arch->name, arch_string)) {
2637 object *
object_split(
object *orig_ob, uint32_t nr,
char *err,
size_t size) {
2640 if (
MAX(1, orig_ob->
nrof) < nr) {
2643 snprintf(err, size,
"There are only %u %ss.",
NROF(orig_ob), orig_ob->
name);
2649 if (orig_ob->
nrof == 0) {
2687 }
else if (op->
env != NULL) {
2735 pl->contr->socket->update_look = 1;
2771 }
else if (op->
env != NULL) {
2812 pl->contr->socket->update_look = 1;
2834 while (op != NULL) {
2867 LOG(
llevError,
"Trying to insert (ob) inserted object.\n%s\n", diff);
2872 if (where == NULL) {
2879 LOG(
llevError,
"Trying to put object in NULL.\n%s\n", diff);
2884 LOG(
llevDebug,
"Warning: Tried to insert object wrong part of multipart object.\n");
2886 where =
HEAD(where);
2931 if (where->
inv == NULL)
2945 if (where->
contr != NULL)
2967 if (otmp && otmp->
contr != NULL) {
2978 LOG(
llevDebug,
" object_insert_in_ob(): got %s to insert in map/op\n", op->
name);
3016 int x = op->
x, y = op->
y;
3017 MoveType move_on, move_slow, move_block;
3043 if ((op->
move_type&~move_on&~move_block) != 0
3044 && (op->
move_type&~move_slow&~move_block) != 0)
3053 if (tmp->
above == NULL)
3099 if (op->
map !=
m || op->
x != x || op->
y != y)
3125 if (tmp->arch == at)
3151 if (tmp->type ==
type)
3171 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
3206 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3225 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
3226 if (tmp->
arch == at)
3242 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3259 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3297 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3320 ix = gen->
x-sx-genx2;
3321 iy = gen->
y-sy-geny2;
3333 for (i = 0; i < (sx+sx+sy+sy); i++) {
3337 }
else if (i <= sx+sy) {
3340 }
else if (i <= sx+sy+sx) {
3341 nx = ix+sx-(i-(sx+sy));
3345 ny = iy+sy-(i-(sx+sy+sx));
3358 freecount =
RANDOM()%freecount;
3359 for (i = 0; i < sx+sx+sy+sy; i++) {
3363 }
else if (i <= sx+sy) {
3366 }
else if (i <= sx+sy+sx) {
3367 nx = ix+sx-(i-(sx+sy));
3371 ny = iy+sy-(i-(sx+sy+sx));
3383 if (freecount <= 0) {
3413 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3414 int8_t x, y, radius;
3415 int freecount = 0, freecountstop = 0;
3423 radius = (int8_t)strtol(value, NULL, 10);
3455 ix = gen->
x-sx-genx2-radius+1;
3456 iy = gen->
y-sy-geny2-radius+1;
3457 sx += genx+sx2+radius*2-1;
3458 sy += geny+sy2+radius*2-1;
3468 x_array =
static_cast<int8_t *
>(malloc(sx*sy*
sizeof(int8_t)));
3469 y_array =
static_cast<int8_t *
>(malloc(sx*sy*
sizeof(int8_t)));
3474 for (x = 0; x < sx; x++) {
3475 for (y = 0; y < sy; y++) {
3488 x_array[freecount] = nx;
3489 y_array[freecount] = ny;
3502 freecountstop =
RANDOM()%freecount;
3503 for (i = 0; i < freecount; i++) {
3511 if (freecountstop <= 0) {
3560 int i, index = 0, flag;
3563 for (i = start; i < stop; i++) {
3566 altern[index++] = i;
3581 return altern[
RANDOM()%index];
3618 static void permute(
int *arr,
int begin,
int end) {
3622 for (i = begin; i < end; i++) {
3664 i = (ob1->
x-ob2->
x)*(ob1->
x-ob2->
x)+
3665 (ob1->
y-ob2->
y)*(ob1->
y-ob2->
y);
3910 object *dst = NULL, *tmp, *src, *part, *prev;
3917 for (part = src; part; part = part->more) {
3924 tmp->carrying = tmp->arch->clone.carrying;
3960 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3961 if (tmp->
name == name_shared)
3983 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4006 for (
object *tmp = who->
inv; tmp; tmp = tmp->
below)
4007 if (tmp->type ==
type) {
4009 for (
int i = 0; i < num_flags; ++i) {
4040 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4041 if (tmp->
type == type1 || tmp->
type == type2)
4063 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4064 if (tmp->
count == tag)
4086 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4111 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4136 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4161 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4186 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4209 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4232 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4255 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4280 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4304 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4325 if (link->
key == key) {
4348 const char *canonical_key;
4352 if (canonical_key == NULL) {
4365 if (link->
key == canonical_key) {
4378 if (ret == NULL || (strcmp(ret,
"") == 0) || (strcmp(ret,
"0") == 0)) {
4392 if (link->key == key) {
4393 if ((strcmp(link->value,
"") == 0) || (strcmp(link->value,
"0") == 0)) {
4419 for (field = op->
key_values; field != NULL; field = field->
next) {
4420 if (field->
key != canonical_key) {
4436 field->
value = NULL;
4444 last->next = field->
next;
4500 const char *canonical_key = NULL;
4501 int floating_ref =
FALSE;
4509 if (canonical_key == NULL) {
4511 floating_ref =
TRUE;
4576 int count, retval = 0;
4581 for (cp = strtok(local_name,
","); cp; cp = strtok(NULL,
",")) {
4582 while (cp[0] ==
' ')
4587 if (!strcmp(cp,
"all"))
4593 if (!strcmp(cp,
"cursed")
4603 if (*cp ==
'+' || *cp ==
'-')
4606 cp = strchr(cp,
' ');
4607 while (cp && cp[0] ==
' ')
4616 if (!cp || cp[0] ==
'\0' || count < 0)
4638 else if (custom_name && !
strcasecmp(cp, custom_name))
4640 else if (!strncasecmp(cp, bname_s, strlen(cp)))
4642 else if (!strncasecmp(cp, bname_p, strlen(cp)))
4649 else if (strstr(bname_p, cp))
4651 else if (strstr(bname_s, cp))
4653 else if (strstr(name_short, cp))
4665 else if (custom_name && strstr(custom_name, cp))
4690 LOG(
llevError,
"object_fix_multipart: not on a map!\n");
4701 for (at = tmp->
arch->
more, last = tmp; at != NULL; at = at->
more, last = op) {
4746 int maxx = 0, maxy = 0, minx = 0, miny = 0;
4752 for (part = ob->
arch; part; part = part->
more) {
4753 if (part->
clone.
x > maxx)
4755 if (part->
clone.
y > maxy)
4757 if (part->
clone.
x < minx)
4759 if (part->
clone.
y < miny)
4812 if (op->
msg != NULL) {
4818 if (*msg !=
'\0' && strchr(msg,
'\0')[-1] !=
'\n') {
4852 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
4853 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
4854 "is_animated", NULL ,
4855 NULL ,
"monster",
"friendly",
"generator",
4856 "is_thrown",
"auto_apply",
"treasure",
"player sold",
4857 "see_invisible",
"can_roll",
"overlay_floor",
4858 "is_turnable", NULL , NULL ,
4859 NULL ,
"is_used_up",
"identified",
"reflecting",
4860 "changing",
"splitting",
"hitback",
"startequip",
4861 "blocksview",
"undead",
"scared",
"unaggressive",
4862 "reflect_missile",
"reflect_spell",
4863 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
4864 "run_away", NULL , NULL ,
4865 NULL ,
"unique",
"no_drop",
4866 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
4867 "can_use_bow",
"can_use_armour",
"can_use_weapon",
4868 "can_use_ring",
"has_ready_range",
"has_ready_bow",
4869 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
4870 "stand_still",
"random_movement",
"only_attack",
"confused",
4871 "stealth", NULL, NULL,
"cursed",
"damned",
4872 "see_anywhere",
"known_magical",
"known_cursed",
4873 "can_use_skill",
"been_applied",
4874 "has_ready_scroll", NULL, NULL,
4875 NULL,
"make_invisible",
"inv_locked",
"is_wooded",
4876 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
4877 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
4878 NULL,
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
4879 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
4880 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
4881 NULL,
"blessed",
"known_blessed"
4895 int i, all_count = 0, count;
4898 strcpy(retbuf_all,
" all");
4914 for (i =
MOVE_ALL, count = 0; i != 0; i >>= 1, count++) {
4915 if (mt&(1<<count)) {
4916 strcat(retbuf,
" ");
4919 strcat(retbuf_all,
" -");
4961 for (
int i = 0; i < 4; i++) {
4962 int idx = ffs((*diff)[i]);
4966 (*diff)[i] &= ~(1 << bit);
4987 static char buf2[64];
4996 for (my_field = op->
key_values; my_field != NULL; my_field = my_field->
next) {
5001 if (arch_field == NULL || my_field->
value != arch_field->
value) {
5007 if (my_field->
value)
5113 if (op->
x != op2->
x)
5115 if (op->
y != op2->
y)
5343 LOG(
llevError,
"could not find original archetype %s for custom monster!\n", at->
name);
5401 if (fputs(cp, fp) == EOF) {
5413 if (death_animation != NULL) {
5416 if (death != NULL) {
5433 if (force == NULL) {
5439 if (duration != 0) {
5440 force->
speed = 0.01;
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
uint8_t casting_time
It takes awhile to cast a spell.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
static object * free_objects
Pointer to the list of unused objects.
sstring name
Face name, as used by archetypes and such.
sstring name_pl
The plural name of the object.
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
void init_objects(void)
Sets up and initialises the linked list of free and used objects.
#define UP_OBJ_FACE
Only thing that changed was the face.
float weapon_speed_left
How much speed is left to spend this round.
static const object * object_get_owner_const(const object *op)
Returns the object which this object marks as being the owner, constant version.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
player * next
Pointer to next player, NULL if this is last.
#define FREE_AND_CLEAR_STR_IF(xyz)
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
void object_clear_owner(object *op)
Clears the owner of specified object.
player * first_player
First player.
struct Settings settings
Server settings.
uint8_t range_modifier
How going up in level affects range
int32_t move_status
What stage in attack mode.
object * object_get_env_recursive(object *op)
Utility function.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
#define UP_OBJ_REMOVE
Object was removed.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
object * owner
Pointer to the object which controls this one.
int16_t maxhp
Max hit points.
int object_count_active(void)
Objects statistics.
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
#define NUM_BODY_LOCATIONS
Number of body locations.
#define MAP_SAVING
Map being saved.
uint32_t weapontype
Type of weapon.
uint8_t map_layer
What level to draw this on the map.
const artifact * find_artifact(const object *op, const char *name)
Searches and returns a specific artifact compatible with an object, NULL if not found.
#define GET_MAP_TOP(M, X, Y)
Gets the top object on a map.
struct Statistics statistics
Merged spell statistics.
@ llevError
Error, serious thing.
void object_set_flag_inv(object *op, int flag)
Activate recursively a flag on an object's inventory.
#define FABS(x)
Decstations have trouble with fabs()...
#define FLAG_CLIENT_ANIM_RANDOM
Client animate this, randomized.
@ EVENT_CONNECTOR
Lauwenmark: an invisible object holding a plugin event hook.
object * find_skill_by_number(object *who, int skillno)
This returns the first skill pointer of the given subtype (the one that accumulates exp,...
#define MOVE_ALL
Mask of all movement types.
uint32_t path_attuned
Paths the object is attuned to.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
static void ADD_STRINGLINE_ENTRY(StringBuffer *sb, const char *name, const char *value)
Adds a line to the buffer.
#define FLAG_OVERLAY_FLOOR
Object is an overlay floor.
archetype * more
Next part of a linked object.
uint16_t client_type
Public type information.
void object_free_all_data(void)
Destroys all allocated objects.
object * inv
Pointer to the first object in the inventory.
#define FLAG_STARTEQUIP
Object was given to player at start.
uint64_t spell_merges
Number of spell merges done.
#define QUERY_FLAG(xyz, p)
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Searches for any objects with a matching archetype at the given map and coordinates.
#define FLAG_IS_TURNABLE
Object can change face with direction.
tag_t ownercount
What count the owner had (in case owner has been freed)
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
#define STARTMAX
How big array of objects to start with.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
void update_position(mapstruct *m, int x, int y)
This function updates various attributes about a specific space on the map (what it looks like,...
#define BITMASK_EVENT(evt)
Convert an event to its bit.
#define SET_MAP_TOP(M, X, Y, tmp)
Sets the top object on a map.
int8_t item_power
Power rating of the object.
struct archetype * arch
Pointer to archetype.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
int16_t players
How many players are on this level right now.
uint16_t attack_movement
What kind of attack movement.
int absdir(int d)
Computes an absolute direction.
static const char *const flag_names[NUM_FLAGS+1]
This is a list of pointers that correspond to the FLAG_.
int8_t range
Range of the spell.
float speed
Frequency of object 'moves' relative to server tick rate.
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
Inserts an object into its map.
int16_t invisible
How much longer the object will be invis.
#define FLAG_OBJ_ORIGINAL
NEVER SET THIS.
#define OB_SPELL_TAG_MATCH(op, count)
Check whether a tag matches in the tags.
object * ob
The object representing the player.
void object_dump_all(void)
Dumps all objects to console.
object * transport
Transport the player is in.
float speed_left
How much speed is left to spend this round.
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
uint8_t pick_up
See crossfire.doc.
struct mapstruct * map
Pointer to the map in which this object is present.
sstring anim_suffix
Used to determine combined animations.
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(),...
unsigned char MoveType
Typdef here to define type large enough to hold bitmask of all movement types.
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
double expmul
needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain level...
void object_handle_death_animation(object *op)
object * item
Special values of the artifact.
#define NUM_FLAGS
Should always be equal to the last defined flag.
#define GET_MAP_MOVE_SLOW(M, X, Y)
Gets the slowing state of a square.
void object_reset(object *op)
Totally resets the specified object, without freeing associated memory.
@ SKILL
Also see SKILL_TOOL (74) below.
int8_t direction
Means the object is moving that way.
static const flag_definition flags[]
Flag mapping.
tag_t count
Unique object number for this object.
int16_t last_grace
As last_sp, except for grace.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
uint8_t smoothlevel
how to smooth this square around
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
object * object_find_by_flag_applied(const object *who, int flag)
Find applied object in inventory by flag.
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator,...
object * object_find_by_type_and_skill(const object *who, int type, const char *skill)
Find object in inventory by type and skill.
#define GET_MAP_PLAYER(M, X, Y)
#define FLAG_NO_MAGIC
Spells (some) can't pass this object.
const Face * blank_face
Following can just as easily be pointers, but it is easier to keep them like this.
#define P_NO_MAGIC
Spells (some) can't pass this object.
@ llevMonster
Many many details.
int flags_differ(ob_flags *diff)
Return the index of the first difference in the given object flag difference set (computed by compare...
@ TRANSPORT
see doc/Developers/objects
uint32_t hidden
If True, player (DM) is hidden from view.
#define FOR_ABOVE_PREPARE(op_, it_)
Constructs a loop iterating over all objects above an object.
void object_copy_with_inv(const object *src_ob, object *dest_ob, bool update_speed)
Copy an object with an inventory, duplicate the inv too.
object * enemy
Monster/player to follow even if not closest.
key_value * key_values
Fields not explictly known by the loader.
void stringbuffer_append_char(StringBuffer *sb, const char c)
Append a character to a string buffer instance.
#define FLAG_BLOCKSVIEW
Object blocks view.
void free_arch(archetype *at)
Frees archetype.
sstring title
Of foo, etc.
#define MAP_DARKNESS(m)
Map darkness level (0-MAX_DARKNESS)
#define FLAG_INV_LOCKED
Item will not be dropped from inventory.
#define FOR_OB_AND_ABOVE_FINISH()
Finishes FOR_OB_AND_ABOVE_PREPARE().
object * object_find_by_tag_global(tag_t i)
Returns the object which has the count-variable equal to the argument.
char path[HUGE_BUF]
Filename of the map.
const char * object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define P_IS_ALIVE
Something alive is on this space.
uint64_t spell_hash_full
Number of times spell hash was full.
#define FLAG_APPLIED
Object is ready for use by living.
int16_t level
Level of creature or object.
static void expand_objects(void)
Allocates more objects for the list of unused objects.
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
void object_merge_spell(object *op, int16_t x, int16_t y)
This sees if there are any objects on the space that can merge with op.
object * active_objects
List of active objects that need to be processed.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
uint8_t will_apply
See crossfire.doc and What monsters apply.
object * above
Pointer to the object stacked above this one.
#define HUGE_BUF
Used for messages - some can be quite long.
static void FAST_SAVE_DOUBLE(StringBuffer *sb, const char *name, const double value)
Adds a double to the buffer.
void stringbuffer_append_int64(StringBuffer *sb, int64_t x)
Append a signed integer to a string buffer instance.
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
#define SAVE_ERROR_WRITE
Write error.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_NO_PICK
Object can't be picked up.
static int object_set_value_s(object *, const char *, const char *, int)
Updates or sets a key value.
Plugin animator file specs[Config] name
#define FLAG_DIALOG_PARSED
Was the object::msg field parsed? Temporary flag not saved.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
#define FLAG_ALIVE
Object can fight (or be fought)
uint32_t path_denied
Paths the object is denied access to.
void object_clear(object *op)
Frees everything allocated by an object, and also clears all variables and flags to default settings.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
uint32_t update_look
If true, we need to send the look window.
#define INS_ABOVE_FLOOR_ONLY
Put object immediatly above the floor.
const char * value
Key's value.
#define FOR_OB_AND_ABOVE_PREPARE(op_)
Constructs a loop iterating over an object and all objects above it in the same pile.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
int32_t carrying
How much weight this object contains.
#define LOOK_OBJ(ob)
This returns TRUE if the object is something that should be displayed in the look window.
uint32_t path_repelled
Paths the object is repelled from.
int16_t y
Position in the map for this object.
object * object_find_by_type_and_race(const object *who, int type, const char *race)
Find object in inventory by type and race.
static event_registration m
#define MAP_IN_MEMORY
Map is fully loaded.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
#define OBJ_EXPAND
How big steps to use when expanding array.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
void object_update(object *op, int action)
object_update() updates the array which represents the map.
struct player * contr
Pointer to the player which control this object.
static uint32_t NROF(const object *const ob)
Returns ob->nrof, unless it is 0, in which case return 1.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
key_value * object_get_key_value(const object *ob, const char *key)
Search for a field by key.
int32_t last_heal
Last healed.
object * object_find_by_type2(const object *who, int type1, int type2)
Find object in inventory.
uint8_t subtype
Subtype of object.
#define FLAG_WAS_WIZ
Player was once a wiz.
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
bool object_value_set_shared(const object *op, sstring key)
Determine if an extra value is set to a non empty or 0 value.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
key_value * next
Next key in the list.
#define P_NO_ERROR
Purely temporary - if set, update_position does not complain if the flags are different.
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Searches for any objects with a matching type variable at the given map and coordinates.
float weapon_speed
The overall speed of this object.
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
Recursive routine to see if we can find a path to a certain point.
#define MOVE_WALK
Object walks.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
object * prev
Pointer to the previous object in the free/used list.
sstring stringbuffer_finish_shared(StringBuffer *sb)
Deallocate the string buffer instance and return the string as a shared string.
#define FOR_ABOVE_FINISH()
Finishes FOR_ABOVE_PREPARE().
object clone
An object from which to do object_copy()
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
void object_dump(const object *op, StringBuffer *sb)
Dumps an object.
int32_t weight_limit
Weight-limit of object.
sstring add_string(const char *str)
This will add 'str' to the hash table.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters speed
sstring name
Usually monster-name/combination.
int object_count_free(void)
Objects statistics.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
#define HEAD(op)
Returns the head part of an object.
object * below
Pointer to the object stacked below this one.
int16_t casting_time
Time left before spell goes off.
MoveType move_type
Type of movement this object uses.
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
#define FLAG_FREED
Object is in the list of free objects.
uint64_t event_bitmask
Bitmask of events this object has a handler for, see events.h.
const Face * face
Face with colors.
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
sstring find_string(const char *str)
Searches a string in the shared strings.
int32_t last_eat
How long since we last ate.
int32_t value
How much money it is worth (or contains)
void object_update_speed(object *op)
Updates the speed of an object.
#define FLAG_IS_WOODED
Item is wooded terrain.
uint8_t type
PLAYER, BULLET, etc.
#define INS_NO_MERGE
Don't try to merge with other items.
#define FLAG_DAMNED
The object is very cursed.
int16_t dam
How much damage this object does when hitting.
int8_t magic
Any magical bonuses to this item.
#define SET_MAP_FLAGS(M, X, Y, C)
Sets map flags.
object * active_prev
Previous object in the 'active list This is used in process_events so that the entire object list doe...
sstring materialname
Specific material name.
object * object_find_by_tag(const object *who, tag_t tag)
Find object in inventory.
#define FLAG_WIZPASS
The wizard can go through walls.
object * object_find_by_flag(const object *who, int flag)
Find object in inventory by flag.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
MoveType move_on
Move types affected moving on to this space.
int32_t food
How much food in stomach.
const char *const resist_save[NROFATTACKS]
Attack types.
uint32_t tag_t
Object tag, unique during the whole game.
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
The ordering of this is actually doesn't make a difference However, for ease of use,...
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
#define P_PLAYER
There is a player on this space.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
#define FLAG_NO_DROP
Object can't be dropped.
#define FLAG_NO_SAVE
If set (through plugins), the object is not saved on maps.
int nrofallocobjects
How many OBs allocated (free + used)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coor...
#define FLAG_NO_STEAL
Item can't be stolen.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
uint8_t sound_chance
Probability, 1 to 100, of the object emitting a sound.
sstring race
Human, goblin, dragon, etc.
static void compare_flags(ob_flags *ret, const object *p, const object *q)
const Animations * animation
Animation of this item, NULL if not animated.
#define GET_MAP_MOVE_ON(M, X, Y)
Gets the move_on state of a square.
#define FREE_OBJ_DROP_ABOVE_FLOOR
If FREE_OBJ_FREE_INVENTORY is not set, drop inventory just above ground instead on top.
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
Returns true if the given object can't fit in the given spot.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be and may attack the nearest of your enemies Others can be in that they follow you around and help you in your quest to kill enemies and find treasure SPECIAL ITEMS There are many special items which can be found in of these the most important may be the signs all a player must do is apply the handle In the case of the player must move items over the button to hold it down Some of the larger buttons may need very large items to be moved onto before they can be activated Gates and locked but be for you could fall down into a pit full of ghosts or dragons and not be able to get back out Break away sometimes it may be worth a player s time to test the walls of a map for secret doors Fire such as missile weapons and spells you will notice them going up in smoke ! So be careful not to destroy valuable items Spellbooks sometimes a player can learn the other times they cannot There are many different types of books and scrolls out there Improve item have lower weight
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
Find an object in inventory that does not have any of the provided flags set.
static const int reduction_dir[SIZEOFFREE][3]
Basically, this is a table of directions, and what directions one could go to go back to us.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the artifact
object * object_create_clone(object *asrc)
Create clone from object to another.
void object_copy_no_speed(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
#define MAP_WIDTH(m)
Map width.
#define P_OUT_OF_MAP
This space is outside the map.
#define MAX_BUF
Used for all kinds of things.
#define INS_ON_TOP
Always put object on top.
const char *const move_name[]
Maps the MOVE_* values to names.
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for d
void object_set_cheat(object *op)
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recur...
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
This function inserts the object in the two-way linked list which represents what is on a map.
void esrv_del_item(player *pl, object *ob)
Tells the client to delete an item.
#define UP_OBJ_INSERT
Object was inserted.
object * head
Points to the main object of a large body.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
object * object_present_in_ob(uint8_t type, const object *op)
Searches for any objects with a matching type variable in the inventory of the given object.
uint32_t get_weight_limit(int stat)
int32_t weight
Attributes of the object.
int nroffreeobjects
How many OBs allocated and free (free)
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
MoveType move_slow
Movement types this slows down.
tag_t * spell_tags
Tags used for spell effect merging.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define offsetof(type, member)
The offsetof macro is part of ANSI C, but many compilers lack it, for example "gcc -ansi".
float move_slow_penalty
How much this slows down the object.
A buffer that will be expanded as content is added to it.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
#define MOVE_FLY_LOW
Low flying object.
int16_t maxgrace
Maximum grace.
#define FLAG_CLIENT_ANIM_SYNC
Let client animate this, synchronized.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
void get_search_arr(int *search_arr)
New function to make monster searching more efficient, and effective! This basically returns a random...
int find_dir_2(int x, int y)
Computes a direction which you should travel to move of x and y.
const char * key
Name of the key.
void object_add_weight(object *op, signed long weight)
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much t...
Magical Runes Runes are magical inscriptions on the dungeon which cast a spell or detonate when something steps on them Flying objects don t detonate runes Beware ! Runes are invisible most of the time They are only visible occasionally ! There are several runes which are there are some special runes which may only be called with the invoke and people may apply it to read it Maybe useful for mazes ! This rune will not nor is it ordinarily invisible Partial Visibility of they ll be visible only part of the time They have so the higher your the better hidden the runes you make are Examples of whichever way you re facing invoke magic rune transfer as above
#define FLAG_REMOVED
Object is not in any map or invenory.
object * object_decrease_nrof(object *op, uint32_t i)
Decreases a specified number from the amount of an object.
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
Find object in inventory by type and slaying.
#define INS_MAP_LOAD
Disable lots of checkings.
#define BITMASK_VALID
Bit indicating if the event bitmask is valid or not.
sstring lore
Obscure information about this object, to get put into books and the like.
uint8_t dam_modifier
How going up in level affects damage.
sstring slaying
Which race to do double damage to.
int8_t glow_radius
indicates the glow radius of the object
#define FLAG_FRIENDLY
Will help players.
uint8_t duration_modifier
how level modifies duration
sstring name
The name of the object, obviously...
int object_count_used(void)
Object statistics.
#define FREE_AND_CLEAR(xyz)
Free the pointer and then set it to NULL.
object * object_find_by_arch_name(const object *who, const char *name)
Find object in inventory by archetype name.
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
#define SCRIPT_FIX_NOTHING
static object objarray[STARTMAX]
All objects, allocated this way at first.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
sstring artifact
If set, the item is the artifact with this name and the matching type.
object * object_find_by_type(const object *who, int type)
Find object in inventory.
int16_t maxsp
Max spell points.
#define P_NEED_UPDATE
This space is out of date.
object * object_find_by_name_global(const char *str)
Finds an object by name.
object * env
Pointer to the object which is the environment.
static int compare_ob_value_lists(const object *, const object *)
Compares two object lists.
int32_t last_sp
As last_heal, but for spell points.
const typedef char * sstring
Magical Runes Runes are magical inscriptions on the dungeon floor
static void get_string_move_type(StringBuffer *sb, MoveType mt)
This returns a string of the integer movement type.
int8_t gen_sp_armour
Sp regen penalty this object has (was last_heal)
static void permute(int *, int, int)
Randomly permutes an array.
sstring skill
Name of the skill this object uses/grants.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
archetype * find_archetype(const char *name)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
tag_t attacked_by_count
The tag of attacker, so we can be sure.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
sstring msg
If this is a book/sign/magic mouth/etc.
const char *const spell_mapping[SPELL_MAPPINGS]
This table is only necessary to convert objects that existed before the spell object conversion to th...
object * objects
Pointer to the list of used objects.
int reference_count
How many times this temporary archetype is used.
#define FLAG_NO_FIX_PLAYER
fix_object() won't be called
void object_unset_flag_inv(object *op, int flag)
Desactivate recursively a flag on an object inventory.
void object_free_key_values(object *op)
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
object * add_force(object *op, const char *name, int duration)
Add or return an existing force inside 'op' with the given 'name' and 'duration' in units of 100 tick...
#define FLAG_BEEN_APPLIED
The object has been applied.
#define CLEAR_FLAG(xyz, p)
#define SET_MAP_OB(M, X, Y, tmp)
Sets the bottom object on a map.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define MAP_HEIGHT(m)
Map height.
void save_object_in_sb(StringBuffer *sb, object *op, const int flag)
Store a string representation of op in sb.
void get_ob_diff(StringBuffer *sb, const object *op, const object *op2)
Returns a pointer to a static string which contains all variables which are different in the two give...
object * attacked_by
This object start to attack us! only player & monster.
int16_t duration
Number of moves (see 'speed') spell lasts.
void object_remove_from_active_list(object *op)
This function removes object 'op' from the list of active objects.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
uint32_t count
Any numbers typed before a command.
static object * find_insert_pos(object *op, const int flag)
int strcasecmp(const char *s1, const char *s2)
ob_flags flags
Various flags.
int object_distance(const object *ob1, const object *ob2)
Return the square of the distance between the two given objects.
object * find_force(object *op, const char *name)
Find a force with the given 'name' in the slaying field.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
#define FLAG_ANIMATE
The object looks at archetype for faces.
#define SAVE_ERROR_OK
No error.
void object_fix_multipart(object *tmp)
Ensures specified object has its more parts correctly inserted in map.
struct treasurelist * randomitems
Items to be generated.
#define GET_MAP_MOVE_OFF(M, X, Y)
Gets the move_off state of a square.
object * container
Current container being used.
#define FLAG_IS_HILLY
Item is hilly/mountain terrain.
#define MOVE_FLY_HIGH
High flying object.
object * active_next
Next object in the 'active' list This is used in process_events so that the entire object list does n...
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define UP_OBJ_CHANGE
Object changed.
#define GET_MAP_FLAGS(M, X, Y)
Gets map flags.
MoveType move_off
Move types affected moving off this space.
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
#define FLAG_UNPAID
Object hasn't been paid for yet.
archetype * empty_archetype
Nice to have fast access to it.
int freedir[SIZEOFFREE]
Direction we're pointing on this spot.
#define P_NO_CLERIC
No clerical spells cast here.
int object_check_move_on(object *op, object *originator)
Checks if any objects has a move_type that matches objects that effect this object on this space.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
uint8_t state
How the object was last drawn (animation)
void object_copy_owner(object *op, object *clone)
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (t...
sstring name
More definite name, like "generate_kobold".
#define FLAG_IS_LINKED
The object is linked with other objects.
uint32_t nrof
Number of objects.
socket_struct * socket
Socket information for this player.
static void object_increase_nrof(object *op, uint32_t i)
Increase the count of an object.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
living stats
Str, Con, Dex, etc.
MoveType move_allow
What movement types explicitly allowed.
This is one artifact, ie one special item.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
object * more
Pointer to the rest of a large body of objects.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
int64_t total_exp
All exp ever earned (used to calc perm_exp)
void object_sub_weight(object *op, signed long weight)
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's e...
#define EVENT_DESTROY
Object destroyed (includes map reset/swapout)
static int compare_ob_value_lists_one(const object *, const object *)
Compares value lists.
#define SPELL_TAG_SIZE
Defines default size of the *spell_tags pointer.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_CURSED
The object is cursed.
int maxfree[SIZEOFFREE]
Number of spots around a location, including that location (except for 0)
#define SAVE_FLAG_SAVE_UNPAID
If set, unpaid items will be saved.
int save_object(FILE *fp, object *op, int flag)
Dumps all variables in an object to a file.
object * object_get_player_container(object *op)
Finds the player carrying an object.
int dirdiff(int dir1, int dir2)
Computes a direction difference.
#define OB_SPELL_TAG_HASH(op, count)
Get the hash on an object for a specified count.
uint16_t material
What materials this object consist of.
const char *const map_layer_name[MAP_LAYERS]
These correspond to the layer names in map.h - since some of the types can be on multiple layers,...
#define CUSTOM_NAME_FIELD
Key in an object for the player-assigned custom name.
void object_free_inventory(object *ob)
Frees the inventory of an object, without any callback.
MoveType move_block
What movement types this blocks.
object * next
Pointer to the next object in the free/used list.
void free_dialog_information(object *op)
Frees obj::dialog_information.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
#define FLAG_NO_APPLY
Avoids step_on/fly_on to this object.
int8_t luck
Affects thaco and ac from time to time.
int16_t oy
For debugging: Where it was last inserted.
sstring name
Name of the animation sequence.
void object_replace_insert_in_map(const char *arch_string, object *op)
This function inserts an object of a specified archetype in the map, but if it finds objects of its o...
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together,...
@ llevDebug
Only for debugging purposes.
#define P_BLOCKSVIEW
This spot blocks the player's view.
static void FAST_SAVE_LONG(StringBuffer *sb, const char *name, const long value)
Adds a long to the buffer.
#define FLAG_IDENTIFIED
Player knows full info about item.