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.176 by root, Sun Dec 16 01:25:17 2007 UTC vs.
Revision 1.209 by root, Thu Dec 18 05:13:38 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
122 continue; 122 continue;
123 123
124 if (*buf == '%') 124 if (*buf == '%')
125 { /* send one news */ 125 { /* send one news */
126 if (size > 0) 126 if (size > 0)
127 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */ 127 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op,
128 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS,
129 "INFORMATION: %s\n%s", (char *)"%s\n%s",
130 subject, news); /*send previously read news */
128 131
129 strcpy (subject, buf + 1); 132 strcpy (subject, buf + 1);
130 strip_endline (subject); 133 strip_endline (subject);
131 size = 0; 134 size = 0;
132 news[0] = '\0'; 135 news[0] = '\0';
215 218
216 /* make sure he's a player -- needed because of class change. */ 219 /* make sure he's a player -- needed because of class change. */
217 ob->type = PLAYER; // we are paranoid 220 ob->type = PLAYER; // we are paranoid
218 ob->race = ob->arch->race; 221 ob->race = ob->arch->race;
219 222
220 ob->carrying = sum_weight (ob); 223 ob->update_weight ();
221 link_player_skills (ob); 224 link_skills ();
222 225
223 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); 226 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER);
224 227
225 assign (title, ob->arch->object::name); 228 assign (title, ob->arch->object::name);
226 229
239 set_dragon_name (ob, abil, skin); 242 set_dragon_name (ob, abil, skin);
240 } 243 }
241 244
242 new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); 245 new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!");
243 246
244 esrv_new_player (this, ob->weight + ob->carrying); 247 esrv_new_player (this);
245 248
246 ob->update_stats (); 249 ob->update_stats ();
247 250
248 ns->floorbox_update (); 251 ns->floorbox_update ();
249 esrv_send_inventory (ob, ob); 252 esrv_send_inventory (ob, ob);
291player::set_object (object *op) 294player::set_object (object *op)
292{ 295{
293 ob = observe = op; 296 ob = observe = op;
294 ob->contr = this; /* this aren't yet in archetype */ 297 ob->contr = this; /* this aren't yet in archetype */
295 298
296 ob->speed = 1.0f; 299 ob->speed = 1.0f;
297 ob->speed_left = 0.5f; 300 ob->speed_left = 0.5f;
298 301
299 ob->direction = 5; /* So player faces south */ 302 ob->direction = 5; /* So player faces south */
300 303
301 ob->flag [FLAG_READY_WEAPON] = false; 304 ob->flag [FLAG_READY_WEAPON] = false;
302 ob->flag [FLAG_READY_SKILL] = false; 305 ob->flag [FLAG_READY_SKILL] = false;
303 ob->flag [FLAG_READY_BOW] = false; 306 ob->flag [FLAG_READY_BOW] = false;
304 307
321 combat_ob = op; 324 combat_ob = op;
322 break; 325 break;
323 } 326 }
324 327
325 ob->change_weapon (combat_ob ? combat_ob : ranged_ob); 328 ob->change_weapon (combat_ob ? combat_ob : ranged_ob);
329 ob->deactivate (); // change_weapon activates, fix this better
326} 330}
327 331
328void 332void
329player::set_observe (object *op) 333player::set_observe (object *op)
330{ 334{
344 savebed_map = first_map_path; /* Init. respawn position */ 348 savebed_map = first_map_path; /* Init. respawn position */
345 349
346 gen_sp_armour = 10; 350 gen_sp_armour = 10;
347 bowtype = bow_normal; 351 bowtype = bow_normal;
348 petmode = pet_normal; 352 petmode = pet_normal;
349 listening = 10;
350 usekeys = containers; 353 usekeys = containers;
351 peaceful = 1; /* default peaceful */ 354 peaceful = 1; /* default peaceful */
352 do_los = 1; 355 do_los = 1;
353 356
354 weapon_sp = 1.0f; 357 weapon_sp = 1.0f;
403 * Note: there MUST be at least one player archetype! 406 * Note: there MUST be at least one player archetype!
404 */ 407 */
405archetype * 408archetype *
406get_player_archetype (archetype *at) 409get_player_archetype (archetype *at)
407{ 410{
411 // archetypes could have been reloaded
412 archetype *nat = at ? archetype::find (at->archname) : archetypes [0];
413
414 if (!nat)
415 return at;
416
408 archvec::iterator i = at ? archetypes.find (at) : archetypes.begin (); 417 archvec::iterator i = archetypes.find (nat);
409 418
410 for (;;) 419 for (;;)
411 { 420 {
412 if (++i == archetypes.end ()) 421 if (++i == archetypes.end ())
413 i = archetypes.begin (); 422 i = archetypes.begin ();
631 640
632 return firstdir; 641 return firstdir;
633} 642}
634 643
635void 644void
636give_initial_items (object *pl, treasurelist * items) 645give_initial_items (object *pl, treasurelist *items)
637{ 646{
638 if (pl->randomitems) 647 if (pl->randomitems)
639 create_treasure (items, pl, GT_STARTEQUIP | GT_ONLY_GOOD, 1, 0); 648 create_treasure (items, pl, GT_STARTEQUIP | GT_ONLY_GOOD, 1, 0);
640 649
641 for (object *next, *op = pl->inv; op; op = next) 650 for (object *next, *op = pl->inv; op; op = next)
651 /* we never give weapons/armour if these cannot be used 660 /* we never give weapons/armour if these cannot be used
652 * by this player due to race restrictions 661 * by this player due to race restrictions
653 */ 662 */
654 if (pl->type == PLAYER) 663 if (pl->type == PLAYER)
655 { 664 {
656 if ((!QUERY_FLAG (pl, FLAG_USE_ARMOUR) && 665 if ((!QUERY_FLAG (pl, FLAG_USE_ARMOUR)
666 &&
657 (op->type == ARMOUR || op->type == BOOTS || 667 (op->type == ARMOUR || op->type == BOOTS
658 op->type == CLOAK || op->type == HELMET || 668 || op->type == CLOAK || op->type == HELMET
659 op->type == SHIELD || op->type == GLOVES || 669 || op->type == SHIELD || op->type == GLOVES
670 || op->type == BRACERS || op->type == GIRDLE))
660 op->type == BRACERS || op->type == GIRDLE)) || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) 671 || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON))
661 { 672 {
662 op->destroy (); 673 op->destroy ();
663 continue; 674 continue;
664 } 675 }
665 } 676 }
691 702
692 if (op->type == SPELLBOOK && op->inv) 703 if (op->type == SPELLBOOK && op->inv)
693 CLEAR_FLAG (op->inv, FLAG_STARTEQUIP); 704 CLEAR_FLAG (op->inv, FLAG_STARTEQUIP);
694 705
695 /* Give starting characters identified, uncursed, and undamned 706 /* Give starting characters identified, uncursed, and undamned
696 * items. Just don't identify gold or silver, or it won't be 707 * items. Just don't identify gold or silver, or it won't be
697 * merged properly. 708 * merged properly.
698 */ 709 */
699 if (need_identify (op)) 710 if (need_identify (op))
700 { 711 {
701 SET_FLAG (op, FLAG_IDENTIFIED); 712 SET_FLAG (op, FLAG_IDENTIFIED);
702 CLEAR_FLAG (op, FLAG_CURSED); 713 CLEAR_FLAG (op, FLAG_CURSED);
703 CLEAR_FLAG (op, FLAG_DAMNED); 714 CLEAR_FLAG (op, FLAG_DAMNED);
704 } 715 }
716
705 if (op->type == SPELL) 717 if (op->type == SPELL)
706 { 718 {
707 op->destroy (); 719 op->destroy ();
708 continue; 720 continue;
709 } 721 }
711 { 723 {
712 SET_FLAG (op, FLAG_CAN_USE_SKILL); 724 SET_FLAG (op, FLAG_CAN_USE_SKILL);
713 op->stats.exp = 0; 725 op->stats.exp = 0;
714 op->level = 1; 726 op->level = 1;
715 } 727 }
716 /* lock all 'normal items by default */ 728 else /* lock all 'normal items by default */
717 else
718 SET_FLAG (op, FLAG_INV_LOCKED); 729 SET_FLAG (op, FLAG_INV_LOCKED);
719 } /* for loop of objects in player inv */ 730 } /* for loop of objects in player inv */
720 731
721 /* Need to set up the skill pointers */ 732 /* Need to set up the skill pointers */
722 link_player_skills (pl); 733 pl->contr->link_skills ();
723} 734}
724 735
725void 736void
726get_party_password (object *op, partylist *party) 737get_party_password (object *op, partylist *party)
727{ 738{
828static void 839static void
829start_info (object *op) 840start_info (object *op)
830{ 841{
831 char buf[MAX_BUF]; 842 char buf[MAX_BUF];
832 843
833 sprintf (buf, "Welcome to Crossfire v%s!", VERSION); 844 sprintf (buf, "Welcome to Deliantra v%s!", VERSION);
834 new_draw_info (NDI_UNIQUE, 0, op, buf); 845 new_draw_info (NDI_UNIQUE, 0, op, buf);
835 //new_draw_info (NDI_UNIQUE, 0, op, "Press `?' for help");
836 //new_draw_info (NDI_UNIQUE, 0, op, " ");
837} 846}
838 847
839/* This function takes the key that is passed, and does the 848/* This function takes the key that is passed, and does the
840 * appropriate action with it (change race, or other things). 849 * appropriate action with it (change race, or other things).
841 * The function name is for historical reasons - now we have 850 * The function name is for historical reasons - now we have
844 */ 853 */
845void 854void
846player::chargen_race_done () 855player::chargen_race_done ()
847{ 856{
848 /* this must before then initial items are given */ 857 /* this must before then initial items are given */
849 esrv_new_player (ob->contr, ob->weight + ob->carrying); 858 esrv_new_player (ob->contr);
850 859
851 treasurelist *tl = treasurelist::find ("starting_wealth"); 860 treasurelist *tl = treasurelist::find ("starting_wealth");
852 if (tl) 861 if (tl)
853 create_treasure (tl, ob, 0, 0, 0); 862 create_treasure (tl, ob, 0, 0, 0);
854 863
858 ob->contr->ns->state = ST_PLAYING; 867 ob->contr->ns->state = ST_PLAYING;
859 868
860 if (ob->msg) 869 if (ob->msg)
861 ob->msg = 0; 870 ob->msg = 0;
862 871
863 /* We create this now because some of the unique maps will need it
864 * to save here.
865 */
866 {
867 char buf[MAX_BUF];
868 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &ob->name);
869 make_path_to_file (buf);
870 }
871
872 start_info (ob); 872 start_info (ob);
873 CLEAR_FLAG (ob, FLAG_WIZ); 873 CLEAR_FLAG (ob, FLAG_WIZ);
874 give_initial_items (ob, ob->randomitems); 874 give_initial_items (ob, ob->randomitems);
875 link_player_skills (ob);
876 esrv_send_inventory (ob, ob); 875 esrv_send_inventory (ob, ob);
877 ob->update_stats (); 876 ob->update_stats ();
878 877
879 /* This moves the player to a different start map, if there 878 /* This moves the player to a different start map, if there
880 * is one for this race 879 * is one for this race
881 */ 880 */
882 if (*first_map_ext_path) 881 if (*first_map_ext_path)
883 { 882 ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y);
884 object *tmp;
885 char mapname[MAX_BUF];
886
887 snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &ob->arch->archname);
888 tmp = object::create ();
889 EXIT_PATH (tmp) = mapname;
890 EXIT_X (tmp) = ob->x;
891 EXIT_Y (tmp) = ob->y;
892 ob->enter_exit (tmp); /* we don't really care if it succeeded;
893 * if the map isn't there, then stay on the
894 * default initial map */
895 tmp->destroy ();
896 }
897 else 883 else
898 LOG (llevDebug, "first_map_ext_path not set\n"); 884 LOG (llevDebug, "first_map_ext_path not set\n");
899} 885}
900 886
901void 887void
1320 if (op->contr->mode & PU_RATIO) 1306 if (op->contr->mode & PU_RATIO)
1321 { 1307 {
1322 /* use value density to decide what else to grab */ 1308 /* use value density to decide what else to grab */
1323 /* >=7 was >= op->contr->mode */ 1309 /* >=7 was >= op->contr->mode */
1324 /* >=7 is the old standard setting. Now we take the last 4 bits 1310 /* >=7 is the old standard setting. Now we take the last 4 bits
1325 * and multiply them by 5, giving 0..15*5== 5..75 */ 1311 */
1326 wvratio = (op->contr->mode & PU_RATIO) * 5; 1312 wvratio = op->contr->mode & PU_RATIO;
1327 if ((query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1))) >= (unsigned int) wvratio) 1313 if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100)
1328 { 1314 {
1329 CHK_PICK_PICKUP; 1315 CHK_PICK_PICKUP;
1330#if 0 1316#if 0
1331 fprintf (stderr, "HIGH WEIGHT/VALUE ["); 1317 fprintf (stderr, "HIGH WEIGHT/VALUE [");
1332 if (tmp->name != NULL) 1318 if (tmp->name != NULL)
1353 * found object is returned. 1339 * found object is returned.
1354 */ 1340 */
1355object * 1341object *
1356find_arrow (object *op, const char *type) 1342find_arrow (object *op, const char *type)
1357{ 1343{
1358 object *tmp = 0;
1359
1360 for (op = op->inv; op; op = op->below) 1344 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1361 if (!tmp && op->type == CONTAINER && op->race == type && QUERY_FLAG (op, FLAG_APPLIED))
1362 tmp = find_arrow (splay (op), type);
1363 else if (op->type == ARROW && op->race == type) 1345 if (tmp->type == ARROW && !strcmp (&tmp->race, type))
1364 return splay (op); 1346 return splay (tmp);
1365 1347
1348 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1349 if (tmp->type == CONTAINER && QUERY_FLAG (tmp, FLAG_APPLIED) && !strcmp (&tmp->race, type))
1350 if (object *arrow = find_arrow (tmp, type))
1351 {
1352 splay (tmp);
1353 return arrow;
1354 }
1355
1366 return tmp; 1356 return 0;
1367} 1357}
1368 1358
1369/* 1359/*
1370 * Similar to find_arrow, but looks for (roughly) the best arrow to use 1360 * Similar to find_arrow, but looks for (roughly) the best arrow to use
1371 * against the target. A full test is not performed, simply a basic test 1361 * against the target. A full test is not performed, simply a basic test
1394 } 1384 }
1395 } 1385 }
1396 else if (arrow->type == ARROW && arrow->race == type) 1386 else if (arrow->type == ARROW && arrow->race == type)
1397 { 1387 {
1398 /* allways prefer assasination/slaying */ 1388 /* allways prefer assasination/slaying */
1399 if (target->race != NULL && arrow->slaying != NULL && strstr (arrow->slaying, target->race)) 1389 if (target->race && arrow->slaying && strstr (arrow->slaying, target->race))
1400 { 1390 {
1401 if (arrow->attacktype & AT_DEATH) 1391 if (arrow->attacktype & AT_DEATH)
1402 { 1392 {
1403 *better = 100; 1393 *better = 100;
1404 return arrow; 1394 return arrow;
1432 betterby = 1 + arrow->magic + arrow->stats.dam; 1422 betterby = 1 + arrow->magic + arrow->stats.dam;
1433 } 1423 }
1434 } 1424 }
1435 } 1425 }
1436 } 1426 }
1427
1437 if (tmp == NULL && arrow == NULL) 1428 if (tmp == NULL && arrow == NULL)
1438 return find_arrow (op, type); 1429 return find_arrow (op, type);
1439 1430
1440 *better = betterby; 1431 *better = betterby;
1441 return tmp; 1432 return tmp;
1587 } 1578 }
1588 1579
1589 /* this should not happen, but sometimes does */ 1580 /* this should not happen, but sometimes does */
1590 if (arrow->nrof == 0) 1581 if (arrow->nrof == 0)
1591 { 1582 {
1583 LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ());
1592 arrow->destroy (); 1584 arrow->destroy ();
1593 return 0; 1585 return 0;
1594 } 1586 }
1595 1587
1596 left = arrow; /* these are arrows left to the player */ 1588 left = arrow; /* these are arrows left to the player */
1597 arrow = get_split_ob (arrow, 1); 1589 arrow = arrow->split ();
1598 if (!arrow) 1590 if (!arrow)
1599 { 1591 {
1600 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); 1592 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race);
1601 return 0; 1593 return 0;
1602 } 1594 }
1669 op->play_sound (sound_find ("fire_arrow")); 1661 op->play_sound (sound_find ("fire_arrow"));
1670 m->insert (arrow, sx, sy, op); 1662 m->insert (arrow, sx, sy, op);
1671 1663
1672 if (!arrow->destroyed ()) 1664 if (!arrow->destroyed ())
1673 move_arrow (arrow); 1665 move_arrow (arrow);
1674
1675 if (op->type == PLAYER)
1676 {
1677 if (left->destroyed ())
1678 esrv_del_item (op->contr, left->count);
1679 else
1680 esrv_send_item (op, left);
1681 }
1682 1666
1683 return 1; 1667 return 1;
1684} 1668}
1685 1669
1686/* Special fire code for players - this takes into 1670/* Special fire code for players - this takes into
1760 return; 1744 return;
1761 } 1745 }
1762 } 1746 }
1763 else if (item->type == ROD || item->type == HORN) 1747 else if (item->type == ROD || item->type == HORN)
1764 { 1748 {
1765 if (item->stats.hp < MAX (item->inv->stats.sp, item->inv->stats.grace)) 1749 sint16 spell_sp = MAX (item->inv->stats.sp, item->inv->stats.grace);
1750
1751 // using the maximum of the rods charge allows at least one spell cast
1752 // for a rod or horn, this fixes some broken rods.
1753 if (item->stats.hp < MIN (spell_sp, item->stats.maxhp))
1766 { 1754 {
1767 op->contr->play_sound (sound_find ("wand_poof")); 1755 op->contr->play_sound (sound_find ("wand_poof"));
1768 1756
1769 if (item->type == ROD) 1757 if (item->type == ROD)
1770 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0)); 1758 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0));
1789 CLEAR_FLAG (item, FLAG_ANIMATE); 1777 CLEAR_FLAG (item, FLAG_ANIMATE);
1790 item->face = item->arch->face; 1778 item->face = item->arch->face;
1791 item->set_speed (0); 1779 item->set_speed (0);
1792 } 1780 }
1793 1781
1794 if ((tmp = item->in_player ())) 1782 if (object *pl = item->visible_to ())
1795 esrv_update_item (UPD_ANIM, tmp, item); 1783 esrv_update_item (UPD_ANIM, pl, item);
1796 } 1784 }
1797 } 1785 }
1798 else if (item->type == ROD || item->type == HORN) 1786 else if (item->type == ROD || item->type == HORN)
1799 drain_rod_charge (item); 1787 drain_rod_charge (item);
1800 } 1788 }
1805bool 1793bool
1806fire (object *op, int dir) 1794fire (object *op, int dir)
1807{ 1795{
1808 int spellcost = 0; 1796 int spellcost = 0;
1809 1797
1810 /* check for loss of invisiblity/hide */
1811 if (action_makes_visible (op))
1812 make_visible (op);
1813
1814 player *pl = op->contr; 1798 player *pl = op->contr;
1815 1799
1816 if (pl->golem) 1800 if (pl->golem)
1817 { 1801 {
1818 control_golem (op->contr->golem, dir); 1802 control_golem (op->contr->golem, dir);
1820 } 1804 }
1821 1805
1822 object *ob = pl->ranged_ob; 1806 object *ob = pl->ranged_ob;
1823 1807
1824 if (!ob) 1808 if (!ob)
1825 return false;
1826
1827 if (!op->change_weapon (ob))
1828 return false; 1809 return false;
1829 1810
1830 if (op->speed_left > 0.f) 1811 if (op->speed_left > 0.f)
1831 --op->speed_left; 1812 --op->speed_left;
1832 else 1813 else
1833 return false; 1814 return false;
1815
1816 if (!op->change_weapon (ob))
1817 return false;
1818
1819 /* check for loss of invisiblity/hide */
1820 if (action_makes_visible (op))
1821 make_visible (op);
1834 1822
1835 switch (ob->type) 1823 switch (ob->type)
1836 { 1824 {
1837 case BOW: 1825 case BOW:
1838 player_fire_bow (op, dir); 1826 player_fire_bow (op, dir);
1976 op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN); 1964 op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN);
1977 remove_door2 (door); /* remove door without violence ;-) */ 1965 remove_door2 (door); /* remove door without violence ;-) */
1978 } 1966 }
1979 1967
1980 /* Do this after we print the message */ 1968 /* Do this after we print the message */
1981 decrease_ob (key); /* Use up one of the keys */ 1969 key->decrease (); /* Use up one of the keys */
1982 /* Need to update the weight the container the key was in */
1983 if (container != op)
1984 esrv_update_item (UPD_WEIGHT, op, container);
1985 1970
1986 return 1; /* Nothing more to do below */ 1971 return 1; /* Nothing more to do below */
1987 } 1972 }
1988 else if (door->type == LOCKED_DOOR) 1973 else if (door->type == LOCKED_DOOR)
1989 { 1974 {
2086 --op->speed_left; 2071 --op->speed_left;
2087 2072
2088 op->play_sound (sound_find ("push_player")); 2073 op->play_sound (sound_find ("push_player"));
2089 push_ob (mon, dir, op); 2074 push_ob (mon, dir, op);
2090 2075
2091 if (op->contr->tmp_invis || op->hide) 2076 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2092 make_visible (op); 2077 make_visible (op);
2093 2078
2094 return true; 2079 return true;
2095 } 2080 }
2096 else 2081 else
2118 push_ob (mon, dir, op); 2103 push_ob (mon, dir, op);
2119 } 2104 }
2120 else 2105 else
2121 op->statusmsg ("You withhold your attack"); 2106 op->statusmsg ("You withhold your attack");
2122 2107
2123 if (op->contr->tmp_invis || op->hide) 2108 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2124 make_visible (op); 2109 make_visible (op);
2125 2110
2126 return true; 2111 return true;
2127 } 2112 }
2128 } 2113 }
2170bool 2155bool
2171move_player (object *op, int dir) 2156move_player (object *op, int dir)
2172{ 2157{
2173 int pick; 2158 int pick;
2174 2159
2175 if (!op->map || op->map->in_memory != MAP_IN_MEMORY) 2160 if (!op->map || op->map->in_memory != MAP_ACTIVE)
2176 return 0; 2161 return 0;
2177 2162
2178 /* Sanity check: make sure dir is valid */ 2163 /* Sanity check: make sure dir is valid */
2179 if ((dir < 0) || (dir >= 9)) 2164 if ((dir < 0) || (dir >= 9))
2180 { 2165 {
2186 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) 2171 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir)
2187 dir = absdir (dir + rndm (3) + rndm (3) - 2); 2172 dir = absdir (dir + rndm (3) + rndm (3) - 2);
2188 2173
2189 op->facing = dir; 2174 op->facing = dir;
2190 2175
2191 if (op->hide) 2176 if (op->flag [FLAG_HIDDEN])
2192 do_hidden_move (op); 2177 do_hidden_move (op);
2193 2178
2194 bool retval; 2179 bool retval;
2195 2180
2196 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir))) 2181 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir)))
2268 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) 2253 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE))
2269 { 2254 {
2270 op->play_sound (sound_find ("ob_evaporate")); 2255 op->play_sound (sound_find ("ob_evaporate"));
2271 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); 2256 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2272 2257
2273 if (op->contr)
2274 esrv_del_item (op->contr, tmp->count);
2275
2276 tmp->destroy (); 2258 tmp->destroy ();
2277 CLEAR_FLAG (op, FLAG_LIFESAVE); 2259 CLEAR_FLAG (op, FLAG_LIFESAVE);
2278 2260
2279 if (op->stats.hp < 0) 2261 if (op->stats.hp < 0)
2280 op->stats.hp = op->stats.maxhp; 2262 op->stats.hp = op->stats.maxhp;
2292 return 0; 2274 return 0;
2293} 2275}
2294 2276
2295/* This goes throws the inventory and removes unpaid objects, and puts them 2277/* This goes throws the inventory and removes unpaid objects, and puts them
2296 * back in the map (location and map determined by values of env). This 2278 * back in the map (location and map determined by values of env). This
2297 * function will descend into containers. op is the object to start the search 2279 * function will descend into containers. op is the object to start the search
2298 * from. 2280 * from.
2299 */ 2281 */
2300static void 2282static void
2301drop_unpaid_items (object *op, object *env) 2283drop_unpaid_items (object *op, object *env)
2302{ 2284{
2303 while (op) 2285 while (op)
2304 { 2286 {
2305 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ 2287 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */
2306 2288
2307 if (QUERY_FLAG (op, FLAG_UNPAID)) 2289 if (QUERY_FLAG (op, FLAG_UNPAID))
2308 {
2309 if (env->type == PLAYER)
2310 esrv_del_item (env->contr, op->count);
2311
2312 op->insert_at (env); 2290 op->insert_at (env);
2313 }
2314 else if (op->inv) 2291 else if (op->inv)
2315 drop_unpaid_items (op->inv, env); 2292 drop_unpaid_items (op->inv, env);
2316 2293
2317 op = next; 2294 op = next;
2318 } 2295 }
2330 * Moved from apply.c to player.c - player.c is what 2307 * Moved from apply.c to player.c - player.c is what
2331 * actually uses this function. player.c may not be quite the 2308 * actually uses this function. player.c may not be quite the
2332 * best, a misc file for object actions is probably better, 2309 * best, a misc file for object actions is probably better,
2333 * but there isn't one in the server directory. 2310 * but there isn't one in the server directory.
2334 */ 2311 */
2335char * 2312const char *
2336gravestone_text (object *op) 2313gravestone_text (object *op)
2337{ 2314{
2338 static char buf2[MAX_BUF]; 2315 static dynbuf_text buf;
2339 char buf[MAX_BUF];
2340 time_t now = time (NULL);
2341 2316
2342 strcpy (buf2, " R.I.P.\n\n"); 2317 buf << "---- R.I.P. ----\n\n"
2318 << op->name;
2319
2343 if (op->type == PLAYER) 2320 if (op->type == PLAYER)
2344 sprintf (buf, "%s the %s\n", &op->name, op->contr->title); 2321 buf << " the " << op->contr->title;
2345 else
2346 sprintf (buf, "%s\n", &op->name);
2347 2322
2348 strncat (buf2, " ", 20 - strlen (buf) / 2); 2323 buf << "\n\n";
2349 strcat (buf2, buf); 2324
2325 buf << "who was level ";
2326 buf << (sint32)op->level << "\n\n" // OO breakdown
2327 << " when " << (op->contr ? "killed" : "died") << "\n\n";
2328
2350 if (op->type == PLAYER) 2329 if (op->type == PLAYER)
2351 sprintf (buf, "who was in level %d when killed\n", op->level); 2330 buf << "by " << op->contr->killer_name () << ".\n\n";
2352 else
2353 sprintf (buf, "who was in level %d when died.\n\n", op->level);
2354 2331
2355 strncat (buf2, " ", 20 - strlen (buf) / 2);
2356 strcat (buf2, buf);
2357 if (op->type == PLAYER)
2358 { 2332 {
2359 sprintf (buf, "by %s.\n\n", op->contr->killer); 2333 static char buf2[128];
2360 strncat (buf2, " ", 21 - strlen (buf) / 2); 2334 time_t now = time (NULL);
2361 strcat (buf2, buf);
2362 }
2363
2364 strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); 2335 strftime (buf2, 128, "%b %d %Y\n\n", localtime (&now));
2365 strncat (buf2, " ", 20 - strlen (buf) / 2); 2336 buf << buf2;
2366 strcat (buf2, buf); 2337 }
2367 2338
2368 return buf2; 2339 return buf;
2369} 2340}
2370 2341
2371void 2342void
2372do_some_living (object *op) 2343do_some_living (object *op)
2373{ 2344{
2554 op->stats.food--; 2525 op->stats.food--;
2555 } 2526 }
2556 2527
2557 if (op->stats.food < 0 && op->stats.hp >= 0) 2528 if (op->stats.food < 0 && op->stats.hp >= 0)
2558 { 2529 {
2559 object *tmp, *flesh = 0; 2530 object *flesh = 0;
2560 2531
2561 for (tmp = op->inv; tmp; tmp = tmp->below) 2532 for_inv_removable (op, tmp)
2562 { 2533 {
2563 if (!QUERY_FLAG (tmp, FLAG_UNPAID)) 2534 if (QUERY_FLAG (tmp, FLAG_UNPAID))
2535 continue;
2536
2537 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON)
2564 { 2538 {
2565 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) 2539 op->statusmsg ("You blindly grab for a bite of food. "
2566 { 2540 "H<To prevent you from starving, you ate some random item from your backpack.>");
2567 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food.");
2568 manual_apply (op, tmp, 0); 2541 manual_apply (op, tmp, 0);
2542
2569 if (op->stats.food >= 0 || op->stats.hp < 0) 2543 if (op->stats.food >= 0 || op->stats.hp < 0)
2570 break; 2544 break;
2571 } 2545 }
2572 else if (tmp->type == FLESH) 2546 else if (tmp->type == FLESH)
2573 flesh = tmp; 2547 flesh = tmp;
2574 } /* End if paid for object */ 2548 }
2575 } /* end of for loop */
2576 2549
2577 /* If player is still starving, it means they don't have any food, so 2550 /* If player is still starving, it means they don't have any food, so
2578 * eat flesh instead. 2551 * eat flesh instead.
2579 */ 2552 */
2580 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) 2553 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh)
2581 { 2554 {
2582 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); 2555 op->statusmsg ("You blindly grab for a bite of food. "
2556 "H<To prevent you from starving, you ate some random item from your backpack.>");
2583 manual_apply (op, flesh, 0); 2557 manual_apply (op, flesh, 0);
2584 } 2558 }
2559
2560 // If player is still starving, alert him!
2561 if (op->stats.food < 0)
2562 op->failmsg ("You are starving! "
2563 "H<Eat some food to increase your food and prevent you from an untimely death.>");
2585 } 2564 }
2586 2565
2587 if (op->stats.food < 0) 2566 if (op->stats.food < 0)
2588 { 2567 {
2589 op->stats.hp += op->stats.food; 2568 op->stats.hp += op->stats.food;
2590 op->stats.food = 0; 2569 op->stats.food = 0;
2570
2571 if (op->stats.hp < 0)
2572 {
2573 op->contr->killer = archetype::get ("killer_starvation");
2574 op->contr->killer->destroy ();
2591 } 2575 }
2576 }
2592 2577
2578 /* killer should be set here already */
2593 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2579 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2594 kill_player (op); 2580 kill_player (op);
2595 } 2581 }
2596} 2582}
2597 2583
2647 { 2633 {
2648 tmp->name = format ("%s's finger" , &op->name); 2634 tmp->name = format ("%s's finger" , &op->name);
2649 tmp->name_pl = format ("%s's fingers", &op->name); 2635 tmp->name_pl = format ("%s's fingers", &op->name);
2650 tmp->msg = format ( 2636 tmp->msg = format (
2651 "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", 2637 "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n",
2652 &op->name, op->contr->title, (int) (op->level), op->contr->killer 2638 &op->name, op->contr->title,
2639 (int)op->level,
2640 op->contr->killer_name ()
2653 ); 2641 );
2654 tmp->value = 0, tmp->type = 0; 2642 tmp->value = 0, tmp->type = 0;
2655 tmp->materialname = "organics"; 2643 tmp->materialname = "organics";
2656 tmp->insert_at (op, tmp); 2644 tmp->insert_at (op, tmp);
2657 } 2645 }
2663 } 2651 }
2664 2652
2665 INVOKE_PLAYER (DEATH, op->contr); 2653 INVOKE_PLAYER (DEATH, op->contr);
2666 2654
2667 command_kill_pets (op, 0); 2655 command_kill_pets (op, 0);
2668
2669 if (op->stats.food < 0)
2670 strcpy (op->contr->killer, "starvation");
2671 2656
2672 op->contr->play_sound (sound_find ("player_dies")); 2657 op->contr->play_sound (sound_find ("player_dies"));
2673 2658
2674 /* save the map location for corpse, gravestone */ 2659 /* save the map location for corpse, gravestone */
2675 x = op->x; 2660 x = op->x;
2784 lost_a_stat = 1; 2769 lost_a_stat = 1;
2785 } 2770 }
2786 } 2771 }
2787 } 2772 }
2788 } 2773 }
2774
2789 /* If no stat lost, tell the player. */ 2775 /* If no stat lost, tell the player. */
2790 if (!lost_a_stat) 2776 if (!lost_a_stat)
2791 { 2777 {
2792 /* determine_god() seems to not work sometimes... why is this? 2778 /* determine_god() seems to not work sometimes... why is this?
2793 Should I be using something else? GD */ 2779 Should I be using something else? GD */
2797 new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god); 2783 new_draw_info_format (NDI_UNIQUE, 0, op, "For a brief moment you feel the holy presence of %s protecting" " you.", god);
2798 else 2784 else
2799 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you."); 2785 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you.");
2800 } 2786 }
2801#else 2787#else
2802 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you" " feel a holy presence protecting you from losing yourself completely."); 2788 new_draw_info (NDI_UNIQUE, 0, op, "For a brief moment you feel a holy presence protecting you from losing yourself completely.");
2803#endif 2789#endif
2804 2790
2805 /* Put a gravestone up where the character 'almost' died. List the 2791 /* Put a gravestone up where the character 'almost' died. List the
2806 * exp loss on the stone. 2792 * exp loss on the stone.
2807 */ 2793 */
2808 tmp = arch_to_object (archetype::find ("gravestone")); 2794 tmp = arch_to_object (archetype::find ("gravestone"));
2809 sprintf (buf, "%s's gravestone", &op->name); 2795 tmp->name = format ("%s's gravestone", &op->name);
2810 tmp->name = buf; 2796 tmp->name_pl = format ("%s's gravestones", &op->name);
2811 sprintf (buf, "%s's gravestones", &op->name); 2797 tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n",
2812 tmp->name_pl = buf; 2798 &op->name, op->contr->title, op->contr->killer_name ());
2813 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);
2814 tmp->msg = buf;
2815 tmp->x = op->x, tmp->y = op->y; 2799 tmp->x = op->x, tmp->y = op->y;
2816 insert_ob_in_map (tmp, op->map, NULL, 0); 2800 insert_ob_in_map (tmp, op->map, NULL, 0);
2817 2801
2818 /**************************************/ 2802 /**************************************/
2819 /* */ 2803 /* */
2842 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2826 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2843 } 2827 }
2844 2828
2845 cure_disease (op, 0, 0); /* remove any disease */ 2829 cure_disease (op, 0, 0); /* remove any disease */
2846 2830
2831 // remove all spell effects that are active
2832 // to avoid long-term effects such as word-of-recall
2833 for (object *item = op->inv; item; )
2834 {
2835 object *next = item->below;
2836
2837 if (item->type == SPELL_EFFECT && item->active)
2838 item->destroy ();
2839
2840 item = next;
2841 }
2842
2847 /*add_exp(op, (op->stats.exp * -0.20)); */ 2843 /*add_exp(op, (op->stats.exp * -0.20)); */
2848 apply_death_exp_penalty (op); 2844 apply_death_exp_penalty (op);
2845
2849 if (op->stats.food < 100) 2846 if (op->stats.food < 100)
2850 op->stats.food = 900; 2847 op->stats.food = 900;
2848
2851 op->stats.hp = op->stats.maxhp; 2849 op->stats.hp = op->stats.maxhp;
2852 op->stats.sp = MAX (op->stats.sp, op->stats.maxsp); 2850 op->stats.sp = MAX (op->stats.sp, op->stats.maxsp);
2853 op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace); 2851 op->stats.grace = MAX (op->stats.grace, op->stats.maxgrace);
2854 2852
2855 /* 2853 /*
2893 if (will_kill_again & (1 << at)) 2891 if (will_kill_again & (1 << at))
2894 force->resist[at] = 100; 2892 force->resist[at] = 100;
2895 2893
2896 insert_ob_in_ob (force, op); 2894 insert_ob_in_ob (force, op);
2897 op->update_stats (); 2895 op->update_stats ();
2898
2899 } 2896 }
2900 2897
2901 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); 2898 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED.");
2902} 2899}
2903 2900
2923 2920
2924 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3)))) 2921 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3))))
2925 { 2922 {
2926 if (tmp->nrof > 1) 2923 if (tmp->nrof > 1)
2927 { 2924 {
2928 tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); 2925 tmp->decrease (rndm (1, tmp->nrof - 1));
2929 tmp2->destroy ();
2930 insert_ob_in_map (tmp, op->map, NULL, 0); 2926 insert_ob_in_map (tmp, op->map, NULL, 0);
2931 } 2927 }
2932 else 2928 else
2933 tmp->destroy (); 2929 tmp->destroy ();
2934 } 2930 }
2945void 2941void
2946fix_weight (void) 2942fix_weight (void)
2947{ 2943{
2948 for_all_players (pl) 2944 for_all_players (pl)
2949 { 2945 {
2950 int old = pl->ob->carrying, sum = sum_weight (pl->ob); 2946 sint32 old = pl->ob->carrying;
2951 2947
2952 if (old == sum) 2948 pl->ob->update_weight ();
2953 continue; 2949
2950 if (old != pl->ob->carrying)
2951 {
2954 pl->ob->update_stats (); 2952 pl->ob->update_stats ();
2955 LOG (llevDebug, "Fixed inventory in %s (%d -> %d)\n", &pl->ob->name, old, sum); 2953 LOG (llevDebug, "Fixed inventory in %s (%d -> %d)\n", &pl->ob->name, (int)old, (int)pl->ob->carrying);
2954 }
2956 } 2955 }
2957} 2956}
2958 2957
2959void 2958void
2960fix_luck (void) 2959fix_luck (void)
3002} 3001}
3003 3002
3004void 3003void
3005make_visible (object *op) 3004make_visible (object *op)
3006{ 3005{
3007 op->hide = 0; 3006 op->flag [FLAG_HIDDEN] = 0;
3008 op->invisible = 0; 3007 op->invisible = 0;
3009 3008
3010 if (op->type == PLAYER) 3009 if (op->type == PLAYER)
3011 { 3010 {
3012 op->contr->tmp_invis = 0; 3011 op->contr->tmp_invis = 0;
3046 * as bad as carrying a light on a pitch dark map */ 3045 * as bad as carrying a light on a pitch dark map */
3047 if (has_carried_lights (ob)) 3046 if (has_carried_lights (ob))
3048 level = -(10 + (2 * ob->map->darkness)); 3047 level = -(10 + (2 * ob->map->darkness));
3049 3048
3050 /* scan through all nearby squares for terrain to hide in */ 3049 /* scan through all nearby squares for terrain to hide in */
3051 for (i = 0, x = ob->x, y = ob->y; i < 9; i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) 3050 for (i = 0, x = ob->x, y = ob->y;
3051 i <= SIZEOFFREE1;
3052 i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i])
3052 { 3053 {
3053 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); 3054 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL);
3054 if (mflag & P_OUT_OF_MAP) 3055 if (mflag & P_OUT_OF_MAP)
3055 {
3056 continue; 3056 continue;
3057 } 3057
3058 if (mflag & P_BLOCKSVIEW) /* something to hide near! */ 3058 if (mflag & P_BLOCKSVIEW) /* something to hide near! */
3059 level += 2; 3059 level += 2;
3060 else /* open terrain! */ 3060 else /* open terrain! */
3061 level -= 1; 3061 level -= 1;
3062 } 3062 }
3073 * spot (surrounded by clear terrain in broad daylight). -b.t. 3073 * spot (surrounded by clear terrain in broad daylight). -b.t.
3074 */ 3074 */
3075void 3075void
3076do_hidden_move (object *op) 3076do_hidden_move (object *op)
3077{ 3077{
3078 int hide = 0, num = random_roll (0, 19, op, PREFER_LOW); 3078 int hide = 0;
3079 object *skop;
3080 3079
3081 if (!op || !op->map) 3080 if (!op || !op->map)
3082 return; 3081 return;
3083 3082
3084 skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING); 3083 object *skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING);
3084 int num = random_roll (0, 19, op, PREFER_LOW);
3085 3085
3086 /* its *extremely* hard to run and sneak/hide at the same time! */ 3086 /* its *extremely* hard to run and sneak/hide at the same time! */
3087 if (op->type == PLAYER && op->contr->run_on) 3087 if (op->type == PLAYER && op->contr->run_on)
3088 if (!skop || num >= skop->level) 3088 if (!skop || num >= skop->level)
3089 { 3089 {
3099 num -= hide; 3099 num -= hide;
3100 3100
3101 if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0)) 3101 if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0))
3102 { 3102 {
3103 make_visible (op); 3103 make_visible (op);
3104
3104 if (op->type == PLAYER) 3105 if (op->type == PLAYER)
3105 new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!"); 3106 new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!");
3106 } 3107 }
3107 else if (op->type == PLAYER && skop) 3108 else if (op->type == PLAYER && skop)
3108 change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0); 3109 change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0);
3231 3232
3232 if (op->contr && op->contr->tmp_invis == 0) 3233 if (op->contr && op->contr->tmp_invis == 0)
3233 return 0; 3234 return 0;
3234 3235
3235 /* If monsters, they should become visible */ 3236 /* If monsters, they should become visible */
3236 if (op->hide || !op->contr || (op->contr && op->contr->tmp_invis)) 3237 if (op->flag [FLAG_HIDDEN] || !op->contr || (op->contr && op->contr->tmp_invis))
3237 { 3238 {
3238 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); 3239 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->flag [FLAG_HIDDEN] ? "unhidden" : "visible");
3239 return 1; 3240 return 1;
3240 } 3241 }
3241 } 3242 }
3242 3243
3243 return 0; 3244 return 0;
3449 else 3450 else
3450 { 3451 {
3451 /* generate misc. treasure */ 3452 /* generate misc. treasure */
3452 tmp = arch_to_object (tr->item); 3453 tmp = arch_to_object (tr->item);
3453 new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp)); 3454 new_draw_info_format (NDI_UNIQUE | NDI_BLUE, 0, who, "You gained %s", query_short_name (tmp));
3454 tmp = insert_ob_in_ob (tmp, who); 3455 who->insert (tmp);
3455 if (who->type == PLAYER)
3456 esrv_send_item (who, tmp);
3457 } 3456 }
3458} 3457}
3459 3458
3460/** 3459/**
3461 * Unready an object for a player. This function does nothing if the object was 3460 * Unready an object for a player. This function does nothing if the object was

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines