32 #include <sys/types.h> 45 static void permute(
int *,
int,
int);
66 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,
67 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1
72 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,
73 -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3
78 0, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45,
79 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
84 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,
85 1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8
96 active_objects = NULL;
102 objarray[0].
prev = NULL,
103 objarray[0].
next = &objarray[1],
106 for (
int i = 1; i <
STARTMAX-1; i++) {
107 objarray[i].
next = &objarray[i+1];
108 objarray[i].
prev = &objarray[i-1];
112 objarray[STARTMAX-1].
next = NULL;
113 objarray[STARTMAX-1].
prev = &objarray[STARTMAX-2];
138 for (wants_field = wants->
key_values; wants_field != NULL; wants_field = wants_field->
next) {
144 if (has_field == NULL) {
201 if (ob1 == ob2 || ob1->
type != ob2->
type)
225 if (ob1->
inv || ob2->
inv) {
259 || ((ob1->
flags[3]&~0x84) != (ob2->
flags[3]&~0x84))
345 sum += inv->carrying+inv->weight*
NROF(inv);
348 sum = (sum*(100-op->
stats.
Str))/100;
361 while (op->
env != NULL)
395 if (op->
owner == NULL)
423 if (op->
arch != NULL) {
471 for (op = objects; op != NULL; op = op->
next) {
494 for (op = objects; op != NULL; op = op->
next)
515 for (op = objects; op != NULL; op = op->
next)
516 if (op->
name == name)
535 for (op = free_objects; op != NULL; ) {
544 for (op = objects; op != NULL; ) {
569 if (op->
owner == NULL)
634 if (op->
owner != NULL)
680 if (op->
enemy == enemy) {
686 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);
725 for (i = op->
key_values; i != NULL; i = next) {
760 if (op->
name != NULL)
764 if (op->
title != NULL)
766 if (op->
race != NULL)
770 if (op->
skill != NULL)
774 if (op->
lore != NULL)
783 memset((
void *)((
char *)op+
offsetof(
object, name)), 0,
sizeof(
object)-
offsetof(
object, name));
831 if (dest_ob->
name != NULL)
837 if (dest_ob->
title != NULL)
839 if (dest_ob->
race != NULL)
843 if (dest_ob->
skill != NULL)
845 if (dest_ob->
msg != NULL)
847 if (dest_ob->
lore != NULL)
862 (void)memcpy((
void *)((
char *)dest_ob+
offsetof(
object, name)),
863 (
void *)((
char *)src_ob+
offsetof(
object, name)),
864 sizeof(
object)-
offsetof(
object, name));
872 if (dest_ob->
name != NULL)
878 if (dest_ob->
title != NULL)
880 if (dest_ob->
race != NULL)
884 if (dest_ob->
skill != NULL)
886 if (dest_ob->
lore != NULL)
888 if (dest_ob->
msg != NULL)
906 if (src_ob->
speed < 0)
919 new_link->
next = NULL;
924 new_link->
value = NULL;
931 tail->
next = new_link;
980 new[0].
next = &
new[1],
985 new[i].next = &
new[i+1],
986 new[i].prev = &
new[i-1],
990 new[OBJ_EXPAND-1].prev = &
new[OBJ_EXPAND-2],
991 new[OBJ_EXPAND-1].next = NULL,
1019 op = calloc(1,
sizeof(
object));
1023 if (free_objects == NULL) {
1033 free_objects = op->
next;
1034 if (free_objects != NULL)
1035 free_objects->
prev = NULL;
1053 if (objects != NULL)
1116 active_objects = op;
1191 int update_now = 0,
flags;
1192 MoveType move_on, move_off, move_block, move_slow;
1197 LOG(
llevDebug,
"object_update() called for NULL object.\n");
1201 if (op->
env != NULL) {
1217 LOG(
llevError,
"object_update() called for object out of map!\n");
1244 if ((move_on|op->
move_on) != move_on)
1246 if ((move_off|op->
move_off) != move_off)
1253 if ((move_slow|op->
move_slow) != move_slow)
1292 LOG(
llevError,
"object_update called with invalid action: %d\n", action);
1300 if (op->
more != NULL)
1341 LOG(
llevDebug,
"Free object called with non removed object\n");
1362 LOG(
llevError,
"Trying to free freed object.\n%s\n", diff);
1404 for (part = ob; part; part = part->
more) {
1408 partcount =
RANDOM()%partcount;
1409 for (part = ob; partcount > 0; partcount--) {
1429 if (ob->
more != NULL) {
1442 if (ob->
prev == NULL) {
1444 if (objects != NULL)
1445 objects->
prev = NULL;
1448 if (ob->
next != NULL)
1482 if (free_objects != NULL)
1483 free_objects->
prev = ob;
1552 while (op != NULL) {
1554 weight = (
signed long)(weight*(100-op->
stats.
Str)/100);
1578 object *last = NULL;
1592 LOG(
llevError,
"Trying to remove removed object.\n%s\n", diff);
1596 if (op->
more != NULL)
1606 if (op->
env != NULL) {
1626 while (above && !above->
contr)
1627 above = above->
above;
1643 if (op->
above != NULL)
1648 if (op->
below != NULL)
1671 if (op->
map == NULL)
1682 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);
1686 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);
1711 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);
1735 if (tmp->type ==
PLAYER && tmp != op) {
1740 if (tmp->container == op) {
1742 tmp->container = NULL;
1744 tmp->contr->socket.update_look = 1;
1748 && ((op->
move_type&tmp->move_off) && (op->
move_type&~tmp->move_off&~tmp->move_block) == 0)) {
1751 LOG(
llevError,
"BUG: object_remove(): name %s, archname %s destroyed leaving object\n", tmp->name, tmp->arch->name);
1756 if (tmp->above == tmp)
1794 for (top = op; top != NULL && top->
above != NULL; top = top->
above)
1842 for (tmp = op; tmp; tmp = tmp->
more) {
1885 if (op->
type == tmp->type
1886 && op->
subtype == tmp->subtype
1889 && op->
range == tmp->range
1890 && op->
stats.
wc == tmp->stats.wc
1891 && op->
level == tmp->level
1893 && op->
speed == tmp->speed
1895 && (tmp->speed_left+tmp->speed) < 0.0
1936 && op->
spell_tags[i] != tmp->spell_tags[i]) {
1944 if ((!op->
spell_tags[i] && tmp->spell_tags[i])
1945 || (op->
spell_tags[i] && !tmp->spell_tags[i])) {
1954 if (i <= SPELL_TAG_SIZE)
1965 && tmp->spell_tags[i]
1975 tmp->spell_tags = NULL;
2012 if (tmp->duration != op->
duration) {
2016 int tmp_dam = tmp->stats.dam*(tmp->duration+1)+
2036 object *floor = NULL;
2052 object *last = NULL;
2100 object *tmp, *top, *floor = NULL;
2114 LOG(
llevError,
"Trying to insert in null-map!\n%s\n", diff);
2125 LOG(
llevError,
"Trying to insert object outside the map.\n%s\n", diff);
2143 LOG(
llevError,
"Trying to insert (map) inserted object.\n%s\n", diff);
2147 if (op->
more != NULL) {
2150 object *more = op->
more;
2162 }
else if (!more->
map) {
2171 LOG(
llevError,
"BUG: object_insert_in_map(): inserting op->more killed op\n");
2229 if (originator->
map != op->
map 2230 || originator->
x != op->
x 2231 || originator->
y != op->
y) {
2232 LOG(
llevError,
"object_insert_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n");
2235 op->
above = originator;
2242 originator->
below = op;
2261 if (op->
above == NULL)
2315 for (tmp = op->
more; tmp != NULL; tmp = tmp->
more)
2337 if (!strcmp(tmp->arch->name, arch_string)) {
2374 if (
MAX(1, orig_ob->
nrof) < nr) {
2377 snprintf(err, size,
"There are only %u %ss.",
NROF(orig_ob), orig_ob->
name);
2383 if (orig_ob->
nrof == 0) {
2421 }
else if (op->
env != NULL) {
2505 }
else if (op->
env != NULL) {
2568 while (op != NULL) {
2570 weight = (
signed long)(weight*(100-op->
stats.
Str)/100);
2601 LOG(
llevError,
"Trying to insert (ob) inserted object.\n%s\n", diff);
2606 if (where == NULL) {
2613 LOG(
llevError,
"Trying to put object in NULL.\n%s\n", diff);
2618 LOG(
llevDebug,
"Warning: Tried to insert object wrong part of multipart object.\n");
2620 where =
HEAD(where);
2656 if (where->
inv == NULL)
2666 if (where->
contr != NULL)
2688 if (otmp && otmp->
contr != NULL) {
2699 LOG(
llevDebug,
" object_insert_in_ob(): got %s to insert in map/op\n", op->
name);
2737 int x = op->
x, y = op->
y;
2738 MoveType move_on, move_slow, move_block;
2764 if ((op->
move_type&~move_on&~move_block) != 0
2765 && (op->
move_type&~move_slow&~move_block) != 0)
2774 if (tmp->
above == NULL)
2820 if (op->
map != m || op->
x != x || op->
y != y)
2846 if (tmp->arch == at)
2872 if (tmp->type == type)
2892 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
2893 if (tmp->
type == type)
2927 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
2928 if ((type == -1 || tmp->
type == type) && !strcmp(str, tmp->
name))
2946 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
2947 if (tmp->
arch == at)
2963 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
2980 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3018 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3041 ix = gen->
x-sx-genx2;
3042 iy = gen->
y-sy-geny2;
3054 for (i = 0; i < (sx+sx+sy+sy); i++) {
3058 }
else if (i <= sx+sy) {
3061 }
else if (i <= sx+sy+sx) {
3062 nx = ix+sx-(i-(sx+sy));
3066 ny = iy+sy-(i-(sx+sy+sx));
3079 freecount =
RANDOM()%freecount;
3080 for (i = 0; i < sx+sx+sy+sy; i++) {
3084 }
else if (i <= sx+sy) {
3087 }
else if (i <= sx+sy+sx) {
3088 nx = ix+sx-(i-(sx+sy));
3092 ny = iy+sy-(i-(sx+sy+sx));
3104 if (freecount <= 0) {
3134 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3136 int freecount = 0, freecountstop = 0;
3144 radius = (
int8_t)strtol(value, NULL, 10);
3176 ix = gen->
x-sx-genx2-radius+1;
3177 iy = gen->
y-sy-geny2-radius+1;
3178 sx += genx+sx2+radius*2-1;
3179 sy += geny+sy2+radius*2-1;
3189 x_array = malloc(sx*sy*
sizeof(
int8_t));
3190 y_array = malloc(sx*sy*
sizeof(
int8_t));
3195 for (x = 0; x < sx; x++) {
3196 for (y = 0; y < sy; y++) {
3209 x_array[freecount] = nx;
3210 y_array[freecount] = ny;
3223 freecountstop =
RANDOM()%freecount;
3224 for (i = 0; i < freecount; i++) {
3232 if (freecountstop <= 0) {
3281 int i, index = 0, flag;
3284 for (i = start; i < stop; i++) {
3287 altern[index++] = i;
3302 return altern[
RANDOM()%index];
3339 static void permute(
int *arr,
int begin,
int end) {
3343 for (i = begin; i < end; i++) {
3399 if (exclude && exclude->
head) {
3400 exclude = exclude->
head;
3407 for (i = 1; i < max; i++) {
3418 if ((move_type&blocked) == move_type) {
3423 && (tmp != exclude || (tmp->head && tmp->head != exclude))) {
3443 i = (ob1->
x-ob2->
x)*(ob1->
x-ob2->
x)+
3444 (ob1->
y-ob2->
y)*(ob1->
y-ob2->
y);
3689 object *dst = NULL, *tmp, *src, *part, *prev;
3696 for (part = src; part; part = part->more) {
3703 tmp->carrying = tmp->arch->clone.carrying;
3739 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3740 if (tmp->
name == name_shared)
3762 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3763 if (tmp->
type == type)
3785 for (
object *tmp = who->
inv; tmp; tmp = tmp->
below)
3786 if (tmp->type == type) {
3788 for (
int i = 0; i < num_flags; ++i) {
3819 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3820 if (tmp->
type == type1 || tmp->
type == type2)
3842 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3843 if (tmp->
count == tag)
3865 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
3890 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
3891 if (tmp->
type == type && strcmp(tmp->
name, name) == 0)
3915 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
3916 if (tmp->
type == type && strcmp(tmp->
race, race) == 0)
3940 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
3965 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
3966 if (tmp->
type == type && tmp->
skill != NULL && strcmp(tmp->
skill, skill) == 0)
3988 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4011 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4034 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4035 if (strcmp(tmp->
arch->
name, name) == 0)
4059 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4060 if (tmp->
type == type && strcmp(tmp->
arch->
name, name) == 0)
4083 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4104 if (link->
key == key) {
4127 const char *canonical_key;
4131 if (canonical_key == NULL) {
4144 if (link->
key == canonical_key) {
4168 for (field = op->
key_values; field != NULL; field = field->
next) {
4169 if (field->
key != canonical_key) {
4185 field->
value = NULL;
4193 last->next = field->
next;
4249 const char *canonical_key = NULL;
4250 int floating_ref =
FALSE;
4258 if (canonical_key == NULL) {
4260 floating_ref =
TRUE;
4325 int count, retval = 0;
4329 for (cp = strtok(local_name,
","); cp; cp = strtok(NULL,
",")) {
4330 while (cp[0] ==
' ')
4335 if (!strcmp(cp,
"all"))
4341 if (!strcmp(cp,
"cursed")
4352 cp = strchr(cp,
' ');
4353 while (cp && cp[0] ==
' ')
4362 if (!cp || cp[0] ==
'\0' || count < 0)
4395 else if (strstr(bname_p, cp))
4397 else if (strstr(bname_s, cp))
4399 else if (strstr(name_short, cp))
4436 LOG(
llevError,
"object_fix_multipart: not on a map!\n");
4447 for (at = tmp->
arch->
more, last = tmp; at != NULL; at = at->
more, last = op) {
4492 int maxx = 0, maxy = 0, minx = 0, miny = 0;
4498 for (part = ob->
arch; part; part = part->
more) {
4499 if (part->
clone.
x > maxx)
4501 if (part->
clone.
y > maxy)
4503 if (part->
clone.
x < minx)
4505 if (part->
clone.
y < miny)
4560 if (op->
msg != NULL) {
4566 if (*msg !=
'\0' && strchr(msg,
'\0')[-1] !=
'\n') {
4600 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
4601 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
4602 "is_animated", NULL ,
4603 NULL ,
"monster",
"friendly",
"generator",
4604 "is_thrown",
"auto_apply",
"treasure",
"player sold",
4605 "see_invisible",
"can_roll",
"overlay_floor",
4606 "is_turnable", NULL , NULL ,
4607 NULL ,
"is_used_up",
"identified",
"reflecting",
4608 "changing",
"splitting",
"hitback",
"startequip",
4609 "blocksview",
"undead",
"scared",
"unaggressive",
4610 "reflect_missile",
"reflect_spell",
4611 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
4612 "run_away", NULL , NULL ,
4613 NULL ,
"unique",
"no_drop",
4614 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
4615 "can_use_bow",
"can_use_armour",
"can_use_weapon",
4616 "can_use_ring",
"has_ready_range",
"has_ready_bow",
4617 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
4618 "stand_still",
"random_movement",
"only_attack",
"confused",
4619 "stealth", NULL, NULL,
"cursed",
"damned",
4620 "see_anywhere",
"known_magical",
"known_cursed",
4621 "can_use_skill",
"been_applied",
4622 "has_ready_scroll", NULL, NULL,
4623 NULL,
"make_invisible",
"inv_locked",
"is_wooded",
4624 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
4625 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
4626 NULL,
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
4627 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
4628 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
4629 NULL,
"blessed",
"known_blessed" 4643 int i, all_count = 0, count;
4646 strcpy(retbuf_all,
" all");
4662 for (i =
MOVE_ALL, count = 0; i != 0; i >>= 1, count++) {
4663 if (mt&(1<<count)) {
4664 strcat(retbuf,
" ");
4667 strcat(retbuf_all,
" -");
4714 static char buf2[64];
4723 for (my_field = op->
key_values; my_field != NULL; my_field = my_field->
next) {
4728 if (arch_field == NULL || my_field->
value != arch_field->
value) {
4734 if (my_field->
value)
4843 if (op->
x != op2->
x)
4845 if (op->
y != op2->
y)
5013 for (tmp = 0; tmp <=
NUM_FLAGS; tmp++) {
5069 if (artifact == NULL) {
5122 if (fputs(cp, fp) == EOF) {
static int compare_ob_value_lists(const object *, const object *)
int object_distance(const object *ob1, const object *ob2)
object * object_find_by_type_and_name(const object *who, int type, const char *name)
int find_dir_2(int x, int y)
#define SET_MAP_OB(M, X, Y, tmp)
#define NUM_BODY_LOCATIONS
archetype * find_archetype(const char *name)
#define INS_BELOW_ORIGINATOR
#define GET_MAP_MOVE_OFF(M, X, Y)
void object_free(object *ob, int flags)
struct Statistics statistics
#define FOR_OB_AND_ABOVE_PREPARE(op_)
void esrv_send_item(object *pl, object *op)
sstring add_refcount(sstring str)
void object_clear_owner(object *op)
void object_sub_weight(object *op, signed long weight)
object * object_find_by_type_applied(const object *who, int type)
void object_free_all_data(void)
void object_copy_owner(object *op, object *clone)
object * object_find_by_type(const object *who, int type)
object * object_get_env_recursive(object *op)
void object_copy_with_inv(const object *src_ob, object *dest_ob)
sstring stringbuffer_finish_shared(StringBuffer *sb)
void fatal(enum fatal_error err)
static object * find_insert_pos(object *op, const int flag)
static void get_string_move_type(StringBuffer *sb, MoveType mt)
#define FLAG_NO_FIX_PLAYER
StringBuffer * stringbuffer_new(void)
void get_search_arr(int *search_arr)
void free_string(sstring str)
signed long object_sum_weight(object *op)
static void FAST_SAVE_LONG(StringBuffer *sb, const char *name, const long value)
void object_fix_multipart(object *tmp)
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
void esrv_update_item(int flags, object *pl, object *op)
const char * object_get_value(const object *op, const char *const key)
struct treasureliststruct * randomitems
static uint32_t NROF(const object *const ob)
void query_base_name(const object *op, int plural, char *buf, size_t size)
short freearr_x[SIZEOFFREE]
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
uint8_t duration_modifier
int object_count_active(void)
object * object_find_by_flag(const object *who, int flag)
int object_check_move_on(object *op, object *originator)
#define FREE_OBJ_NO_DESTROY_CALLBACK
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
void object_dump_all(void)
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
#define OUT_OF_REAL_MAP(M, X, Y)
#define object_was_destroyed(op, old_tag)
object * arch_present_in_ob(const archetype *at, const object *op)
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
void remove_friendly_object(object *op)
void object_update(object *op, int action)
uint32_t get_weight_limit(int stat)
int object_can_merge(object *ob1, object *ob2)
void free_dialog_information(object *op)
struct archt * other_arch
object * object_find_by_name(const object *who, const char *name)
#define FOR_OB_AND_BELOW_FINISH()
short freearr_y[SIZEOFFREE]
static const int reduction_dir[SIZEOFFREE][3]
void object_set_flag_inv(object *op, int flag)
void esrv_del_item(player *pl, object *ob)
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
void object_set_owner(object *op, object *owner)
#define SAVE_FLAG_SAVE_UNPAID
int object_set_value(object *op, const char *key, const char *value, int add_key)
void object_free_drop_inventory(object *ob)
key_value * object_get_key_value(const object *ob, const char *key)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
sstring find_string(const char *str)
void object_replace_insert_in_map(const char *arch_string, object *op)
int dirdiff(int dir1, int dir2)
void object_update_turn_face(object *op)
#define FREE_OBJ_FREE_INVENTORY
void object_dump(const object *op, StringBuffer *sb)
#define FLAG_CLIENT_ANIM_RANDOM
EXTERN archetype * empty_archetype
object * object_new(void)
#define FLAG_OBJ_ORIGINAL
void stringbuffer_append_string(StringBuffer *sb, const char *str)
object * object_find_by_tag_global(tag_t i)
#define FOR_OB_AND_ABOVE_FINISH()
int object_can_pick(const object *who, const object *item)
object * object_insert_in_ob(object *op, object *where)
const char * materialname
#define FOR_ABOVE_FINISH()
void update_all_los(const mapstruct *map, int x, int y)
void free_arch(archetype *at)
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
const char *const move_name[]
const artifact * find_artifact(const object *op, const char *name)
#define FLAG_CLIENT_ANIM_SYNC
object * object_find_by_flag_applied(const object *who, int flag)
void object_remove_from_active_list(object *op)
void update_position(mapstruct *m, int x, int y)
int object_count_free(void)
struct artifactstruct artifact
static const char *const flag_names[NUM_FLAGS+1]
static void FAST_SAVE_DOUBLE(StringBuffer *sb, const char *name, const double value)
#define FOR_ABOVE_PREPARE(op_, it_)
#define OB_SPELL_TAG_MATCH(op, count)
int save_object(FILE *fp, object *op, int flag)
object * object_present_in_ob(uint8_t type, const object *op)
#define offsetof(type, member)
#define FLAG_IS_A_TEMPLATE
void object_reset(object *op)
#define GET_MAP_TOP(M, X, Y)
object * object_create_clone(object *asrc)
#define GET_MAP_MOVE_ON(M, X, Y)
#define FLAG_OVERLAY_FLOOR
#define GET_MAP_MOVE_BLOCK(M, X, Y)
object * object_find_by_name_global(const char *str)
EXTERN Animations * animations
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
void object_clear(object *op)
#define FREE_AND_CLEAR_STR(xyz)
static void ADD_STRINGLINE_ENTRY(StringBuffer *sb, const char *name, const char *value)
object * object_find_by_type_and_race(const object *who, int type, const char *race)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
#define INS_ABOVE_FLOOR_ONLY
#define FLAG_BEEN_APPLIED
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
const Animations * animation
static object * free_objects
static void expand_objects(void)
void give_artifact_abilities(object *op, const object *artifact)
method_ret ob_move_on(object *op, object *victim, object *originator)
int strncasecmp(const char *s1, const char *s2, int n)
const char *const map_layer_name[MAP_LAYERS]
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
static const flag_definition flags[]
#define COMPARE_FLAGS(p, q)
void animate_object(object *op, int dir)
int16_t resist[NROFATTACKS]
#define FLAG_KNOWN_CURSED
object * object_find_by_tag(const object *who, tag_t tag)
#define GET_MAP_FLAGS(M, X, Y)
object * object_find_by_type_subtype(const object *who, int type, int subtype)
#define SET_MAP_FLAGS(M, X, Y, C)
int8_t body_info[NUM_BODY_LOCATIONS]
object * object_find_by_type_and_skill(const object *who, int type, const char *skill)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object * object_decrease_nrof(object *op, uint32_t i)
void save_object_in_sb(StringBuffer *sb, const object *op, const int flag)
#define GET_MAP_PLAYER(M, X, Y)
void object_set_enemy(object *op, object *enemy)
object * object_merge(object *op, object *top)
void query_short_name(const object *op, char *buf, size_t size)
object * object_get_player_container(object *op)
int out_of_map(mapstruct *m, int x, int y)
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
static object objarray[STARTMAX]
#define OB_SPELL_TAG_HASH(op, count)
int object_count_used(void)
static const object * object_get_owner_const(const object *op)
static void permute(int *, int, int)
void object_unset_flag_inv(object *op, int flag)
int object_matches_string(object *pl, object *op, const char *name)
#define FOR_OB_AND_BELOW_PREPARE(op_)
void object_merge_spell(object *op, int16_t x, int16_t y)
int map_find_dir(mapstruct *m, int x, int y, object *exclude)
sstring add_string(const char *str)
EXTERN player * first_player
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
void object_add_weight(object *op, signed long weight)
#define GET_MAP_OB(M, X, Y)
int strcasecmp(const char *s1, const char *s2)
void object_copy(const object *src_ob, object *dest_ob)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void object_set_cheat(object *op)
void LOG(LogLevel logLevel, const char *format,...)
static void object_increase_nrof(object *op, uint32_t i)
EXTERN const char *const resist_save[NROFATTACKS]
#define SET_MAP_TOP(M, X, Y, tmp)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
#define FREE_OBJ_DROP_ABOVE_FLOOR
#define GET_MAP_MOVE_SLOW(M, X, Y)
void object_set_msg(object *op, const char *msg)
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
#define FLAG_DIALOG_PARSED
void query_name(const object *op, char *buf, size_t size)
object * find_skill_by_number(object *who, int skillno)
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
void get_ob_diff(StringBuffer *sb, const object *op, const object *op2)
#define FREE_AND_CLEAR(xyz)
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
void object_free_key_values(object *op)
void fix_object(object *op)
object * arch_to_object(archetype *at)
void object_update_speed(object *op)
#define SCRIPT_FIX_NOTHING
object * object_get_owner(object *op)
char * stringbuffer_finish(StringBuffer *sb)
object * object_find_by_arch_name(const object *who, const char *name)
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
#define FOR_INV_PREPARE(op_, it_)
void object_remove(object *op)
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
static int compare_ob_value_lists_one(const object *, const object *)
object * object_find_by_type2(const object *who, int type1, int type2)
static int object_set_value_s(object *, const char *, const char *, int)