1 | /* |
1 | /* |
2 | * static char *rcsid_move_c = |
2 | * static char *rcsid_move_c = |
3 | * "$Id: move.c,v 1.1.1.1 2006/02/03 07:14:33 root Exp $"; |
3 | * "$Id: move.c,v 1.1.1.2 2006/02/22 18:03:22 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 | |
… | |
… | |
123 | /* we already have newx, newy, and m, so lets use them. |
123 | /* we already have newx, newy, and m, so lets use them. |
124 | * In addition, this fixes potential crashes, because multipart object was |
124 | * In addition, this fixes potential crashes, because multipart object was |
125 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
125 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
126 | */ |
126 | */ |
127 | for(tmp = op; tmp != NULL; tmp = tmp->more) { |
127 | for(tmp = op; tmp != NULL; tmp = tmp->more) { |
128 | tmp->x = newx + tmp->arch->clone.x; |
128 | tmp->x += freearr_x[dir]; |
129 | tmp->y = newy + tmp->arch->clone.y; |
129 | tmp->y += freearr_y[dir]; |
130 | tmp->map = m; |
130 | tmp->map = get_map_from_coord(tmp->map, &tmp->x, &tmp->y); |
131 | } |
131 | } |
132 | |
132 | |
133 | /* insert_ob_in_map will deal with any tiling issues */ |
133 | /* insert_ob_in_map will deal with any tiling issues */ |
134 | insert_ob_in_map(op, m, originator,0); |
134 | insert_ob_in_map(op, m, originator,0); |
135 | |
135 | |
136 | /* Hmmm. Should be possible for multispace players now */ |
136 | /* Hmmm. Should be possible for multispace players now */ |
137 | if (op->type==PLAYER) { |
137 | if (op->type==PLAYER) { |
138 | esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]); |
138 | esrv_map_scroll(&op->contr->socket, freearr_x[dir],freearr_y[dir]); |
139 | op->contr->socket.update_look=1; |
139 | op->contr->socket.update_look=1; |
140 | op->contr->socket.look_position=0; |
140 | 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 | } |
141 | } |
156 | } |
142 | |
157 | |
143 | return 1; /* this shouldn't be reached */ |
158 | return 1; /* this shouldn't be reached */ |
144 | } |
159 | } |
145 | |
160 | |