ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/request.C
(Generate patch)

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.130 by root, Tue May 20 03:14:19 2008 UTC vs.
Revision 1.131 by root, Tue May 20 13:25:55 2008 UTC

141 pl->ns->send_packet ("newmap"); 141 pl->ns->send_packet ("newmap");
142 142
143 pl->ns->floorbox_reset (); 143 pl->ns->floorbox_reset ();
144} 144}
145 145
146static void
147send_map_info (player *pl)
148{
149 client &socket = *pl->ns;
150 object *ob = pl->observe;
151
152 if (socket.mapinfocmd)
153 {
154 if (ob->map && ob->map->path[0])
155 {
156 int flags = 0;
157
158 if (ob->map->tile_path[0]) flags |= 1;
159 if (ob->map->tile_path[1]) flags |= 2;
160 if (ob->map->tile_path[2]) flags |= 4;
161 if (ob->map->tile_path[3]) flags |= 8;
162
163 socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s",
164 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y,
165 ob->map->width, ob->map->height, &ob->map->path);
166 }
167 else
168 socket.send_packet ("mapinfo current");
169 }
170}
171
146/** check for map/region change and send new map data */ 172/** check for map/region change and send new map data */
147static void 173static void
148check_map_change (player *pl) 174check_map_change (player *pl)
149{ 175{
150 client &socket = *pl->ns; 176 client &socket = *pl->ns;
151 object *ob = pl->observe; 177 object *ob = pl->observe;
152 178
179 region *reg = ob->region ();
180 if (socket.current_region != reg)
181 {
182 INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region));
183 socket.current_region = reg;
184 }
185
153 // first try to aovid a full newmap on tiled map scrolls 186 // first try to aovid a full newmap on tiled map scrolls
154 if (socket.current_map != ob->map) 187 if (socket.current_map != ob->map && !socket.force_newmap)
155 { 188 {
156 rv_vector rv; 189 rv_vector rv;
157 190
158 get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0); 191 get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0);
159 192
164 socket.current_x = ob->x; 197 socket.current_x = ob->x;
165 socket.current_y = ob->y; 198 socket.current_y = ob->y;
166 199
167 socket_map_scroll (&socket, rv.distance_x, rv.distance_y); 200 socket_map_scroll (&socket, rv.distance_x, rv.distance_y);
168 socket.floorbox_reset (); 201 socket.floorbox_reset ();
202 send_map_info (pl);
169 } 203 }
170 } 204 }
171 205
172 if (socket.current_map != ob->map || socket.force_newmap) 206 if (socket.current_map != ob->map || socket.force_newmap)
173 { 207 {
174 clear_map (pl); 208 clear_map (pl);
175 socket.current_map = ob->map; 209 socket.current_map = ob->map;
176 210 send_map_info (pl);
177 if (socket.mapinfocmd)
178 {
179 if (ob->map && ob->map->path[0])
180 {
181 int flags = 0;
182
183 if (ob->map->tile_path[0]) flags |= 1;
184 if (ob->map->tile_path[1]) flags |= 2;
185 if (ob->map->tile_path[2]) flags |= 4;
186 if (ob->map->tile_path[3]) flags |= 8;
187
188 socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s",
189 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y,
190 ob->map->width, ob->map->height, &ob->map->path);
191 }
192 else
193 socket.send_packet ("mapinfo current");
194 }
195 } 211 }
196 else if (socket.current_x != ob->x || socket.current_y != ob->y) 212 else if (socket.current_x != ob->x || socket.current_y != ob->y)
197 { 213 {
198 int dx = ob->x - socket.current_x; 214 int dx = ob->x - socket.current_x;
199 int dy = ob->y - socket.current_y; 215 int dy = ob->y - socket.current_y;
207 } 223 }
208 } 224 }
209 225
210 socket.current_x = ob->x; 226 socket.current_x = ob->x;
211 socket.current_y = ob->y; 227 socket.current_y = ob->y;
212
213 region *reg = ob->region ();
214 if (socket.current_region != reg)
215 {
216 INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region));
217 socket.current_region = reg;
218 }
219} 228}
220 229
221/** 230/**
222 * RequestInfo is sort of a meta command. There is some specific 231 * RequestInfo is sort of a meta command. There is some specific
223 * request of information, but we call other functions to provide 232 * request of information, but we call other functions to provide

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines