Crossfire Server, Trunk
duplicator.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 
19 #include "global.h"
20 
21 #include <string.h>
22 
23 #include "ob_methods.h"
24 #include "ob_types.h"
25 #include "sounds.h"
26 #include "sproto.h"
27 
28 static method_ret duplicator_type_trigger(object *op, object *cause, int state);
29 
35 }
36 
48 static void move_duplicator(object *op) {
49  object *tmp;
50 
51  if (!op->other_arch) {
52  LOG(llevInfo, "Duplicator with no other_arch! %d %d %s\n", op->x, op->y, op->map ? op->map->path : "nullmap");
53  return;
54  }
55 
56  if (op->above == NULL)
57  return;
58  int count = op->nrof;
59  for (tmp = op->above; tmp != NULL; tmp = tmp->above) {
60  if (strcmp(op->other_arch->name, tmp->arch->name) == 0) {
61  if (op->level <= 0) {
64  tmp = op; // Old tmp was removed, so we can't follow that linked list
65  } else {
66  uint64_t new_nrof = (uint64_t)tmp->nrof*op->level;
67 
68  if (new_nrof >= 1UL<<31)
69  new_nrof = 1UL<<31;
70  tmp->nrof = new_nrof;
71  }
72  if ( count <= 1 ) break;
73  --count;
74  }
75  }
76 }
77 
85 static method_ret duplicator_type_trigger(object *op, object *cause, int state) {
86  (void)cause;
87  (void)state;
89  return METHOD_OK;
90 }
global.h
object_remove
void object_remove(object *op)
Definition: object.c:1806
METHOD_OK
#define METHOD_OK
Definition: ob_methods.h:15
init_type_duplicator
void init_type_duplicator(void)
Definition: duplicator.c:33
Ice.tmp
int tmp
Definition: Ice.py:207
move_duplicator
static void move_duplicator(object *op)
Definition: duplicator.c:48
disinfect.count
int count
Definition: disinfect.py:7
sproto.h
register_trigger
void register_trigger(int ob_type, trigger_func method)
Definition: ob_types.c:98
nlohmann::detail::void
j template void())
Definition: json.hpp:4099
method_ret
char method_ret
Definition: ob_methods.h:14
ob_types.h
sounds.h
llevInfo
@ llevInfo
Definition: logger.h:12
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
DUPLICATOR
@ DUPLICATOR
Definition: object.h:202
give.op
op
Definition: give.py:33
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1533
quest.state
state
Definition: quest.py:13
ob_methods.h
duplicator_type_trigger
static method_ret duplicator_type_trigger(object *op, object *cause, int state)
Definition: duplicator.c:85
if
if(!(yy_init))
Definition: loader.c:2589