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

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.24 by root, Sat Dec 9 16:11:09 2006 UTC vs.
Revision 1.25 by root, Tue Dec 12 20:53:03 2006 UTC

219 if (tmp) 219 if (tmp)
220 esrv_del_item (tmp->contr, op->count); 220 esrv_del_item (tmp->contr, op->count);
221 } 221 }
222 222
223 if (!QUERY_FLAG (op, FLAG_REMOVED)) 223 if (!QUERY_FLAG (op, FLAG_REMOVED))
224 remove_ob (op); 224 op->remove ();
225 225
226 free_object (op); 226 op->destroy (0);
227 } 227 }
228 228
229 if (type & (AT_FIRE | AT_ELECTRICITY)) 229 if (type & (AT_FIRE | AT_ELECTRICITY))
230 if (env) 230 if (env)
231 { 231 {
264 tmp->move_slow = 0; 264 tmp->move_slow = 0;
265 insert_ob_in_map (tmp, op->map, originator, 0); 265 insert_ob_in_map (tmp, op->map, originator, 0);
266 } 266 }
267 267
268 if (!QUERY_FLAG (op, FLAG_REMOVED)) 268 if (!QUERY_FLAG (op, FLAG_REMOVED))
269 remove_ob (op); 269 op->remove ();
270 270
271 insert_ob_in_ob (op, tmp); 271 insert_ob_in_ob (op, tmp);
272 return; 272 return;
273 } 273 }
274} 274}
906 if (op->weight <= 5000 && tmp->stats.hp >= 0) 906 if (op->weight <= 5000 && tmp->stats.hp >= 0)
907 { 907 {
908 if (tmp->head != NULL) 908 if (tmp->head != NULL)
909 tmp = tmp->head; 909 tmp = tmp->head;
910 910
911 remove_ob (op); 911 op->remove ();
912 op = insert_ob_in_ob (op, tmp); 912 op = insert_ob_in_ob (op, tmp);
913 913
914 if (tmp->type == PLAYER) 914 if (tmp->type == PLAYER)
915 esrv_send_item (tmp, op); 915 esrv_send_item (tmp, op);
916 916
935 /* Disassemble missile */ 935 /* Disassemble missile */
936 if (op->inv) 936 if (op->inv)
937 { 937 {
938 container = op; 938 container = op;
939 hitter = op->inv; 939 hitter = op->inv;
940 remove_ob (hitter); 940 hitter->remove ();
941 insert_ob_in_map (hitter, container->map, hitter, INS_NO_MERGE | INS_NO_WALK_ON); 941 insert_ob_in_map (hitter, container->map, hitter, INS_NO_MERGE | INS_NO_WALK_ON);
942 /* Note that we now have an empty THROWN_OBJ on the map. Code that 942 /* Note that we now have an empty THROWN_OBJ on the map. Code that
943 * might be called until this THROWN_OBJ is either reassembled or 943 * might be called until this THROWN_OBJ is either reassembled or
944 * removed at the end of this function must be able to deal with empty 944 * removed at the end of this function must be able to deal with empty
945 * THROWN_OBJs. */ 945 * THROWN_OBJs. */
961 */ 961 */
962 if (hitter->destroyed () || hitter->env != NULL) 962 if (hitter->destroyed () || hitter->env != NULL)
963 { 963 {
964 if (container) 964 if (container)
965 { 965 {
966 remove_ob (container); 966 container->remove ();
967 free_object (container); 967 container->destroy (0);
968 } 968 }
969 969
970 return 0; 970 return 0;
971 } 971 }
972 972
983 if (!hitter) 983 if (!hitter)
984 return 0; 984 return 0;
985 } 985 }
986 else 986 else
987 { 987 {
988 remove_ob (container); 988 container->remove ();
989 free_object (container); 989 container->destroy (0);
990 } 990 }
991 991
992 /* Try to stick arrow into victim */ 992 /* Try to stick arrow into victim */
993 if (!victim->destroyed () && stick_arrow (hitter, victim)) 993 if (!victim->destroyed () && stick_arrow (hitter, victim))
994 return 0; 994 return 0;
1000 * can fly over but not otherwise move over. What is the correct 1000 * can fly over but not otherwise move over. What is the correct
1001 * way to handle those otherwise? 1001 * way to handle those otherwise?
1002 */ 1002 */
1003 if (victim->x != hitter->x || victim->y != hitter->y) 1003 if (victim->x != hitter->x || victim->y != hitter->y)
1004 { 1004 {
1005 remove_ob (hitter); 1005 hitter->remove ();
1006 hitter->x = victim->x; 1006 hitter->x = victim->x;
1007 hitter->y = victim->y; 1007 hitter->y = victim->y;
1008 insert_ob_in_map (hitter, victim->map, hitter, 0); 1008 insert_ob_in_map (hitter, victim->map, hitter, 0);
1009 } 1009 }
1010 else 1010 else
1018 op->speed -= 1.0; 1018 op->speed -= 1.0;
1019 1019
1020 /* Missile missed victim - reassemble missile */ 1020 /* Missile missed victim - reassemble missile */
1021 if (container) 1021 if (container)
1022 { 1022 {
1023 remove_ob (hitter); 1023 hitter->remove ();
1024 insert_ob_in_ob (hitter, container); 1024 insert_ob_in_ob (hitter, container);
1025 } 1025 }
1026 1026
1027 return op; 1027 return op;
1028} 1028}
1041 else if (!GET_ANIM_ID (op)) 1041 else if (!GET_ANIM_ID (op))
1042 { 1042 {
1043 /* Object has been called - no animations, so remove it */ 1043 /* Object has been called - no animations, so remove it */
1044 if (op->stats.hp < 0) 1044 if (op->stats.hp < 0)
1045 { 1045 {
1046 remove_ob (op); /* Should update LOS */ 1046 op->remove (); /* Should update LOS */
1047 free_object (op); 1047 op->destroy (0);
1048 /* Don't know why this is here - remove_ob should do it for us */ 1048 /* Don't know why this is here - remove_ob should do it for us */
1049 /*update_position(m, x, y); */ 1049 /*update_position(m, x, y); */
1050 } 1050 }
1051 return; /* no animations, so nothing more to do */ 1051 return; /* no animations, so nothing more to do */
1052 } 1052 }
1060 if (perc == NUM_ANIMATIONS (op) - 1) 1060 if (perc == NUM_ANIMATIONS (op) - 1)
1061 { /* Reached the last animation */ 1061 { /* Reached the last animation */
1062 if (op->face == blank_face) 1062 if (op->face == blank_face)
1063 { 1063 {
1064 /* If the last face is blank, remove the ob */ 1064 /* If the last face is blank, remove the ob */
1065 remove_ob (op); /* Should update LOS */ 1065 op->remove (); /* Should update LOS */
1066 free_object (op); 1066 op->destroy (0);
1067 1067
1068 /* remove_ob should call update_position for us */ 1068 /* remove_ob should call update_position for us */
1069 /*update_position(m, x, y); */ 1069 /*update_position(m, x, y); */
1070 1070
1071 } 1071 }
1454 remove_friendly_object (op); 1454 remove_friendly_object (op);
1455 1455
1456 if (get_owner (op) && op->owner->type == PLAYER && op->owner->contr->ranges[range_golem] == op) 1456 if (get_owner (op) && op->owner->type == PLAYER && op->owner->contr->ranges[range_golem] == op)
1457 op->owner->contr->ranges[range_golem] = 0; 1457 op->owner->contr->ranges[range_golem] = 0;
1458 1458
1459 remove_ob (op); 1459 op->remove ();
1460 free_object (op); 1460 op->destroy (0);
1461 return maxdam; 1461 return maxdam;
1462 } 1462 }
1463 1463
1464 /* Now lets start dealing with experience we get for killing something */ 1464 /* Now lets start dealing with experience we get for killing something */
1465 1465
1664 } 1664 }
1665 1665
1666 remove_friendly_object (op); 1666 remove_friendly_object (op);
1667 } 1667 }
1668 1668
1669 remove_ob (op); 1669 op->remove ();
1670 free_object (op); 1670 op->destroy (0);
1671 } 1671 }
1672 else 1672 else
1673 { 1673 {
1674 /* Player has been killed! */ 1674 /* Player has been killed! */
1675 if (owner->type == PLAYER) 1675 if (owner->type == PLAYER)
1967 */ 1967 */
1968 if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) 1968 if (QUERY_FLAG (hitter, FLAG_ONE_HIT))
1969 { 1969 {
1970 if (QUERY_FLAG (hitter, FLAG_FRIENDLY)) 1970 if (QUERY_FLAG (hitter, FLAG_FRIENDLY))
1971 remove_friendly_object (hitter); 1971 remove_friendly_object (hitter);
1972 remove_ob (hitter); 1972 hitter->remove ();
1973 free_object (hitter); 1973 hitter->destroy (0);
1974 } 1974 }
1975 /* Lets handle creatures that are splitting now */ 1975 /* Lets handle creatures that are splitting now */
1976 else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) 1976 else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING))
1977 { 1977 {
1978 int i; 1978 int i;
1983 if (!op->other_arch) 1983 if (!op->other_arch)
1984 { 1984 {
1985 LOG (llevError, "SPLITTING without other_arch error.\n"); 1985 LOG (llevError, "SPLITTING without other_arch error.\n");
1986 return maxdam; 1986 return maxdam;
1987 } 1987 }
1988 remove_ob (op); 1988 op->remove ();
1989 for (i = 0; i < NROFNEWOBJS (op); i++) 1989 for (i = 0; i < NROFNEWOBJS (op); i++)
1990 { /* This doesn't handle op->more yet */ 1990 { /* This doesn't handle op->more yet */
1991 object *tmp = arch_to_object (op->other_arch); 1991 object *tmp = arch_to_object (op->other_arch);
1992 int j; 1992 int j;
1993 1993
2002 } 2002 }
2003 if (unaggressive) 2003 if (unaggressive)
2004 SET_FLAG (tmp, FLAG_UNAGGRESSIVE); 2004 SET_FLAG (tmp, FLAG_UNAGGRESSIVE);
2005 j = find_first_free_spot (tmp, op->map, op->x, op->y); 2005 j = find_first_free_spot (tmp, op->map, op->x, op->y);
2006 if (j == -1) /* No spot to put this monster */ 2006 if (j == -1) /* No spot to put this monster */
2007 free_object (tmp); 2007 tmp->destroy (0);
2008 else 2008 else
2009 { 2009 {
2010 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; 2010 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j];
2011 insert_ob_in_map (tmp, op->map, NULL, 0); 2011 insert_ob_in_map (tmp, op->map, NULL, 0);
2012 } 2012 }
2013 } 2013 }
2014 if (friendly) 2014 if (friendly)
2015 remove_friendly_object (op); 2015 remove_friendly_object (op);
2016 free_object (op); 2016 op->destroy (0);
2017 } 2017 }
2018 else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) 2018 else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10)
2019 { 2019 {
2020 remove_ob (hitter); 2020 hitter->remove ();
2021 free_object (hitter); 2021 hitter->destroy (0);
2022 } 2022 }
2023 return maxdam; 2023 return maxdam;
2024} 2024}
2025 2025
2026 2026

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines