--- deliantra/server/socket/request.C 2008/05/20 03:14:19 1.130 +++ deliantra/server/socket/request.C 2008/05/20 13:25:55 1.131 @@ -143,6 +143,32 @@ pl->ns->floorbox_reset (); } +static void +send_map_info (player *pl) +{ + client &socket = *pl->ns; + object *ob = pl->observe; + + if (socket.mapinfocmd) + { + if (ob->map && ob->map->path[0]) + { + int flags = 0; + + if (ob->map->tile_path[0]) flags |= 1; + if (ob->map->tile_path[1]) flags |= 2; + if (ob->map->tile_path[2]) flags |= 4; + if (ob->map->tile_path[3]) flags |= 8; + + socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s", + flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, + ob->map->width, ob->map->height, &ob->map->path); + } + else + socket.send_packet ("mapinfo current"); + } +} + /** check for map/region change and send new map data */ static void check_map_change (player *pl) @@ -150,8 +176,15 @@ client &socket = *pl->ns; object *ob = pl->observe; + region *reg = ob->region (); + if (socket.current_region != reg) + { + INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); + socket.current_region = reg; + } + // first try to aovid a full newmap on tiled map scrolls - if (socket.current_map != ob->map) + if (socket.current_map != ob->map && !socket.force_newmap) { rv_vector rv; @@ -166,6 +199,7 @@ socket_map_scroll (&socket, rv.distance_x, rv.distance_y); socket.floorbox_reset (); + send_map_info (pl); } } @@ -173,25 +207,7 @@ { clear_map (pl); socket.current_map = ob->map; - - if (socket.mapinfocmd) - { - if (ob->map && ob->map->path[0]) - { - int flags = 0; - - if (ob->map->tile_path[0]) flags |= 1; - if (ob->map->tile_path[1]) flags |= 2; - if (ob->map->tile_path[2]) flags |= 4; - if (ob->map->tile_path[3]) flags |= 8; - - socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s", - flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, - ob->map->width, ob->map->height, &ob->map->path); - } - else - socket.send_packet ("mapinfo current"); - } + send_map_info (pl); } else if (socket.current_x != ob->x || socket.current_y != ob->y) { @@ -209,13 +225,6 @@ socket.current_x = ob->x; socket.current_y = ob->y; - - region *reg = ob->region (); - if (socket.current_region != reg) - { - INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); - socket.current_region = reg; - } } /**