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

Comparing deliantra/server/server/time.C (file contents):
Revision 1.15 by root, Tue Nov 7 16:30:55 2006 UTC vs.
Revision 1.16 by root, Tue Dec 12 20:53:03 2006 UTC

58 tmp->y = op->y; 58 tmp->y = op->y;
59 tmp->map = op->map; 59 tmp->map = op->map;
60 tmp->level = op->level; 60 tmp->level = op->level;
61 insert_ob_in_map (tmp, op->map, op, 0); 61 insert_ob_in_map (tmp, op->map, op, 0);
62 } 62 }
63 remove_ob (op); 63 op->remove ();
64 free_object (op); 64 op->destroy (0);
65} 65}
66 66
67void 67void
68remove_door2 (object *op) 68remove_door2 (object *op)
69{ 69{
87 tmp->y = op->y; 87 tmp->y = op->y;
88 tmp->map = op->map; 88 tmp->map = op->map;
89 tmp->level = op->level; 89 tmp->level = op->level;
90 insert_ob_in_map (tmp, op->map, op, 0); 90 insert_ob_in_map (tmp, op->map, op, 0);
91 } 91 }
92 remove_ob (op); 92 op->remove ();
93 free_object (op); 93 op->destroy (0);
94} 94}
95 95
96/* Will generate a monster according to content 96/* Will generate a monster according to content
97 * of generator. 97 * of generator.
98 */ 98 */
220 CLEAR_FLAG (op, FLAG_APPLIED); 220 CLEAR_FLAG (op, FLAG_APPLIED);
221 change_abil (op->env, op); 221 change_abil (op->env, op);
222 fix_player (op->env); 222 fix_player (op->env);
223 } 223 }
224 } 224 }
225 remove_ob (op); 225 op->remove ();
226 free_object (op); 226 op->destroy (0);
227} 227}
228 228
229void 229void
230remove_blindness (object *op) 230remove_blindness (object *op)
231{ 231{
235 if (op->env != NULL) 235 if (op->env != NULL)
236 { 236 {
237 change_abil (op->env, op); 237 change_abil (op->env, op);
238 fix_player (op->env); 238 fix_player (op->env);
239 } 239 }
240 remove_ob (op); 240 op->remove ();
241 free_object (op); 241 op->destroy (0);
242} 242}
243 243
244void 244void
245poison_more (object *op) 245poison_more (object *op)
246{ 246{
247 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) 247 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0)
248 { 248 {
249 remove_ob (op); 249 op->remove ();
250 free_object (op); 250 op->destroy (0);
251 return; 251 return;
252 } 252 }
253 if (op->stats.food == 1) 253 if (op->stats.food == 1)
254 { 254 {
255 /* need to remove the object before fix_player is called, else fix_player 255 /* need to remove the object before fix_player is called, else fix_player
259 { 259 {
260 CLEAR_FLAG (op, FLAG_APPLIED); 260 CLEAR_FLAG (op, FLAG_APPLIED);
261 fix_player (op->env); 261 fix_player (op->env);
262 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now."); 262 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now.");
263 } 263 }
264 remove_ob (op); 264 op->remove ();
265 free_object (op); 265 op->destroy (0);
266 return; 266 return;
267 } 267 }
268 if (op->env->type == PLAYER) 268 if (op->env->type == PLAYER)
269 { 269 {
270 op->env->stats.food--; 270 op->env->stats.food--;
382 int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); 382 int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9);
383 383
384 /* If there is a free spot, move the object someplace */ 384 /* If there is a free spot, move the object someplace */
385 if (i != -1) 385 if (i != -1)
386 { 386 {
387 remove_ob (tmp); 387 tmp->remove ();
388 tmp->x += freearr_x[i], tmp->y += freearr_y[i]; 388 tmp->x += freearr_x[i], tmp->y += freearr_y[i];
389 insert_ob_in_map (tmp, op->map, op, 0); 389 insert_ob_in_map (tmp, op->map, op, 0);
390 } 390 }
391 } 391 }
392 } 392 }
591 { 591 {
592 object *payload = op->inv; 592 object *payload = op->inv;
593 593
594 if (payload == NULL) 594 if (payload == NULL)
595 return NULL; 595 return NULL;
596 remove_ob (payload); 596 payload->remove ();
597 remove_ob (op); 597 op->remove ();
598 free_object (op); 598 op->destroy (0);
599 return payload; 599 return payload;
600 } 600 }
601 601
602 case ARROW: 602 case ARROW:
603 if (op->speed >= MIN_ACTIVE_SPEED) 603 if (op->speed >= MIN_ACTIVE_SPEED)
630fix_stopped_arrow (object *op) 630fix_stopped_arrow (object *op)
631{ 631{
632 if (rndm (0, 99) < op->stats.food) 632 if (rndm (0, 99) < op->stats.food)
633 { 633 {
634 /* Small chance of breaking */ 634 /* Small chance of breaking */
635 remove_ob (op); 635 op->remove ();
636 free_object (op); 636 op->destroy (0);
637 return NULL; 637 return NULL;
638 } 638 }
639 639
640 op->direction = 0; 640 op->direction = 0;
641 op->move_on = 0; 641 op->move_on = 0;
685 685
686 if (op->inv) 686 if (op->inv)
687 { 687 {
688 object *payload = op->inv; 688 object *payload = op->inv;
689 689
690 remove_ob (payload); 690 payload->remove ();
691 clear_owner (payload); 691 clear_owner (payload);
692 insert_ob_in_map (payload, op->map, payload, 0); 692 insert_ob_in_map (payload, op->map, payload, 0);
693 remove_ob (op); 693 op->remove ();
694 free_object (op); 694 op->destroy (0);
695 } 695 }
696 else 696 else
697 { 697 {
698 op = fix_stopped_arrow (op); 698 op = fix_stopped_arrow (op);
699 if (op) 699 if (op)
713 maptile *m; 713 maptile *m;
714 714
715 if (op->map == NULL) 715 if (op->map == NULL)
716 { 716 {
717 LOG (llevError, "BUG: Arrow had no map.\n"); 717 LOG (llevError, "BUG: Arrow had no map.\n");
718 remove_ob (op); 718 op->remove ();
719 free_object (op); 719 op->destroy (0);
720 return; 720 return;
721 } 721 }
722 722
723 /* we need to stop thrown objects at some point. Like here. */ 723 /* we need to stop thrown objects at some point. Like here. */
724 if (op->type == THROWN_OBJ) 724 if (op->type == THROWN_OBJ)
731 * bomb code, but there are potential other cases where that could happen, 731 * bomb code, but there are potential other cases where that could happen,
732 * and it is easy enough to clean it up here. 732 * and it is easy enough to clean it up here.
733 */ 733 */
734 if (op->inv == NULL) 734 if (op->inv == NULL)
735 { 735 {
736 remove_ob (op); 736 op->remove ();
737 free_object (op); 737 op->destroy (0);
738 return; 738 return;
739 } 739 }
740 740
741 if (op->last_sp-- < 0) 741 if (op->last_sp-- < 0)
742 { 742 {
892 SET_ANIMATION (op, op->direction); 892 SET_ANIMATION (op, op->direction);
893 } /* object is reflected */ 893 } /* object is reflected */
894 } /* object ran into a wall */ 894 } /* object ran into a wall */
895 895
896 /* Move the arrow. */ 896 /* Move the arrow. */
897 remove_ob (op); 897 op->remove ();
898 op->x = new_x; 898 op->x = new_x;
899 op->y = new_y; 899 op->y = new_y;
900 900
901 /* decrease the speed as it flies. 0.05 means a standard bow will shoot 901 /* decrease the speed as it flies. 0.05 means a standard bow will shoot
902 * about 17 squares. Tune as needed. 902 * about 17 squares. Tune as needed.
928 return; 928 return;
929 else 929 else
930 op->stats.food = 1; /* so 1 other_arch is made */ 930 op->stats.food = 1; /* so 1 other_arch is made */
931 } 931 }
932 env = op->env; 932 env = op->env;
933 remove_ob (op); 933 op->remove ();
934 for (i = 0; i < NROFNEWOBJS (op); i++) 934 for (i = 0; i < NROFNEWOBJS (op); i++)
935 { 935 {
936 tmp = arch_to_object (op->other_arch); 936 tmp = arch_to_object (op->other_arch);
937 if (op->type == LAMP) 937 if (op->type == LAMP)
938 tmp->stats.food = op->stats.food - 1; 938 tmp->stats.food = op->stats.food - 1;
953 } 953 }
954 else 954 else
955 { 955 {
956 j = find_first_free_spot (tmp, op->map, op->x, op->y); 956 j = find_first_free_spot (tmp, op->map, op->x, op->y);
957 if (j == -1) /* No free spot */ 957 if (j == -1) /* No free spot */
958 free_object (tmp); 958 tmp->destroy (0);
959 else 959 else
960 { 960 {
961 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; 961 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j];
962 insert_ob_in_map (tmp, op->map, op, 0); 962 insert_ob_in_map (tmp, op->map, op, 0);
963 } 963 }
964 } 964 }
965 } 965 }
966 free_object (op); 966 op->destroy (0);
967} 967}
968 968
969void 969void
970move_teleporter (object *op) 970move_teleporter (object *op)
971{ 971{
1008 else if (EXIT_X (head) || EXIT_Y (head)) 1008 else if (EXIT_X (head) || EXIT_Y (head))
1009 { 1009 {
1010 if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head))) 1010 if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head)))
1011 { 1011 {
1012 LOG (llevError, "Removed illegal teleporter.\n"); 1012 LOG (llevError, "Removed illegal teleporter.\n");
1013 remove_ob (head); 1013 head->remove ();
1014 free_object (head); 1014 head->destroy (0);
1015 return; 1015 return;
1016 } 1016 }
1017 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) 1017 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp)))
1018 return; 1018 return;
1019 transfer_ob (tmp, EXIT_X (head), EXIT_Y (head), 0, head); 1019 transfer_ob (tmp, EXIT_X (head), EXIT_Y (head), 0, head);
1132 if (victim->head) 1132 if (victim->head)
1133 victim = victim->head; 1133 victim = victim->head;
1134 1134
1135 if (QUERY_FLAG (op, FLAG_LIFESAVE) && op->stats.hp-- < 0) 1135 if (QUERY_FLAG (op, FLAG_LIFESAVE) && op->stats.hp-- < 0)
1136 { 1136 {
1137 remove_ob (op); 1137 op->remove ();
1138 free_object (op); 1138 op->destroy (0);
1139 return; 1139 return;
1140 } 1140 }
1141 nx = op->x + freearr_x[dir]; 1141 nx = op->x + freearr_x[dir];
1142 ny = op->y + freearr_y[dir]; 1142 ny = op->y + freearr_y[dir];
1143 m = op->map; 1143 m = op->map;
1224 { 1224 {
1225 if (strcmp (op->other_arch->name, tmp->arch->name) == 0) 1225 if (strcmp (op->other_arch->name, tmp->arch->name) == 0)
1226 { 1226 {
1227 if (op->level <= 0) 1227 if (op->level <= 0)
1228 { 1228 {
1229 remove_ob (tmp); 1229 tmp->remove ();
1230 free_object (tmp); 1230 tmp->destroy (0);
1231 } 1231 }
1232 else 1232 else
1233 { 1233 {
1234 uint64 new_nrof = (uint64) tmp->nrof * op->level; 1234 uint64 new_nrof = (uint64) tmp->nrof * op->level;
1235 1235
1300 } 1300 }
1301 1301
1302 /* Make sure this multipart object fits */ 1302 /* Make sure this multipart object fits */
1303 if (new_ob->arch->more && ob_blocked (new_ob, creator->map, creator->x, creator->y)) 1303 if (new_ob->arch->more && ob_blocked (new_ob, creator->map, creator->x, creator->y))
1304 { 1304 {
1305 free_object (new_ob); 1305 new_ob->destroy (0);
1306 return; 1306 return;
1307 } 1307 }
1308 1308
1309 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y); 1309 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y);
1310 if (QUERY_FLAG (new_ob, FLAG_FREED)) 1310 if (QUERY_FLAG (new_ob, FLAG_FREED))
1342 break; 1342 break;
1343 } 1343 }
1344 1344
1345 if (tmp2) 1345 if (tmp2)
1346 { 1346 {
1347 remove_ob (tmp2); 1347 tmp2->remove ();
1348 free_object (tmp2); 1348 tmp2->destroy (0);
1349 } 1349 }
1350 1350
1351 /* cycle through his inventory to look for the MARK we want to 1351 /* cycle through his inventory to look for the MARK we want to
1352 * place 1352 * place
1353 */ 1353 */
1383 { 1383 {
1384 op->stats.hp--; 1384 op->stats.hp--;
1385 if (op->stats.hp == 0) 1385 if (op->stats.hp == 0)
1386 { 1386 {
1387 /* marker expires--granted mark number limit */ 1387 /* marker expires--granted mark number limit */
1388 remove_ob (op); 1388 op->remove ();
1389 free_object (op); 1389 op->destroy (0);
1390 return; 1390 return;
1391 } 1391 }
1392 } 1392 }
1393 } /* if tmp2 == NULL */ 1393 } /* if tmp2 == NULL */
1394 } /* if tmp->type == PLAYER */ 1394 } /* if tmp->type == PLAYER */
1438 object *pl = is_player_inv (op); 1438 object *pl = is_player_inv (op);
1439 1439
1440 if (pl) 1440 if (pl)
1441 esrv_del_item (pl->contr, op->count); 1441 esrv_del_item (pl->contr, op->count);
1442 1442
1443 remove_ob (op); 1443 op->remove ();
1444 1444
1445 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1445 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1446 make_sure_not_seen (op); 1446 make_sure_not_seen (op);
1447 1447
1448 free_object (op); 1448 op->destroy (0);
1449 } 1449 }
1450 1450
1451 return 1; 1451 return 1;
1452 } 1452 }
1453 1453

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines