1 | /* |
1 | /* |
2 | * static char *rcsid_time_c = |
2 | * static char *rcsid_time_c = |
3 | * "$Id: time.c,v 1.1.1.2 2006/02/22 18:03:26 elmex Exp $"; |
3 | * "$Id: time.c,v 1.6 2006/08/13 17:16:05 elmex dead $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
94 | /* Code below assumes the generator is on a map, as it tries |
94 | /* Code below assumes the generator is on a map, as it tries |
95 | * to place the monster on the map. So if the generator |
95 | * to place the monster on the map. So if the generator |
96 | * isn't on a map, complain and exit. |
96 | * isn't on a map, complain and exit. |
97 | */ |
97 | */ |
98 | if (gen->map == NULL) { |
98 | if (gen->map == NULL) { |
99 | LOG(llevError,"Generator (%s) not on a map?\n", gen->name); |
99 | //LOG(llevError,"Generator (%s) not on a map?\n", gen->name); |
100 | return; |
100 | return; |
101 | } |
101 | } |
102 | /*First count numer of objects in inv*/ |
102 | /*First count numer of objects in inv*/ |
103 | for (op=gen->inv;op;op=op->below) |
103 | for (op=gen->inv;op;op=op->below) |
104 | qty++; |
104 | qty++; |
… | |
… | |
128 | int i; |
128 | int i; |
129 | object *op,*head=NULL,*prev=NULL; |
129 | object *op,*head=NULL,*prev=NULL; |
130 | archetype *at=gen->other_arch; |
130 | archetype *at=gen->other_arch; |
131 | |
131 | |
132 | if(gen->other_arch==NULL) { |
132 | if(gen->other_arch==NULL) { |
133 | LOG(llevError,"Generator without other_arch: %s\n",gen->name); |
133 | //LOG(llevError,"Generator without other_arch: %s\n",gen->name); |
134 | return; |
134 | return; |
135 | } |
135 | } |
136 | /* Code below assumes the generator is on a map, as it tries |
136 | /* Code below assumes the generator is on a map, as it tries |
137 | * to place the monster on the map. So if the generator |
137 | * to place the monster on the map. So if the generator |
138 | * isn't on a map, complain and exit. |
138 | * isn't on a map, complain and exit. |
139 | */ |
139 | */ |
140 | if (gen->map == NULL) { |
140 | if (gen->map == NULL) { |
141 | LOG(llevError,"Generator (%s) not on a map?\n", gen->name); |
141 | //LOG(llevError,"Generator (%s) not on a map?\n", gen->name); |
142 | return; |
142 | return; |
143 | } |
143 | } |
144 | i=find_free_spot(&at->clone,gen->map,gen->x,gen->y,1,9); |
144 | i=find_free_spot(&at->clone,gen->map,gen->x,gen->y,1,9); |
145 | if (i==-1) return; |
145 | if (i==-1) return; |
146 | while(at!=NULL) { |
146 | while(at!=NULL) { |
… | |
… | |
1053 | */ |
1053 | */ |
1054 | |
1054 | |
1055 | void move_duplicator(object *op) { |
1055 | void move_duplicator(object *op) { |
1056 | object *tmp; |
1056 | object *tmp; |
1057 | |
1057 | |
|
|
1058 | if ( !op->other_arch ) { |
|
|
1059 | LOG(llevInfo, "Duplicator with no other_arch! %d %d %s\n", op->x, op->y, op->map ? op->map->path : "nullmap"); |
|
|
1060 | return; |
|
|
1061 | } |
|
|
1062 | |
1058 | if (op->above == NULL) |
1063 | if (op->above == NULL) |
1059 | return; |
1064 | return; |
1060 | for (tmp=op->above; tmp != NULL; tmp=tmp->above) { |
1065 | for (tmp=op->above; tmp != NULL; tmp=tmp->above) { |
1061 | if (strcmp(op->other_arch->name, tmp->arch->name) == 0) { |
1066 | if (strcmp(op->other_arch->name, tmp->arch->name) == 0) { |
1062 | if (op->level <= 0) { |
1067 | if (op->level <= 0) { |
… | |
… | |
1246 | } |
1251 | } |
1247 | /* Lauwenmark: Handle for plugin time event */ |
1252 | /* Lauwenmark: Handle for plugin time event */ |
1248 | execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
1253 | execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
1249 | switch(op->type) { |
1254 | switch(op->type) { |
1250 | case TRANSPORT: |
1255 | case TRANSPORT: |
1251 | /* Transports are directed by players - thus, there |
1256 | /* Transports are directed by players - thus, their |
1252 | * speed is reduced when the player moves them about. |
1257 | * speed is reduced when the player moves them about. |
1253 | * So give them back there speed here, since process_objects() |
1258 | * So give them back there speed here, since process_objects() |
1254 | * has decremented it. |
1259 | * has decremented it. |
1255 | */ |
1260 | */ |
1256 | if (op->speed_left < 0.0) op->speed_left += 1.0; |
1261 | if (op->speed_left < 0.0) op->speed_left += 1.0; |