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.215 by root, Sun Nov 29 09:41:28 2009 UTC vs.
Revision 1.219 by root, Sat Jan 30 23:30:26 2010 UTC

1766 * instead of having their spell stored in stats.sp. These are 1766 * instead of having their spell stored in stats.sp. These are
1767 * legacy spellbooks 1767 * legacy spellbooks
1768 */ 1768 */
1769 if (tmp->slaying) 1769 if (tmp->slaying)
1770 { 1770 {
1771 spell = arch_to_object (find_archetype_by_object_name (tmp->slaying)); 1771 spell = find_archetype_by_object_name (tmp->slaying)->instance ();
1772
1772 if (!spell) 1773 if (!spell)
1773 { 1774 {
1774 op->failmsg (format ("The book's formula for %s is incomplete.", &tmp->slaying)); 1775 op->failmsg (format ("The book's formula for %s is incomplete.", &tmp->slaying));
1775 return; 1776 return;
1776 } 1777 }
1997 int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */ 1998 int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */
1998 int winners = 0; /* number of winners */ 1999 int winners = 0; /* number of winners */
1999 int i; /* index */ 2000 int i; /* index */
2000 2001
2001 /* let's make sure and doublecheck the parameters */ 2002 /* let's make sure and doublecheck the parameters */
2002 if (meal->type != FLESH || !is_dragon_pl (op)) 2003 if (meal->type != FLESH || !op->is_dragon ())
2003 return 0; 2004 return 0;
2004 2005
2005 /* now grab the 'dragon_skin'- and 'dragon_ability'-forces 2006 /* now grab the 'dragon_skin'- and 'dragon_ability'-forces
2006 from the player's inventory */ 2007 from the player's inventory */
2007 for (tmp = op->inv; tmp; tmp = tmp->below) 2008 for (tmp = op->inv; tmp; tmp = tmp->below)
2145 if (op->type != PLAYER) 2146 if (op->type != PLAYER)
2146 op->stats.hp = op->stats.maxhp; 2147 op->stats.hp = op->stats.maxhp;
2147 else 2148 else
2148 { 2149 {
2149 /* check if this is a dragon (player), eating some flesh */ 2150 /* check if this is a dragon (player), eating some flesh */
2150 if (tmp->type == FLESH && is_dragon_pl (op) && dragon_eat_flesh (op, tmp)) 2151 if (tmp->type == FLESH && op->is_dragon () && dragon_eat_flesh (op, tmp))
2151 ; 2152 ;
2152 else 2153 else
2153 { 2154 {
2154 /* usual case - no dragon meal: */ 2155 /* usual case - no dragon meal: */
2155 if (op->stats.food + tmp->stats.food > 999) 2156 if (op->stats.food + tmp->stats.food > 999)
2170 2171
2171 if (!QUERY_FLAG (tmp, FLAG_CURSED)) 2172 if (!QUERY_FLAG (tmp, FLAG_CURSED))
2172 { 2173 {
2173 const char *buf; 2174 const char *buf;
2174 2175
2175 if (!is_dragon_pl (op)) 2176 if (!op->is_dragon ())
2176 { 2177 {
2177 /* eating message for normal players */ 2178 /* eating message for normal players */
2178 if (tmp->type == DRINK) 2179 if (tmp->type == DRINK)
2179 buf = format ("Ahhh...that %s tasted good.", &tmp->name); 2180 buf = format ("Ahhh...that %s tasted good.", &tmp->name);
2180 else 2181 else
2619static void 2620static void
2620apply_item_transformer (object *pl, object *transformer) 2621apply_item_transformer (object *pl, object *transformer)
2621{ 2622{
2622 object *marked; 2623 object *marked;
2623 object *new_item; 2624 object *new_item;
2624 char *find; 2625 const char *find;
2625 char *separator; 2626 char *separator;
2626 int yield; 2627 int yield;
2627 char got[MAX_BUF]; 2628 char got[MAX_BUF];
2628 int len; 2629 int len;
2629 2630
2672 while (*find == ' ') 2673 while (*find == ' ')
2673 find++; 2674 find++;
2674 2675
2675 memset (got, 0, MAX_BUF); 2676 memset (got, 0, MAX_BUF);
2676 2677
2677 if ((separator = strchr (find, ';')) != NULL) 2678 if ((separator = strchr (find, ';')))
2678 len = separator - find; 2679 len = separator - find;
2679 else 2680 else
2680 len = strlen (find); 2681 len = strlen (find);
2681 2682
2682 if (len > MAX_BUF - 1) 2683 min_it (len, MAX_BUF - 1);
2683 len = MAX_BUF - 1;
2684 2684
2685 strcpy (got, find); 2685 strcpy (got, find);
2686 got[len] = '\0'; 2686 got[len] = '\0';
2687 2687
2688 /* Now create new item, remove used ones when required. */ 2688 /* Now create new item, remove used ones when required. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines