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

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.66 by root, Wed Sep 12 11:10:10 2007 UTC vs.
Revision 1.67 by root, Tue Oct 16 00:30:24 2007 UTC

489 * Removed multiplicator, too many high-level items were generated on low-difficulty maps. 489 * Removed multiplicator, too many high-level items were generated on low-difficulty maps.
490 */ 490 */
491int 491int
492level_for_item (const object *op, int difficulty) 492level_for_item (const object *op, int difficulty)
493{ 493{
494 int olevel = 0;
495
496 if (!op->inv) 494 if (!op->inv)
497 { 495 {
498 LOG (llevError, "level_for_item: Object %s has no inventory!\n", &op->name); 496 LOG (llevError, "level_for_item: Object %s has no inventory!\n", &op->name);
499 return 0; 497 return 0;
500 } 498 }
501 499
502 olevel = (int) (op->inv->level + (double) difficulty * (1 - drand48 () * drand48 () * 2)); 500 int olevel = op->inv->level + int (difficulty * (1. - rndm () * rndm () * 2.));
503 501
504 if (olevel <= 0) 502 if (olevel <= 0)
505 olevel = rndm (1, MIN (op->inv->level, 1)); 503 olevel = rndm (1, op->inv->level);
506 504
507 if (olevel > MAXLEVEL) 505 return min (olevel, MAXLEVEL);
508 olevel = MAXLEVEL;
509
510 return olevel;
511} 506}
512 507
513/* 508/*
514 * Based upon the specified difficulty and upon the difftomagic_list array, 509 * Based upon the specified difficulty and upon the difftomagic_list array,
515 * a random magical bonus is returned. This is used when determine 510 * a random magical bonus is returned. This is used when determine

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines