~ubuntu-branches/ubuntu/utopic/tinymux/utopic

« back to all changes in this revision

Viewing changes to src/object.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ervin Hearn III
  • Date: 2008-04-11 23:18:25 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080411231825-1pq4trckagyk8roo
Tags: 2.6.5.27-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// object.cpp -- Low-level object manipulation routines.
2
2
//
3
 
// $Id: object.cpp,v 1.17 2006/01/07 17:36:11 sdennis Exp $
 
3
// $Id: object.cpp 3211 2008-01-22 19:17:24Z brazilofmux $
4
4
//
5
5
 
6
6
#include "copyright.h"
182
182
dbref create_obj(dbref player, int objtype, const char *name, int cost)
183
183
{
184
184
    dbref obj, owner;
185
 
    int quota = 0, value = 0, nValidName;
 
185
    int quota = 0, value = 0;
 
186
    size_t nValidName;
186
187
    FLAGSET f;
187
188
    char *buff;
188
189
    const char *pValidName;
406
407
    if (!mudstate.bStandAlone)
407
408
    {
408
409
        halt_que(NOTHING, obj);
409
 
        nfy_que(obj, A_SEMAPHORE, NFY_DRAIN, 0);
 
410
        nfy_que(obj, 0, NFY_DRAIN, 0);
410
411
        fwdlist_clr(obj);
 
412
#ifdef DEPRECATED
411
413
        stack_clr(obj);
 
414
#endif // DEPRECATED
412
415
        ReleaseAllResources(obj);
413
416
    }
414
417
    atr_free(obj);
457
460
        {
458
461
            notify(owner, "Halted.");
459
462
        }
460
 
        nfy_que(obj, A_SEMAPHORE, NFY_DRAIN, 0);
 
463
        nfy_que(obj, 0, NFY_DRAIN, 0);
461
464
 
462
465
        // Remove forwardlists and stacks.
463
466
        //
464
467
        fwdlist_clr(obj);
 
468
#ifdef DEPRECATED
465
469
        stack_clr(obj);
 
470
#endif // DEPRECATED
466
471
    }
467
472
 
468
473
    // Compensate the owner for the object.
516
521
            {
517
522
                notify(owner, tprintf(
518
523
                       "You get back your %d %s deposit for %s(#%d).",
519
 
                        val, mudconf.one_coin, Name(obj), obj));
 
524
                        val, mudconf.one_coin, Moniker(obj), obj));
520
525
            }
521
526
        }
522
527
        if (  mudconf.quotas
888
893
                       && !Quiet(owner))
889
894
                    {
890
895
                        notify(owner, tprintf("Parent cleared on %s(#%d)",
891
 
                            Name(i), i));
 
896
                            Moniker(i), i));
892
897
                    }
893
898
                }
894
899
                else
920
925
                       && !Quiet(owner))
921
926
                    {
922
927
                        notify(owner, tprintf("Zone cleared on %s(#%d)",
923
 
                            Name(i), i));
 
928
                            Moniker(i), i));
924
929
                    }
925
930
                }
926
931
                else
973
978
        {
974
979
            // Check for wizards
975
980
            //
976
 
            if (Wizard(i))
 
981
            if (RealWizard(i))
977
982
            {
978
983
                if (isPlayer(i))
979
984
                {
1043
1048
                       && !Quiet(owner))
1044
1049
                    {
1045
1050
                        notify(owner, tprintf("Home reset on %s(#%d)",
1046
 
                            Name(i), i));
 
1051
                            Moniker(i), i));
1047
1052
                    }
1048
1053
                    else
1049
1054
                    {
1098
1103
                           && !Quiet(owner))
1099
1104
                        {
1100
1105
                            notify(owner, tprintf("Dropto removed from %s(#%d)",
1101
 
                                Name(i), i));
 
1106
                                Moniker(i), i));
1102
1107
                        }
1103
1108
                    }
1104
1109
                    else
1571
1576
            //
1572
1577
            if (check_type & DBCK_FULL)
1573
1578
            {
1574
 
                // Check for wizard command-handlers inside nonwiz. Just warn
1575
 
                // if we find one.
 
1579
                // Check for wizard command-handlers inside non-wizard. Just
 
1580
                // warn if we find one.
1576
1581
                //
1577
 
                if (Wizard(obj) && !Wizard(loc))
 
1582
                if (  RealWizard(obj)
 
1583
                   && !Wizard(loc))
1578
1584
                {
1579
1585
                    if (Commer(obj))
1580
1586
                    {
1581
1587
                        Log_simple_err(obj, loc,
1582
 
                            "Wizard command handling object inside nonwizard.");
 
1588
                            "Wizard command handling object inside non-wizard.");
1583
1589
                    }
1584
1590
                }
1585
1591
 
1586
 
                // Check for nonwizard objects inside wizard objects.
 
1592
                // Check for non-wizard objects inside wizard objects.
1587
1593
                //
1588
 
                if (  Wizard(loc)
 
1594
                if (  RealWizard(loc)
1589
1595
                   && !Wizard(obj)
1590
1596
                   && !Wizard(Owner(obj)))
1591
1597
                {
1592
 
                    Log_simple_err(obj, loc, "Nonwizard object inside wizard.");
 
1598
                    Log_simple_err(obj, loc, "Non-wizard object inside wizard.");
1593
1599
                }
1594
1600
            }
1595
1601
            Mark(obj);
1634
1640
 
1635
1641
static void mark_place(dbref loc)
1636
1642
{
1637
 
    dbref exit;
1638
 
 
1639
1643
    // If already marked, exit.  Otherwise set marked.
1640
1644
    //
1641
 
    if (!Good_obj(loc))
1642
 
    {
1643
 
        return;
1644
 
    }
1645
 
    if (Marked(loc))
 
1645
    if (  !Good_obj(loc)
 
1646
       || Marked(loc))
1646
1647
    {
1647
1648
        return;
1648
1649
    }
1650
1651
 
1651
1652
    // Visit all places you can get to via exits from here.
1652
1653
    //
 
1654
    dbref exit;
1653
1655
    for (exit = Exits(loc); exit != NOTHING; exit = Next(exit))
1654
1656
    {
1655
1657
        if (Good_obj(Location(exit)))
1661
1663
 
1662
1664
static void check_floating(void)
1663
1665
{
1664
 
    dbref owner, i;
 
1666
    dbref i;
1665
1667
 
1666
1668
    // Mark everyplace you can get to via exits from the starting room.
1667
1669
    //
1668
1670
    Unmark_all(i);
1669
1671
    mark_place(mudconf.start_room);
1670
1672
 
1671
 
    // Look for rooms not marked and not set FLOATING.
1672
 
    //
1673
 
    DO_WHOLE_DB(i)
1674
 
    {
1675
 
        if (  isRoom(i)
1676
 
           && !Floating(i)
 
1673
    // Mark every room you can get to from a floating room.
 
1674
    //
 
1675
    DO_WHOLE_DB(i)
 
1676
    {
 
1677
        if (  isRoom(i)
 
1678
           && Floating(i)
 
1679
           && !Going(i))
 
1680
        {
 
1681
            mark_place(i);
 
1682
        }
 
1683
    }
 
1684
 
 
1685
    // Look for unvisited rooms.
 
1686
    //
 
1687
    DO_WHOLE_DB(i)
 
1688
    {
 
1689
        if (  isRoom(i)
1677
1690
           && !Going(i)
1678
1691
           && !Marked(i))
1679
1692
        {
1680
 
            owner = Owner(i);
1681
1693
            if (!mudstate.bStandAlone)
1682
1694
            {
 
1695
                dbref owner = Owner(i);
1683
1696
                if (Good_owner(owner))
1684
1697
                {
1685
1698
                    notify(owner, tprintf( "You own a floating room: %s(#%d)",
1686
 
                        Name(i), i));
 
1699
                        Moniker(i), i));
1687
1700
                }
1688
1701
            }
1689
1702
            else
1716
1729
    }
1717
1730
    purge_going();
1718
1731
    make_freelist();
 
1732
    scheduler.Shrink();
1719
1733
 
1720
1734
    // Allow the local extensions to do data checks.
1721
1735
    //