ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/move.c
(Generate patch)

Comparing deliantra/server/server/move.c (file contents):
Revision 1.1.1.2 by elmex, Wed Feb 22 18:03:22 2006 UTC vs.
Revision 1.6 by elmex, Sun Aug 13 17:16:04 2006 UTC

1/* 1/*
2 * static char *rcsid_move_c = 2 * static char *rcsid_move_c =
3 * "$Id: move.c,v 1.1.1.2 2006/02/22 18:03:22 elmex Exp $"; 3 * "$Id: move.c,v 1.6 2006/08/13 17:16:04 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
27*/ 27*/
28 28
29#include <global.h> 29#include <global.h>
30#ifndef __CEXTRACT__ 30#ifndef __CEXTRACT__
31#include <sproto.h> 31#include <sproto.h>
32#endif
33
34#ifdef COZY_SERVER
35// use a ptotoype
36extern int same_party (partylist *a, partylist *b);
32#endif 37#endif
33 38
34/* 39/*
35 * move_object() tries to move object op in the direction "dir". 40 * move_object() tries to move object op in the direction "dir".
36 * If it fails (something blocks the passage), it returns 0, 41 * If it fails (something blocks the passage), it returns 0,
209 * be used close to each other and not have the player put to the 214 * be used close to each other and not have the player put to the
210 * one of another type. 215 * one of another type.
211 */ 216 */
212int teleport (object *teleporter, uint8 tele_type, object *user) 217int teleport (object *teleporter, uint8 tele_type, object *user)
213{ 218{
214 object *altern[120]; /* Better use c/malloc here in the future */ 219 object *altern;
215 int i,j,k,nrofalt=0; 220 int i,j,k,nrofalt=0;
216 object *other_teleporter, *tmp; 221 object *other_teleporter, *tmp;
217 mapstruct *m; 222 mapstruct *m;
218 sint16 sx, sy; 223 sint16 sx, sy;
219 224
237 242
238 while (other_teleporter) { 243 while (other_teleporter) {
239 if (other_teleporter->type == tele_type) break; 244 if (other_teleporter->type == tele_type) break;
240 other_teleporter = other_teleporter->above; 245 other_teleporter = other_teleporter->above;
241 } 246 }
242 if (other_teleporter) 247 if (other_teleporter && !(RANDOM() % ++nrofalt))
243 altern[nrofalt++]=other_teleporter; 248 altern = other_teleporter;
244 } 249 }
245 250
246 if(!nrofalt) { 251 if(!nrofalt) {
247 LOG(llevError,"No alternative teleporters around!\n"); 252 LOG(llevError,"No alternative teleporters around!\n");
248 return 0; 253 return 0;
249 } 254 }
250 255
251 other_teleporter=altern[RANDOM()%nrofalt]; 256 other_teleporter=altern;
252 k=find_free_spot(user,other_teleporter->map, 257 k=find_free_spot(user,other_teleporter->map,
253 other_teleporter->x,other_teleporter->y,1,9); 258 other_teleporter->x,other_teleporter->y,1,9);
254 259
255 /* if k==-1, unable to find a free spot. If this is shop 260 /* if k==-1, unable to find a free spot. If this is shop
256 * mat that the player is using, find someplace to move 261 * mat that the player is using, find someplace to move
410 /* Wake up sleeping monsters that may be pushed */ 415 /* Wake up sleeping monsters that may be pushed */
411 CLEAR_FLAG(who,FLAG_SLEEP); 416 CLEAR_FLAG(who,FLAG_SLEEP);
412 417
413 /* player change place with his pets or summoned creature */ 418 /* player change place with his pets or summoned creature */
414 /* TODO: allow multi arch pushing. Can't be very difficult */ 419 /* TODO: allow multi arch pushing. Can't be very difficult */
415 if (who->more == NULL && owner == pusher) { 420 if (who->more == NULL
421#ifdef COZY_SERVER
422 &&
423 (
424 (owner && owner->contr && pusher->contr
425 && same_party (owner->contr->party, pusher->contr->party))
426 || owner == pusher
427 )
428#else
429 && owner == pusher
430#endif
431 ) {
416 int temp; 432 int temp;
417 mapstruct *m; 433 mapstruct *m;
418 434
419 remove_ob(who); 435 remove_ob(who);
420 remove_ob(pusher); 436 remove_ob(pusher);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines