Crossfire Server, Trunk
time.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
20 #include "global.h"
21 
22 #include <stdlib.h>
23 
24 #include "spells.h"
25 #include "sproto.h"
26 #include "object.h"
27 
38 void remove_door(object *op) {
39  int i;
40  object *tmp;
41 
42  for (i = 1; i < 9; i += 2)
43  if ((tmp = map_find_by_type(op->map, op->x+freearr_x[i], op->y+freearr_y[i], DOOR)) != NULL) {
44  tmp->speed = 0.1;
46  tmp->speed_left = -0.2;
47  }
48 
49  if (op->other_arch) {
50  tmp = arch_to_object(op->other_arch);
51  tmp->level = op->level;
52  object_insert_in_map_at(tmp, op->map, op, 0, op->x, op->y);
53  }
56 }
57 
64 void remove_locked_door(object *op) {
65  int i;
66  object *tmp;
67 
68  for (i = 1; i < 9; i += 2) {
69  tmp = map_find_by_type(op->map, op->x+freearr_x[i], op->y+freearr_y[i], LOCKED_DOOR);
70  if (tmp && tmp->slaying == op->slaying) {/* same key both doors */
71  tmp->speed = 0.1;
73  tmp->speed_left = -0.2;
74  }
75  }
76  if (op->other_arch) {
77  tmp = arch_to_object(op->other_arch);
78  tmp->level = op->level;
79  object_insert_in_map_at(tmp, op->map, op, 0, op->x, op->y);
80  }
83 }
84 
97 static int generate_monster_inv(object *gen) {
98  int i;
99  int nx, ny;
100  object *op, *head = NULL;
101  const char *code;
102  int qty = 0;
103 
104  /* Code below assumes the generator is on a map, as it tries
105  * to place the monster on the map. So if the generator
106  * isn't on a map, complain and exit.
107  */
108  if (gen->map == NULL) {
109  LOG(llevError, "Generator (%s) not on a map?\n", gen->name);
110  return FALSE;
111  }
112 
113  /*First count number of objects in inv*/
114  FOR_INV_PREPARE(gen, op)
115  qty++;
116  FOR_INV_FINISH();
117  if (!qty) {
118  LOG(llevError, "Generator (%s) has no inventory in generate_monster_inv?\n", gen->name);
119  return FALSE;/*No inventory*/
120  }
121  qty = rndm(0, qty-1);
122  op = NULL;
123  FOR_INV_PREPARE(gen, tmp) {
124  op = tmp;
125  if (qty == 0)
126  break;
127  qty--;
128  } FOR_INV_FINISH();
129  i = object_find_multi_free_spot_within_radius(op, gen, &nx, &ny);
130  if (i == -1)
131  return FALSE;
132  head = object_create_clone(op);
135  if (rndm(0, 9))
136  generate_artifact(head, gen->map->difficulty);
137  code = object_get_value(gen, "generator_code");
138  if (code) {
139  object_set_value(head, "generator_code", code, 1);
140  }
141  object_insert_in_map_at(head, gen->map, gen, 0, nx, ny);
142  if (QUERY_FLAG(head, FLAG_FREED))
143  return TRUE;
144  object_fix_multipart(head);
145  if (HAS_RANDOM_ITEMS(head)) {
146  create_treasure(head->randomitems, head, 0, gen->map->difficulty, 0);
147  if (QUERY_FLAG(head, FLAG_MONSTER)) {
149  }
150  }
151  return TRUE;
152 }
153 
164 static int generate_monster_arch(object *gen) {
165  int i;
166  int nx, ny;
167  object *op;
168  const char *code;
169 
170  if (gen->other_arch == NULL) {
171  LOG(llevError, "Generator without other_arch: %s\n", gen->name);
172  return FALSE;
173  }
174  /* Code below assumes the generator is on a map, as it tries
175  * to place the monster on the map. So if the generator
176  * isn't on a map, complain and exit.
177  */
178  if (gen->map == NULL) {
179  LOG(llevError, "Generator (%s) not on a map?\n", gen->name);
180  return FALSE;
181  }
183  if (i == -1)
184  return FALSE;
185 
187  if (rndm(0, 9))
189  object *ins = object_insert_in_map_at(op, gen->map, gen, 0, nx, ny);
190  /* Object insert in map at can return NULL when failing to place something
191  * because the tile is blocked or because the monster was immediately killed
192  * by a spell effect on the space they were trying to be added to.
193  * Banishment in particular is guilty of causing the latter.
194  *
195  * Regardless, it appears to be intended behavior, but wasn't accounted for here.
196  *
197  * Ensure we actually got op back before continuing to process.
198  */
199  if (ins == NULL)
200  return FALSE;
201  op = ins; // Make sure we look at the object we got back. I *think* the pointer should be the same, but to be safe...
202  if (QUERY_FLAG(op, FLAG_FREED))
203  return TRUE;
204  if (HAS_RANDOM_ITEMS(op)) {
205  create_treasure(op->randomitems, op, 0, gen->map->difficulty, 0);
206  if (QUERY_FLAG(op, FLAG_MONSTER)) {
208  }
209  }
210  code = object_get_value(gen, "generator_code");
211  if (code) {
212  object_set_value(op, "generator_code", code, 1);
213  }
214 
215  return TRUE;
216 }
217 
224 static void generate_monster(object *gen) {
225  int8_t children, max_children;
226  int8_t x, y;
227  const char *code, *value;
228  int did_gen = 0;
229 
230  if (GENERATE_SPEED(gen) && rndm(0, GENERATE_SPEED(gen)-1))
231  return;
232 
233  value = object_get_value(gen, "generator_max_map");
234  if (value) {
235  max_children = (int8_t)strtol(value, NULL, 10);
236  if (max_children < 1)
237  return;
238  code = object_get_value(gen, "generator_code");
239  if (code) {
240  /* Generator has a limit and has created some,
241  * so count how many already exist
242  */
243  children = 0;
244  for (x = 0; x < MAP_WIDTH(gen->map); x++) {
245  for (y = 0; y < MAP_HEIGHT(gen->map); y++) {
246  FOR_MAP_PREPARE(gen->map, x, y, tmp) {
247  value = object_get_value(tmp, "generator_code");
248  if (value && value == code) {
249  children++;
250  }
251  } FOR_MAP_FINISH();
252  }
253  }
254  /* and return without generating if there are already enough */
255  if (children >= max_children+1)
256  return;
257  } else {
258  /* Generator has a limit, but hasn't created anything yet,
259  * so no need to count, just set code and go
260  */
261  value = object_get_value(gen, "generator_name");
262  if (value) {
263  object_set_value(gen, "generator_code", value, 1);
264  } else if (gen->name) {
265  object_set_value(gen, "generator_code", gen->name, 1);
266  } else {
267  object_set_value(gen, "generator_code", "generator", 1);
268  }
269  }
270  } /* If this has a max map generator limit */
271 
273  did_gen = generate_monster_inv(gen);
274  else
275  did_gen = generate_monster_arch(gen);
276 
277  /* See if generator has a generator_limit limit set */
278  value = object_get_value(gen, "generator_limit");
279 
280  /* Only do this if we actually made a monster. If the generator
281  * was unable to create a monster (no space for example),
282  * we don't want to prematurely remove the generator.
283  */
284  if (value && did_gen) {
285  int limit = atoi(value), num_generated = 0;
286 
287  value = object_get_value(gen, "generator_generated");
288  if (value)
289  num_generated = atoi(value);
290 
291  if (num_generated++ >= limit) {
293  object_remove(gen);
295  } else {
296  char buf[50];
297 
298  snprintf(buf, sizeof(buf), "%d", num_generated);
299  object_set_value(gen, "generator_generated", buf, 1);
300  }
301  }
302 }
303 
311 static void remove_force(object *op) {
312  if (--op->duration > 0) {
314  return;
315  }
316 
317  switch (op->subtype) {
318  case FORCE_CONFUSION:
319  if (op->env != NULL) {
320  CLEAR_FLAG(op->env, FLAG_CONFUSED);
321  draw_ext_info(NDI_UNIQUE, 0, op->env,
323  "You regain your senses.");
324  }
325  break;
326 
328  /* The force is into the item that was created */
329  if (op->env != NULL && op->inv != NULL) {
330  object *inv = op->inv;
331  object *pl = object_get_player_container(op);
332 
334  inv->weight = (inv->nrof ? (int32_t)(op->env->weight/inv->nrof) : op->env->weight);
335  if (op->env->env) {
336  object_insert_in_ob(inv, op->env->env);
337  if (pl) {
338  char name[HUGE_BUF];
339 
342  "Your %s recovers its original form.",
343  name);
344  }
345  } else {
346  /* Object on map */
347  object_insert_in_map_at(inv, op->env->map, NULL, 0, op->env->x, op->env->y);
348  }
349  inv = op->env;
350  object_remove(op);
353  }
354  return;
355 
356  default:
357  break;
358  }
359 
360  if (op->env != NULL) {
362  change_abil(op->env, op);
363  fix_object(op->env);
364  }
365  object_remove(op);
367 }
368 
375 static void animate_trigger(object *op) {
376  if ((unsigned char)++op->stats.wc >= NUM_ANIMATIONS(op)) {
377  op->stats.wc = 0;
378  check_trigger(op, NULL);
379  } else {
380  SET_ANIMATION(op, op->stats.wc);
382  }
383 }
384 
391 static void move_hole(object *op) { /* 1 = opening, 0 = closing */
392  if (op->value) { /* We're opening */
393  if (--op->stats.wc <= 0) { /* Opened, let's stop */
394  op->stats.wc = 0;
395  op->speed = 0;
397 
398  /* Hard coding this makes sense for holes I suppose */
399  op->move_on = MOVE_WALK;
401  ob_move_on(op, tmp, tmp);
403  }
404 
405  op->state = op->stats.wc;
406  animate_object(op, 0);
408  return;
409  }
410  /* We're closing */
411  op->move_on = 0;
412 
413  op->stats.wc++;
414  if ((int)op->stats.wc >= NUM_ANIMATIONS(op))
415  op->stats.wc = NUM_ANIMATIONS(op)-1;
416 
417  op->state = op->stats.wc;
418  animate_object(op, 0);
420  if ((unsigned char)op->stats.wc == (NUM_ANIMATIONS(op)-1)) {
421  op->speed = 0;
422  object_update_speed(op); /* closed, let's stop */
423  return;
424  }
425 }
426 
447 object *stop_item(object *op) {
448  if (free_no_drop(op))
449  return NULL;
450 
451  if (op->map == NULL)
452  return op;
453 
454  switch (op->type) {
455  case THROWN_OBJ: {
456  object *payload = op->inv;
457 
458  if (payload == NULL)
459  return NULL;
460  object_remove(payload);
461  object_remove(op);
463  return payload;
464  }
465 
466  case ARROW:
467  if (op->speed >= MIN_ACTIVE_SPEED)
469  return op;
470 
471  default:
472  return op;
473  }
474 }
475 
487 void fix_stopped_item(object *op, mapstruct *map, object *originator) {
488  if (map == NULL)
489  return;
490  if (QUERY_FLAG(op, FLAG_REMOVED))
491  object_insert_in_map(op, map, originator, 0);
492  else if (op->type == ARROW)
493  object_merge(op, NULL); /* only some arrows actually need this */
494 }
495 
504 object *fix_stopped_arrow(object *op) {
505  if (free_no_drop(op))
506  return NULL;
507 
508  if (rndm(0, 99) < op->stats.food) {
509  /* Small chance of breaking */
510  object_remove(op);
512  return NULL;
513  }
514 
515  op->direction = 0;
516  op->move_on = 0;
517  op->move_type = 0;
518  op->speed = 0;
520  op->stats.wc = op->stats.sp;
521  op->stats.dam = op->stats.hp;
522  op->attacktype = op->stats.grace;
523  if (op->slaying != NULL)
524  FREE_AND_CLEAR_STR(op->slaying);
525 
526  if (op->skill != NULL)
527  FREE_AND_CLEAR_STR(op->skill);
528 
529  if (op->spellarg != NULL) {
530  op->slaying = add_string(op->spellarg);
531  free(op->spellarg);
532  op->spellarg = NULL;
533  } else
534  op->slaying = NULL;
535 
536  /* Reset these to zero, so that object_can_merge will work properly */
537  op->spellarg = NULL;
538  op->stats.sp = 0;
539  op->stats.hp = 0;
540  op->stats.grace = 0;
541  op->level = 0;
542  animate_object(op, 0);
543  object_clear_owner(op); /* So that stopped arrows will be saved */
545  return op;
546 }
547 
557 int free_no_drop(object *op) {
558  if (!QUERY_FLAG(op, FLAG_NO_DROP)) {
559  return 0;
560  }
561 
562  if (!QUERY_FLAG(op, FLAG_REMOVED)) {
563  object_remove(op);
564  }
565 
567  return 1;
568 }
569 
584 void change_object(object *op) {
585  object *env;
586  int i;
587  int friendly;
588  int unaggressive;
589  object *owner;
590 
591  if (op->other_arch == NULL) {
592  LOG(llevError, "Change object (%s) without other_arch error.\n", op->name);
593  return;
594  }
595 
596  /* In non-living items only change when food value is 0 */
597  if (!QUERY_FLAG(op, FLAG_ALIVE)) {
598  if (op->stats.food-- > 0)
599  return;
600  else
601  op->stats.food = 1; /* so 1 other_arch is made */
602  }
603 
604  env = op->env;
605  object_remove(op);
606  friendly = QUERY_FLAG(op, FLAG_FRIENDLY);
607  unaggressive = QUERY_FLAG(op, FLAG_UNAGGRESSIVE);
608  owner = object_get_owner(op);
609  for (i = 0; i < op->stats.food; i++) {
610  object *tmp;
611 
612  tmp = arch_to_object(op->other_arch);
613  if (op->type == LAMP)
614  tmp->stats.food = op->stats.food-1;
615  tmp->stats.hp = op->stats.hp;
616  if (friendly) {
619  tmp->attack_movement = PETMOVE;
620  if (owner != NULL)
621  object_set_owner(tmp, owner);
622  }
623  if (unaggressive)
625  if (env) {
626  tmp->x = env->x,
627  tmp->y = env->y;
629  }
630  // If there is more to the object, put in the map,
631  // then initiate the process of setting up multipartdom.
632  else if (tmp->arch->more)
633  {
634  tmp->map = op->map;
635  // Get the best free spot for the object
636  // Using the clone of the arch because I do not think that the actual object is ready yet.
637  if (object_find_multi_free_spot_around(&tmp->arch->clone, op, &tmp->x, &tmp->y) != 0)
638  {
639  LOG(llevInfo, "change_object: Failed to find a spot to put changing multipart object\n");
640  // Put the orignal object back.
642  // Free the failed object
644  // Bail out so we don't break things.
645  return;
646  }
649  }
650  else{
651  // Single-size objects work here.
653  }
654  }
655  if (friendly)
658 }
659 
670 void move_firewall(object *op) {
671  object *spell;
672 
673  if (!op->map)
674  return; /* dm has created a firewall in his inventory */
675 
676  spell = op->inv;
677  if (!spell) {
678  LOG(llevError, "firewall '%s' in (%s, %d, %d) has no spell\n", op->name, op->map->path, op->x, op->y);
679  return;
680  }
681 
682  cast_spell(op, op, op->direction ? op->direction : get_random_dir(), spell, NULL);
683 }
684 
685 
699 void move_player_mover(object *op) {
700  int dir = op->stats.sp;
701  int16_t nx, ny;
702  mapstruct *m;
703 
704  if (!op->map) {
705  if (op->env && op->env->map)
706  LOG(llevError, "move_player_mover: mover not in a map at %s %d %d!\n", op->env->map->path, op->env->x, op->env->y);
707  else
708  LOG(llevError, "move_player_mover: mover not in a map at undefinite location!");
709  op->speed = 0;
711  return;
712  }
713 
714  /* Determine direction now for random movers so we do the right thing */
715  if (!dir)
716  dir = get_random_dir();
717 
718  FOR_MAP_PREPARE(op->map, op->x, op->y, victim) {
721  && (victim->move_type&op->move_type || !victim->move_type)) {
722  victim = HEAD(victim);
723 
724  if (QUERY_FLAG(op, FLAG_LIFESAVE) && op->stats.hp-- < 0) {
725  object_remove(op);
727  return;
728  }
729  nx = op->x+freearr_x[dir];
730  ny = op->y+freearr_y[dir];
731  m = op->map;
732  if (get_map_flags(m, &m, nx, ny, &nx, &ny)&P_OUT_OF_MAP) {
733  LOG(llevError, "move_player_mover: Trying to push player off the map! map=%s (%d, %d)\n", m->path, op->x, op->y);
734  return;
735  }
736 
738  return;
739 
740  FOR_MAP_PREPARE(m, nx, ny, nextmover) {
741  if (nextmover->type == PLAYERMOVER)
742  nextmover->speed_left = -.99;
743  if (QUERY_FLAG(nextmover, FLAG_ALIVE)) {
744  op->speed_left = -1.1; /* wait until the next thing gets out of the way */
745  }
746  } FOR_MAP_FINISH();
747 
748  if (victim->type == PLAYER) {
749  /* only level >= 1 movers move people */
750  if (op->level) {
751  /* Following is a bit of hack. We need to make sure it
752  * is cleared, otherwise the player will get stuck in
753  * place. This can happen if the player used a spell to
754  * get to this space.
755  */
756  victim->contr->fire_on = 0;
757  victim->speed_left = -FABS(victim->speed);
758  move_player(victim, dir);
759  } else
760  return;
761  } else
762  move_object(victim, dir);
763 
764  if (!op->stats.maxsp && op->attacktype)
765  op->stats.maxsp = 2.0;
766 
767  if (op->attacktype) { /* flag to paralyze the player */
768  victim->speed_left = -FABS(op->stats.maxsp*victim->speed/op->speed);
769  /* Not sure why, but for some chars on metalforge, they
770  * would sometimes get -inf speed_left, and from the
771  * description, it could only happen here, so just put
772  * a lower sanity limit. My only guess is that the
773  * mover has 0 speed.
774  */
775  if (victim->speed_left < -5.0)
776  victim->speed_left = -5.0;
777  }
778  }
779  } FOR_MAP_FINISH();
780 }
781 
791 int process_object(object *op) {
793  return 0;
794 
795  if (events_execute_object_event(op, EVENT_TIME, NULL, NULL, NULL, SCRIPT_FIX_NOTHING) != 0)
796  return 0;
797 
798  if (QUERY_FLAG(op, FLAG_MONSTER))
800  return 1;
801 
802  if ((QUERY_FLAG(op, FLAG_ANIMATE) && op->anim_speed == 0)
803  || (op->temp_animation && op->temp_anim_speed == 0)) {
804  op->state++;
805  if (op->type == PLAYER)
806  animate_object(op, op->facing);
807  else
808  animate_object(op, op->direction);
809 
812  }
813  if (QUERY_FLAG(op, FLAG_CHANGING) && !op->state) {
814  change_object(op);
815  return 1;
816  }
819 
820  /* If object can be used up, decrement 'food' and eventually remove it. */
821  if (QUERY_FLAG(op, FLAG_IS_USED_UP) && op->stats.food-- <= 0) {
822  if (QUERY_FLAG(op, FLAG_APPLIED)) {
823  remove_force(op);
824  } else {
825  if (op->env != NULL && op->env->type == PLAYER) {
826  sstring key;
827  key_value *used_up_message;
828 
829  key = add_string("used_up_message");
830  used_up_message = object_get_key_value(op, key);
831  free_string(key);
832 
833  if (used_up_message != NULL) {
836  "The %s %s.", op->name, used_up_message->value);
837  }
838  }
839 
840  object_remove(op);
844  }
845  return 1;
846  }
847  return (ob_process(op) == METHOD_OK ? 1 : 0);
848 }
849 
850 void legacy_remove_force(object *op) {
851  remove_force(op);
852 }
853 
854 void legacy_animate_trigger(object *op) {
856 }
857 
858 void legacy_move_hole(object *op) {
859  move_hole(op);
860 }
stop_item
object * stop_item(object *op)
Definition: time.c:447
HAS_RANDOM_ITEMS
#define HAS_RANDOM_ITEMS(op)
Definition: define.h:184
UP_OBJ_FACE
#define UP_OBJ_FACE
Definition: object.h:520
PLAYER
@ PLAYER
Definition: object.h:107
change_object
void change_object(object *op)
Definition: time.c:584
global.h
object_free
void object_free(object *ob, int flags)
Definition: object.c:1565
INS_NO_WALK_ON
#define INS_NO_WALK_ON
Definition: object.h:569
make_sure_seen
void make_sure_seen(const object *op)
Definition: los.c:636
add_string
sstring add_string(const char *str)
Definition: shstr.c:124
object_remove
void object_remove(object *op)
Definition: object.c:1806
FOR_MAP_FINISH
#define FOR_MAP_FINISH()
Definition: define.h:728
FLAG_CONFUSED
#define FLAG_CONFUSED
Definition: define.h:311
FORCE_CONFUSION
#define FORCE_CONFUSION
Definition: spells.h:144
llevError
@ llevError
Definition: logger.h:11
FABS
#define FABS(x)
Definition: define.h:22
object_create_clone
object * object_create_clone(object *asrc)
Definition: object.c:3917
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
FLAG_GENERATOR
#define FLAG_GENERATOR
Definition: define.h:248
object_update
void object_update(object *op, int action)
Definition: object.c:1407
diamondslots.x
x
Definition: diamondslots.py:15
obj::map
struct mapdef * map
Definition: object.h:298
SIZEOFFREE1
#define SIZEOFFREE1
Definition: define.h:153
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
FLAG_CONTENT_ON_GEN
#define FLAG_CONTENT_ON_GEN
Definition: define.h:365
FALSE
#define FALSE
Definition: compat.h:14
cast_spell
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Definition: spell_util.c:1420
fix_stopped_arrow
object * fix_stopped_arrow(object *op)
Definition: time.c:504
METHOD_OK
#define METHOD_OK
Definition: ob_methods.h:15
pl
Definition: player.h:92
MSG_TYPE_ATTRIBUTE
#define MSG_TYPE_ATTRIBUTE
Definition: newclient.h:405
commongive.inv
inv
Definition: commongive.py:28
SET_ANIMATION
#define SET_ANIMATION(ob, newanim)
Definition: global.h:160
move_player
int move_player(object *op, int dir)
Definition: player.c:2912
process_object
int process_object(object *op)
Definition: time.c:791
Ice.tmp
int tmp
Definition: Ice.py:207
remove_friendly_object
void remove_friendly_object(object *op)
Definition: friend.c:56
FOR_ABOVE_PREPARE
#define FOR_ABOVE_PREPARE(op_, it_)
Definition: define.h:685
create_treasure
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
Definition: treasure.c:242
FLAG_APPLIED
#define FLAG_APPLIED
Definition: define.h:235
events_execute_object_event
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Definition: events.cpp:259
obj::randomitems
struct treasureliststruct * randomitems
Definition: object.h:389
HUGE_BUF
#define HUGE_BUF
Definition: define.h:37
ob_process
method_ret ob_process(object *op)
Definition: ob_methods.c:67
freearr_x
short freearr_x[SIZEOFFREE]
Definition: object.c:288
free_no_drop
int free_no_drop(object *op)
Definition: time.c:557
freearr_y
short freearr_y[SIZEOFFREE]
Definition: object.c:294
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
animate_object
void animate_object(object *op, int dir)
Definition: anim.c:43
INS_ABOVE_FLOOR_ONLY
#define INS_ABOVE_FLOOR_ONLY
Definition: object.h:568
object_merge
object * object_merge(object *op, object *top)
Definition: object.c:2018
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.c:4354
FLAG_IS_A_TEMPLATE
#define FLAG_IS_A_TEMPLATE
Definition: define.h:366
free_string
void free_string(sstring str)
Definition: shstr.c:280
remove_door
void remove_door(object *op)
Definition: time.c:38
legacy_animate_trigger
void legacy_animate_trigger(object *op)
Definition: time.c:854
m
static event_registration m
Definition: citylife.cpp:425
move_player_mover
void move_player_mover(object *op)
Definition: time.c:699
object_get_key_value
key_value * object_get_key_value(const object *ob, const char *key)
Definition: object.c:4329
object_unset_flag_inv
void object_unset_flag_inv(object *op, int flag)
Definition: object.c:3206
disinfect.map
map
Definition: disinfect.py:4
obj::name
sstring name
Definition: object.h:312
MOVE_WALK
#define MOVE_WALK
Definition: define.h:392
move_firewall
void move_firewall(object *op)
Definition: time.c:670
FOR_ABOVE_FINISH
#define FOR_ABOVE_FINISH()
Definition: define.h:692
generate_monster_inv
static int generate_monster_inv(object *gen)
Definition: time.c:97
HEAD
#define HEAD(op)
Definition: object.h:594
object_fix_multipart
void object_fix_multipart(object *tmp)
Definition: object.c:4672
mapdef::difficulty
uint16_t difficulty
Definition: map.h:342
FLAG_FREED
#define FLAG_FREED
Definition: define.h:233
LOCKED_DOOR
@ LOCKED_DOOR
Definition: object.h:123
MSG_TYPE_ITEM
#define MSG_TYPE_ITEM
Definition: newclient.h:412
PLAYERMOVER
@ PLAYERMOVER
Definition: object.h:140
should_director_abort
int should_director_abort(const object *op, const object *victim)
Definition: apply.c:68
query_short_name
void query_short_name(const object *op, char *buf, size_t size)
Definition: item.c:509
generate_artifact
void generate_artifact(object *op, int difficulty)
Definition: artifact.c:143
INS_NO_MERGE
#define INS_NO_MERGE
Definition: object.h:567
FORCE_TRANSFORMED_ITEM
#define FORCE_TRANSFORMED_ITEM
Definition: spells.h:146
fix_object
void fix_object(object *op)
Definition: living.c:1126
FLAG_WIZPASS
#define FLAG_WIZPASS
Definition: define.h:314
LAMP
@ LAMP
Definition: object.h:201
obj::other_arch
struct archt * other_arch
Definition: object.h:417
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:675
fix_stopped_item
void fix_stopped_item(object *op, mapstruct *map, object *originator)
Definition: time.c:487
sstring
const typedef char * sstring
Definition: global.h:40
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:4489
rndm
int rndm(int min, int max)
Definition: utils.c:162
FLAG_UNAGGRESSIVE
#define FLAG_UNAGGRESSIVE
Definition: define.h:272
animate_trigger
static void animate_trigger(object *op)
Definition: time.c:375
sproto.h
ARROW
@ ARROW
Definition: object.h:117
FLAG_NO_DROP
#define FLAG_NO_DROP
Definition: define.h:288
mapdef
Definition: map.h:324
FREE_OBJ_DROP_ABOVE_FLOOR
#define FREE_OBJ_DROP_ABOVE_FLOOR
Definition: object.h:533
NDI_BLACK
#define NDI_BLACK
Definition: newclient.h:242
object_find_multi_free_spot_around
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
Definition: object.c:3246
ob_move_on
method_ret ob_move_on(object *op, object *victim, object *originator)
Definition: ob_methods.c:111
FLAG_MONSTER
#define FLAG_MONSTER
Definition: define.h:245
object_set_owner
void object_set_owner(object *op, object *owner)
Definition: object.c:833
MAP_WIDTH
#define MAP_WIDTH(m)
Definition: map.h:78
P_OUT_OF_MAP
#define P_OUT_OF_MAP
Definition: map.h:250
env
static std::shared_ptr< inja::Environment > env
Definition: mapper.cpp:2215
remove_force
static void remove_force(object *op)
Definition: time.c:311
check_trigger
int check_trigger(object *op, object *cause)
Definition: button.c:518
object_insert_to_free_spot_or_free
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
Definition: object.c:4778
monster_check_apply_all
void monster_check_apply_all(object *monster)
Definition: monster.c:1959
move_object
int move_object(object *op, int dir)
Definition: move.c:39
FREE_AND_CLEAR_STR
#define FREE_AND_CLEAR_STR(xyz)
Definition: global.h:196
FOR_MAP_PREPARE
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Definition: define.h:721
FLAG_REMOVED
#define FLAG_REMOVED
Definition: define.h:232
move_hole
static void move_hole(object *op)
Definition: time.c:391
llevInfo
@ llevInfo
Definition: logger.h:12
NDI_UNIQUE
#define NDI_UNIQUE
Definition: newclient.h:262
FLAG_FRIENDLY
#define FLAG_FRIENDLY
Definition: define.h:246
spells.h
legacy_move_hole
void legacy_move_hole(object *op)
Definition: time.c:858
archt::clone
object clone
Definition: object.h:472
SCRIPT_FIX_NOTHING
#define SCRIPT_FIX_NOTHING
Definition: global.h:368
MSG_TYPE_ITEM_REMOVE
#define MSG_TYPE_ITEM_REMOVE
Definition: newclient.h:642
reputation.victim
victim
Definition: reputation.py:14
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
give.op
op
Definition: give.py:33
autojail.value
value
Definition: autojail.py:6
object_insert_in_map
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
Definition: object.c:2328
EVENT_TIME
#define EVENT_TIME
Definition: events.h:31
GENERATE_SPEED
#define GENERATE_SPEED(xyz)
Definition: define.h:437
_key_value
Definition: object.h:40
map_find_by_type
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Definition: object.c:3095
diamondslots.y
y
Definition: diamondslots.py:16
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
buf
StringBuffer * buf
Definition: readable.c:1606
MAP_HEIGHT
#define MAP_HEIGHT(m)
Definition: map.h:80
NUM_ANIMATIONS
#define NUM_ANIMATIONS(ob)
Definition: global.h:169
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.c:2820
object_update_speed
void object_update_speed(object *op)
Definition: object.c:1317
object_handle_death_animation
void object_handle_death_animation(object *op)
Definition: object.c:5371
check_spell_expiry
void check_spell_expiry(object *spell)
Definition: spell_util.c:2002
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:232
castle_read.key
key
Definition: castle_read.py:64
MIN_ACTIVE_SPEED
#define MIN_ACTIVE_SPEED
Definition: define.h:637
FLAG_IS_USED_UP
#define FLAG_IS_USED_UP
Definition: define.h:260
FLAG_ANIMATE
#define FLAG_ANIMATE
Definition: define.h:242
MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
Definition: newclient.h:567
FLAG_SEE_ANYWHERE
#define FLAG_SEE_ANYWHERE
Definition: define.h:318
object_insert_in_map_at
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Definition: object.c:2067
draw_ext_info
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Definition: main.c:309
monster_move
int monster_move(object *op)
Definition: monster.c:823
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1533
object_find_multi_free_spot_within_radius
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
Definition: object.c:3362
generate_monster_arch
static int generate_monster_arch(object *gen)
Definition: time.c:164
DOOR
@ DOOR
Definition: object.h:126
add_friendly_object
void add_friendly_object(object *op)
Definition: friend.c:30
MSG_TYPE_ITEM_CHANGE
#define MSG_TYPE_ITEM_CHANGE
Definition: newclient.h:644
FREE_OBJ_FREE_INVENTORY
#define FREE_OBJ_FREE_INVENTORY
Definition: object.h:531
_key_value::value
const char * value
Definition: object.h:42
get_random_dir
int get_random_dir(void)
Definition: utils.c:427
make_sure_not_seen
void make_sure_not_seen(const object *op)
Definition: los.c:659
PETMOVE
#define PETMOVE
Definition: define.h:501
generate_monster
static void generate_monster(object *gen)
Definition: time.c:224
TRUE
#define TRUE
Definition: compat.h:11
FLAG_CHANGING
#define FLAG_CHANGING
Definition: define.h:263
get_map_flags
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
Definition: map.c:311
object_get_player_container
object * object_get_player_container(object *op)
Definition: object.c:600
change_abil
int change_abil(object *op, object *tmp)
Definition: living.c:395
THROWN_OBJ
@ THROWN_OBJ
Definition: object.h:146
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:668
remove_locked_door
void remove_locked_door(object *op)
Definition: time.c:64
draw_ext_info_format
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
Definition: main.c:319
object.h
legacy_remove_force
void legacy_remove_force(object *op)
Definition: time.c:850
FLAG_LIFESAVE
#define FLAG_LIFESAVE
Definition: define.h:305
object_clear_owner
void object_clear_owner(object *op)
Definition: object.c:816
give.name
name
Definition: give.py:27
object_get_owner
object * object_get_owner(object *op)
Definition: object.c:797