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

Comparing deliantra/server/common/map.C (file contents):
Revision 1.89 by root, Fri Feb 16 22:16:16 2007 UTC vs.
Revision 1.92 by root, Sun Feb 18 17:24:16 2007 UTC

404 coroapi::cede_every (1000); // cede once in a while 404 coroapi::cede_every (1000); // cede once in a while
405 405
406 switch (f.kw) 406 switch (f.kw)
407 { 407 {
408 case KW_arch: 408 case KW_arch:
409 if (object *op = object::read (f)) 409 if (object *op = object::read (f, this))
410 { 410 {
411 if (op->inv) 411 if (op->inv)
412 sum_weight (op); 412 sum_weight (op);
413 413
414 insert_ob_in_map (op, this, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); 414 insert_ob_in_map (op, this, op, INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD);
1669 return default_region; 1669 return default_region;
1670 1670
1671 return ::region::default_region (); 1671 return ::region::default_region ();
1672} 1672}
1673 1673
1674/* picks a random object from a style map.
1675 * Redone by MSW so it should be faster and not use static
1676 * variables to generate tables.
1677 */
1678object *
1679maptile::pick_random_object () const
1680{
1681 /* while returning a null object will result in a crash, that
1682 * is actually preferable to an infinite loop. That is because
1683 * most servers will automatically restart in case of crash.
1684 * Change the logic on getting the random space - shouldn't make
1685 * any difference, but this seems clearer to me.
1686 */
1687 for (int i = 1000; --i;)
1688 {
1689 object *pick = at (rndm (width), rndm (height)).bot;
1674 1690
1691 // do not prefer big monsters just because they are big.
1692 if (pick && pick->head_ () == pick)
1693 return pick->head_ ();
1694 }
1695
1696 // instead of crashing in the unlikely(?) case, try to return *something*
1697 return get_archetype ("blocked");
1698}
1699

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines