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.169 by root, Sun Sep 7 21:31:23 2008 UTC vs.
Revision 1.175 by root, Sat Dec 27 02:31:19 2008 UTC

995 item->nrof = give; 995 item->nrof = give;
996 996
997 if (nr) 997 if (nr)
998 item->nrof *= nr; 998 item->nrof *= nr;
999 999
1000 if (is_in_shop (converter)) 1000 if (converter->flag [FLAG_PRECIOUS])
1001 SET_FLAG (item, FLAG_UNPAID); 1001 SET_FLAG (item, FLAG_UNPAID);
1002
1003 if (is_in_shop (converter))
1004 {
1005 // converters on shop floors don't work anymore, bug lets check for it
1006 // and report in case someone still does it.
1007 LOG (llevDebug, "ITEMBUG: broken converter, converters on shop floor don't work: %s\n",
1008 converter->debug_desc ());
1009 SET_FLAG (item, FLAG_UNPAID);
1010 }
1002 else if (price_in < sint64 (item->nrof) * item->value) 1011 else if (price_in < sint64 (item->nrof) * item->value)
1003 { 1012 {
1004 LOG (llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n", 1013 LOG (llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n",
1005 &converter->name, &converter->map->path, converter->x, converter->y, price_in, item->nrof * item->value, &item->name); 1014 &converter->name, &converter->map->path, converter->x, converter->y, price_in, item->nrof * item->value, &item->name);
1006 /** 1015 /**
1306 ns->play_sound (sign->sound); 1315 ns->play_sound (sign->sound);
1307 else if (autoapply) 1316 else if (autoapply)
1308 ns->play_sound (sound_find ("msg_voice")); 1317 ns->play_sound (sound_find ("msg_voice"));
1309 1318
1310 if (ns->can_msg) 1319 if (ns->can_msg)
1311 op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n\n\n%s", &sign->name, &sign->msg)); 1320 op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg));
1312 else 1321 else
1313 { 1322 {
1314 readable_message_type *msgType = get_readable_message_type (sign); 1323 readable_message_type *msgType = get_readable_message_type (sign);
1315 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); 1324 const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg);
1316 draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); 1325 draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg);
1627 readable_message_type *msgType = get_readable_message_type (tmp); 1636 readable_message_type *msgType = get_readable_message_type (tmp);
1628 1637
1629 if (player *pl = op->contr) 1638 if (player *pl = op->contr)
1630 if (client *ns = pl->ns) 1639 if (client *ns = pl->ns)
1631 if (ns->can_msg) 1640 if (ns->can_msg)
1632 pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); 1641 pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg));
1633 else 1642 else
1634 draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, 1643 draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op,
1635 msgType->message_type, msgType->message_subtype, 1644 msgType->message_type, msgType->message_subtype,
1636 "You open the %s and start reading.\n%s", (char *)"%s\n%s", 1645 "You open the %s and start reading.\n%s", (char *)"%s\n%s",
1637 long_desc (tmp, op), &tmp->msg); 1646 long_desc (tmp, op), &tmp->msg);
1965 if (op->destroyed () || tmp->destroyed ()) 1974 if (op->destroyed () || tmp->destroyed ())
1966 break; 1975 break;
1967 } 1976 }
1968 1977
1969 if (!tmp->destroyed () && !tmp->inv) 1978 if (!tmp->destroyed () && !tmp->inv)
1970 tmp->decrease (); 1979 tmp->decrease (true);
1971} 1980}
1972 1981
1973/** 1982/**
1974 * op eats food. 1983 * op eats food.
1975 * If player, takes care of messages and dragon special food. 1984 * If player, takes care of messages and dragon special food.
2170 op->statusmsg (buf); 2179 op->statusmsg (buf);
2171 2180
2172 /* now choose a winner if we have any */ 2181 /* now choose a winner if we have any */
2173 i = -1; 2182 i = -1;
2174 if (winners > 0) 2183 if (winners > 0)
2175 i = atnr_winner[RANDOM () % winners]; 2184 i = atnr_winner [rndm (winners)];
2176 2185
2177 if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) 2186 if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95)
2178 { 2187 {
2179 /* resistance increased! */ 2188 /* resistance increased! */
2180 skin->resist[i]++; 2189 skin->resist[i]++;
2660 * person moving on it, also activate. Added code to make it 2669 * person moving on it, also activate. Added code to make it
2661 * so that at least one of players movement types be that which 2670 * so that at least one of players movement types be that which
2662 * the item needs. 2671 * the item needs.
2663 */ 2672 */
2664 if (!tmp->invisible || (tmp->move_on & pl->move_type)) 2673 if (!tmp->invisible || (tmp->move_on & pl->move_type))
2665 {
2666 if (player_apply (pl, tmp, 0, 1) == 1) 2674 if (player_apply (pl, tmp, 0, 1) == 1)
2667 return; 2675 return;
2668 } 2676
2669 if (floors >= 2) 2677 if (floors >= 2)
2670 return; /* process at most two floor objects */ 2678 return; /* process at most two floor objects */
2671 } 2679 }
2672} 2680}
2673 2681
2767 op->destroy (); 2775 op->destroy ();
2768 who->insert (tmp2); 2776 who->insert (tmp2);
2769 who->update_stats (); 2777 who->update_stats ();
2770 2778
2771 if (who->contr) 2779 if (who->contr)
2772 {
2773 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 2780 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
2774 { 2781 {
2775 who->failmsg ("Oops, it feels deadly cold!"); 2782 who->failmsg ("Oops, it feels deadly cold!");
2776 SET_FLAG (tmp2, FLAG_KNOWN_CURSED); 2783 SET_FLAG (tmp2, FLAG_KNOWN_CURSED);
2777 } 2784 }
2778 }
2779 } 2785 }
2780 2786
2781 return 1; /* otherwise, an attempt to drop causes problems */ 2787 return 1; /* otherwise, an attempt to drop causes problems */
2782 2788
2783 case BOW: 2789 case BOW:
3305 who->update_stats (); 3311 who->update_stats ();
3306 3312
3307 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 3313 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
3308 if (who->type == PLAYER) 3314 if (who->type == PLAYER)
3309 { 3315 {
3310 who->failmsg ("Oops, it feels deadly cold! H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>"); 3316 who->failmsg ("Oops, it feels deadly cold! H<Maybe it wasn't such a bright (hrhrhr) idea to apply this cursed or damned item.>");
3311 SET_FLAG (tmp2, FLAG_KNOWN_CURSED); 3317 SET_FLAG (tmp2, FLAG_KNOWN_CURSED);
3312 } 3318 }
3313 3319
3314 return 0; 3320 return 0;
3315 3321
3493 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 3499 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
3494 if (who->type == PLAYER) 3500 if (who->type == PLAYER)
3495 { 3501 {
3496 who->failmsg ( 3502 who->failmsg (
3497 "Oops, it feels deadly cold! " 3503 "Oops, it feels deadly cold! "
3498 "H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>" 3504 "H<Maybe it wasn't such a bright idea to apply this cursed or damned item.>"
3499 ); 3505 );
3500 SET_FLAG (op, FLAG_KNOWN_CURSED); 3506 SET_FLAG (op, FLAG_KNOWN_CURSED);
3501 } 3507 }
3502 3508
3503 if (object *pl = op->visible_to ()) 3509 if (object *pl = op->visible_to ())
3572 /* If we generated an object and put it in this object inventory, 3578 /* If we generated an object and put it in this object inventory,
3573 * move it to the parent object as the current object is about 3579 * move it to the parent object as the current object is about
3574 * to disappear. An example of this item is the random_* stuff 3580 * to disappear. An example of this item is the random_* stuff
3575 * that is put inside other objects. 3581 * that is put inside other objects.
3576 */ 3582 */
3577 for (tmp = op->inv; tmp; tmp = tmp2)
3578 {
3579 tmp2 = tmp->below;
3580 tmp->remove ();
3581
3582 if (op->env) 3583 if (op->env)
3583 insert_ob_in_ob (tmp, op->env); 3584 while (op->inv)
3584 else 3585 op->env->insert (op->inv);
3585 tmp->destroy ();
3586 }
3587 3586
3588 op->destroy (); 3587 op->destroy ();
3589 break; 3588 break;
3590 } 3589 }
3591 3590

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines