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.252 by root, Wed Mar 24 17:23:43 2010 UTC vs.
Revision 1.255 by root, Fri Mar 26 00:53:26 2010 UTC

838 dir = absdir (4 + rv.direction); 838 dir = absdir (4 + rv.direction);
839 for (diff = 0; diff < 3; diff++) 839 for (diff = 0; diff < 3; diff++)
840 { 840 {
841 int m = 1 - rndm (2) * 2; 841 int m = 1 - rndm (2) * 2;
842 842
843 if (move_ob (op, absdir (dir + diff * m), op) || (diff == 0 && move_ob (op, absdir (dir - diff * m), op))) 843 if (op->move (absdir (dir + diff * m)) || (diff == 0 && op->move (absdir (dir - diff * m))))
844 return; 844 return;
845 } 845 }
846 846
847 /* Cornered, get rid of scared */ 847 /* Cornered, get rid of scared */
848 CLEAR_FLAG (op, FLAG_SCARED); 848 CLEAR_FLAG (op, FLAG_SCARED);
1856 * going to try and move (not fire weapons). 1856 * going to try and move (not fire weapons).
1857 */ 1857 */
1858bool 1858bool
1859move_player_attack (object *op, int dir) 1859move_player_attack (object *op, int dir)
1860{ 1860{
1861 if (!op->contr->braced && op->speed_left > 0.f && move_ob (op, dir, op)) 1861 if (!op->contr->braced && op->speed_left > 0.f && op->move (dir))
1862 { 1862 {
1863 --op->speed_left; 1863 --op->speed_left;
1864 return true; 1864 return true;
1865 } 1865 }
1866 1866
1867 int on_battleground;
1868
1869 sint16 nx = freearr_x[dir] + op->x; 1867 sint16 nx = freearr_x[dir] + op->x;
1870 sint16 ny = freearr_y[dir] + op->y; 1868 sint16 ny = freearr_y[dir] + op->y;
1871
1872 on_battleground = op_on_battleground (op, 0, 0);
1873 1869
1874 if (out_of_map (op->map, nx, ny)) 1870 if (out_of_map (op->map, nx, ny))
1875 return false; 1871 return false;
1876 1872
1877 /* If braced, or can't move to the square, and it is not out of the 1873 /* If braced, or can't move to the square, and it is not out of the
1949 } 1945 }
1950 else 1946 else
1951 return false; 1947 return false;
1952 } 1948 }
1953 1949
1950 bool on_battleground = op_on_battleground (op, 0, 0);
1951
1954 /* in certain circumstances, you shouldn't attack friendly 1952 /* in certain circumstances, you shouldn't attack friendly
1955 * creatures. Note that if you are braced, you can't push 1953 * creatures. Note that if you are braced, you can't push
1956 * someone, but put it inside this loop so that you won't 1954 * someone, but put it inside this loop so that you won't
1957 * attack them either. 1955 * attack them either.
1958 */ 1956 */
2026{ 2024{
2027 if (!op->map || op->map->in_memory != MAP_ACTIVE) 2025 if (!op->map || op->map->in_memory != MAP_ACTIVE)
2028 return 0; 2026 return 0;
2029 2027
2030 /* Sanity check: make sure dir is valid */ 2028 /* Sanity check: make sure dir is valid */
2031 if ((dir < 0) || (dir >= 9)) 2029 if (dir < 0 || dir >= 9)
2032 { 2030 {
2033 LOG (llevError, "move_player: invalid direction %d\n", dir); 2031 LOG (llevError, "move_player: invalid direction %d\n", dir);
2034 return 0; 2032 return 0;
2035 } 2033 }
2036 2034

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines