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.301 by root, Sat Nov 17 23:40:04 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
234 235
235 attachable::do_destroy (); 236 attachable::do_destroy ();
236 237
237 if (ob) 238 if (ob)
238 { 239 {
240 // potentially fix a bug where ob->contr is non-null while ob->contr->ob is null, causing a segfault.
241 // temporarily backed out patchset 4025 to see if THIS change causes crashes
239 ob->contr = 0; 242 //ob->contr = 0;
240 ob->destroy (); 243 ob->destroy ();
241 } 244 }
242 245
243 ob = observe = viewpoint = 0; 246 ob = observe = viewpoint = 0;
244} 247}
1315 y = op->y; 1318 y = op->y;
1316 1319
1317 /* find the first target */ 1320 /* find the first target */
1318 for (i = 0, found = 0; i < 20; i++) 1321 for (i = 0, found = 0; i < 20; i++)
1319 { 1322 {
1320 x += freearr_x[dir]; 1323 x += DIRX (dir);
1321 y += freearr_y[dir]; 1324 y += DIRY (dir);
1322 mflags = get_map_flags (m, &m, x, y, &x, &y); 1325 mflags = get_map_flags (m, &m, x, y, &x, &y);
1323 1326
1324 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW) 1327 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW)
1325 { 1328 {
1326 tmp = 0; 1329 tmp = 0;
1536 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y); 1539 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y);
1537 } 1540 }
1538 else if (op->contr->bowtype == bow_threewide) 1541 else if (op->contr->bowtype == bow_threewide)
1539 { 1542 {
1540 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1543 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)]); 1544 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)]); 1545 ret |= fire_bow (op, op, NULL, dir, -5, op->x + DIRX (absdir (dir - 2)), op->y + DIRY (absdir (dir - 2)));
1543 } 1546 }
1544 else if (op->contr->bowtype == bow_spreadshot) 1547 else if (op->contr->bowtype == bow_spreadshot)
1545 { 1548 {
1546 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1549 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); 1550 ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y);
1854 { 1857 {
1855 --op->speed_left; 1858 --op->speed_left;
1856 return true; 1859 return true;
1857 } 1860 }
1858 1861
1859 sint16 nx = freearr_x[dir] + op->x; 1862 sint16 nx = DIRX (dir) + op->x;
1860 sint16 ny = freearr_y[dir] + op->y; 1863 sint16 ny = DIRY (dir) + op->y;
1861 1864
1862 if (out_of_map (op->map, nx, ny)) 1865 if (out_of_map (op->map, nx, ny))
1863 return false; 1866 return false;
1864 1867
1865 /* If braced, or can't move to the square, and it is not out of the 1868 /* If braced, or can't move to the square, and it is not out of the
2871 level = -(10 + (2 * ob->map->darklevel ())); 2874 level = -(10 + (2 * ob->map->darklevel ()));
2872 2875
2873 /* scan through all nearby squares for terrain to hide in */ 2876 /* scan through all nearby squares for terrain to hide in */
2874 for (i = 0, x = ob->x, y = ob->y; 2877 for (i = 0, x = ob->x, y = ob->y;
2875 i <= SIZEOFFREE1; 2878 i <= SIZEOFFREE1;
2876 i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) 2879 i++, x = ob->x + DIRX (i), y = ob->y + DIRY (i))
2877 { 2880 {
2878 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); 2881 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL);
2879 if (mflag & P_OUT_OF_MAP) 2882 if (mflag & P_OUT_OF_MAP)
2880 continue; 2883 continue;
2881 2884
2953 friendly = who->flag [FLAG_FRIENDLY]; 2956 friendly = who->flag [FLAG_FRIENDLY];
2954 2957
2955 /* search adjacent squares */ 2958 /* search adjacent squares */
2956 for (i = 1; i < 9; i++) 2959 for (i = 1; i < 9; i++)
2957 { 2960 {
2958 x = who->x + freearr_x[i]; 2961 x = who->x + DIRX (i);
2959 y = who->y + freearr_y[i]; 2962 y = who->y + DIRY (i);
2960 m = who->map; 2963 m = who->map;
2961 mflags = get_map_flags (m, &m, x, y, &x, &y); 2964 mflags = get_map_flags (m, &m, x, y, &x, &y);
2962 /* space must be blocked if there is a monster. If not 2965 /* space must be blocked if there is a monster. If not
2963 * blocked, don't need to check this space. 2966 * blocked, don't need to check this space.
2964 */ 2967 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines