Crossfire Server, Trunk
time.cpp
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  if (object_value_set(gen, "generator_limit")) {
279  value = object_get_value(gen, "generator_limit");
280 
281  /* Only do this if we actually made a monster. If the generator
282  * was unable to create a monster (no space for example),
283  * we don't want to prematurely remove the generator.
284  */
285  if (value && did_gen) {
286  int limit = atoi(value), num_generated = 0;
287 
288  value = object_get_value(gen, "generator_generated");
289  if (value)
290  num_generated = atoi(value);
291 
292  if (num_generated++ >= limit) {
294  object_remove(gen);
296  } else {
297  char buf[50];
298 
299  snprintf(buf, sizeof(buf), "%d", num_generated);
300  object_set_value(gen, "generator_generated", buf, 1);
301  }
302  }
303  }
304 }
305 
313 static void remove_force(object *op) {
314  if (--op->duration > 0) {
316  return;
317  }
318 
319  switch (op->subtype) {
320  case FORCE_CONFUSION:
321  if (op->env != NULL) {
322  CLEAR_FLAG(op->env, FLAG_CONFUSED);
323  draw_ext_info(NDI_UNIQUE, 0, op->env,
325  "You regain your senses.");
326  }
327  break;
328 
330  /* The force is into the item that was created */
331  if (op->env != NULL && op->inv != NULL) {
332  object *inv = op->inv;
333  object *pl = object_get_player_container(op);
334 
336 
337  // FIXME: For whatever reason, leaving an item transformed this way somewhere that it gets saved
338  // propagates the NO_PICK flag from the force down to the item. Clearing that here
339  // fixes the symptom, but not the underlying logic that causes the problem to occur.
341 
342  inv->weight = (inv->nrof ? (int32_t)(op->env->weight/inv->nrof) : op->env->weight);
343  if (op->env->env) {
344  object_insert_in_ob(inv, op->env->env);
345  if (pl) {
346  char name[HUGE_BUF];
347 
350  "Your %s recovers its original form.",
351  name);
352  }
353  } else {
354  /* Object on map */
355  object_insert_in_map_at(inv, op->env->map, NULL, 0, op->env->x, op->env->y);
356  }
357  inv = op->env;
358  object_remove(op);
361  }
362  return;
363 
364  default:
365  break;
366  }
367 
368  if (op->env != NULL) {
370  change_abil(op->env, op);
371  fix_object(op->env);
372  }
373  object_remove(op);
375 }
376 
383 static void animate_trigger(object *op) {
384  if ((unsigned char)++op->stats.wc >= NUM_ANIMATIONS(op)) {
385  op->stats.wc = 0;
386  check_trigger(op, NULL);
387  } else {
388  SET_ANIMATION(op, op->stats.wc);
390  }
391 }
392 
399 static void move_hole(object *op) { /* 1 = opening, 0 = closing */
400  if (op->value) { /* We're opening */
401  if (--op->stats.wc <= 0) { /* Opened, let's stop */
402  op->stats.wc = 0;
403  op->speed = 0;
405 
406  /* Hard coding this makes sense for holes I suppose */
407  op->move_on = MOVE_WALK;
409  ob_move_on(op, tmp, tmp);
411  }
412 
413  op->state = op->stats.wc;
414  animate_object(op, 0);
416  return;
417  }
418  /* We're closing */
419  op->move_on = 0;
420 
421  op->stats.wc++;
422  if ((int)op->stats.wc >= NUM_ANIMATIONS(op))
423  op->stats.wc = NUM_ANIMATIONS(op)-1;
424 
425  op->state = op->stats.wc;
426  animate_object(op, 0);
428  if ((unsigned char)op->stats.wc == (NUM_ANIMATIONS(op)-1)) {
429  op->speed = 0;
430  object_update_speed(op); /* closed, let's stop */
431  return;
432  }
433 }
434 
455 object *stop_item(object *op) {
456  if (free_no_drop(op))
457  return NULL;
458 
459  if (op->map == NULL)
460  return op;
461 
462  switch (op->type) {
463  case THROWN_OBJ: {
464  object *payload = op->inv;
465 
466  if (payload == NULL)
467  return NULL;
468  object_remove(payload);
469  object_remove(op);
471  return payload;
472  }
473 
474  case ARROW:
475  if (op->speed >= MIN_ACTIVE_SPEED)
477  return op;
478 
479  default:
480  return op;
481  }
482 }
483 
495 void fix_stopped_item(object *op, mapstruct *map, object *originator) {
496  if (map == NULL)
497  return;
498  if (QUERY_FLAG(op, FLAG_REMOVED))
499  object_insert_in_map(op, map, originator, 0);
500  else if (op->type == ARROW)
501  object_merge(op, NULL); /* only some arrows actually need this */
502 }
503 
512 object *fix_stopped_arrow(object *op) {
513  if (free_no_drop(op))
514  return NULL;
515 
516  if (rndm(0, 99) < op->stats.food) {
517  /* Small chance of breaking */
518  object_remove(op);
520  return NULL;
521  }
522 
523  op->direction = 0;
524  op->move_on = 0;
525  op->move_type = 0;
526  op->speed = 0;
528  op->stats.wc = op->stats.sp;
529  op->stats.dam = op->stats.hp;
530  op->attacktype = op->stats.grace;
531  if (op->slaying != NULL)
532  FREE_AND_CLEAR_STR(op->slaying);
533 
534  if (op->skill != NULL)
535  FREE_AND_CLEAR_STR(op->skill);
536 
537  if (op->spellarg != NULL) {
538  op->slaying = add_string(op->spellarg);
539  free(op->spellarg);
540  op->spellarg = NULL;
541  } else
542  op->slaying = NULL;
543 
544  /* Reset these to zero, so that object_can_merge will work properly */
545  op->spellarg = NULL;
546  op->stats.sp = 0;
547  op->stats.hp = 0;
548  op->stats.grace = 0;
549  op->level = 0;
550  animate_object(op, 0);
551  object_clear_owner(op); /* So that stopped arrows will be saved */
553  return op;
554 }
555 
565 int free_no_drop(object *op) {
566  if (!QUERY_FLAG(op, FLAG_NO_DROP)) {
567  return 0;
568  }
569 
570  if (!QUERY_FLAG(op, FLAG_REMOVED)) {
571  object_remove(op);
572  }
573 
575  return 1;
576 }
577 
592 void change_object(object *op) {
593  object *env;
594  int i;
595  int friendly;
596  int unaggressive;
597  object *owner;
598 
599  if (op->other_arch == NULL) {
600  LOG(llevError, "Change object (%s) without other_arch error.\n", op->name);
601  return;
602  }
603 
604  /* In non-living items only change when food value is 0 */
605  if (!QUERY_FLAG(op, FLAG_ALIVE)) {
606  if (op->stats.food-- > 0)
607  return;
608  else
609  op->stats.food = 1; /* so 1 other_arch is made */
610  }
611 
612  env = op->env;
613  object_remove(op);
614  friendly = QUERY_FLAG(op, FLAG_FRIENDLY);
615  unaggressive = QUERY_FLAG(op, FLAG_UNAGGRESSIVE);
616  owner = object_get_owner(op);
617  for (i = 0; i < op->stats.food; i++) {
618  object *tmp;
619 
620  tmp = arch_to_object(op->other_arch);
621  if (op->type == LAMP)
622  tmp->stats.food = op->stats.food-1;
623  tmp->stats.hp = op->stats.hp;
624  if (friendly) {
627  tmp->attack_movement = PETMOVE;
628  if (owner != NULL)
629  object_set_owner(tmp, owner);
630  }
631  if (unaggressive)
633  if (env) {
634  tmp->x = env->x,
635  tmp->y = env->y;
637  }
638  // If there is more to the object, put in the map,
639  // then initiate the process of setting up multipartdom.
640  else if (tmp->arch->more)
641  {
642  tmp->map = op->map;
643  // Get the best free spot for the object
644  // Using the clone of the arch because I do not think that the actual object is ready yet.
645  if (object_find_multi_free_spot_around(&tmp->arch->clone, op, &tmp->x, &tmp->y) != 0)
646  {
647  LOG(llevInfo, "change_object: Failed to find a spot to put changing multipart object\n");
648  // Put the orignal object back.
650  // Free the failed object
652  // Bail out so we don't break things.
653  return;
654  }
657  }
658  else{
659  // Single-size objects work here.
661  }
662  }
663  if (friendly)
666 }
667 
678 void move_firewall(object *op) {
679  object *spell;
680 
681  if (!op->map)
682  return; /* dm has created a firewall in his inventory */
683 
684  spell = op->inv;
685  if (!spell) {
686  LOG(llevError, "firewall '%s' in (%s, %d, %d) has no spell\n", op->name, op->map->path, op->x, op->y);
687  return;
688  }
689 
690  cast_spell(op, op, op->direction ? op->direction : get_random_dir(), spell, NULL);
691 }
692 
693 
707 void move_player_mover(object *op) {
708  int dir = op->stats.sp;
709  int16_t nx, ny;
710  mapstruct *m;
711 
712  if (!op->map) {
713  if (op->env && op->env->map)
714  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);
715  else
716  LOG(llevError, "move_player_mover: mover not in a map at undefinite location!");
717  op->speed = 0;
719  return;
720  }
721 
722  /* Determine direction now for random movers so we do the right thing */
723  if (!dir)
724  dir = get_random_dir();
725 
726  FOR_MAP_PREPARE(op->map, op->x, op->y, victim) {
729  && (victim->move_type&op->move_type || !victim->move_type)) {
730  victim = HEAD(victim);
731 
732  if (QUERY_FLAG(op, FLAG_LIFESAVE) && op->stats.hp-- < 0) {
733  object_remove(op);
735  return;
736  }
737  nx = op->x+freearr_x[dir];
738  ny = op->y+freearr_y[dir];
739  m = op->map;
740  if (get_map_flags(m, &m, nx, ny, &nx, &ny)&P_OUT_OF_MAP) {
741  LOG(llevError, "move_player_mover: Trying to push player off the map! map=%s (%d, %d)\n", m->path, op->x, op->y);
742  return;
743  }
744 
746  return;
747 
748  FOR_MAP_PREPARE(m, nx, ny, nextmover) {
749  if (nextmover->type == PLAYERMOVER)
750  nextmover->speed_left = -.99;
751  if (QUERY_FLAG(nextmover, FLAG_ALIVE)) {
752  op->speed_left = -1.1; /* wait until the next thing gets out of the way */
753  }
754  } FOR_MAP_FINISH();
755 
756  if (victim->type == PLAYER) {
757  /* only level >= 1 movers move people */
758  if (op->level) {
759  /* Following is a bit of hack. We need to make sure it
760  * is cleared, otherwise the player will get stuck in
761  * place. This can happen if the player used a spell to
762  * get to this space.
763  */
764  victim->contr->fire_on = 0;
765  victim->speed_left = -FABS(victim->speed);
766  move_player(victim, dir);
767  } else
768  return;
769  } else
770  move_object(victim, dir);
771 
772  if (!op->stats.maxsp && op->attacktype)
773  op->stats.maxsp = 2.0;
774 
775  if (op->attacktype) { /* flag to paralyze the player */
776  victim->speed_left = -FABS(op->stats.maxsp*victim->speed/op->speed);
777  /* Not sure why, but for some chars on metalforge, they
778  * would sometimes get -inf speed_left, and from the
779  * description, it could only happen here, so just put
780  * a lower sanity limit. My only guess is that the
781  * mover has 0 speed.
782  */
783  if (victim->speed_left < -5.0)
784  victim->speed_left = -5.0;
785  }
786  }
787  } FOR_MAP_FINISH();
788 }
789 
796 void process_object(object *op) {
797  if (getenv("CF_DEBUG_PROCESS")) {
798  LOG(llevDebug, "processing %s (%d), speed %.3f\n", op->name, op->count, op->speed);
799  }
801  return;
802 
803  if (events_execute_object_event(op, EVENT_TIME, NULL, NULL, NULL, SCRIPT_FIX_NOTHING) != 0)
804  return;
805 
806  if (QUERY_FLAG(op, FLAG_REMOVED)) {
807  return;
808  }
809 
810  if (QUERY_FLAG(op, FLAG_MONSTER))
812  return;
813 
814  if ((QUERY_FLAG(op, FLAG_ANIMATE) && op->anim_speed == 0)
815  || (op->temp_animation && op->temp_anim_speed == 0)) {
816  op->state++;
817  if (op->type == PLAYER)
818  animate_object(op, op->facing);
819  else
820  animate_object(op, op->direction);
821 
824  }
825  if (QUERY_FLAG(op, FLAG_CHANGING) && !op->state) {
826  change_object(op);
827  return;
828  }
831 
832  /* If object can be used up, decrement 'food' and eventually remove it. */
833  if (QUERY_FLAG(op, FLAG_IS_USED_UP) && (--op->stats.food) <= 0) {
834  if (QUERY_FLAG(op, FLAG_APPLIED)) {
835  remove_force(op);
836  } else {
837  if (op->env != NULL && op->env->type == PLAYER) {
838  sstring key;
839  key_value *used_up_message;
840 
841  key = add_string("used_up_message");
842  used_up_message = object_get_key_value(op, key);
843  free_string(key);
844 
845  if (used_up_message != NULL) {
848  "The %s %s.", op->name, used_up_message->value);
849  }
850  }
851 
852  object_remove(op);
856  }
857  return;
858  }
859  ob_process(op);
860 }
861 
862 void legacy_remove_force(object *op) {
863  remove_force(op);
864 }
865 
866 void legacy_animate_trigger(object *op) {
868 }
869 
870 void legacy_move_hole(object *op) {
871  move_hole(op);
872 }
remove_door
void remove_door(object *op)
Definition: time.cpp:38
object_value_set
bool object_value_set(const object *op, const char *const key)
Definition: object.cpp:4376
HAS_RANDOM_ITEMS
#define HAS_RANDOM_ITEMS(op)
Definition: define.h:184
UP_OBJ_FACE
#define UP_OBJ_FACE
Definition: object.h:533
make_sure_not_seen
void make_sure_not_seen(const object *op)
Definition: los.cpp:718
PLAYER
@ PLAYER
Definition: object.h:112
object_get_owner
object * object_get_owner(object *op)
Definition: object.cpp:804
free_no_drop
int free_no_drop(object *op)
Definition: time.cpp:565
global.h
object_clear_owner
void object_clear_owner(object *op)
Definition: object.cpp:823
INS_NO_WALK_ON
#define INS_NO_WALK_ON
Definition: object.h:582
FOR_MAP_FINISH
#define FOR_MAP_FINISH()
Definition: define.h:730
remove_friendly_object
void remove_friendly_object(object *op)
Definition: friend.cpp:52
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
mapstruct::difficulty
uint16_t difficulty
Definition: map.h:331
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:58
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
FLAG_GENERATOR
#define FLAG_GENERATOR
Definition: define.h:248
diamondslots.x
x
Definition: diamondslots.py:15
SIZEOFFREE1
#define SIZEOFFREE1
Definition: define.h:153
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
get_random_dir
int get_random_dir(void)
Definition: utils.cpp:400
FLAG_CONTENT_ON_GEN
#define FLAG_CONTENT_ON_GEN
Definition: define.h:365
object_merge
object * object_merge(object *op, object *top)
Definition: object.cpp:2051
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.cpp:1424
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.cpp:4791
object::map
struct mapstruct * map
Definition: object.h:305
move_firewall
void move_firewall(object *op)
Definition: time.cpp:678
key_value
Definition: object.h:42
object_set_owner
void object_set_owner(object *op, object *owner)
Definition: object.cpp:840
object_handle_death_animation
void object_handle_death_animation(object *op)
Definition: object.cpp:5410
MSG_TYPE_ATTRIBUTE
#define MSG_TYPE_ATTRIBUTE
Definition: newclient.h:408
commongive.inv
inv
Definition: commongive.py:29
SET_ANIMATION
#define SET_ANIMATION(ob, newanim)
Definition: global.h:162
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,...) PRINTF_ARGS(6
move_player
int move_player(object *op, int dir)
Definition: player.cpp:2948
fix_object
void fix_object(object *op)
Definition: living.cpp:1132
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.cpp:3412
Ice.tmp
int tmp
Definition: Ice.py:207
move_hole
static void move_hole(object *op)
Definition: time.cpp:399
FOR_ABOVE_PREPARE
#define FOR_ABOVE_PREPARE(op_, it_)
Definition: define.h:687
rndm
int rndm(int min, int max)
Definition: utils.cpp:162
fix_stopped_item
void fix_stopped_item(object *op, mapstruct *map, object *originator)
Definition: time.cpp:495
generate_monster
static void generate_monster(object *gen)
Definition: time.cpp:224
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.cpp:4346
create_treasure
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
Definition: treasure.cpp:263
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:299
generate_monster_arch
static int generate_monster_arch(object *gen)
Definition: time.cpp:164
stop_item
object * stop_item(object *op)
Definition: time.cpp:455
buf
StringBuffer * buf
Definition: readable.cpp:1565
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.cpp:2857
HUGE_BUF
#define HUGE_BUF
Definition: define.h:37
ob_move_on
method_ret ob_move_on(object *op, object *victim, object *originator)
Definition: ob_methods.cpp:111
FLAG_NO_PICK
#define FLAG_NO_PICK
Definition: define.h:239
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
INS_ABOVE_FLOOR_ONLY
#define INS_ABOVE_FLOOR_ONLY
Definition: object.h:581
key_value::value
const char * value
Definition: object.h:44
FLAG_IS_A_TEMPLATE
#define FLAG_IS_A_TEMPLATE
Definition: define.h:366
m
static event_registration m
Definition: citylife.cpp:425
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.cpp:1560
object_update
void object_update(object *op, int action)
Definition: object.cpp:1434
disinfect.map
map
Definition: disinfect.py:4
object_get_key_value
key_value * object_get_key_value(const object *ob, const char *key)
Definition: object.cpp:4321
move_player_mover
void move_player_mover(object *op)
Definition: time.cpp:707
freearr_y
short freearr_y[SIZEOFFREE]
Definition: object.cpp:305
map_find_by_type
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Definition: object.cpp:3145
MOVE_WALK
#define MOVE_WALK
Definition: define.h:392
FOR_ABOVE_FINISH
#define FOR_ABOVE_FINISH()
Definition: define.h:694
archetype::clone
object clone
Definition: object.h:487
sword_of_souls.victim
victim
Definition: sword_of_souls.py:12
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
HEAD
#define HEAD(op)
Definition: object.h:607
query_short_name
void query_short_name(const object *op, char *buf, size_t size)
Definition: item.cpp:513
FLAG_FREED
#define FLAG_FREED
Definition: define.h:233
LOCKED_DOOR
@ LOCKED_DOOR
Definition: object.h:128
MSG_TYPE_ITEM
#define MSG_TYPE_ITEM
Definition: newclient.h:415
PLAYERMOVER
@ PLAYERMOVER
Definition: object.h:145
should_director_abort
int should_director_abort(const object *op, const object *victim)
Definition: apply.cpp:68
object_update_speed
void object_update_speed(object *op)
Definition: object.cpp:1349
legacy_remove_force
void legacy_remove_force(object *op)
Definition: time.cpp:862
legacy_animate_trigger
void legacy_animate_trigger(object *op)
Definition: time.cpp:866
INS_NO_MERGE
#define INS_NO_MERGE
Definition: object.h:580
FORCE_TRANSFORMED_ITEM
#define FORCE_TRANSFORMED_ITEM
Definition: spells.h:146
FLAG_WIZPASS
#define FLAG_WIZPASS
Definition: define.h:314
object_free
void object_free(object *ob, int flags)
Definition: object.cpp:1592
LAMP
@ LAMP
Definition: object.h:206
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:677
FLAG_UNAGGRESSIVE
#define FLAG_UNAGGRESSIVE
Definition: define.h:272
process_object
void process_object(object *op)
Definition: time.cpp:796
legacy_move_hole
void legacy_move_hole(object *op)
Definition: time.cpp:870
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.cpp:3296
sproto.h
ARROW
@ ARROW
Definition: object.h:122
FLAG_NO_DROP
#define FLAG_NO_DROP
Definition: define.h:288
FREE_OBJ_DROP_ABOVE_FLOOR
#define FREE_OBJ_DROP_ABOVE_FLOOR
Definition: object.h:546
NDI_BLACK
#define NDI_BLACK
Definition: newclient.h:245
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.cpp:2100
object::other_arch
struct archetype * other_arch
Definition: object.h:425
object_create_clone
object * object_create_clone(object *asrc)
Definition: object.cpp:3909
FLAG_MONSTER
#define FLAG_MONSTER
Definition: define.h:245
MAP_WIDTH
#define MAP_WIDTH(m)
Definition: map.h:73
P_OUT_OF_MAP
#define P_OUT_OF_MAP
Definition: map.h:247
env
static std::shared_ptr< inja::Environment > env
Definition: mapper.cpp:2168
object_insert_in_map
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
Definition: object.cpp:2361
free_string
void free_string(sstring str)
Definition: shstr.cpp:280
monster_check_apply_all
void monster_check_apply_all(object *monster)
Definition: monster.cpp:1999
move_object
int move_object(object *op, int dir)
Definition: move.cpp:39
FREE_AND_CLEAR_STR
#define FREE_AND_CLEAR_STR(xyz)
Definition: global.h:198
animate_trigger
static void animate_trigger(object *op)
Definition: time.cpp:383
FOR_MAP_PREPARE
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Definition: define.h:723
change_abil
int change_abil(object *op, object *tmp)
Definition: living.cpp:394
FLAG_REMOVED
#define FLAG_REMOVED
Definition: define.h:232
check_trigger
int check_trigger(object *op, object *cause)
Definition: button.cpp:518
fix_stopped_arrow
object * fix_stopped_arrow(object *op)
Definition: time.cpp:512
llevInfo
@ llevInfo
Definition: logger.h:12
NDI_UNIQUE
#define NDI_UNIQUE
Definition: newclient.h:265
FLAG_FRIENDLY
#define FLAG_FRIENDLY
Definition: define.h:246
spells.h
change_object
void change_object(object *op)
Definition: time.cpp:592
object::name
sstring name
Definition: object.h:319
ob_process
method_ret ob_process(object *op)
Definition: ob_methods.cpp:67
SCRIPT_FIX_NOTHING
#define SCRIPT_FIX_NOTHING
Definition: global.h:390
add_friendly_object
void add_friendly_object(object *op)
Definition: friend.cpp:32
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.cpp:300
MSG_TYPE_ITEM_REMOVE
#define MSG_TYPE_ITEM_REMOVE
Definition: newclient.h:645
mapstruct
Definition: map.h:313
sstring
const typedef char * sstring
Definition: sstring.h:2
give.op
op
Definition: give.py:33
generate_monster_inv
static int generate_monster_inv(object *gen)
Definition: time.cpp:97
autojail.value
value
Definition: autojail.py:6
remove_locked_door
void remove_locked_door(object *op)
Definition: time.cpp:64
animate_object
void animate_object(object *op, int dir)
Definition: anim.cpp:44
EVENT_TIME
#define EVENT_TIME
Definition: events.h:32
GENERATE_SPEED
#define GENERATE_SPEED(xyz)
Definition: define.h:437
remove_force
static void remove_force(object *op)
Definition: time.cpp:313
object_unset_flag_inv
void object_unset_flag_inv(object *op, int flag)
Definition: object.cpp:3256
diamondslots.y
y
Definition: diamondslots.py:16
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
MAP_HEIGHT
#define MAP_HEIGHT(m)
Definition: map.h:75
NUM_ANIMATIONS
#define NUM_ANIMATIONS(ob)
Definition: global.h:171
check_spell_expiry
void check_spell_expiry(object *spell)
Definition: spell_util.cpp:2006
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:229
castle_read.key
key
Definition: castle_read.py:64
MIN_ACTIVE_SPEED
#define MIN_ACTIVE_SPEED
Definition: define.h:639
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:570
object_fix_multipart
void object_fix_multipart(object *tmp)
Definition: object.cpp:4685
object::randomitems
struct treasurelist * randomitems
Definition: object.h:395
FLAG_SEE_ANYWHERE
#define FLAG_SEE_ANYWHERE
Definition: define.h:318
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.cpp:308
monster_move
int monster_move(object *op)
Definition: monster.cpp:854
object_remove
void object_remove(object *op)
Definition: object.cpp:1833
DOOR
@ DOOR
Definition: object.h:131
MSG_TYPE_ITEM_CHANGE
#define MSG_TYPE_ITEM_CHANGE
Definition: newclient.h:647
FREE_OBJ_FREE_INVENTORY
#define FREE_OBJ_FREE_INVENTORY
Definition: object.h:544
PETMOVE
#define PETMOVE
Definition: define.h:501
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.cpp:4499
freearr_x
short freearr_x[SIZEOFFREE]
Definition: object.cpp:299
TRUE
#define TRUE
Definition: compat.h:11
FLAG_CHANGING
#define FLAG_CHANGING
Definition: define.h:263
object_get_player_container
object * object_get_player_container(object *op)
Definition: object.cpp:607
altar_valkyrie.pl
pl
Definition: altar_valkyrie.py:28
generate_artifact
void generate_artifact(object *op, int difficulty)
Definition: artifact.cpp:177
THROWN_OBJ
@ THROWN_OBJ
Definition: object.h:151
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:670
object.h
make_sure_seen
void make_sure_seen(const object *op)
Definition: los.cpp:695
llevDebug
@ llevDebug
Definition: logger.h:13
FLAG_LIFESAVE
#define FLAG_LIFESAVE
Definition: define.h:305
give.name
name
Definition: give.py:27