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.142 by root, Sat Dec 20 02:32:31 2008 UTC vs.
Revision 1.143 by root, Tue Dec 23 06:58:24 2008 UTC

98 */ 98 */
99 mx = ns->mapx; 99 mx = ns->mapx;
100 my = ns->mapy; 100 my = ns->mapy;
101 101
102 /* the x and y here are coordinates for the new map, i.e. if we moved 102 /* the x and y here are coordinates for the new map, i.e. if we moved
103 * (dx,dy), newmap[x][y] = oldmap[x-dx][y-dy]. For this reason, 103 * (dx,dy), newmap[x][y] = oldmap[x-dx][y-dy]. For this reason,
104 * if the destination x or y coordinate is outside the viewable 104 * if the destination x or y coordinate is outside the viewable
105 * area, we clear the values - otherwise, the old values 105 * area, we clear the values - otherwise, the old values
106 * are preserved, and the check_head thinks it needs to clear them. 106 * are preserved, and the check_head thinks it needs to clear them.
107 */ 107 */
108 for (x = 0; x < mx; x++) 108 for (x = 0; x < mx; x++)
109 {
110 for (y = 0; y < my; y++) 109 for (y = 0; y < my; y++)
111 {
112 if (x >= ns->mapx || y >= ns->mapy) 110 if (x >= ns->mapx || y >= ns->mapy)
113 /* clear cells outside the viewable area */ 111 /* clear cells outside the viewable area */
114 memset (&newmap.cells[x][y], 0, sizeof (struct MapCell)); 112 memset (&newmap.cells[x][y], 0, sizeof (struct MapCell));
115 else if ((x + dx) < 0 || (x + dx) >= ns->mapx || (y + dy) < 0 || (y + dy) >= ns->mapy) 113 else if ((x + dx) < 0 || (x + dx) >= ns->mapx || (y + dy) < 0 || (y + dy) >= ns->mapy)
116 /* clear newly visible tiles within the viewable area */ 114 /* clear newly visible tiles within the viewable area */
117 memset (&(newmap.cells[x][y]), 0, sizeof (struct MapCell)); 115 memset (&(newmap.cells[x][y]), 0, sizeof (struct MapCell));
118 else 116 else
119 memcpy (&(newmap.cells[x][y]), &(ns->lastmap.cells[x + dx][y + dy]), sizeof (struct MapCell)); 117 memcpy (&(newmap.cells[x][y]), &(ns->lastmap.cells[x + dx][y + dy]), sizeof (struct MapCell));
120 }
121 }
122 118
123 memcpy (&(ns->lastmap), &newmap, sizeof (struct Map)); 119 memcpy (&(ns->lastmap), &newmap, sizeof (struct Map));
124 120
125 /* Make sure that the next "map1" command will be sent (even if it is 121 /* Make sure that the next "map1" command will be sent (even if it is
126 * empty). 122 * empty).
1056 1052
1057 check_map_change (pl); 1053 check_map_change (pl);
1058 prefetch_surrounding_maps (pl->ob); 1054 prefetch_surrounding_maps (pl->ob);
1059 1055
1060 /* do LOS after calls to update_position */ 1056 /* do LOS after calls to update_position */
1061 if (ob != pl->ob) 1057 /* unfortunately, we need to udpate los when observing, currently */
1062 pl->clear_los (0); 1058 if (pl->do_los || pl->observe != pl->ob)
1063 else if (pl->do_los)
1064 { 1059 {
1065 update_los (ob);
1066 pl->do_los = 0; 1060 pl->do_los = 0;
1061 pl->update_los ();
1067 } 1062 }
1068 1063
1069 /** 1064 /**
1070 * This function uses the new map1 protocol command to send the map 1065 * This function uses the new map1 protocol command to send the map
1071 * to the client. It is necessary because the old map command supports 1066 * to the client. It is necessary because the old map command supports

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines