 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
34 #include <sys/types.h>
44 #if defined(CF_MXE_CROSS_COMPILE) || defined(WIN32)
45 # define ffs(word) (__builtin_constant_p (word) \
46 ? __builtin_ffs (word) \
47 : ({ int __cnt, __tmp; \
48 __asm__ __volatile__ \
51 : "=&r" (__cnt), "=r" (__tmp) \
52 : "rm" (word), "1" (-1)); \
58 static void permute(
int *,
int,
int);
78 "spell_small_fireball",
79 "spell_medium_fireball",
80 "spell_large_fireball",
81 "spell_burning_hands",
83 "spell_large_lightning",
84 "spell_magic_missile",
87 "spell_summon_fire_elemental",
88 "spell_summon_earth_elemental",
89 "spell_summon_water_elemental",
90 "spell_summon_air_elemental",
91 "spell_dimension_door",
92 "spell_create_earth_wall",
95 "spell_magic_mapping",
101 "spell_perceive_self",
102 "spell_word_of_recall",
104 "spell_invisible_to_undead",
106 "spell_lg_magic_bullet",
107 "spell_improved_invisibility",
109 "spell_minor_healing",
110 "spell_medium_healing",
111 "spell_major_healing",
114 "spell_earth_to_dust",
118 "spell_constitution",
120 "spell_create_fire_wall",
121 "spell_create_frost_wall",
122 "spell_protection_from_cold",
123 "spell_protection_from_electricity",
124 "spell_protection_from_fire",
125 "spell_protection_from_poison",
126 "spell_protection_from_slow",
127 "spell_protection_from_paralysis",
128 "spell_protection_from_draining",
129 "spell_protection_from_magic",
130 "spell_protection_from_attack",
132 "spell_small_speedball",
133 "spell_large_speedball",
135 "spell_dragonbreath",
136 "spell_large_icestorm",
139 "spell_cancellation",
141 "spell_mass_confusion",
142 "spell_summon_pet_monster",
144 "spell_regenerate_spellpoints",
146 "spell_protection_from_confusion",
147 "spell_protection_from_cancellation",
148 "spell_protection_from_depletion",
150 "spell_remove_curse",
151 "spell_remove_damnation",
153 "spell_detect_magic",
154 "spell_detect_monster",
156 "spell_detect_curse",
164 "spell_face_of_death",
165 "spell_ball_lightning",
166 "spell_meteor_swarm",
170 "spell_resurrection",
171 "spell_reincarnation",
181 "spell_invulnerability",
183 "spell_rune_of_fire",
184 "spell_rune_of_frost",
185 "spell_rune_of_shocking",
186 "spell_rune_of_blasting",
187 "spell_rune_of_death",
188 "spell_marking_rune",
189 "spell_build_director",
190 "spell_create_pool_of_chaos",
191 "spell_build_bullet_wall",
192 "spell_build_lightning_wall",
193 "spell_build_fireball_wall",
195 "spell_rune_of_magic_drain",
196 "spell_antimagic_rune",
197 "spell_rune_of_transference",
198 "spell_transference",
200 "spell_counterspell",
202 "spell_cure_confusion",
206 "spell_cause_light_wounds",
207 "spell_cause_medium_wounds",
208 "spell_cause_heavy_wounds",
209 "spell_charm_monsters",
211 "spell_create_missile",
212 "spell_show_invisible",
217 "spell_command_undead",
219 "spell_summon_avatar",
220 "spell_holy_possession",
223 "spell_regeneration",
225 "spell_summon_cult_monsters",
226 "spell_cause_critical_wounds",
228 "spell_retributive_strike",
229 "spell_finger_of_death",
230 "spell_insect_plague",
231 "spell_call_holy_servant",
232 "spell_wall_of_thorns",
233 "spell_staff_to_snake",
240 "spell_cure_blindness",
242 "spell_bullet_swarm",
243 "spell_bullet_storm",
244 "spell_cause_many_wounds",
245 "spell_small_snowstorm",
246 "spell_medium_snowstorm",
247 "spell_large_snowstorm",
248 "spell_cure_disease",
249 "spell_cause_red_death",
251 "spell_cause_black_death",
252 "spell_cause_leprosy",
253 "spell_cause_smallpox",
254 "spell_cause_white_death",
255 "spell_cause_anthrax",
256 "spell_cause_typhoid",
258 "spell_small_manaball",
259 "spell_medium_manaball",
260 "spell_large_manaball",
262 "spell_dancing_sword",
263 "spell_animate_weapon",
265 "spell_divine_shock",
272 "spell_forked_lightning",
274 "spell_flaming_aura",
276 "spell_vitriol_splash",
278 "spell_wrathful_eye",
280 "spell_missile_swarm",
281 "spell_cause_rabies",
304 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,
305 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1
310 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,
311 -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3
316 0, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 36, 37, 39, 39, 42, 43, 44, 45,
317 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
322 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,
323 1, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 8
344 for (
int i = 1; i <
STARTMAX-1; i++) {
378 for (wants_field = wants->
key_values; wants_field != NULL; wants_field = wants_field->
next) {
384 if (has_field == NULL) {
441 if (ob1 == ob2 || ob1->
type != ob2->
type)
465 if (ob1->
inv || ob2->
inv) {
484 || ((ob1->
flags[3]&~0x84) != (ob2->
flags[3]&~0x84))
564 sum += inv->carrying+inv->weight*
NROF(inv);
567 sum = (sum*(100-op->
stats.
Str))/100;
579 while (op->
env != NULL)
613 if (op->
owner == NULL)
641 if (op->
arch != NULL) {
772 for (op =
objects; op != NULL; ) {
799 if (op->
owner == NULL)
864 if (op->
owner != NULL)
910 if (op->
enemy == enemy) {
916 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);
955 for (i = op->
key_values; i != NULL; i = next) {
990 if (op->
name != NULL)
994 if (op->
title != NULL)
996 if (op->
race != NULL)
1000 if (op->
skill != NULL)
1002 if (op->
msg != NULL)
1004 if (op->
lore != NULL)
1062 if (dest_ob->
name != NULL)
1068 if (dest_ob->
title != NULL)
1070 if (dest_ob->
race != NULL)
1074 if (dest_ob->
skill != NULL)
1076 if (dest_ob->
msg != NULL)
1078 if (dest_ob->
lore != NULL)
1091 (void)memcpy((
void *)((
char *)dest_ob+
offsetof(
object,
name)),
1101 if (dest_ob->
name != NULL)
1107 if (dest_ob->
title != NULL)
1109 if (dest_ob->
race != NULL)
1113 if (dest_ob->
skill != NULL)
1115 if (dest_ob->
lore != NULL)
1117 if (dest_ob->
msg != NULL)
1130 if (dest_ob->
arch != NULL) {
1135 if (src_ob->
speed < 0)
1148 new_link->
next = NULL;
1153 new_link->
value = NULL;
1160 tail->
next = new_link;
1217 #ifndef MEMORY_DEBUG
1235 add[0].
next = &add[1],
1240 add[i].
next = &add[i+1],
1241 add[i].
prev = &add[i-1],
1275 op =
static_cast<object *
>(calloc(1,
sizeof(
object)));
1430 int update_now = 0,
flags;
1431 MoveType move_on, move_off, move_block, move_slow;
1436 LOG(
llevDebug,
"object_update() called for NULL object.\n");
1440 if (op->
env != NULL) {
1456 LOG(
llevError,
"object_update() called for object out of map!\n");
1483 if ((move_on|op->
move_on) != move_on)
1485 if ((move_off|op->
move_off) != move_off)
1492 if ((move_slow|op->
move_slow) != move_slow)
1531 LOG(
llevError,
"object_update called with invalid action: %d\n", action);
1539 if (op->
more != NULL)
1565 object *inv = ob->
inv;
1592 LOG(
llevError,
"Free object called with non removed object\n");
1613 LOG(
llevError,
"Trying to free freed object.\n%s\n", diff);
1654 for (part = ob; part; part = part->
more) {
1658 partcount =
RANDOM()%partcount;
1659 for (part = ob; partcount > 0; partcount--) {
1679 if (ob->
more != NULL) {
1693 if (ob->
prev == NULL) {
1699 if (ob->
next != NULL)
1804 while (op != NULL) {
1830 object *last = NULL;
1844 LOG(
llevError,
"Trying to remove removed object.\n%s\n", diff);
1848 if (op->
more != NULL)
1858 if (op->
env != NULL) {
1895 if (op->
above != NULL)
1900 if (op->
below != NULL)
1927 if (op->
map == NULL)
1938 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);
1942 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);
1967 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);
1991 if (tmp->type ==
PLAYER && tmp != op) {
1996 if (tmp->container == op) {
1998 tmp->container = NULL;
2002 tmp->contr->socket->update_look = 1;
2006 && ((op->
move_type&tmp->move_off) && (op->
move_type&~tmp->move_off&~tmp->move_block) == 0)) {
2009 LOG(
llevError,
"BUG: object_remove(): name %s, archname %s destroyed leaving object\n", tmp->name, tmp->arch->name);
2014 if (tmp->above == tmp)
2052 for (top = op; top != NULL && top->
above != NULL; top = top->
above)
2100 for (tmp = op; tmp; tmp = tmp->
more) {
2143 if (op->
type == tmp->type
2144 && op->
subtype == tmp->subtype
2147 && op->
range == tmp->range
2148 && op->
stats.
wc == tmp->stats.wc
2149 && op->
level == tmp->level
2151 && op->
speed == tmp->speed
2153 && (tmp->speed_left+tmp->speed) < 0.0
2194 && op->
spell_tags[i] != tmp->spell_tags[i]) {
2202 if ((!op->
spell_tags[i] && tmp->spell_tags[i])
2203 || (op->
spell_tags[i] && !tmp->spell_tags[i])) {
2223 && tmp->spell_tags[i]
2233 tmp->spell_tags = NULL;
2270 if (tmp->duration != op->
duration) {
2274 int tmp_dam = tmp->stats.dam*(tmp->duration+1)+
2294 object *
floor = NULL;
2310 object *last = NULL;
2358 object *tmp, *top, *
floor = NULL;
2372 LOG(
llevError,
"Trying to insert in null-map!\n%s\n", diff);
2383 LOG(
llevError,
"Trying to insert object outside the map.\n%s\n", diff);
2401 LOG(
llevError,
"Trying to insert (map) inserted object.\n%s\n", diff);
2405 if (op->
more != NULL) {
2408 object *more = op->
more;
2420 }
else if (!more->
map) {
2429 LOG(
llevError,
"BUG: object_insert_in_map(): inserting op->more killed op\n");
2441 if (op->
map == NULL) {
2452 op->
nrof += spot->nrof;
2491 if (originator->
map != op->
map
2492 || originator->
x != op->
x
2493 || originator->
y != op->
y) {
2494 LOG(
llevError,
"object_insert_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n");
2497 op->
above = originator;
2504 originator->
below = op;
2523 if (op->
above == NULL)
2577 for (tmp = op->
more; tmp != NULL; tmp = tmp->
more)
2599 if (!strcmp(tmp->arch->name, arch_string)) {
2633 object *
object_split(
object *orig_ob, uint32_t nr,
char *err,
size_t size) {
2636 if (
MAX(1, orig_ob->
nrof) < nr) {
2639 snprintf(err, size,
"There are only %u %ss.",
NROF(orig_ob), orig_ob->
name);
2645 if (orig_ob->
nrof == 0) {
2683 }
else if (op->
env != NULL) {
2731 pl->contr->socket->update_look = 1;
2767 }
else if (op->
env != NULL) {
2808 pl->contr->socket->update_look = 1;
2830 while (op != NULL) {
2863 LOG(
llevError,
"Trying to insert (ob) inserted object.\n%s\n", diff);
2868 if (where == NULL) {
2875 LOG(
llevError,
"Trying to put object in NULL.\n%s\n", diff);
2880 LOG(
llevDebug,
"Warning: Tried to insert object wrong part of multipart object.\n");
2882 where =
HEAD(where);
2927 if (where->
inv == NULL)
2941 if (where->
contr != NULL)
2963 if (otmp && otmp->
contr != NULL) {
2974 LOG(
llevDebug,
" object_insert_in_ob(): got %s to insert in map/op\n", op->
name);
3012 int x = op->
x, y = op->
y;
3013 MoveType move_on, move_slow, move_block;
3039 if ((op->
move_type&~move_on&~move_block) != 0
3040 && (op->
move_type&~move_slow&~move_block) != 0)
3049 if (tmp->
above == NULL)
3095 if (op->
map !=
m || op->
x != x || op->
y != y)
3121 if (tmp->arch == at)
3147 if (tmp->type ==
type)
3167 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
3202 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3221 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below)
3222 if (tmp->
arch == at)
3238 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3255 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
3293 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3316 ix = gen->
x-sx-genx2;
3317 iy = gen->
y-sy-geny2;
3329 for (i = 0; i < (sx+sx+sy+sy); i++) {
3333 }
else if (i <= sx+sy) {
3336 }
else if (i <= sx+sy+sx) {
3337 nx = ix+sx-(i-(sx+sy));
3341 ny = iy+sy-(i-(sx+sy+sx));
3354 freecount =
RANDOM()%freecount;
3355 for (i = 0; i < sx+sx+sy+sy; i++) {
3359 }
else if (i <= sx+sy) {
3362 }
else if (i <= sx+sy+sx) {
3363 nx = ix+sx-(i-(sx+sy));
3367 ny = iy+sy-(i-(sx+sy+sx));
3379 if (freecount <= 0) {
3409 int genx, geny, genx2, geny2, sx, sy, sx2, sy2, ix, iy, nx, ny, i, flag;
3410 int8_t x, y, radius;
3411 int freecount = 0, freecountstop = 0;
3419 radius = (int8_t)strtol(value, NULL, 10);
3451 ix = gen->
x-sx-genx2-radius+1;
3452 iy = gen->
y-sy-geny2-radius+1;
3453 sx += genx+sx2+radius*2-1;
3454 sy += geny+sy2+radius*2-1;
3464 x_array =
static_cast<int8_t *
>(malloc(sx*sy*
sizeof(int8_t)));
3465 y_array =
static_cast<int8_t *
>(malloc(sx*sy*
sizeof(int8_t)));
3470 for (x = 0; x < sx; x++) {
3471 for (y = 0; y < sy; y++) {
3484 x_array[freecount] = nx;
3485 y_array[freecount] = ny;
3498 freecountstop =
RANDOM()%freecount;
3499 for (i = 0; i < freecount; i++) {
3507 if (freecountstop <= 0) {
3556 int i, index = 0, flag;
3559 for (i = start; i < stop; i++) {
3562 altern[index++] = i;
3577 return altern[
RANDOM()%index];
3614 static void permute(
int *arr,
int begin,
int end) {
3618 for (i = begin; i < end; i++) {
3660 i = (ob1->
x-ob2->
x)*(ob1->
x-ob2->
x)+
3661 (ob1->
y-ob2->
y)*(ob1->
y-ob2->
y);
3906 object *dst = NULL, *tmp, *src, *part, *prev;
3913 for (part = src; part; part = part->more) {
3920 tmp->carrying = tmp->arch->clone.carrying;
3956 for (tmp = who->
inv; tmp; tmp = tmp->
below)
3957 if (tmp->
name == name_shared)
3979 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4002 for (
object *tmp = who->
inv; tmp; tmp = tmp->
below)
4003 if (tmp->type ==
type) {
4005 for (
int i = 0; i < num_flags; ++i) {
4036 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4037 if (tmp->
type == type1 || tmp->
type == type2)
4059 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4060 if (tmp->
count == tag)
4082 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4107 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4132 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4157 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4182 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4205 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4228 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4251 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4276 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below)
4300 for (tmp = who->
inv; tmp; tmp = tmp->
below)
4321 if (link->
key == key) {
4344 const char *canonical_key;
4348 if (canonical_key == NULL) {
4361 if (link->
key == canonical_key) {
4374 if (ret == NULL || (strcmp(ret,
"") == 0) || (strcmp(ret,
"0") == 0)) {
4388 if (link->key == key) {
4389 if ((strcmp(link->value,
"") == 0) || (strcmp(link->value,
"0") == 0)) {
4415 for (field = op->
key_values; field != NULL; field = field->
next) {
4416 if (field->
key != canonical_key) {
4432 field->
value = NULL;
4440 last->next = field->
next;
4496 const char *canonical_key = NULL;
4497 int floating_ref =
FALSE;
4505 if (canonical_key == NULL) {
4507 floating_ref =
TRUE;
4573 int count, retval = 0;
4576 if (op->
count == strtoul(
name, &endptr, 10)) {
4577 if ((endptr !=
name) && (*endptr ==
'\0')) {
4586 for (cp = strtok(local_name,
","); cp; cp = strtok(NULL,
",")) {
4587 while (cp[0] ==
' ')
4592 if (!strcmp(cp,
"all"))
4598 if (!strcmp(cp,
"cursed")
4608 if (*cp ==
'+' || *cp ==
'-')
4611 cp = strchr(cp,
' ');
4612 while (cp && cp[0] ==
' ')
4621 if (!cp || cp[0] ==
'\0' || count < 0)
4643 else if (custom_name && !
strcasecmp(cp, custom_name))
4645 else if (!strncasecmp(cp, bname_s, strlen(cp)))
4647 else if (!strncasecmp(cp, bname_p, strlen(cp)))
4654 else if (strstr(bname_p, cp))
4656 else if (strstr(bname_s, cp))
4658 else if (strstr(name_short, cp))
4670 else if (custom_name && strstr(custom_name, cp))
4695 LOG(
llevError,
"object_fix_multipart: not on a map!\n");
4706 for (at = tmp->
arch->
more, last = tmp; at != NULL; at = at->
more, last = op) {
4751 int maxx = 0, maxy = 0, minx = 0, miny = 0;
4757 for (part = ob->
arch; part; part = part->
more) {
4758 if (part->
clone.
x > maxx)
4760 if (part->
clone.
y > maxy)
4762 if (part->
clone.
x < minx)
4764 if (part->
clone.
y < miny)
4817 if (op->
msg != NULL) {
4823 if (*msg !=
'\0' && strchr(msg,
'\0')[-1] !=
'\n') {
4857 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
4858 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
4859 "is_animated", NULL ,
4860 NULL ,
"monster",
"friendly",
"generator",
4861 "is_thrown",
"auto_apply",
"treasure",
"player sold",
4862 "see_invisible",
"can_roll",
"overlay_floor",
4863 "is_turnable", NULL , NULL ,
4864 NULL ,
"is_used_up",
"identified",
"reflecting",
4865 "changing",
"splitting",
"hitback",
"startequip",
4866 "blocksview",
"undead",
"scared",
"unaggressive",
4867 "reflect_missile",
"reflect_spell",
4868 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
4869 "run_away", NULL , NULL ,
4870 NULL ,
"unique",
"no_drop",
4871 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
4872 "can_use_bow",
"can_use_armour",
"can_use_weapon",
4873 "can_use_ring",
"has_ready_range",
"has_ready_bow",
4874 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
4875 "stand_still",
"random_movement",
"only_attack",
"confused",
4876 "stealth", NULL, NULL,
"cursed",
"damned",
4877 "see_anywhere",
"known_magical",
"known_cursed",
4878 "can_use_skill",
"been_applied",
4879 "has_ready_scroll", NULL, NULL,
4880 NULL,
"make_invisible",
"inv_locked",
"is_wooded",
4881 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
4882 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
4883 NULL,
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
4884 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
4885 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
4886 NULL,
"blessed",
"known_blessed"
4899 std::string retbuf{
""}, retbuf_all{
" all"};
4900 int i, all_count = 0, count;
4916 for (i =
MOVE_ALL, count = 0; i != 0; i >>= 1, count++) {
4917 if (mt&(1<<count)) {
4963 for (
int i = 0; i < 4; i++) {
4964 int idx = ffs((*diff)[i]);
4968 (*diff)[i] &= ~(1 << bit);
4989 static char buf2[64];
4998 for (my_field = op->
key_values; my_field != NULL; my_field = my_field->
next) {
5003 if (arch_field == NULL || my_field->
value != arch_field->
value) {
5009 if (my_field->
value)
5118 if (op->
x != op2->
x)
5120 if (op->
y != op2->
y)
5348 LOG(
llevError,
"could not find original archetype %s for custom monster!\n", at->
name);
5406 if (fputs(cp, fp) == EOF) {
5418 if (death_animation != NULL && strcmp(death_animation,
"NONE")) {
5421 if (death != NULL) {
5438 if (force == NULL) {
5444 if (duration != 0) {
5445 force->
speed = 0.01;
#define FLAG_IS_TURNABLE
Object can change face with direction.
#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.
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)
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
Global settings.
#define MOVE_WALK
Object walks.
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.
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 FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
#define FLAG_NO_APPLY
Avoids step_on/fly_on to this object.
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.
#define SCRIPT_FIX_NOTHING
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.
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
Problems requiring server admin to fix.
void object_set_flag_inv(object *op, int flag)
Activate recursively a flag on an object's inventory.
#define P_BLOCKSVIEW
This spot blocks the player's view.
#define FABS(x)
Decstations have trouble with fabs()...
#define FLAG_ANIMATE
The object looks at archetype for faces.
@ 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,...
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 INS_MAP_LOAD
Disable lots of checkings.
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.
#define FLAG_IS_LINKED
The object is linked with other objects.
object * inv
Pointer to the first object in the inventory.
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.
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.
#define FLAG_FRIENDLY
Will help players.
struct archetype * arch
Pointer to archetype.
#define P_NO_CLERIC
No clerical spells cast here.
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 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.
#define UP_OBJ_CHANGE
Object changed.
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.
#define MAP_IN_MEMORY
Map is fully loaded.
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.
static int object_set_value_s(object *, const char *, const char *, int)
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)
#define UP_OBJ_INSERT
Object was inserted.
object * item
Special values of the artifact.
#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 FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
#define GET_MAP_PLAYER(M, X, Y)
const Face * blank_face
Following can just as easily be pointers, but it is easier to keep them like this.
@ llevMonster
Many many details.
sstring key
Name of the key.
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 FLAG_DIALOG_PARSED
Was the object::msg field parsed? Temporary flag not saved.
#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.
void free_arch(archetype *at)
Frees archetype.
sstring title
Of foo, etc.
#define MAP_DARKNESS(m)
Map darkness level (0-MAX_DARKNESS)
#define FLAG_IS_HILLY
Item is hilly/mountain terrain.
#define FOR_OB_AND_ABOVE_FINISH()
Finishes FOR_OB_AND_ABOVE_PREPARE().
#define FLAG_CURSED
The object is cursed.
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.
uint64_t spell_hash_full
Number of times spell hash was full.
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.
#define UP_OBJ_REMOVE
Object was removed.
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.
const tag_t OBJECT_INVALID
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
Plugin animator file specs[Config] name
#define FLAG_REMOVED
Object is not in any map or invenory.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
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 FOR_OB_AND_ABOVE_PREPARE(op_)
Constructs a loop iterating over an object and all objects above it in the same pile.
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.
#define FLAG_ALIVE
Object can fight (or be fought)
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 MOVE_ALL
Mask of all movement types.
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.
#define FLAG_FREED
Object is in the list of free objects.
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.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
bool object_value_set_shared(const object *op, sstring key)
Determine if an extra value is set to a non empty or 0 value.
#define FLAG_NO_DROP
Object can't be dropped.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
key_value * next
Next key in the list.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define P_NO_MAGIC
Spells (some) can't pass this object.
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.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
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.
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 SAVE_FLAG_SAVE_UNPAID
If set, unpaid items will be saved.
#define FOR_ABOVE_FINISH()
Finishes FOR_ABOVE_PREPARE().
#define FLAG_NO_MAGIC
Spells (some) can't pass this object.
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)
Share a string.
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.
std::string StringBuffer
The string buffer state.
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...
uint64_t event_bitmask
Bitmask of events this object has a handler for, see events.h.
#define FLAG_CLIENT_ANIM_RANDOM
Client animate this, randomized.
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.
#define FLAG_NO_STEAL
Item can't be stolen.
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 SAVE_ERROR_WRITE
Write error.
uint8_t type
PLAYER, BULLET, etc.
#define NUM_FLAGS
Should always be equal to the last defined flag.
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...
#define FLAG_BLOCKSVIEW
Object blocks view.
sstring materialname
Specific material name.
object * object_find_by_tag(const object *who, tag_t tag)
Find object in inventory.
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 FLAG_NO_PICK
Object can't be picked up.
#define FLAG_NO_SAVE
If set (through plugins), the object is not saved on maps.
#define P_PLAYER
There is a player on this space.
#define INS_ON_TOP
Always put object on top.
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.
#define P_NEED_UPDATE
This space is out of date.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
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_OUT_OF_MAP
This space is outside the map.
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.
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_IS_FLOOR
Can't see what's underneath this object.
#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.
#define FLAG_OVERLAY_FLOOR
Object is an overlay floor.
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 INS_NO_WALK_ON
Don't call check_walk_on against the originator.
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.
#define FLAG_INV_LOCKED
Item will not be dropped from inventory.
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 MAX_BUF
Used for all kinds of things.
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.
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.
static std::map< tag_t, object * > object_map
MoveType move_slow
Movement types this slows down.
tag_t * spell_tags
Tags used for spell effect merging.
const char *const spell_mapping[SPELL_MAPPINGS]
This table is only necessary to convert objects that existed before the spell object conversion to th...
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.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
int16_t maxgrace
Maximum grace.
#define FLAG_DAMNED
The object is very cursed.
#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.
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
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 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.
#define P_IS_ALIVE
Something alive is on this space.
sstring slaying
Which race to do double damage to.
int8_t glow_radius
indicates the glow radius of the object
uint8_t duration_modifier
how level modifies duration
sstring name
The name of the object, obviously...
#define INS_ABOVE_FLOOR_ONLY
Put object immediatly above the floor.
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.
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.
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
#define EVENT_DESTROY
Object destroyed (includes map reset/swapout)
Magical Runes Runes are magical inscriptions on the dungeon floor
#define P_NO_ERROR
Purely temporary - if set, update_position does not complain if the flags are different.
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.
sstring value
Key's value.
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.
#define FLAG_APPLIED
Object is ready for use by living.
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.
static object * objects
Pointer to the list of used objects.
int reference_count
How many times this temporary archetype is used.
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.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
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 CLEAR_FLAG(xyz, p)
#define FLAG_STARTEQUIP
Object was given to player at start.
#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.
#define INS_NO_MERGE
Don't try to merge with other items.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define UP_OBJ_FACE
Only thing that changed was the face.
#define FLAG_CLIENT_ANIM_SYNC
Let client animate this, synchronized.
uint32_t count
Any numbers typed before a command.
static object * find_insert_pos(object *op, const int flag)
#define FLAG_NO_FIX_PLAYER
fix_object() won't be called
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 MOVE_FLY_HIGH
High flying object.
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 FREE_OBJ_DROP_ABOVE_FLOOR
If FREE_OBJ_FREE_INVENTORY is not set, drop inventory just above ground instead on top.
#define FLAG_OBJ_ORIGINAL
NEVER SET THIS.
#define GET_MAP_MOVE_OFF(M, X, Y)
Gets the move_off state of a square.
object * container
Current container being used.
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 GET_MAP_FLAGS(M, X, Y)
Gets map flags.
MoveType move_off
Move types affected moving off this space.
archetype * empty_archetype
Nice to have fast access to it.
int freedir[SIZEOFFREE]
Direction we're pointing on this spot.
#define MOVE_FLY_LOW
Low flying object.
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.
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".
uint32_t nrof
Number of objects.
#define FLAG_WAS_WIZ
Player was once a wiz.
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.
if you malloc the data for the make sure to free it when done There is also the newclient h file which is shared between the client and server This file contains the definition of the as well as many defined values for constants of varying you will need to grab these constant values for yourself Many of the constants in this file are used in the protocol to denote types Image Caching ~ Image caching has been implemented on the with necessary server support to handle it This section will briefly describe how image caching works on the protocol as well as how the current client does it the client checks for an option denoting the image caching is desired If we initialize all the images to a default value this means we don t need to put special checks into the drawing code to see if we have an image we just draw the default we know what filename to store it as we request the server to do image caching This is done by or ing the cache directive to the image mode we want C when the server finds an image number that it has not send to the it sends us a name command information us the number to name and there is no space between that the and the name Such formating is difficult but the above example illustrates the data is sent The client then checks for the existence of the image locally It is up to the client to organize images and then splits them into sub directories based on the first letters in the above the file would be crossfire images CS CSword If the client does not have the image or otherwise needs a copy from the it then requests it
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...
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 SAVE_ERROR_OK
No error.
int maxfree[SIZEOFFREE]
Number of spots around a location, including that location (except for 0)
#define FLAG_WIZPASS
The wizard can go through walls.
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.
void object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying and sto...
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.
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,...
#define FLAG_IS_WOODED
Item is wooded terrain.
@ llevDebug
Only for debugging purposes.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
static void FAST_SAVE_LONG(StringBuffer *sb, const char *name, const long value)
Adds a long to the buffer.
#define MAP_SAVING
Map being saved.