1 | /* |
1 | /* |
2 | * static char *rcsid_move_c = |
2 | * static char *rcsid_move_c = |
3 | * "$Id: move.c,v 1.3 2006/02/09 02:11:26 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 | |
… | |
… | |
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 | */ |
132 | for(tmp = op; tmp != NULL; tmp = tmp->more) { |
132 | for(tmp = op; tmp != NULL; tmp = tmp->more) { |
133 | tmp->x = newx + tmp->arch->clone.x; |
133 | tmp->x += freearr_x[dir]; |
134 | tmp->y = newy + tmp->arch->clone.y; |
134 | tmp->y += freearr_y[dir]; |
135 | tmp->map = m; |
135 | tmp->map = get_map_from_coord(tmp->map, &tmp->x, &tmp->y); |
136 | } |
136 | } |
137 | |
137 | |
138 | /* insert_ob_in_map will deal with any tiling issues */ |
138 | /* insert_ob_in_map will deal with any tiling issues */ |
139 | insert_ob_in_map(op, m, originator,0); |
139 | insert_ob_in_map(op, m, originator,0); |
140 | |
140 | |
141 | /* Hmmm. Should be possible for multispace players now */ |
141 | /* Hmmm. Should be possible for multispace players now */ |
142 | if (op->type==PLAYER) { |
142 | if (op->type==PLAYER) { |
143 | 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]); |
144 | op->contr->socket.update_look=1; |
144 | op->contr->socket.update_look=1; |
145 | 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 | } |
146 | } |
161 | } |
147 | |
162 | |
148 | return 1; /* this shouldn't be reached */ |
163 | return 1; /* this shouldn't be reached */ |
149 | } |
164 | } |
150 | |
165 | |