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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.298 by root, Sun Jan 29 03:59:15 2017 UTC vs.
Revision 1.300 by root, Sat Sep 16 22:17:42 2017 UTC

234 234
235 attachable::do_destroy (); 235 attachable::do_destroy ();
236 236
237 if (ob) 237 if (ob)
238 { 238 {
239 // potentially fix a bug where ob->contr is non-null while ob->contr->ob is null, causing a segfault.
240 // temporarily backed out patchset 4025 to see if THIS change causes crashes
239 ob->contr = 0; 241 //ob->contr = 0;
240 ob->destroy (); 242 ob->destroy ();
241 } 243 }
242 244
243 ob = observe = viewpoint = 0; 245 ob = observe = viewpoint = 0;
244} 246}
1315 y = op->y; 1317 y = op->y;
1316 1318
1317 /* find the first target */ 1319 /* find the first target */
1318 for (i = 0, found = 0; i < 20; i++) 1320 for (i = 0, found = 0; i < 20; i++)
1319 { 1321 {
1320 x += freearr_x[dir]; 1322 x += DIRX (dir);
1321 y += freearr_y[dir]; 1323 y += DIRY (dir);
1322 mflags = get_map_flags (m, &m, x, y, &x, &y); 1324 mflags = get_map_flags (m, &m, x, y, &x, &y);
1323 1325
1324 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW) 1326 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW)
1325 { 1327 {
1326 tmp = 0; 1328 tmp = 0;
1536 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y); 1538 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y);
1537 } 1539 }
1538 else if (op->contr->bowtype == bow_threewide) 1540 else if (op->contr->bowtype == bow_threewide)
1539 { 1541 {
1540 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1542 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y);
1541 ret |= fire_bow (op, op, NULL, dir, -5, op->x + freearr_x[absdir (dir + 2)], op->y + freearr_y[absdir (dir + 2)]); 1543 ret |= fire_bow (op, op, NULL, dir, -5, op->x + DIRX (absdir (dir + 2)), op->y + DIRY (absdir (dir + 2)));
1542 ret |= fire_bow (op, op, NULL, dir, -5, op->x + freearr_x[absdir (dir - 2)], op->y + freearr_y[absdir (dir - 2)]); 1544 ret |= fire_bow (op, op, NULL, dir, -5, op->x + DIRX (absdir (dir - 2)), op->y + DIRY (absdir (dir - 2)));
1543 } 1545 }
1544 else if (op->contr->bowtype == bow_spreadshot) 1546 else if (op->contr->bowtype == bow_spreadshot)
1545 { 1547 {
1546 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1548 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y);
1547 ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y); 1549 ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y);
1854 { 1856 {
1855 --op->speed_left; 1857 --op->speed_left;
1856 return true; 1858 return true;
1857 } 1859 }
1858 1860
1859 sint16 nx = freearr_x[dir] + op->x; 1861 sint16 nx = DIRX (dir) + op->x;
1860 sint16 ny = freearr_y[dir] + op->y; 1862 sint16 ny = DIRY (dir) + op->y;
1861 1863
1862 if (out_of_map (op->map, nx, ny)) 1864 if (out_of_map (op->map, nx, ny))
1863 return false; 1865 return false;
1864 1866
1865 /* If braced, or can't move to the square, and it is not out of the 1867 /* If braced, or can't move to the square, and it is not out of the
2871 level = -(10 + (2 * ob->map->darklevel ())); 2873 level = -(10 + (2 * ob->map->darklevel ()));
2872 2874
2873 /* scan through all nearby squares for terrain to hide in */ 2875 /* scan through all nearby squares for terrain to hide in */
2874 for (i = 0, x = ob->x, y = ob->y; 2876 for (i = 0, x = ob->x, y = ob->y;
2875 i <= SIZEOFFREE1; 2877 i <= SIZEOFFREE1;
2876 i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) 2878 i++, x = ob->x + DIRX (i), y = ob->y + DIRY (i))
2877 { 2879 {
2878 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); 2880 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL);
2879 if (mflag & P_OUT_OF_MAP) 2881 if (mflag & P_OUT_OF_MAP)
2880 continue; 2882 continue;
2881 2883
2953 friendly = who->flag [FLAG_FRIENDLY]; 2955 friendly = who->flag [FLAG_FRIENDLY];
2954 2956
2955 /* search adjacent squares */ 2957 /* search adjacent squares */
2956 for (i = 1; i < 9; i++) 2958 for (i = 1; i < 9; i++)
2957 { 2959 {
2958 x = who->x + freearr_x[i]; 2960 x = who->x + DIRX (i);
2959 y = who->y + freearr_y[i]; 2961 y = who->y + DIRY (i);
2960 m = who->map; 2962 m = who->map;
2961 mflags = get_map_flags (m, &m, x, y, &x, &y); 2963 mflags = get_map_flags (m, &m, x, y, &x, &y);
2962 /* space must be blocked if there is a monster. If not 2964 /* space must be blocked if there is a monster. If not
2963 * blocked, don't need to check this space. 2965 * blocked, don't need to check this space.
2964 */ 2966 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines