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.195 by root, Mon May 5 15:21:50 2008 UTC vs.
Revision 1.196 by root, Mon May 5 15:54:39 2008 UTC

2545 op->stats.food--; 2545 op->stats.food--;
2546 } 2546 }
2547 2547
2548 if (op->stats.food < 0 && op->stats.hp >= 0) 2548 if (op->stats.food < 0 && op->stats.hp >= 0)
2549 { 2549 {
2550 object *tmp, *flesh = 0; 2550 object *flesh = 0;
2551 2551
2552 for (tmp = op->inv; tmp; tmp = tmp->below) 2552 for_inv_removable (op, tmp)
2553 { 2553 {
2554 if (!QUERY_FLAG (tmp, FLAG_UNPAID)) 2554 if (QUERY_FLAG (tmp, FLAG_UNPAID))
2555 continue;
2556
2557 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON)
2555 { 2558 {
2556 if (tmp->type == FOOD || tmp->type == DRINK || tmp->type == POISON) 2559 op->statusmsg ("You blindly grab for a bite of food. "
2557 { 2560 "H<To prevent you from starving, you ate some random item from your backpack.>");
2558 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food.");
2559 manual_apply (op, tmp, 0); 2561 manual_apply (op, tmp, 0);
2562
2560 if (op->stats.food >= 0 || op->stats.hp < 0) 2563 if (op->stats.food >= 0 || op->stats.hp < 0)
2561 break; 2564 break;
2562 } 2565 }
2563 else if (tmp->type == FLESH) 2566 else if (tmp->type == FLESH)
2564 flesh = tmp; 2567 flesh = tmp;
2565 } /* End if paid for object */ 2568 }
2566 } /* end of for loop */
2567 2569
2568 /* If player is still starving, it means they don't have any food, so 2570 /* If player is still starving, it means they don't have any food, so
2569 * eat flesh instead. 2571 * eat flesh instead.
2570 */ 2572 */
2571 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) 2573 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh)
2572 { 2574 {
2573 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); 2575 op->statusmsg ("You blindly grab for a bite of food. "
2576 "H<To prevent you from starving, you ate some random item from your backpack.>");
2574 manual_apply (op, flesh, 0); 2577 manual_apply (op, flesh, 0);
2575 } 2578 }
2576 }
2577 2579
2578 if (op->stats.food < 0 && op->stats.hp >= -op->stats.food) 2580 // If player is still starving, alert him!
2581 if (op->stats.food < 0)
2582 op->failmsg ("You are starving! "
2583 "H<Eat some food to increase your food and prevent you from an untimely death.>");
2579 { 2584 }
2585
2586 if (op->stats.food < 0)
2587 {
2580 op->stats.hp += op->stats.food; 2588 op->stats.hp += op->stats.food;
2581 op->stats.food = 0; 2589 op->stats.food = 0;
2582 } 2590 }
2583 2591
2584 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2592 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2585 kill_player (op); 2593 kill_player (op);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines