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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.17 by elmex, Wed Aug 30 11:58:43 2006 UTC vs.
Revision 1.18 by root, Sun Sep 3 00:18:42 2006 UTC

1/* 1/*
2 * static char *rcsid_apply_c = 2 * static char *rcsid_apply_c =
3 * "$Id: apply.C,v 1.17 2006/08/30 11:58:43 elmex Exp $"; 3 * "$Id: apply.C,v 1.18 2006/09/03 00:18:42 root Exp $";
4 */ 4 */
5/* 5/*
6 CrossFire, A Multiplayer game for X-windows 6 CrossFire, A Multiplayer game for X-windows
7 7
8 Copyright (C) 2001 Mark Wedel & Crossfire Development Team 8 Copyright (C) 2001 Mark Wedel & Crossfire Development Team
527 527
528 if (improver->slaying!=NULL) { 528 if (improver->slaying!=NULL) {
529 count = check_item(op,improver->slaying); 529 count = check_item(op,improver->slaying);
530 if (count<1) { 530 if (count<1) {
531 char buf[200]; 531 char buf[200];
532 sprintf(buf,"The gods want more %ss",improver->slaying); 532 sprintf(buf,"The gods want more %ss", &improver->slaying);
533 new_draw_info(NDI_UNIQUE,0,op,buf); 533 new_draw_info(NDI_UNIQUE,0,op,buf);
534 return 0; 534 return 0;
535 } 535 }
536 } 536 }
537 else 537 else
608 weapon->level=isqrt(sacrifice_count); 608 weapon->level=isqrt(sacrifice_count);
609 new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted."); 609 new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted.");
610 eat_item(op, improver->slaying, sacrifice_count); 610 eat_item(op, improver->slaying, sacrifice_count);
611 611
612 new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.", 612 new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.",
613 weapon->name,weapon->level); 613 &weapon->name,weapon->level);
614 614
615 sprintf(buf,"%s's %s",op->name,weapon->name); 615 sprintf(buf,"%s's %s",&op->name,&weapon->name);
616 FREE_AND_COPY(weapon->name, buf); 616 weapon->name = weapon->name_pl = buf;
617 FREE_AND_COPY(weapon->name_pl, buf);
618 weapon->nrof=0; /* prevents preparing n weapons in the same 617 weapon->nrof=0; /* prevents preparing n weapons in the same
619 slot at once! */ 618 slot at once! */
620 decrease_ob(improver); 619 decrease_ob(improver);
621 weapon->last_eat=0; 620 weapon->last_eat=0;
622 return 1; 621 return 1;
703 sacrifice_needed *=2; 702 sacrifice_needed *=2;
704 703
705 sacrifice_count = check_sacrifice(op,improver); 704 sacrifice_count = check_sacrifice(op,improver);
706 if (sacrifice_count < sacrifice_needed) { 705 if (sacrifice_count < sacrifice_needed) {
707 new_draw_info_format(NDI_UNIQUE, 0, op, 706 new_draw_info_format(NDI_UNIQUE, 0, op,
708 "You need at least %d %s", sacrifice_needed, improver->slaying); 707 "You need at least %d %s", sacrifice_needed, &improver->slaying);
709 return 0; 708 return 0;
710 } 709 }
711 eat_item(op,improver->slaying, sacrifice_needed); 710 eat_item(op,improver->slaying, sacrifice_needed);
712 weapon->item_power++; 711 weapon->item_power++;
713 712
948 item = object_create_clone(ob_to_copy); 947 item = object_create_clone(ob_to_copy);
949 CLEAR_FLAG(item, FLAG_IS_A_TEMPLATE); 948 CLEAR_FLAG(item, FLAG_IS_A_TEMPLATE);
950 unflag_inv(item, FLAG_IS_A_TEMPLATE); 949 unflag_inv(item, FLAG_IS_A_TEMPLATE);
951 } else { 950 } else {
952 if (converter->other_arch == NULL) { 951 if (converter->other_arch == NULL) {
953 LOG(llevError,"move_creator: Converter doesn't have other arch set: %s (%s, %d, %d)\n", converter->name ? converter->name : "(null)", converter->map->path, converter->x, converter->y); 952 LOG(llevError,"move_creator: Converter doesn't have other arch set: %s (%s, %d, %d)\n",
953 &converter->name, converter->map->path, converter->x, converter->y);
954 return -1; 954 return -1;
955 } 955 }
956 956
957 item = object_create_arch(converter->other_arch); 957 item = object_create_arch(converter->other_arch);
958 fix_generated_item(item, converter, 0, 0, GT_MINIMAL); 958 fix_generated_item(item, converter, 0, 0, GT_MINIMAL);
964 item->nrof*=nr; 964 item->nrof*=nr;
965 if(is_in_shop (converter)) 965 if(is_in_shop (converter))
966 SET_FLAG(item,FLAG_UNPAID); 966 SET_FLAG(item,FLAG_UNPAID);
967 else if(price_in < item->nrof*item->value) { 967 else if(price_in < item->nrof*item->value) {
968 LOG(llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n", 968 LOG(llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n",
969 converter->name, converter->map->path, converter->x, converter->y, price_in, 969 &converter->name, converter->map->path, converter->x, converter->y, price_in,
970 item->nrof*item->value, item->name); 970 item->nrof*item->value, &item->name);
971 /** 971 /**
972 * elmex: we are going to let the game continue, as the mapcreator 972 * elmex: we are going to let the game continue, as the mapcreator
973 * propably had something in mind when doing this 973 * propably had something in mind when doing this
974 */ 974 */
975 } 975 }
991 991
992 if(op->type!=PLAYER) 992 if(op->type!=PLAYER)
993 return 0; /* This might change */ 993 return 0; /* This might change */
994 994
995 if (sack==NULL || sack->type != CONTAINER) { 995 if (sack==NULL || sack->type != CONTAINER) {
996 LOG (llevError, "apply_container: %s is not container!\n",sack?sack->name:"NULL"); 996 LOG (llevError, "apply_container: %s is not container!\n", &sack->name);
997 return 0; 997 return 0;
998 } 998 }
999 op->contr->last_used = NULL; 999 op->contr->last_used = NULL;
1000 op->contr->last_used_id = 0; 1000 op->contr->last_used_id = 0;
1001 1001
1112 object *tmp=op->container; 1112 object *tmp=op->container;
1113 if(op->type!=PLAYER) 1113 if(op->type!=PLAYER)
1114 return 0; /* This might change */ 1114 return 0; /* This might change */
1115 1115
1116 if (sack==NULL || sack->type != CONTAINER) { 1116 if (sack==NULL || sack->type != CONTAINER) {
1117 LOG (llevError,
1118 "esrv_apply_container: %s is not container!\n",sack?sack->name:"NULL"); 1117 LOG (llevError, "esrv_apply_container: %s is not container!\n", &sack->name);
1119 return 0; 1118 return 0;
1120 } 1119 }
1121 1120
1122 /* If we have a currently open container, then it needs to be closed in all cases 1121 /* If we have a currently open container, then it needs to be closed in all cases
1123 * if we are opening this one up. We then fall through if appropriate for 1122 * if we are opening this one up. We then fall through if appropriate for
1220 /* Simple check. Unfortunately, it means you can't cast magic bullet 1219 /* Simple check. Unfortunately, it means you can't cast magic bullet
1221 * with an altar. We call it a Potion - altars are stationary - it 1220 * with an altar. We call it a Potion - altars are stationary - it
1222 * is up to map designers to use them properly. 1221 * is up to map designers to use them properly.
1223 */ 1222 */
1224 if (altar->inv && altar->inv->type==SPELL) { 1223 if (altar->inv && altar->inv->type==SPELL) {
1225 new_draw_info_format (NDI_BLACK, 0, originator, "The altar casts %s.", 1224 new_draw_info_format (NDI_BLACK, 0, originator, "The altar casts %s.", &altar->inv->name);
1226 altar->inv->name);
1227 cast_spell (originator, altar, 0, altar->inv, NULL); 1225 cast_spell (originator, altar, 0, altar->inv, NULL);
1228 /* If it is connected, push the button. Fixes some problems with 1226 /* If it is connected, push the button. Fixes some problems with
1229 * old maps. 1227 * old maps.
1230 */ 1228 */
1231/* push_button (altar);*/ 1229/* push_button (altar);*/
1388 new_draw_info (NDI_UNIQUE, 0, op, 1386 new_draw_info (NDI_UNIQUE, 0, op,
1389 "You are unable to read while blind."); 1387 "You are unable to read while blind.");
1390 return; 1388 return;
1391 } 1389 }
1392 msgType=get_readable_message_type(sign); 1390 msgType=get_readable_message_type(sign);
1393 snprintf(newbuf,sizeof(newbuf),"%hhu %s", autoapply?1:0,sign->msg); 1391 snprintf(newbuf,sizeof(newbuf),"%hhu %s", autoapply?1:0, &sign->msg);
1394 draw_ext_info(NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, newbuf, sign->msg); 1392 draw_ext_info(NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, newbuf, &sign->msg);
1395} 1393}
1396
1397 1394
1398/** 1395/**
1399 * 'victim' moves onto 'trap' 1396 * 'victim' moves onto 'trap'
1400 * 'victim' leaves 'trap' 1397 * 'victim' leaves 'trap'
1401 * effect is determined by move_on/move_off of trap and move_type of victime. 1398 * effect is determined by move_on/move_off of trap and move_type of victime.
1422 * proper. This code was causing needless crashes. 1419 * proper. This code was causing needless crashes.
1423 */ 1420 */
1424 if (recursion_depth >= 500) { 1421 if (recursion_depth >= 500) {
1425 LOG (llevDebug, "WARNING: move_apply(): aborting recursion " 1422 LOG (llevDebug, "WARNING: move_apply(): aborting recursion "
1426 "[trap arch %s, name %s; victim arch %s, name %s]\n", 1423 "[trap arch %s, name %s; victim arch %s, name %s]\n",
1427 trap->arch->name, trap->name, victim->arch->name, victim->name); 1424 &trap->arch->name, &trap->name, &victim->arch->name, &victim->name);
1428 return; 1425 return;
1429 } 1426 }
1430 recursion_depth++; 1427 recursion_depth++;
1431 if (trap->head) trap=trap->head; 1428 if (trap->head) trap=trap->head;
1432 1429
1624 } 1621 }
1625 goto leave; 1622 goto leave;
1626 1623
1627 default: 1624 default:
1628 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not " 1625 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not "
1629 "handled in move_apply()\n", trap->name, trap->arch->name, 1626 "handled in move_apply()\n", &trap->name, &trap->arch->name,
1630 trap->type); 1627 trap->type);
1631 goto leave; 1628 goto leave;
1632 } 1629 }
1633 1630
1634 leave: 1631 leave:
1647 new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind."); 1644 new_draw_info(NDI_UNIQUE, 0,op,"You are unable to read while blind.");
1648 return; 1645 return;
1649 } 1646 }
1650 if(tmp->msg==NULL) { 1647 if(tmp->msg==NULL) {
1651 new_draw_info_format(NDI_UNIQUE, 0, op, 1648 new_draw_info_format(NDI_UNIQUE, 0, op,
1652 "You open the %s and find it empty.", tmp->name); 1649 "You open the %s and find it empty.", &tmp->name);
1653 return; 1650 return;
1654 } 1651 }
1655 1652
1656 /* need a literacy skill to read stuff! */ 1653 /* need a literacy skill to read stuff! */
1657 skill_ob = find_skill_by_name(op, tmp->skill); 1654 skill_ob = find_skill_by_name(op, tmp->skill);
1680 readable_message_type* msgType = get_readable_message_type(tmp); 1677 readable_message_type* msgType = get_readable_message_type(tmp);
1681 draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op, 1678 draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op,
1682 msgType->message_type, msgType->message_subtype, 1679 msgType->message_type, msgType->message_subtype,
1683 "You open the %s and start reading.\n%s", 1680 "You open the %s and start reading.\n%s",
1684 "%s\n%s", 1681 "%s\n%s",
1685 long_desc(tmp,op), tmp->msg); 1682 long_desc(tmp,op), &tmp->msg);
1686 1683
1687 /* gain xp from reading */ 1684 /* gain xp from reading */
1688 if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */ 1685 if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */
1689 int exp_gain=calc_skill_exp(op,tmp, skill_ob); 1686 int exp_gain=calc_skill_exp(op,tmp, skill_ob);
1690 if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) { 1687 if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) {
1710 new_draw_info(NDI_UNIQUE, 0,op,"You already possess the knowledge "); 1707 new_draw_info(NDI_UNIQUE, 0,op,"You already possess the knowledge ");
1711 new_draw_info_format(NDI_UNIQUE, 0,op,"held within the %s.\n",query_name(tmp)); 1708 new_draw_info_format(NDI_UNIQUE, 0,op,"held within the %s.\n",query_name(tmp));
1712 return; 1709 return;
1713 1710
1714 case 1: 1711 case 1:
1715 new_draw_info_format(NDI_UNIQUE, 0,op,"You succeed in learning %s", 1712 new_draw_info_format(NDI_UNIQUE, 0,op,"You succeed in learning %s", &tmp->skill);
1716 tmp->skill);
1717 new_draw_info_format(NDI_UNIQUE, 0, op,
1718 "Type 'bind ready_skill %s",tmp->skill);
1719 new_draw_info(NDI_UNIQUE, 0,op,"to store the skill in a key.");
1720 decrease_ob(tmp); 1713 decrease_ob(tmp);
1721 return; 1714 return;
1722 1715
1723 default: 1716 default:
1724 new_draw_info_format(NDI_UNIQUE,0,op, 1717 new_draw_info_format(NDI_UNIQUE,0,op,
1757 1750
1758 if (special_prayer) { 1751 if (special_prayer) {
1759 SET_FLAG(tmp, FLAG_STARTEQUIP); 1752 SET_FLAG(tmp, FLAG_STARTEQUIP);
1760 } 1753 }
1761 1754
1762 new_draw_info_format (NDI_UNIQUE, 0, op,
1763 "Type 'bind cast %s", spell->name);
1764 new_draw_info (NDI_UNIQUE, 0, op, "to store the spell in a key.");
1765 esrv_add_spells(op->contr, tmp); 1755 esrv_add_spells(op->contr, tmp);
1766} 1756}
1767 1757
1768/** 1758/**
1769 * Erases spell from player's inventory. 1759 * Erases spell from player's inventory.
1810 1800
1811 if(tmp->slaying != NULL) { 1801 if(tmp->slaying != NULL) {
1812 spell=arch_to_object(find_archetype_by_object_name(tmp->slaying)); 1802 spell=arch_to_object(find_archetype_by_object_name(tmp->slaying));
1813 if (!spell) { 1803 if (!spell) {
1814 new_draw_info_format(NDI_UNIQUE, 0, op, 1804 new_draw_info_format(NDI_UNIQUE, 0, op,
1815 "The book's formula for %s is incomplete", tmp->slaying); 1805 "The book's formula for %s is incomplete", &tmp->slaying);
1816 return; 1806 return;
1817 } 1807 }
1818 else 1808 else
1819 insert_ob_in_ob(spell, tmp); 1809 insert_ob_in_ob(spell, tmp);
1820 free_string(tmp->slaying);
1821 tmp->slaying=NULL; 1810 tmp->slaying=NULL;
1822 } 1811 }
1823 1812
1824 skop = find_skill_by_name(op, tmp->skill); 1813 skop = find_skill_by_name(op, tmp->skill);
1825 1814
1830 return; 1819 return;
1831 } 1820 }
1832 1821
1833 spell = tmp->inv; 1822 spell = tmp->inv;
1834 if (!spell) { 1823 if (!spell) {
1835 LOG(llevError,"apply_spellbook: Book %s has no spell in it!\n", tmp->name); 1824 LOG(llevError,"apply_spellbook: Book %s has no spell in it!\n", &tmp->name);
1836 new_draw_info(NDI_UNIQUE, 0,op,"The spellbook symbols make no sense."); 1825 new_draw_info(NDI_UNIQUE, 0,op,"The spellbook symbols make no sense.");
1837 return; 1826 return;
1838 } 1827 }
1839 if (spell->level > (skop->level+10)) { 1828 if (spell->level > (skop->level+10)) {
1840 new_draw_info(NDI_UNIQUE, 0,op,"You are unable to decipher the strange symbols."); 1829 new_draw_info(NDI_UNIQUE, 0,op,"You are unable to decipher the strange symbols.");
1841 return; 1830 return;
1842 } 1831 }
1843 1832
1844 new_draw_info_format(NDI_UNIQUE, 0, op, 1833 new_draw_info_format(NDI_UNIQUE, 0, op,
1845 "The spellbook contains the %s level spell %s.", 1834 "The spellbook contains the %s level spell %s.",
1846 get_levelnumber(spell->level), spell->name); 1835 get_levelnumber(spell->level), &spell->name);
1847 1836
1848 if (!QUERY_FLAG(tmp, FLAG_IDENTIFIED)) { 1837 if (!QUERY_FLAG(tmp, FLAG_IDENTIFIED)) {
1849 identify(tmp); 1838 identify(tmp);
1850 if (tmp->env) 1839 if (tmp->env)
1851 esrv_update_item(UPD_FLAGS|UPD_NAME,op,tmp); 1840 esrv_update_item(UPD_FLAGS|UPD_NAME,op,tmp);
1866 if (spell->skill) { 1855 if (spell->skill) {
1867 spell_skill = find_skill_by_name(op, spell->skill); 1856 spell_skill = find_skill_by_name(op, spell->skill);
1868 if (!spell_skill) { 1857 if (!spell_skill) {
1869 new_draw_info_format(NDI_UNIQUE, 0, op, 1858 new_draw_info_format(NDI_UNIQUE, 0, op,
1870 "You lack the skill %s to use this spell", 1859 "You lack the skill %s to use this spell",
1871 spell->skill); 1860 &spell->skill);
1872 return; 1861 return;
1873 } 1862 }
1874 if (spell_skill->level < spell->level) { 1863 if (spell_skill->level < spell->level) {
1875 new_draw_info_format(NDI_UNIQUE, 0, op, 1864 new_draw_info_format(NDI_UNIQUE, 0, op,
1876 "You need to be level %d in %s to learn this spell.", 1865 "You need to be level %d in %s to learn this spell.",
1877 spell->level, spell->skill); 1866 spell->level, &spell->skill);
1878 return; 1867 return;
1879 } 1868 }
1880 } 1869 }
1881 1870
1882 /* Logic as follows 1871 /* Logic as follows
1950 1939
1951 if (!QUERY_FLAG(tmp, FLAG_IDENTIFIED)) 1940 if (!QUERY_FLAG(tmp, FLAG_IDENTIFIED))
1952 identify(tmp); 1941 identify(tmp);
1953 1942
1954 new_draw_info_format(NDI_BLACK, 0, op, 1943 new_draw_info_format(NDI_BLACK, 0, op,
1955 "The scroll of %s turns to dust.", tmp->inv->name); 1944 "The scroll of %s turns to dust.", &tmp->inv->name);
1956 1945
1957 1946
1958 cast_spell(op,tmp,dir,tmp->inv, NULL); 1947 cast_spell(op,tmp,dir,tmp->inv, NULL);
1959 decrease_ob(tmp); 1948 decrease_ob(tmp);
1960} 1949}
2038 char buf[MAX_BUF]; 2027 char buf[MAX_BUF];
2039 2028
2040 if (!is_dragon_pl(op)) { 2029 if (!is_dragon_pl(op)) {
2041 /* eating message for normal players*/ 2030 /* eating message for normal players*/
2042 if(tmp->type==DRINK) 2031 if(tmp->type==DRINK)
2043 sprintf(buf,"Ahhh...that %s tasted good.",tmp->name); 2032 sprintf(buf,"Ahhh...that %s tasted good.",&tmp->name);
2044 else 2033 else
2045 sprintf(buf,"The %s tasted %s",tmp->name, 2034 sprintf(buf,"The %s tasted %s",&tmp->name,
2046 tmp->type==FLESH?"terrible!":"good."); 2035 tmp->type==FLESH?"terrible!":"good.");
2047 } 2036 }
2048 else { 2037 else {
2049 /* eating message for dragon players*/ 2038 /* eating message for dragon players*/
2050 sprintf(buf,"The %s tasted terrible!",tmp->name); 2039 sprintf(buf,"The %s tasted terrible!",&tmp->name);
2051 } 2040 }
2052 2041
2053 new_draw_info(NDI_UNIQUE, 0,op,buf); 2042 new_draw_info(NDI_UNIQUE, 0,op,buf);
2054 capacity_remaining = 999 - op->stats.food; 2043 capacity_remaining = 999 - op->stats.food;
2055 op->stats.food+=tmp->stats.food; 2044 op->stats.food+=tmp->stats.food;
2170 2159
2171 /* inverse totalchance as until now we have the failure-chance */ 2160 /* inverse totalchance as until now we have the failure-chance */
2172 totalchance = 100 - totalchance*100; 2161 totalchance = 100 - totalchance*100;
2173 /* print message according to totalchance */ 2162 /* print message according to totalchance */
2174 if (totalchance > 50.) 2163 if (totalchance > 50.)
2175 sprintf(buf, "Hmm! The %s tasted delicious!", meal->name); 2164 sprintf(buf, "Hmm! The %s tasted delicious!", &meal->name);
2176 else if (totalchance > 10.) 2165 else if (totalchance > 10.)
2177 sprintf(buf, "The %s tasted very good.", meal->name); 2166 sprintf(buf, "The %s tasted very good.", &meal->name);
2178 else if (totalchance > 1.) 2167 else if (totalchance > 1.)
2179 sprintf(buf, "The %s tasted good.", meal->name); 2168 sprintf(buf, "The %s tasted good.", &meal->name);
2180 else if (totalchance > 0.1) 2169 else if (totalchance > 0.1)
2181 sprintf(buf, "The %s tasted bland.", meal->name); 2170 sprintf(buf, "The %s tasted bland.", &meal->name);
2182 else if (totalchance >= 0.01) 2171 else if (totalchance >= 0.01)
2183 sprintf(buf, "The %s had a boring taste.", meal->name); 2172 sprintf(buf, "The %s had a boring taste.", &meal->name);
2184 else if (meal->last_eat > 0 && atnr_is_dragon_enabled(meal->last_eat)) 2173 else if (meal->last_eat > 0 && atnr_is_dragon_enabled(meal->last_eat))
2185 sprintf(buf, "The %s tasted strange.", meal->name); 2174 sprintf(buf, "The %s tasted strange.", &meal->name);
2186 else 2175 else
2187 sprintf(buf, "The %s had no taste.", meal->name); 2176 sprintf(buf, "The %s had no taste.", &meal->name);
2188 new_draw_info(NDI_UNIQUE, 0, op, buf); 2177 new_draw_info(NDI_UNIQUE, 0, op, buf);
2189 2178
2190 /* now choose a winner if we have any */ 2179 /* now choose a winner if we have any */
2191 i = -1; 2180 i = -1;
2192 if (winners>0) 2181 if (winners>0)
2236 /* Need to call terminate_all_pets() before we remove the player ob */ 2225 /* Need to call terminate_all_pets() before we remove the player ob */
2237 terminate_all_pets(pl); 2226 terminate_all_pets(pl);
2238 remove_ob(pl); 2227 remove_ob(pl);
2239 pl->direction=0; 2228 pl->direction=0;
2240 new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, 2229 new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl,
2241 "%s leaves the game.",pl->name); 2230 "%s leaves the game.", &pl->name);
2242 2231
2243 /* update respawn position */ 2232 /* update respawn position */
2244 strcpy(pl->contr->savebed_map, pl->map->path); 2233 strcpy(pl->contr->savebed_map, pl->map->path);
2245 pl->contr->bed_x = pl->x; 2234 pl->contr->bed_x = pl->x;
2246 pl->contr->bed_y = pl->y; 2235 pl->contr->bed_y = pl->y;
2725 new_draw_info_format (NDI_UNIQUE, 0, who, 2714 new_draw_info_format (NDI_UNIQUE, 0, who,
2726 "You stop using the %s.", query_name(op)); 2715 "You stop using the %s.", query_name(op));
2727 } else { 2716 } else {
2728 new_draw_info_format (NDI_UNIQUE, 0, who, 2717 new_draw_info_format (NDI_UNIQUE, 0, who,
2729 "You can no longer use the skill: %s.", 2718 "You can no longer use the skill: %s.",
2730 op->skill); 2719 &op->skill);
2731 } 2720 }
2732 } 2721 }
2733 (void) change_abil (who, op); 2722 (void) change_abil (who, op);
2734 who->chosen_skill = NULL; 2723 who->chosen_skill = NULL;
2735 CLEAR_FLAG (who, FLAG_READY_SKILL); 2724 CLEAR_FLAG (who, FLAG_READY_SKILL);
2748 new_draw_info_format(NDI_UNIQUE, 0, who, "You unwear %s.",query_name(op)); 2737 new_draw_info_format(NDI_UNIQUE, 0, who, "You unwear %s.",query_name(op));
2749 (void) change_abil (who,op); 2738 (void) change_abil (who,op);
2750 break; 2739 break;
2751 case LAMP: 2740 case LAMP:
2752 new_draw_info_format(NDI_UNIQUE, 0, who, "You turn off your %s.", 2741 new_draw_info_format(NDI_UNIQUE, 0, who, "You turn off your %s.",
2753 op->name); 2742 &op->name);
2754 tmp2 = arch_to_object(op->other_arch); 2743 tmp2 = arch_to_object(op->other_arch);
2755 tmp2->x = op->x; 2744 tmp2->x = op->x;
2756 tmp2->y = op->y; 2745 tmp2->y = op->y;
2757 tmp2->map = op->map; 2746 tmp2->map = op->map;
2758 tmp2->below = op->below; 2747 tmp2->below = op->below;
3155 } 3144 }
3156 } 3145 }
3157 if (op->skill && op->type != SKILL && op->type != SKILL_TOOL) { 3146 if (op->skill && op->type != SKILL && op->type != SKILL_TOOL) {
3158 skop=find_skill_by_name(who, op->skill); 3147 skop=find_skill_by_name(who, op->skill);
3159 if (!skop) { 3148 if (!skop) {
3160 new_draw_info_format(NDI_UNIQUE, 0, who, "You need the %s skill to use this item!", op->skill); 3149 new_draw_info_format(NDI_UNIQUE, 0, who, "You need the %s skill to use this item!", &op->skill);
3161 return 1; 3150 return 1;
3162 } else { 3151 } else {
3163 /* While experience will be credited properly, we want to change the 3152 /* While experience will be credited properly, we want to change the
3164 * skill so that the dam and wc get updated 3153 * skill so that the dam and wc get updated
3165 */ 3154 */
3233 (void) change_abil (who,op); 3222 (void) change_abil (who,op);
3234 break; 3223 break;
3235 case LAMP: 3224 case LAMP:
3236 if (op->stats.food < 1) { 3225 if (op->stats.food < 1) {
3237 new_draw_info_format(NDI_UNIQUE, 0, who, "Your %s is out of" 3226 new_draw_info_format(NDI_UNIQUE, 0, who, "Your %s is out of"
3238 " fuel!", op->name); 3227 " fuel!", &op->name);
3239 return 1; 3228 return 1;
3240 } 3229 }
3241 new_draw_info_format(NDI_UNIQUE, 0, who, "You turn on your %s.", 3230 new_draw_info_format(NDI_UNIQUE, 0, who, "You turn on your %s.",
3242 op->name); 3231 &op->name);
3243 tmp2 = arch_to_object(op->other_arch); 3232 tmp2 = arch_to_object(op->other_arch);
3244 tmp2->stats.food = op->stats.food; 3233 tmp2->stats.food = op->stats.food;
3245 SET_FLAG(tmp2, FLAG_APPLIED); 3234 SET_FLAG(tmp2, FLAG_APPLIED);
3246 if (QUERY_FLAG(op, FLAG_INV_LOCKED)) 3235 if (QUERY_FLAG(op, FLAG_INV_LOCKED))
3247 SET_FLAG(tmp2, FLAG_INV_LOCKED); 3236 SET_FLAG(tmp2, FLAG_INV_LOCKED);
3284 if ( ! op->invisible) { 3273 if ( ! op->invisible) {
3285 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", 3274 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.",
3286 query_name (op)); 3275 query_name (op));
3287 new_draw_info_format (NDI_UNIQUE, 0, who, 3276 new_draw_info_format (NDI_UNIQUE, 0, who,
3288 "You can now use the skill: %s.", 3277 "You can now use the skill: %s.",
3289 op->skill); 3278 &op->skill);
3290 } else { 3279 } else {
3291 new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", 3280 new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.",
3292 op->skill? op->skill:op->name); 3281 op->skill ? &op->skill : &op->name);
3293 } 3282 }
3294 } 3283 }
3295 SET_FLAG (op, FLAG_APPLIED); 3284 SET_FLAG (op, FLAG_APPLIED);
3296 (void) change_abil (who, op); 3285 (void) change_abil (who, op);
3297 who->chosen_skill = op; 3286 who->chosen_skill = op;
3326 if(who->type==PLAYER) { 3315 if(who->type==PLAYER) {
3327 if (op->type == BOW) { 3316 if (op->type == BOW) {
3328 (void)change_abil(who, op); 3317 (void)change_abil(who, op);
3329 new_draw_info_format (NDI_UNIQUE, 0, who, 3318 new_draw_info_format (NDI_UNIQUE, 0, who,
3330 "You will now fire %s with %s.", 3319 "You will now fire %s with %s.",
3331 op->race ? op->race : "nothing", query_name(op)); 3320 op->race ? &op->race : "nothing", query_name(op));
3332 who->contr->shoottype = range_bow; 3321 who->contr->shoottype = range_bow;
3333 } else { 3322 } else {
3334 who->contr->shoottype = range_misc; 3323 who->contr->shoottype = range_misc;
3335 } 3324 }
3336 } else { 3325 } else {
3652 } 3641 }
3653 3642
3654 } else if(lighter->last_eat) { /* no charges left in lighter */ 3643 } else if(lighter->last_eat) { /* no charges left in lighter */
3655 new_draw_info_format(NDI_UNIQUE, 0,who, 3644 new_draw_info_format(NDI_UNIQUE, 0,who,
3656 "You attempt to light the %s with a used up %s.", 3645 "You attempt to light the %s with a used up %s.",
3657 item->name, lighter->name); 3646 &item->name, &lighter->name);
3658 return; 3647 return;
3659 } 3648 }
3660 /* Perhaps we should split what we are trying to light on fire? 3649 /* Perhaps we should split what we are trying to light on fire?
3661 * I can't see many times when you would want to light multiple 3650 * I can't see many times when you would want to light multiple
3662 * objects at once. 3651 * objects at once.
3674 /* Change to check count and not freed, since the object pointer 3663 /* Change to check count and not freed, since the object pointer
3675 * may have gotten recycled 3664 * may have gotten recycled
3676 */ 3665 */
3677 if ((nrof != item->nrof ) || (count != item->count)) { 3666 if ((nrof != item->nrof ) || (count != item->count)) {
3678 new_draw_info_format(NDI_UNIQUE, 0,who, 3667 new_draw_info_format(NDI_UNIQUE, 0,who,
3679 "You light the %s with the %s.",item_name,lighter->name); 3668 "You light the %s with the %s.", &item_name, &lighter->name);
3680 /* Need to update the player so that the players glow radius 3669 /* Need to update the player so that the players glow radius
3681 * gets changed. 3670 * gets changed.
3682 */ 3671 */
3683 if (is_player_env) fix_player(who); 3672 if (is_player_env) fix_player(who);
3684 } else { 3673 } else {
3685 new_draw_info_format(NDI_UNIQUE, 0,who, 3674 new_draw_info_format(NDI_UNIQUE, 0,who,
3686 "You attempt to light the %s with the %s and fail.",item->name,lighter->name); 3675 "You attempt to light the %s with the %s and fail.", &item->name, &lighter->name);
3687 } 3676 }
3688 3677
3689 } else /* nothing to light */ 3678 } else /* nothing to light */
3690 new_draw_info(NDI_UNIQUE, 0,who,"You need to mark a lightable object."); 3679 new_draw_info(NDI_UNIQUE, 0,who,"You need to mark a lightable object.");
3691 3680
3882 { 3871 {
3883 new_draw_info_format( NDI_UNIQUE, 0, pl, "This %s is strange, better to not use it.", query_base_name( marked, 0 ) ); 3872 new_draw_info_format( NDI_UNIQUE, 0, pl, "This %s is strange, better to not use it.", query_base_name( marked, 0 ) );
3884 return; 3873 return;
3885 } 3874 }
3886 new_item->nrof = yield; 3875 new_item->nrof = yield;
3887 new_draw_info_format( NDI_UNIQUE, 0, pl, "You %s the %s.", transformer->slaying, query_base_name( marked, 0 ) ); 3876 new_draw_info_format( NDI_UNIQUE, 0, pl, "You %s the %s.", &transformer->slaying, query_base_name( marked, 0 ) );
3888 insert_ob_in_ob( new_item, pl ); 3877 insert_ob_in_ob( new_item, pl );
3889 esrv_send_inventory( pl, pl ); 3878 esrv_send_inventory( pl, pl );
3890 /* Eat up one item */ 3879 /* Eat up one item */
3891 decrease_ob_nr( marked, 1 ); 3880 decrease_ob_nr( marked, 1 );
3892 /* Eat one transformer if needed */ 3881 /* Eat one transformer if needed */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines