… | |
… | |
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 | |