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.250 by root, Sat Dec 12 03:17:21 2009 UTC vs.
Revision 1.255 by root, Fri Mar 26 00:53:26 2010 UTC

110 link_skills (); 110 link_skills ();
111 111
112 assign (title, ob->arch->object::name); 112 assign (title, ob->arch->object::name);
113 113
114 /* if it's a dragon player, set the correct title here */ 114 /* if it's a dragon player, set the correct title here */
115 if (is_dragon_pl (ob)) 115 if (ob->is_dragon ())
116 { 116 {
117 object *tmp, *abil = 0, *skin = 0; 117 object *tmp, *abil = 0, *skin = 0;
118 118
119 for (tmp = ob->inv; tmp; tmp = tmp->below) 119 for (tmp = ob->inv; tmp; tmp = tmp->below)
120 if (tmp->type == FORCE) 120 if (tmp->type == FORCE)
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
3045 && tmp->name == shstr_battleground 3043 && tmp->name == shstr_battleground
3046 && EXIT_X (tmp) && EXIT_Y (tmp)) 3044 && EXIT_X (tmp) && EXIT_Y (tmp))
3047 { 3045 {
3048 /* before we assign the exit, check if this is a teambattle */ 3046 /* before we assign the exit, check if this is a teambattle */
3049 if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp)) 3047 if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp))
3050 {
3051 for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below) 3048 for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below)
3049 if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying)
3052 { 3050 {
3053 if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying)
3054 {
3055 if (x && y) 3051 if (x && y)
3056 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); 3052 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp);
3057 3053
3058 return 1; 3054 return 1;
3059 }
3060 } 3055 }
3061 }
3062 3056
3063 if (x && y) 3057 if (x && y)
3064 *x = EXIT_X (tmp), *y = EXIT_Y (tmp); 3058 *x = EXIT_X (tmp), *y = EXIT_Y (tmp);
3065 3059
3066 return 1; 3060 return 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines