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.2 by root, Fri Feb 3 07:25:25 2006 UTC vs.
Revision 1.4 by elmex, Wed Feb 22 18:53:56 2006 UTC

1/* 1/*
2 * static char *rcsid_move_c = 2 * static char *rcsid_move_c =
3 * "$Id: move.c,v 1.2 2006/02/03 07:25:25 root Exp $"; 3 * "$Id: move.c,v 1.4 2006/02/22 18:53:56 elmex 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
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 33
34#ifdef COZY_SERVER
35// use a ptotoype
34extern int same_party (partylist *a, partylist *b); 36extern int same_party (partylist *a, partylist *b);
37#endif
35 38
36/* 39/*
37 * move_object() tries to move object op in the direction "dir". 40 * move_object() tries to move object op in the direction "dir".
38 * If it fails (something blocks the passage), it returns 0, 41 * If it fails (something blocks the passage), it returns 0,
39 * otherwise 1. 42 * otherwise 1.
125 /* we already have newx, newy, and m, so lets use them. 128 /* we already have newx, newy, and m, so lets use them.
126 * In addition, this fixes potential crashes, because multipart object was 129 * In addition, this fixes potential crashes, because multipart object was
127 * on edge of map, +=x, +=y doesn't make correct coordinates. 130 * on edge of map, +=x, +=y doesn't make correct coordinates.
128 */ 131 */
129 for(tmp = op; tmp != NULL; tmp = tmp->more) { 132 for(tmp = op; tmp != NULL; tmp = tmp->more) {
130 tmp->x = newx + tmp->arch->clone.x; 133 tmp->x += freearr_x[dir];
131 tmp->y = newy + tmp->arch->clone.y; 134 tmp->y += freearr_y[dir];
132 tmp->map = m; 135 tmp->map = get_map_from_coord(tmp->map, &tmp->x, &tmp->y);
133 } 136 }
134 137
135 /* insert_ob_in_map will deal with any tiling issues */ 138 /* insert_ob_in_map will deal with any tiling issues */
136 insert_ob_in_map(op, m, originator,0); 139 insert_ob_in_map(op, m, originator,0);
137 140
138 /* Hmmm. Should be possible for multispace players now */ 141 /* Hmmm. Should be possible for multispace players now */
139 if (op->type==PLAYER) { 142 if (op->type==PLAYER) {
140 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]);
141 op->contr->socket.update_look=1; 144 op->contr->socket.update_look=1;
142 op->contr->socket.look_position=0; 145 op->contr->socket.look_position=0;
146 }
147 else if (op->type == TRANSPORT) {
148 object *pl;
149
150 for (pl=op->inv; pl; pl=pl->below) {
151 if (pl->type == PLAYER) {
152 pl->contr->do_los=1;
153 pl->map = op->map;
154 pl->x = op->x;
155 pl->y = op->y;
156 esrv_map_scroll(&pl->contr->socket, freearr_x[dir],freearr_y[dir]);
157 pl->contr->socket.update_look=1;
158 pl->contr->socket.look_position=0;
159 }
160 }
143 } 161 }
144 162
145 return 1; /* this shouldn't be reached */ 163 return 1; /* this shouldn't be reached */
146} 164}
147 165
398 CLEAR_FLAG(who,FLAG_SLEEP); 416 CLEAR_FLAG(who,FLAG_SLEEP);
399 417
400 /* player change place with his pets or summoned creature */ 418 /* player change place with his pets or summoned creature */
401 /* TODO: allow multi arch pushing. Can't be very difficult */ 419 /* TODO: allow multi arch pushing. Can't be very difficult */
402 if (who->more == NULL 420 if (who->more == NULL
421#ifdef COZY_SERVER
403 && 422 &&
404 ( 423 (
405 (owner && owner->contr && pusher->contr 424 (owner && owner->contr && pusher->contr
406 && same_party (owner->contr->party, pusher->contr->party)) 425 && same_party (owner->contr->party, pusher->contr->party))
407 || owner == pusher 426 || owner == pusher
408 ) 427 )
428#else
429 && owner == pusher
430#endif
409 ) { 431 ) {
410 int temp; 432 int temp;
411 mapstruct *m; 433 mapstruct *m;
412 434
413 remove_ob(who); 435 remove_ob(who);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines