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.25 by root, Sat Sep 16 22:24:13 2006 UTC vs.
Revision 1.31 by pippijn, Mon Dec 11 19:46:47 2006 UTC

20 20
21 The author can be reached via e-mail to <crossfire@schmorp.de> 21 The author can be reached via e-mail to <crossfire@schmorp.de>
22*/ 22*/
23 23
24#include <global.h> 24#include <global.h>
25#ifndef WIN32 /* ---win32 remove headers */
26# include <pwd.h> 25#include <pwd.h>
27#endif
28#ifndef __CEXTRACT__ 26#ifndef __CEXTRACT__
29# include <sproto.h> 27# include <sproto.h>
30#endif 28#endif
31#include <sounds.h> 29#include <sounds.h>
32#include <living.h> 30#include <living.h>
329 player *p; 327 player *p;
330 328
331 p = get_player (NULL); 329 p = get_player (NULL);
332 p->socket = *ns; 330 p->socket = *ns;
333 p->socket.faces_sent = (uint8 *) malloc (p->socket.faces_sent_len * sizeof (*p->socket.faces_sent)); 331 p->socket.faces_sent = (uint8 *) malloc (p->socket.faces_sent_len * sizeof (*p->socket.faces_sent));
332
334 if (p->socket.faces_sent == NULL) 333 if (p->socket.faces_sent == NULL)
335 fatal (OUT_OF_MEMORY); 334 fatal (OUT_OF_MEMORY);
335
336 memcpy (p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len * sizeof (*p->socket.faces_sent)); 336 memcpy (p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len * sizeof (*p->socket.faces_sent));
337 /* Needed because the socket we just copied over needs to be cleared. 337 /* Needed because the socket we just copied over needs to be cleared.
338 * Note that this can result in a client reset if there is partial data 338 * Note that this can result in a client reset if there is partial data
339 * on the uncoming socket. 339 * on the uncoming socket.
340 */ 340 */
345 add_friendly_object (p->ob); 345 add_friendly_object (p->ob);
346 send_rules (p->ob); 346 send_rules (p->ob);
347 send_news (p->ob); 347 send_news (p->ob);
348 display_motd (p->ob); 348 display_motd (p->ob);
349 get_name (p->ob); 349 get_name (p->ob);
350
350 return 0; 351 return 0;
351} 352}
352 353
353/* 354/*
354 * get_player_archetype() return next player archetype from archetype 355 * get_player_archetype() return next player archetype from archetype
765 player *pl = op->contr; 766 player *pl = op->contr;
766 shstr name = op->name; 767 shstr name = op->name;
767 768
768 op->contr = 0; 769 op->contr = 0;
769 op->type = 0; 770 op->type = 0;
770 op->free (1); 771 op->destroy (1);
771 pl = get_player (pl); 772 pl = get_player (pl);
772 op = pl->ob; 773 op = pl->ob;
773 add_friendly_object (op); 774 add_friendly_object (op);
774 op->contr->password[0] = '~'; 775 op->contr->password[0] = '~';
775 op->name = op->name_pl = 0; 776 op->name = op->name_pl = 0;
1423 /* question: don't pick up known-poisonous stuff? */ 1424 /* question: don't pick up known-poisonous stuff? */
1424 if (op->contr->mode & PU_FOOD) 1425 if (op->contr->mode & PU_FOOD)
1425 if (tmp->type == FOOD) 1426 if (tmp->type == FOOD)
1426 { 1427 {
1427 pick_up (op, tmp); 1428 pick_up (op, tmp);
1428 if (0)
1429 fprintf (stderr, "FOOD\n");
1430 continue; 1429 continue;
1431 } 1430 }
1431
1432 if (op->contr->mode & PU_DRINK) 1432 if (op->contr->mode & PU_DRINK)
1433 if (tmp->type == DRINK || (tmp->type == POISON && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED))) 1433 if (tmp->type == DRINK || (tmp->type == POISON && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)))
1434 { 1434 {
1435 pick_up (op, tmp); 1435 pick_up (op, tmp);
1436 if (0)
1437 fprintf (stderr, "DRINK\n");
1438 continue; 1436 continue;
1439 } 1437 }
1440 1438
1441 if (op->contr->mode & PU_POTION) 1439 if (op->contr->mode & PU_POTION)
1442 if (tmp->type == POTION) 1440 if (tmp->type == POTION)
1443 { 1441 {
1444 pick_up (op, tmp); 1442 pick_up (op, tmp);
1445 if (0)
1446 fprintf (stderr, "POTION\n");
1447 continue; 1443 continue;
1448 } 1444 }
1449 1445
1450 /* spellbooks, skillscrolls and normal books/scrolls */ 1446 /* spellbooks, skillscrolls and normal books/scrolls */
1451 if (op->contr->mode & PU_SPELLBOOK) 1447 if (op->contr->mode & PU_SPELLBOOK)
1452 if (tmp->type == SPELLBOOK) 1448 if (tmp->type == SPELLBOOK)
1453 { 1449 {
1454 pick_up (op, tmp); 1450 pick_up (op, tmp);
1455 if (0)
1456 fprintf (stderr, "SPELLBOOK\n");
1457 continue; 1451 continue;
1458 } 1452 }
1453
1459 if (op->contr->mode & PU_SKILLSCROLL) 1454 if (op->contr->mode & PU_SKILLSCROLL)
1460 if (tmp->type == SKILLSCROLL) 1455 if (tmp->type == SKILLSCROLL)
1461 { 1456 {
1462 pick_up (op, tmp); 1457 pick_up (op, tmp);
1463 if (0)
1464 fprintf (stderr, "SKILLSCROLL\n");
1465 continue; 1458 continue;
1466 } 1459 }
1460
1467 if (op->contr->mode & PU_READABLES) 1461 if (op->contr->mode & PU_READABLES)
1468 if (tmp->type == BOOK || tmp->type == SCROLL) 1462 if (tmp->type == BOOK || tmp->type == SCROLL)
1469 { 1463 {
1470 pick_up (op, tmp); 1464 pick_up (op, tmp);
1471 if (0)
1472 fprintf (stderr, "READABLES\n");
1473 continue; 1465 continue;
1474 } 1466 }
1475 1467
1476 /* wands/staves/rods/horns */ 1468 /* wands/staves/rods/horns */
1477 if (op->contr->mode & PU_MAGIC_DEVICE) 1469 if (op->contr->mode & PU_MAGIC_DEVICE)
1478 if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) 1470 if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN)
1479 { 1471 {
1480 pick_up (op, tmp); 1472 pick_up (op, tmp);
1481 if (0)
1482 fprintf (stderr, "MAGIC_DEVICE\n");
1483 continue; 1473 continue;
1484 } 1474 }
1485 1475
1486 /* pick up all magical items */ 1476 /* pick up all magical items */
1487 if (op->contr->mode & PU_MAGICAL) 1477 if (op->contr->mode & PU_MAGICAL)
1488 if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) 1478 if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED))
1489 { 1479 {
1490 pick_up (op, tmp); 1480 pick_up (op, tmp);
1491 if (0)
1492 fprintf (stderr, "MAGICAL\n");
1493 continue; 1481 continue;
1494 } 1482 }
1495 1483
1496 if (op->contr->mode & PU_VALUABLES) 1484 if (op->contr->mode & PU_VALUABLES)
1497 { 1485 {
1498 if (tmp->type == MONEY || tmp->type == GEM) 1486 if (tmp->type == MONEY || tmp->type == GEM)
1499 { 1487 {
1500 pick_up (op, tmp); 1488 pick_up (op, tmp);
1501 if (0)
1502 fprintf (stderr, "MONEY/GEM\n");
1503 continue; 1489 continue;
1504 } 1490 }
1505 } 1491 }
1506 1492
1507 /* rings & amulets - talismans seems to be typed AMULET */ 1493 /* rings & amulets - talismans seems to be typed AMULET */
1508 if (op->contr->mode & PU_JEWELS) 1494 if (op->contr->mode & PU_JEWELS)
1509 if (tmp->type == RING || tmp->type == AMULET) 1495 if (tmp->type == RING || tmp->type == AMULET)
1510 { 1496 {
1511 pick_up (op, tmp); 1497 pick_up (op, tmp);
1498 continue;
1512 if (0) 1499 }
1513 fprintf (stderr, "JEWELS\n"); 1500
1501 /* we don't forget dragon food */
1502 if (op->contr->mode & PU_FLESH)
1503 if (tmp->type == FLESH)
1504 {
1505 pick_up (op, tmp);
1514 continue; 1506 continue;
1515 } 1507 }
1516 1508
1517 /* bows and arrows. Bows are good for selling! */ 1509 /* bows and arrows. Bows are good for selling! */
1518 if (op->contr->mode & PU_BOW) 1510 if (op->contr->mode & PU_BOW)
1519 if (tmp->type == BOW) 1511 if (tmp->type == BOW)
1520 { 1512 {
1521 pick_up (op, tmp); 1513 pick_up (op, tmp);
1522 if (0)
1523 fprintf (stderr, "BOW\n");
1524 continue; 1514 continue;
1525 } 1515 }
1516
1526 if (op->contr->mode & PU_ARROW) 1517 if (op->contr->mode & PU_ARROW)
1527 if (tmp->type == ARROW) 1518 if (tmp->type == ARROW)
1528 { 1519 {
1529 pick_up (op, tmp); 1520 pick_up (op, tmp);
1530 if (0)
1531 fprintf (stderr, "ARROW\n");
1532 continue; 1521 continue;
1533 } 1522 }
1534 1523
1535 /* all kinds of armor etc. */ 1524 /* all kinds of armor etc. */
1536 if (op->contr->mode & PU_ARMOUR) 1525 if (op->contr->mode & PU_ARMOUR)
1537 if (tmp->type == ARMOUR) 1526 if (tmp->type == ARMOUR)
1538 { 1527 {
1539 pick_up (op, tmp); 1528 pick_up (op, tmp);
1540 if (0)
1541 fprintf (stderr, "ARMOUR\n");
1542 continue; 1529 continue;
1543 } 1530 }
1531
1544 if (op->contr->mode & PU_HELMET) 1532 if (op->contr->mode & PU_HELMET)
1545 if (tmp->type == HELMET) 1533 if (tmp->type == HELMET)
1546 { 1534 {
1547 pick_up (op, tmp); 1535 pick_up (op, tmp);
1548 if (0)
1549 fprintf (stderr, "HELMET\n");
1550 continue; 1536 continue;
1551 } 1537 }
1538
1552 if (op->contr->mode & PU_SHIELD) 1539 if (op->contr->mode & PU_SHIELD)
1553 if (tmp->type == SHIELD) 1540 if (tmp->type == SHIELD)
1554 { 1541 {
1555 pick_up (op, tmp); 1542 pick_up (op, tmp);
1556 if (0)
1557 fprintf (stderr, "SHIELD\n");
1558 continue; 1543 continue;
1559 } 1544 }
1545
1560 if (op->contr->mode & PU_BOOTS) 1546 if (op->contr->mode & PU_BOOTS)
1561 if (tmp->type == BOOTS) 1547 if (tmp->type == BOOTS)
1562 { 1548 {
1563 pick_up (op, tmp); 1549 pick_up (op, tmp);
1564 if (0)
1565 fprintf (stderr, "BOOTS\n");
1566 continue; 1550 continue;
1567 } 1551 }
1552
1568 if (op->contr->mode & PU_GLOVES) 1553 if (op->contr->mode & PU_GLOVES)
1569 if (tmp->type == GLOVES) 1554 if (tmp->type == GLOVES)
1570 { 1555 {
1571 pick_up (op, tmp); 1556 pick_up (op, tmp);
1572 if (0)
1573 fprintf (stderr, "GLOVES\n");
1574 continue; 1557 continue;
1575 } 1558 }
1559
1576 if (op->contr->mode & PU_CLOAK) 1560 if (op->contr->mode & PU_CLOAK)
1577 if (tmp->type == CLOAK) 1561 if (tmp->type == CLOAK)
1578 { 1562 {
1579 pick_up (op, tmp); 1563 pick_up (op, tmp);
1580 if (0)
1581 fprintf (stderr, "GLOVES\n");
1582 continue; 1564 continue;
1583 } 1565 }
1584 1566
1585 /* hoping to catch throwing daggers here */ 1567 /* hoping to catch throwing daggers here */
1586 if (op->contr->mode & PU_MISSILEWEAPON) 1568 if (op->contr->mode & PU_MISSILEWEAPON)
1587 if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_IS_THROWN)) 1569 if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_IS_THROWN))
1588 { 1570 {
1589 pick_up (op, tmp); 1571 pick_up (op, tmp);
1590 if (0)
1591 fprintf (stderr, "MISSILEWEAPON\n");
1592 continue; 1572 continue;
1593 } 1573 }
1594 1574
1595 /* careful: chairs and tables are weapons! */ 1575 /* careful: chairs and tables are weapons! */
1596 if (op->contr->mode & PU_ALLWEAPON) 1576 if (op->contr->mode & PU_ALLWEAPON)
1599 { 1579 {
1600 if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->name, "table") == NULL && 1580 if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->name, "table") == NULL &&
1601 strstr (tmp->name, "chair") && strstr (tmp->arch->name, "chair") == NULL) 1581 strstr (tmp->name, "chair") && strstr (tmp->arch->name, "chair") == NULL)
1602 { 1582 {
1603 pick_up (op, tmp); 1583 pick_up (op, tmp);
1604 if (0)
1605 fprintf (stderr, "WEAPON\n");
1606 continue; 1584 continue;
1607 } 1585 }
1608 } 1586 }
1587
1609 if (tmp->type == WEAPON && tmp->name == NULL) 1588 if (tmp->type == WEAPON && tmp->name == NULL)
1610 { 1589 {
1611 if (strstr (tmp->arch->name, "table") == NULL && strstr (tmp->arch->name, "chair") == NULL) 1590 if (strstr (tmp->arch->name, "table") == NULL && strstr (tmp->arch->name, "chair") == NULL)
1612 { 1591 {
1613 pick_up (op, tmp); 1592 pick_up (op, tmp);
1614 if (0)
1615 fprintf (stderr, "WEAPON\n");
1616 continue; 1593 continue;
1617 } 1594 }
1618 } 1595 }
1619 } 1596 }
1620 1597
1621 /* misc stuff that's useful */ 1598 /* misc stuff that's useful */
1622 if (op->contr->mode & PU_KEY) 1599 if (op->contr->mode & PU_KEY)
1623 if (tmp->type == KEY || tmp->type == SPECIAL_KEY) 1600 if (tmp->type == KEY || tmp->type == SPECIAL_KEY)
1624 { 1601 {
1625 pick_up (op, tmp); 1602 pick_up (op, tmp);
1626 if (0)
1627 fprintf (stderr, "KEY\n");
1628 continue; 1603 continue;
1629 } 1604 }
1630 1605
1631 /* any of the last 4 bits set means we use the ratio for value 1606 /* any of the last 4 bits set means we use the ratio for value
1632 * pickups */ 1607 * pickups */
1654 continue; 1629 continue;
1655 } 1630 }
1656 } 1631 }
1657 } /* the new pickup model */ 1632 } /* the new pickup model */
1658 } 1633 }
1634
1659 return !stop; 1635 return !stop;
1660} 1636}
1661 1637
1662/* 1638/*
1663 * Find an arrow in the inventory and after that 1639 * Find an arrow in the inventory and after that
2127 case range_misc: 2103 case range_misc:
2128 fire_misc_object (op, dir); 2104 fire_misc_object (op, dir);
2129 return; 2105 return;
2130 2106
2131 case range_golem: /* Control summoned monsters from scrolls */ 2107 case range_golem: /* Control summoned monsters from scrolls */
2132 if (op->contr->ranges[range_golem] == NULL || op->contr->golem_count != op->contr->ranges[range_golem]->count) 2108 if (QUERY_FLAG (op->contr->ranges[range_golem], FLAG_REMOVED))
2133 { 2109 {
2134 op->contr->ranges[range_golem] = NULL; 2110 op->contr->ranges[range_golem] = 0;
2135 op->contr->shoottype = range_none; 2111 op->contr->shoottype = range_none;
2136 op->contr->golem_count = 0;
2137 } 2112 }
2138 else 2113 else
2139 control_golem (op->contr->ranges[range_golem], dir); 2114 control_golem (op->contr->ranges[range_golem], dir);
2140 return; 2115 return;
2141 2116
2349 if (tmp == op) 2324 if (tmp == op)
2350 { 2325 {
2351 tmp = tmp->above; 2326 tmp = tmp->above;
2352 continue; 2327 continue;
2353 } 2328 }
2329
2354 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 2330 if (QUERY_FLAG (tmp, FLAG_ALIVE))
2355 { 2331 {
2356 mon = tmp; 2332 mon = tmp;
2357 break; 2333 break;
2358 } 2334 }
2335
2359 if (tmp->type == LOCKED_DOOR || QUERY_FLAG (tmp, FLAG_CAN_ROLL)) 2336 if (tmp->type == LOCKED_DOOR || QUERY_FLAG (tmp, FLAG_CAN_ROLL))
2360 mon = tmp; 2337 mon = tmp;
2338
2361 tmp = tmp->above; 2339 tmp = tmp->above;
2362 } 2340 }
2363 2341
2364 if (mon == NULL) /* This happens anytime the player tries to move */ 2342 if (mon == NULL) /* This happens anytime the player tries to move */
2365 return; /* into a wall */ 2343 return; /* into a wall */
2584 /* I've been seeing crashes where the golem has been destroyed, but 2562 /* I've been seeing crashes where the golem has been destroyed, but
2585 * the player object still points to the defunct golem. The code that 2563 * the player object still points to the defunct golem. The code that
2586 * destroys the golem looks correct, and it doesn't always happen, so 2564 * destroys the golem looks correct, and it doesn't always happen, so
2587 * put this in a a workaround to clean up the golem pointer. 2565 * put this in a a workaround to clean up the golem pointer.
2588 */ 2566 */
2589 if (op->contr->ranges[range_golem] &&
2590 ((op->contr->golem_count != op->contr->ranges[range_golem]->count) || QUERY_FLAG (op->contr->ranges[range_golem], FLAG_REMOVED))) 2567 if (op->contr->ranges[range_golem] && QUERY_FLAG (op->contr->ranges[range_golem], FLAG_REMOVED))
2591 {
2592 op->contr->ranges[range_golem] = NULL; 2568 op->contr->ranges[range_golem] = 0;
2593 op->contr->golem_count = 0;
2594 }
2595 2569
2596 /* call this here - we also will call this in do_ericserver, but 2570 /* call this here - we also will call this in do_ericserver, but
2597 * the players time has been increased when doericserver has been 2571 * the players time has been increased when doericserver has been
2598 * called, so we recheck it here. 2572 * called, so we recheck it here.
2599 */ 2573 */
3169 /* determine_god() seems to not work sometimes... why is this? 3143 /* determine_god() seems to not work sometimes... why is this?
3170 Should I be using something else? GD */ 3144 Should I be using something else? GD */
3171 const char *god = determine_god (op); 3145 const char *god = determine_god (op);
3172 3146
3173 if (god && (strcmp (god, "none"))) 3147 if (god && (strcmp (god, "none")))
3174 new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief " "moment you feel the holy presence of %s protecting" " you.", god); 3148 new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god);
3175 else 3149 else
3176 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you."); 3150 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you.");
3177 } 3151 }
3152#else
3153 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely.");
3178#endif 3154#endif
3179 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely.");
3180 3155
3181 /* Put a gravestone up where the character 'almost' died. List the 3156 /* Put a gravestone up where the character 'almost' died. List the
3182 * exp loss on the stone. 3157 * exp loss on the stone.
3183 */ 3158 */
3184 tmp = arch_to_object (archetype::find ("gravestone")); 3159 tmp = arch_to_object (archetype::find ("gravestone"));
3189 sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer); 3164 sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer);
3190 tmp->msg = buf; 3165 tmp->msg = buf;
3191 tmp->x = op->x, tmp->y = op->y; 3166 tmp->x = op->x, tmp->y = op->y;
3192 insert_ob_in_map (tmp, op->map, NULL, 0); 3167 insert_ob_in_map (tmp, op->map, NULL, 0);
3193 3168
3194 /**************************************/ 3169 /**************************************/
3195 /* */ 3170 /* */
3196 /* Subtract the experience points, */ 3171 /* Subtract the experience points, */
3197 /* if we died cause of food, give us */ 3172 /* if we died cause of food, give us */
3198 /* food, and reset HP's... */ 3173 /* food, and reset HP's... */
3199 /* */ 3174 /* */
3200
3201 /**************************************/ 3175 /**************************************/
3202 3176
3203 /* remove any poisoning and confusion the character may be suffering. */ 3177 /* remove any poisoning and confusion the character may be suffering. */
3204 /* restore player */ 3178 /* restore player */
3205 at = archetype::find ("poisoning"); 3179 at = archetype::find ("poisoning");
3206 tmp = present_arch_in_ob (at, op); 3180 tmp = present_arch_in_ob (at, op);
3217 { 3191 {
3218 remove_ob (tmp); 3192 remove_ob (tmp);
3219 free_object (tmp); 3193 free_object (tmp);
3220 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 3194 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
3221 } 3195 }
3196
3222 cure_disease (op, 0); /* remove any disease */ 3197 cure_disease (op, 0); /* remove any disease */
3223 3198
3224 /*add_exp(op, (op->stats.exp * -0.20)); */ 3199 /*add_exp(op, (op->stats.exp * -0.20)); */
3225 apply_death_exp_penalty (op); 3200 apply_death_exp_penalty (op);
3226 if (op->stats.food < 100) 3201 if (op->stats.food < 100)
3236 */ 3211 */
3237 3212
3238 if (is_in_shop (op)) 3213 if (is_in_shop (op))
3239 remove_unpaid_objects (op->inv, op); 3214 remove_unpaid_objects (op->inv, op);
3240 3215
3241 /****************************************/ 3216 /****************************************/
3242 /* */ 3217 /* */
3243 /* Move player to his current respawn- */ 3218 /* Move player to his current respawn- */
3244 /* position (usually last savebed) */ 3219 /* position (usually last savebed) */
3245 /* */ 3220 /* */
3246
3247 /****************************************/ 3221 /****************************************/
3248 3222
3249 enter_player_savebed (op); 3223 enter_player_savebed (op);
3250 3224
3251 /* Save the player before inserting the force to reduce 3225 /* Save the player before inserting the force to reduce
3252 * chance of abuse. 3226 * chance of abuse.
3259 * spell effects. So first see if there is a spell effect 3233 * spell effects. So first see if there is a spell effect
3260 * on the space that might harm the player. 3234 * on the space that might harm the player.
3261 */ 3235 */
3262 will_kill_again = 0; 3236 will_kill_again = 0;
3263 for (tmp = get_map_ob (op->map, op->x, op->y); tmp; tmp = tmp->above) 3237 for (tmp = get_map_ob (op->map, op->x, op->y); tmp; tmp = tmp->above)
3264 {
3265 if (tmp->type == SPELL_EFFECT) 3238 if (tmp->type == SPELL_EFFECT)
3266 will_kill_again |= tmp->attacktype; 3239 will_kill_again |= tmp->attacktype;
3267 } 3240
3268 if (will_kill_again) 3241 if (will_kill_again)
3269 { 3242 {
3270 object *force; 3243 object *force;
3271 int at; 3244 int at;
3272 3245
3274 /* 50 ticks should be enough time for the spell to abate */ 3247 /* 50 ticks should be enough time for the spell to abate */
3275 force->speed = 0.1; 3248 force->speed = 0.1;
3276 force->speed_left = -5.0; 3249 force->speed_left = -5.0;
3277 SET_FLAG (force, FLAG_APPLIED); 3250 SET_FLAG (force, FLAG_APPLIED);
3278 for (at = 0; at < NROFATTACKS; at++) 3251 for (at = 0; at < NROFATTACKS; at++)
3279 {
3280 if (will_kill_again & (1 << at)) 3252 if (will_kill_again & (1 << at))
3281 force->resist[at] = 100; 3253 force->resist[at] = 100;
3282 } 3254
3283 insert_ob_in_ob (force, op); 3255 insert_ob_in_ob (force, op);
3284 fix_player (op); 3256 fix_player (op);
3285 3257
3286 } 3258 }
3287 3259
3297 op->contr->party = NULL; 3269 op->contr->party = NULL;
3298 if (settings.set_title == TRUE) 3270 if (settings.set_title == TRUE)
3299 op->contr->own_title[0] = '\0'; 3271 op->contr->own_title[0] = '\0';
3300 new_draw_info (NDI_UNIQUE | NDI_ALL, 0, NULL, buf); 3272 new_draw_info (NDI_UNIQUE | NDI_ALL, 0, NULL, buf);
3301 check_score (op); 3273 check_score (op);
3274
3302 if (op->contr->ranges[range_golem] != NULL) 3275 if (op->contr->ranges[range_golem])
3303 { 3276 {
3304 remove_friendly_object (op->contr->ranges[range_golem]); 3277 remove_friendly_object (op->contr->ranges[range_golem]);
3305 remove_ob (op->contr->ranges[range_golem]); 3278 remove_ob (op->contr->ranges[range_golem]);
3306 free_object (op->contr->ranges[range_golem]); 3279 free_object (op->contr->ranges[range_golem]);
3307 op->contr->ranges[range_golem] = NULL; 3280 op->contr->ranges[range_golem] = 0;
3308 op->contr->golem_count = 0;
3309 } 3281 }
3282
3310 loot_object (op); /* Remove some of the items for good */ 3283 loot_object (op); /* Remove some of the items for good */
3311 remove_ob (op); 3284 remove_ob (op);
3312 op->direction = 0; 3285 op->direction = 0;
3313 3286
3314 if (!QUERY_FLAG (op, FLAG_WAS_WIZ) && op->stats.exp) 3287 if (!QUERY_FLAG (op, FLAG_WAS_WIZ) && op->stats.exp)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines