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.16 by root, Tue Dec 12 20:53:03 2006 UTC vs.
Revision 1.17 by root, Tue Dec 12 21:39:57 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 op->remove (); 63
64 op->destroy (0); 64 op->destroy ();
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 op->remove (); 92
93 op->destroy (0); 93 op->destroy ();
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 op->remove (); 225
226 op->destroy (0); 226 op->destroy ();
227} 227}
228 228
229void 229void
230remove_blindness (object *op) 230remove_blindness (object *op)
231{ 231{
232 if (--op->stats.food > 0) 232 if (--op->stats.food > 0)
233 return; 233 return;
234
234 CLEAR_FLAG (op, FLAG_APPLIED); 235 CLEAR_FLAG (op, FLAG_APPLIED);
236
235 if (op->env != NULL) 237 if (op->env != NULL)
236 { 238 {
237 change_abil (op->env, op); 239 change_abil (op->env, op);
238 fix_player (op->env); 240 fix_player (op->env);
239 } 241 }
240 op->remove (); 242
241 op->destroy (0); 243 op->destroy ();
242} 244}
243 245
244void 246void
245poison_more (object *op) 247poison_more (object *op)
246{ 248{
247 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) 249 if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0)
248 { 250 {
249 op->remove ();
250 op->destroy (0); 251 op->destroy ();
251 return; 252 return;
252 } 253 }
254
253 if (op->stats.food == 1) 255 if (op->stats.food == 1)
254 { 256 {
255 /* need to remove the object before fix_player is called, else fix_player 257 /* need to remove the object before fix_player is called, else fix_player
256 * will not do anything. 258 * will not do anything.
257 */ 259 */
259 { 261 {
260 CLEAR_FLAG (op, FLAG_APPLIED); 262 CLEAR_FLAG (op, FLAG_APPLIED);
261 fix_player (op->env); 263 fix_player (op->env);
262 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now."); 264 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now.");
263 } 265 }
264 op->remove (); 266
265 op->destroy (0); 267 op->destroy ();
266 return; 268 return;
267 } 269 }
270
268 if (op->env->type == PLAYER) 271 if (op->env->type == PLAYER)
269 { 272 {
270 op->env->stats.food--; 273 op->env->stats.food--;
271 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel very sick..."); 274 new_draw_info (NDI_UNIQUE, 0, op->env, "You feel very sick...");
272 } 275 }
592 object *payload = op->inv; 595 object *payload = op->inv;
593 596
594 if (payload == NULL) 597 if (payload == NULL)
595 return NULL; 598 return NULL;
596 payload->remove (); 599 payload->remove ();
597 op->remove ();
598 op->destroy (0); 600 op->destroy ();
599 return payload; 601 return payload;
600 } 602 }
601 603
602 case ARROW: 604 case ARROW:
603 if (op->speed >= MIN_ACTIVE_SPEED) 605 if (op->speed >= MIN_ACTIVE_SPEED)
630fix_stopped_arrow (object *op) 632fix_stopped_arrow (object *op)
631{ 633{
632 if (rndm (0, 99) < op->stats.food) 634 if (rndm (0, 99) < op->stats.food)
633 { 635 {
634 /* Small chance of breaking */ 636 /* Small chance of breaking */
635 op->remove ();
636 op->destroy (0); 637 op->destroy ();
637 return NULL; 638 return NULL;
638 } 639 }
639 640
640 op->direction = 0; 641 op->direction = 0;
641 op->move_on = 0; 642 op->move_on = 0;
688 object *payload = op->inv; 689 object *payload = op->inv;
689 690
690 payload->remove (); 691 payload->remove ();
691 clear_owner (payload); 692 clear_owner (payload);
692 insert_ob_in_map (payload, op->map, payload, 0); 693 insert_ob_in_map (payload, op->map, payload, 0);
693 op->remove ();
694 op->destroy (0); 694 op->destroy ();
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 op->remove ();
719 op->destroy (0); 718 op->destroy ();
720 return; 719 return;
721 } 720 }
722 721
723 /* we need to stop thrown objects at some point. Like here. */ 722 /* we need to stop thrown objects at some point. Like here. */
724 if (op->type == THROWN_OBJ) 723 if (op->type == THROWN_OBJ)
731 * bomb code, but there are potential other cases where that could happen, 730 * bomb code, but there are potential other cases where that could happen,
732 * and it is easy enough to clean it up here. 731 * and it is easy enough to clean it up here.
733 */ 732 */
734 if (op->inv == NULL) 733 if (op->inv == NULL)
735 { 734 {
736 op->remove ();
737 op->destroy (0); 735 op->destroy ();
738 return; 736 return;
739 } 737 }
740 738
741 if (op->last_sp-- < 0) 739 if (op->last_sp-- < 0)
742 { 740 {
953 } 951 }
954 else 952 else
955 { 953 {
956 j = find_first_free_spot (tmp, op->map, op->x, op->y); 954 j = find_first_free_spot (tmp, op->map, op->x, op->y);
957 if (j == -1) /* No free spot */ 955 if (j == -1) /* No free spot */
958 tmp->destroy (0); 956 tmp->destroy ();
959 else 957 else
960 { 958 {
961 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; 959 tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j];
962 insert_ob_in_map (tmp, op->map, op, 0); 960 insert_ob_in_map (tmp, op->map, op, 0);
963 } 961 }
964 } 962 }
965 } 963 }
964
966 op->destroy (0); 965 op->destroy ();
967} 966}
968 967
969void 968void
970move_teleporter (object *op) 969move_teleporter (object *op)
971{ 970{
1008 else if (EXIT_X (head) || EXIT_Y (head)) 1007 else if (EXIT_X (head) || EXIT_Y (head))
1009 { 1008 {
1010 if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head))) 1009 if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head)))
1011 { 1010 {
1012 LOG (llevError, "Removed illegal teleporter.\n"); 1011 LOG (llevError, "Removed illegal teleporter.\n");
1013 head->remove ();
1014 head->destroy (0); 1012 head->destroy ();
1015 return; 1013 return;
1016 } 1014 }
1015
1017 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) 1016 if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp)))
1018 return; 1017 return;
1018
1019 transfer_ob (tmp, EXIT_X (head), EXIT_Y (head), 0, head); 1019 transfer_ob (tmp, EXIT_X (head), EXIT_Y (head), 0, head);
1020 } 1020 }
1021 else 1021 else
1022 { 1022 {
1023 /* Random teleporter */ 1023 /* Random teleporter */
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 op->remove (); 1137 op->remove ();
1138 op->destroy (0);
1139 return; 1138 return;
1140 } 1139 }
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;
1144 if (get_map_flags (m, &m, nx, ny, &nx, &ny) & P_OUT_OF_MAP) 1144 if (get_map_flags (m, &m, nx, ny, &nx, &ny) & P_OUT_OF_MAP)
1145 { 1145 {
1223 for (tmp = op->above; tmp != NULL; tmp = tmp->above) 1223 for (tmp = op->above; tmp != NULL; tmp = tmp->above)
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 {
1229 tmp->remove ();
1230 tmp->destroy (0); 1228 tmp->destroy ();
1231 }
1232 else 1229 else
1233 { 1230 {
1234 uint64 new_nrof = (uint64) tmp->nrof * op->level; 1231 uint64 new_nrof = (uint64) tmp->nrof * op->level;
1235 1232
1236 if (new_nrof >= 1UL << 31) 1233 if (new_nrof >= 1UL << 31)
1237 new_nrof = 1UL << 31; 1234 new_nrof = 1UL << 31;
1235
1238 tmp->nrof = new_nrof; 1236 tmp->nrof = new_nrof;
1239 } 1237 }
1238
1240 break; 1239 break;
1241 } 1240 }
1242 } 1241 }
1243} 1242}
1244 1243
1300 } 1299 }
1301 1300
1302 /* Make sure this multipart object fits */ 1301 /* Make sure this multipart object fits */
1303 if (new_ob->arch->more && ob_blocked (new_ob, creator->map, creator->x, creator->y)) 1302 if (new_ob->arch->more && ob_blocked (new_ob, creator->map, creator->x, creator->y))
1304 { 1303 {
1305 new_ob->destroy (0); 1304 new_ob->destroy ();
1306 return; 1305 return;
1307 } 1306 }
1308 1307
1309 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y); 1308 insert_ob_in_map_at (new_ob, creator->map, creator, 0, creator->x, creator->y);
1310 if (QUERY_FLAG (new_ob, FLAG_FREED)) 1309 if (QUERY_FLAG (new_ob, FLAG_FREED))
1341 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) 1340 if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name))
1342 break; 1341 break;
1343 } 1342 }
1344 1343
1345 if (tmp2) 1344 if (tmp2)
1346 {
1347 tmp2->remove ();
1348 tmp2->destroy (0); 1345 tmp2->destroy ();
1349 }
1350 1346
1351 /* cycle through his inventory to look for the MARK we want to 1347 /* cycle through his inventory to look for the MARK we want to
1352 * place 1348 * place
1353 */ 1349 */
1354 for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) 1350 for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below)
1383 { 1379 {
1384 op->stats.hp--; 1380 op->stats.hp--;
1385 if (op->stats.hp == 0) 1381 if (op->stats.hp == 0)
1386 { 1382 {
1387 /* marker expires--granted mark number limit */ 1383 /* marker expires--granted mark number limit */
1388 op->remove ();
1389 op->destroy (0); 1384 op->destroy ();
1390 return; 1385 return;
1391 } 1386 }
1392 } 1387 }
1393 } /* if tmp2 == NULL */ 1388 } /* if tmp2 == NULL */
1394 } /* if tmp->type == PLAYER */ 1389 } /* if tmp->type == PLAYER */
1443 op->remove (); 1438 op->remove ();
1444 1439
1445 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE)) 1440 if (QUERY_FLAG (op, FLAG_SEE_ANYWHERE))
1446 make_sure_not_seen (op); 1441 make_sure_not_seen (op);
1447 1442
1448 op->destroy (0); 1443 op->destroy ();
1449 } 1444 }
1450 1445
1451 return 1; 1446 return 1;
1452 } 1447 }
1453 1448

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines