… | |
… | |
142 | |
142 | |
143 | static void |
143 | static void |
144 | send_map_info (player *pl) |
144 | send_map_info (player *pl) |
145 | { |
145 | { |
146 | client &socket = *pl->ns; |
146 | client &socket = *pl->ns; |
147 | object *ob = pl->observe; |
147 | object *ob = pl->viewpoint; |
148 | |
148 | |
149 | if (socket.mapinfocmd) |
149 | if (socket.mapinfocmd) |
150 | { |
150 | { |
151 | if (ob->map && ob->map->path[0]) |
151 | if (ob->map && ob->map->path[0]) |
152 | { |
152 | { |
… | |
… | |
169 | /** check for map/region change and send new map data */ |
169 | /** check for map/region change and send new map data */ |
170 | static void |
170 | static void |
171 | check_map_change (player *pl) |
171 | check_map_change (player *pl) |
172 | { |
172 | { |
173 | client &socket = *pl->ns; |
173 | client &socket = *pl->ns; |
174 | object *ob = pl->observe; |
174 | object *ob = pl->viewpoint; |
175 | |
175 | |
176 | region *reg = ob->region (); |
176 | region *reg = ob->region (); |
177 | if (socket.current_region != reg) |
177 | if (socket.current_region != reg) |
178 | { |
178 | { |
179 | INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); |
179 | INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); |
… | |
… | |
279 | { |
279 | { |
280 | char *token = buf; |
280 | char *token = buf; |
281 | buf += strlen (buf) + 9; |
281 | buf += strlen (buf) + 9; |
282 | |
282 | |
283 | // initial map and its origin |
283 | // initial map and its origin |
284 | maptile *map = pl->observe->map; |
284 | maptile *map = pl->viewpoint->map; |
285 | int mapx = pl->ns->mapx / 2 - pl->observe->x; |
285 | int mapx = pl->ns->mapx / 2 - pl->viewpoint->x; |
286 | int mapy = pl->ns->mapy / 2 - pl->observe->y; |
286 | int mapy = pl->ns->mapy / 2 - pl->viewpoint->y; |
287 | int max_distance = 8; // limit maximum path length to something generous |
287 | int max_distance = 8; // limit maximum path length to something generous |
288 | |
288 | |
289 | while (*buf && map && max_distance) |
289 | while (*buf && map && max_distance) |
290 | { |
290 | { |
291 | int dir = *buf++ - '1'; |
291 | int dir = *buf++ - '1'; |
… | |
… | |
952 | * Draws client map. |
952 | * Draws client map. |
953 | */ |
953 | */ |
954 | void |
954 | void |
955 | draw_client_map (player *pl) |
955 | draw_client_map (player *pl) |
956 | { |
956 | { |
957 | object *ob = pl->observe; |
957 | object *ob = pl->viewpoint; |
958 | if (!ob->active) |
958 | if (!pl->observe->active) |
959 | return; |
959 | return; |
960 | |
960 | |
961 | /* If player is just joining the game, he isn't here yet, so the map |
961 | /* If player is just joining the game, he isn't here yet, so the map |
962 | * can get swapped out. If so, don't try to send them a map. All will |
962 | * can get swapped out. If so, don't try to send them a map. All will |
963 | * be OK once they really log in. |
963 | * be OK once they really log in. |
… | |
… | |
970 | check_map_change (pl); |
970 | check_map_change (pl); |
971 | prefetch_surrounding_maps (pl->ob); |
971 | prefetch_surrounding_maps (pl->ob); |
972 | |
972 | |
973 | /* do LOS after calls to update_position */ |
973 | /* do LOS after calls to update_position */ |
974 | /* unfortunately, we need to udpate los when observing, currently */ |
974 | /* unfortunately, we need to udpate los when observing, currently */ |
975 | if (pl->do_los || pl->observe != pl->ob) |
975 | if (pl->do_los || pl->viewpoint != pl->ob) |
976 | { |
976 | { |
977 | pl->do_los = 0; |
977 | pl->do_los = 0; |
978 | pl->update_los (); |
978 | pl->update_los (); |
979 | } |
979 | } |
980 | |
980 | |