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.4 by elmex, Wed Feb 22 18:53:56 2006 UTC vs.
Revision 1.5 by root, Mon Mar 20 23:58:15 2006 UTC

1/* 1/*
2 * static char *rcsid_move_c = 2 * static char *rcsid_move_c =
3 * "$Id: move.c,v 1.4 2006/02/22 18:53:56 elmex Exp $"; 3 * "$Id: move.c,v 1.5 2006/03/20 23:58:15 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
214 * 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
215 * one of another type. 215 * one of another type.
216 */ 216 */
217int teleport (object *teleporter, uint8 tele_type, object *user) 217int teleport (object *teleporter, uint8 tele_type, object *user)
218{ 218{
219 object *altern[120]; /* Better use c/malloc here in the future */ 219 object *altern;
220 int i,j,k,nrofalt=0; 220 int i,j,k,nrofalt=0;
221 object *other_teleporter, *tmp; 221 object *other_teleporter, *tmp;
222 mapstruct *m; 222 mapstruct *m;
223 sint16 sx, sy; 223 sint16 sx, sy;
224 224
242 242
243 while (other_teleporter) { 243 while (other_teleporter) {
244 if (other_teleporter->type == tele_type) break; 244 if (other_teleporter->type == tele_type) break;
245 other_teleporter = other_teleporter->above; 245 other_teleporter = other_teleporter->above;
246 } 246 }
247 if (other_teleporter) 247 if (other_teleporter && !(RANDOM() % ++nrofalt))
248 altern[nrofalt++]=other_teleporter; 248 altern = other_teleporter;
249 } 249 }
250 250
251 if(!nrofalt) { 251 if(!nrofalt) {
252 LOG(llevError,"No alternative teleporters around!\n"); 252 LOG(llevError,"No alternative teleporters around!\n");
253 return 0; 253 return 0;
254 } 254 }
255 255
256 other_teleporter=altern[RANDOM()%nrofalt]; 256 other_teleporter=altern;
257 k=find_free_spot(user,other_teleporter->map, 257 k=find_free_spot(user,other_teleporter->map,
258 other_teleporter->x,other_teleporter->y,1,9); 258 other_teleporter->x,other_teleporter->y,1,9);
259 259
260 /* 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
261 * mat that the player is using, find someplace to move 261 * mat that the player is using, find someplace to move

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines