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.8 by root, Thu Sep 14 22:34:04 2006 UTC vs.
Revision 1.11 by root, Wed Dec 13 03:28:42 2006 UTC

59move_ob (object *op, int dir, object *originator) 59move_ob (object *op, int dir, object *originator)
60{ 60{
61 sint16 newx = op->x + freearr_x[dir]; 61 sint16 newx = op->x + freearr_x[dir];
62 sint16 newy = op->y + freearr_y[dir]; 62 sint16 newy = op->y + freearr_y[dir];
63 object *tmp; 63 object *tmp;
64 mapstruct *m; 64 maptile *m;
65 int mflags; 65 int mflags;
66 66
67 if (op == NULL) 67 if (op == NULL)
68 { 68 {
69 LOG (llevError, "Trying to move NULL.\n"); 69 LOG (llevError, "Trying to move NULL.\n");
121 * ok - the caller will deal with actual object removal/insertion 121 * ok - the caller will deal with actual object removal/insertion
122 */ 122 */
123 if (op->head) 123 if (op->head)
124 return 1; 124 return 1;
125 125
126 remove_ob (op); 126 op->remove ();
127 127
128 /* we already have newx, newy, and m, so lets use them. 128 /* we already have newx, newy, and m, so lets use them.
129 * In addition, this fixes potential crashes, because multipart object was 129 * In addition, this fixes potential crashes, because multipart object was
130 * on edge of map, +=x, +=y doesn't make correct coordinates. 130 * on edge of map, +=x, +=y doesn't make correct coordinates.
131 */ 131 */
169 if (i == -1) 169 if (i == -1)
170 return 0; /* No free spot */ 170 return 0; /* No free spot */
171 171
172 if (op->head != NULL) 172 if (op->head != NULL)
173 op = op->head; 173 op = op->head;
174 remove_ob (op); 174 op->remove ();
175 for (tmp = op; tmp != NULL; tmp = tmp->more) 175 for (tmp = op; tmp != NULL; tmp = tmp->more)
176 tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x), 176 tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x),
177 tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y); 177 tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y);
178 178
179 tmp = insert_ob_in_map (op, op->map, originator, 0); 179 tmp = insert_ob_in_map (op, op->map, originator, 0);
199teleport (object *teleporter, uint8 tele_type, object *user) 199teleport (object *teleporter, uint8 tele_type, object *user)
200{ 200{
201 object *altern; 201 object *altern;
202 int i, j, k, nrofalt = 0; 202 int i, j, k, nrofalt = 0;
203 object *other_teleporter, *tmp; 203 object *other_teleporter, *tmp;
204 mapstruct *m; 204 maptile *m;
205 sint16 sx, sy; 205 sint16 sx, sy;
206 206
207 if (user == NULL) 207 if (user == NULL)
208 return 0; 208 return 0;
209 if (user->head != NULL) 209 if (user->head != NULL)
272 } 272 }
273 else 273 else
274 return 0; 274 return 0;
275 } 275 }
276 276
277 remove_ob (user); 277 user->remove ();
278 278
279 /* Update location for the object */ 279 /* Update location for the object */
280 for (tmp = user; tmp != NULL; tmp = tmp->more) 280 for (tmp = user; tmp != NULL; tmp = tmp->more)
281 { 281 {
282 tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x); 282 tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x);
307 * This is currently only used for the boulder roll code. 307 * This is currently only used for the boulder roll code.
308 * Returns 1 if object does not fit, 0 if it does. 308 * Returns 1 if object does not fit, 0 if it does.
309 */ 309 */
310 310
311int 311int
312try_fit (object *op, mapstruct *m, int x, int y) 312try_fit (object *op, maptile *m, int x, int y)
313{ 313{
314 object *tmp, *more; 314 object *tmp, *more;
315 sint16 tx, ty; 315 sint16 tx, ty;
316 int mflags; 316 int mflags;
317 mapstruct *m2; 317 maptile *m2;
318 318
319 if (op->head) 319 if (op->head)
320 op = op->head; 320 op = op->head;
321 321
322 for (more = op; more; more = more->more) 322 for (more = op; more; more = more->more)
355roll_ob (object *op, int dir, object *pusher) 355roll_ob (object *op, int dir, object *pusher)
356{ 356{
357 object *tmp; 357 object *tmp;
358 sint16 x, y; 358 sint16 x, y;
359 int flags; 359 int flags;
360 mapstruct *m; 360 maptile *m;
361 MoveType move_block; 361 MoveType move_block;
362 362
363 if (op->head) 363 if (op->head)
364 op = op->head; 364 op = op->head;
365 365
389 } 389 }
390 } 390 }
391 if (try_fit (op, m, x, y)) 391 if (try_fit (op, m, x, y))
392 return 0; 392 return 0;
393 393
394 remove_ob (op); 394 op->remove ();
395 for (tmp = op; tmp != NULL; tmp = tmp->more) 395 for (tmp = op; tmp != NULL; tmp = tmp->more)
396 tmp->x += freearr_x[dir], tmp->y += freearr_y[dir]; 396 tmp->x += freearr_x[dir], tmp->y += freearr_y[dir];
397 insert_ob_in_map (op, op->map, pusher, 0); 397 insert_ob_in_map (op, op->map, pusher, 0);
398 return 1; 398 return 1;
399} 399}
405 int str1, str2; 405 int str1, str2;
406 object *owner; 406 object *owner;
407 407
408 if (who->head != NULL) 408 if (who->head != NULL)
409 who = who->head; 409 who = who->head;
410 owner = get_owner (who); 410 owner = who->owner;
411 411
412 /* Wake up sleeping monsters that may be pushed */ 412 /* Wake up sleeping monsters that may be pushed */
413 CLEAR_FLAG (who, FLAG_SLEEP); 413 CLEAR_FLAG (who, FLAG_SLEEP);
414 414
415 /* player change place with his pets or summoned creature */ 415 /* player change place with his pets or summoned creature */
421 && owner == pusher 421 && owner == pusher
422#endif 422#endif
423 ) 423 )
424 { 424 {
425 int temp; 425 int temp;
426 mapstruct *m; 426 maptile *m;
427 427
428 remove_ob (who); 428 who->remove ();
429 remove_ob (pusher); 429 pusher->remove ();
430 temp = pusher->x; 430 temp = pusher->x;
431 pusher->x = who->x; 431 pusher->x = who->x;
432 who->x = temp; 432 who->x = temp;
433 433
434 temp = pusher->y; 434 temp = pusher->y;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines