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.3 by root, Thu Feb 9 02:11:26 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.3 2006/02/09 02:11:26 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
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,
123 /* we already have newx, newy, and m, so lets use them. 128 /* we already have newx, newy, and m, so lets use them.
124 * In addition, this fixes potential crashes, because multipart object was 129 * In addition, this fixes potential crashes, because multipart object was
125 * on edge of map, +=x, +=y doesn't make correct coordinates. 130 * on edge of map, +=x, +=y doesn't make correct coordinates.
126 */ 131 */
127 for(tmp = op; tmp != NULL; tmp = tmp->more) { 132 for(tmp = op; tmp != NULL; tmp = tmp->more) {
128 tmp->x += freearr_x[dir]; 133 tmp->x = newx + tmp->arch->clone.x;
129 tmp->y += freearr_y[dir]; 134 tmp->y = newy + tmp->arch->clone.y;
130 tmp->map = get_map_from_coord(tmp->map, &tmp->x, &tmp->y); 135 tmp->map = m;
131 } 136 }
132 137
133 /* insert_ob_in_map will deal with any tiling issues */ 138 /* insert_ob_in_map will deal with any tiling issues */
134 insert_ob_in_map(op, m, originator,0); 139 insert_ob_in_map(op, m, originator,0);
135 140
136 /* Hmmm. Should be possible for multispace players now */ 141 /* Hmmm. Should be possible for multispace players now */
137 if (op->type==PLAYER) { 142 if (op->type==PLAYER) {
138 esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]); 143 esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]);
139 op->contr->socket.update_look=1; 144 op->contr->socket.update_look=1;
140 op->contr->socket.look_position=0; 145 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 } 146 }
157 147
158 return 1; /* this shouldn't be reached */ 148 return 1; /* this shouldn't be reached */
159} 149}
160 150
410 /* Wake up sleeping monsters that may be pushed */ 400 /* Wake up sleeping monsters that may be pushed */
411 CLEAR_FLAG(who,FLAG_SLEEP); 401 CLEAR_FLAG(who,FLAG_SLEEP);
412 402
413 /* player change place with his pets or summoned creature */ 403 /* player change place with his pets or summoned creature */
414 /* TODO: allow multi arch pushing. Can't be very difficult */ 404 /* TODO: allow multi arch pushing. Can't be very difficult */
415 if (who->more == NULL && owner == pusher) { 405 if (who->more == NULL
406#ifdef COZY_SERVER
407 &&
408 (
409 (owner && owner->contr && pusher->contr
410 && same_party (owner->contr->party, pusher->contr->party))
411 || owner == pusher
412 )
413#else
414 && owner == pusher
415#endif
416 ) {
416 int temp; 417 int temp;
417 mapstruct *m; 418 mapstruct *m;
418 419
419 remove_ob(who); 420 remove_ob(who);
420 remove_ob(pusher); 421 remove_ob(pusher);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines