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.2 by root, Fri Feb 3 07:25:25 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.2 2006/02/03 07:25:25 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
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 32#endif
33
34extern int same_party (partylist *a, partylist *b);
33 35
34/* 36/*
35 * move_object() tries to move object op in the direction "dir". 37 * move_object() tries to move object op in the direction "dir".
36 * If it fails (something blocks the passage), it returns 0, 38 * If it fails (something blocks the passage), it returns 0,
37 * otherwise 1. 39 * otherwise 1.
123 /* we already have newx, newy, and m, so lets use them. 125 /* we already have newx, newy, and m, so lets use them.
124 * In addition, this fixes potential crashes, because multipart object was 126 * In addition, this fixes potential crashes, because multipart object was
125 * on edge of map, +=x, +=y doesn't make correct coordinates. 127 * on edge of map, +=x, +=y doesn't make correct coordinates.
126 */ 128 */
127 for(tmp = op; tmp != NULL; tmp = tmp->more) { 129 for(tmp = op; tmp != NULL; tmp = tmp->more) {
128 tmp->x += freearr_x[dir]; 130 tmp->x = newx + tmp->arch->clone.x;
129 tmp->y += freearr_y[dir]; 131 tmp->y = newy + tmp->arch->clone.y;
130 tmp->map = get_map_from_coord(tmp->map, &tmp->x, &tmp->y); 132 tmp->map = m;
131 } 133 }
132 134
133 /* insert_ob_in_map will deal with any tiling issues */ 135 /* insert_ob_in_map will deal with any tiling issues */
134 insert_ob_in_map(op, m, originator,0); 136 insert_ob_in_map(op, m, originator,0);
135 137
136 /* Hmmm. Should be possible for multispace players now */ 138 /* Hmmm. Should be possible for multispace players now */
137 if (op->type==PLAYER) { 139 if (op->type==PLAYER) {
138 esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]); 140 esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]);
139 op->contr->socket.update_look=1; 141 op->contr->socket.update_look=1;
140 op->contr->socket.look_position=0; 142 op->contr->socket.look_position=0;
141 }
142 else if (op->type == TRANSPORT) {
143 object *pl;
144
145 for (pl=op->inv; pl; pl=pl->below) {
146 if (pl->type == PLAYER) {
147 pl->contr->do_los=1;
148 pl->map = op->map;
149 pl->x = op->x;
150 pl->y = op->y;
151 esrv_map_scroll(&pl->contr->socket, freearr_x[dir],freearr_y[dir]);
152 pl->contr->socket.update_look=1;
153 pl->contr->socket.look_position=0;
154 }
155 }
156 } 143 }
157 144
158 return 1; /* this shouldn't be reached */ 145 return 1; /* this shouldn't be reached */
159} 146}
160 147
410 /* Wake up sleeping monsters that may be pushed */ 397 /* Wake up sleeping monsters that may be pushed */
411 CLEAR_FLAG(who,FLAG_SLEEP); 398 CLEAR_FLAG(who,FLAG_SLEEP);
412 399
413 /* player change place with his pets or summoned creature */ 400 /* player change place with his pets or summoned creature */
414 /* TODO: allow multi arch pushing. Can't be very difficult */ 401 /* TODO: allow multi arch pushing. Can't be very difficult */
415 if (who->more == NULL && owner == pusher) { 402 if (who->more == NULL
403 &&
404 (
405 (owner && owner->contr && pusher->contr
406 && same_party (owner->contr->party, pusher->contr->party))
407 || owner == pusher
408 )
409 ) {
416 int temp; 410 int temp;
417 mapstruct *m; 411 mapstruct *m;
418 412
419 remove_ob(who); 413 remove_ob(who);
420 remove_ob(pusher); 414 remove_ob(pusher);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines