mux/src/object.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "attrs.h"
#include "command.h"
#include "mguests.h"
#include "powers.h"

Include dependency graph for object.cpp:

Go to the source code of this file.

Defines

#define IS_CLEAN(i)

Functions

static void Log_pointer_err (dbref prior, dbref obj, dbref loc, dbref ref, const char *reftype, const char *errtype)
static void Log_header_err (dbref obj, dbref loc, dbref val, bool is_object, const char *valtype, const char *errtype)
static void Log_simple_err (dbref obj, dbref loc, const char *errtype)
dbref start_home (void)
dbref default_home (void)
bool can_set_home (dbref player, dbref thing, dbref home)
dbref new_home (dbref player)
dbref clone_home (dbref player, dbref thing)
dbref create_obj (dbref player, int objtype, const char *name, int cost)
static void destroy_bad_obj (dbref obj)
void destroy_obj (dbref obj)
static void make_freelist (void)
void divest_object (dbref thing)
void empty_obj (dbref obj)
void destroy_exit (dbref exit)
void destroy_thing (dbref thing)
void destroy_player (dbref player, dbref victim)
static void purge_going (void)
static void check_pennies (dbref thing, int limit, const char *qual)
static void check_dead_refs (void)
static void check_loc_exits (dbref loc)
static void check_exit_chains (void)
static void check_loc_contents (dbref)
static void check_misplaced_obj (dbref *obj, dbref back, dbref loc)
static void check_contents_chains (void)
static void mark_place (dbref loc)
static void check_floating (void)
void do_dbck (dbref executor, dbref caller, dbref enactor, int key)

Variables

static int check_type


Define Documentation

#define IS_CLEAN (  ) 

Value:

(isGarbage(i) && Going(i) && \
             ((i) >= 0) && ((i) < mudstate.db_top) && \
             (Location(i) == NOTHING) && \
             (Contents(i) == NOTHING) && (Exits(i) == NOTHING) && \
             (Next(i) == NOTHING) && (Owner(i) == GOD))

Definition at line 16 of file object.cpp.

Referenced by create_obj(), and make_freelist().


Function Documentation

bool can_set_home ( dbref  player,
dbref  thing,
dbref  home 
)

Definition at line 124 of file object.cpp.

References Abode, Controls, Going, Good_obj, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by clone_home(), do_link(), and new_home().

00125 {
00126     if (  !Good_obj(player)
00127        || !Good_obj(home)
00128        || thing == home)
00129     {
00130         return false;
00131     }
00132 
00133     switch (Typeof(home))
00134     {
00135     case TYPE_PLAYER:
00136     case TYPE_ROOM:
00137     case TYPE_THING:
00138         if (Going(home))
00139         {
00140             return false;
00141         }
00142         if (  Controls(player, home)
00143            || Abode(home))
00144         {
00145             return true;
00146         }
00147     }
00148     return false;
00149 }

static void check_contents_chains ( void   )  [static]

Definition at line 1602 of file object.cpp.

References check_loc_contents(), DO_WHOLE_DB, Going, Good_obj, Has_location, HOME, Home, Location, Log_simple_err(), Marked, move_via_generic(), new_home(), NOTHING, s_Home, s_Location, s_Next, and Unmark_all.

Referenced by do_dbck().

01603 {
01604     dbref i;
01605 
01606     Unmark_all(i);
01607     DO_WHOLE_DB(i)
01608     {
01609         check_loc_contents(i);
01610     }
01611     DO_WHOLE_DB(i)
01612     {
01613         if (  !Going(i)
01614            && !Marked(i)
01615            && Has_location(i))
01616         {
01617             Log_simple_err(i, Location(i), "Orphaned object, moved home.");
01618             s_Location(i, NOTHING);
01619             s_Next(i, NOTHING);
01620             if (  !Good_obj(Home(i))
01621                || Going(Home(i)))
01622             {
01623                 s_Home(i, new_home(i));
01624             }
01625             move_via_generic(i, HOME, NOTHING, 0);
01626         }
01627     }
01628 }

static void check_dead_refs ( void   )  [static]

Definition at line 802 of file object.cpp.

References A_FORWARDLIST, alloc_lbuf, atr_add(), atr_get_info(), statedata::bStandAlone, check_pennies(), check_type, Contents, forward_list::count, confdata::createmax, forward_list::data, DBCK_FULL, default_home(), destroy_obj(), DO_WHOLE_DB, Dropto, Exits, free_lbuf, fwdlist_get(), fwdlist_rewrite(), GOD, Going, Good_obj, halt_que(), Has_contents, HOME, Home, isPlayer, Link, Location, Log_header_err(), Log_pointer_err(), Log_simple_err(), move_object(), mudconf, mudstate, Name, new_home(), Next, NOTHING, notify, OBJECT_ENDOWMENT, Owner, OwnsOthers, Parent, confdata::paylimit, Quiet, s_Contents, s_Dropto, s_Going, s_Halted, s_Home, s_Link, s_Next, s_Owner, s_Parent, s_Zone, tprintf(), TYPE_EXIT, TYPE_GARBAGE, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, Wizard, and Zone.

Referenced by do_dbck().

00803 {
00804     dbref targ, owner, i, j;
00805     int aflags;
00806     char *str;
00807     FWDLIST *fp;
00808     bool dirty;
00809 
00810     DO_WHOLE_DB(i)
00811     {
00812         // Check the owner.
00813         //
00814         owner = Owner(i);
00815         if (!Good_obj(owner))
00816         {
00817             if (isPlayer(i))
00818             {
00819                 Log_header_err(i, NOTHING, owner, true, "Owner",
00820                     "is invalid.  Set to player.");
00821                 owner = i;
00822             }
00823             else
00824             {
00825                 Log_header_err(i, NOTHING, owner, true, "Owner",
00826                     "is invalid.  Set to GOD.");
00827                 owner = GOD;
00828             }
00829             s_Owner(i, owner);
00830             if (!mudstate.bStandAlone)
00831             {
00832                 halt_que(NOTHING, i);
00833             }
00834             s_Halted(i);
00835         }
00836         else if (check_type & DBCK_FULL)
00837         {
00838             if (Going(owner))
00839             {
00840                 if (isPlayer(i))
00841                 {
00842                     Log_header_err(i, NOTHING, owner, true,
00843                        "Owner", "is set GOING.  Set to player.");
00844                     owner = i;
00845                 }
00846                 else
00847                 {
00848                     Log_header_err(i, NOTHING, owner, true,
00849                        "Owner", "is set GOING.  Set to GOD.");
00850                     owner = GOD;
00851                 }
00852                 s_Owner(i, owner);
00853                 if (!mudstate.bStandAlone)
00854                 {
00855                     halt_que(NOTHING, i);
00856                 }
00857                 s_Halted(i);
00858             }
00859             else if (!OwnsOthers(owner))
00860             {
00861                 if (isPlayer(i))
00862                 {
00863                     Log_header_err(i, NOTHING, owner, true,
00864                        "Owner", "is not a valid owner type.  Set to player.");
00865                     owner = i;
00866                 }
00867                 else
00868                 {
00869                     Log_header_err(i, NOTHING, owner, true,
00870                        "Owner", "is not a valid owner type.  Set to GOD.");
00871                     owner = GOD;
00872                 }
00873                 s_Owner(i, owner);
00874             }
00875         }
00876 
00877         // Check the parent
00878         //
00879         targ = Parent(i);
00880         if (Good_obj(targ))
00881         {
00882             if (Going(targ))
00883             {
00884                 s_Parent(i, NOTHING);
00885                 if (!mudstate.bStandAlone)
00886                 {
00887                     if (  !Quiet(i)
00888                        && !Quiet(owner))
00889                     {
00890                         notify(owner, tprintf("Parent cleared on %s(#%d)",
00891                             Name(i), i));
00892                     }
00893                 }
00894                 else
00895                 {
00896                     Log_header_err(i, Location(i), targ, true, "Parent",
00897                         "is invalid.  Cleared.");
00898                 }
00899             }
00900         }
00901         else if (targ != NOTHING)
00902         {
00903             Log_header_err(i, Location(i), targ, true,
00904                 "Parent", "is invalid.  Cleared.");
00905             s_Parent(i, NOTHING);
00906         }
00907 
00908         // Check the zone.
00909         //
00910         targ = Zone(i);
00911         if (Good_obj(targ))
00912         {
00913             if (Going(targ))
00914             {
00915                 s_Zone(i, NOTHING);
00916                 if (!mudstate.bStandAlone)
00917                 {
00918                     owner = Owner(i);
00919                     if (  !Quiet(i)
00920                        && !Quiet(owner))
00921                     {
00922                         notify(owner, tprintf("Zone cleared on %s(#%d)",
00923                             Name(i), i));
00924                     }
00925                 }
00926                 else
00927                 {
00928                     Log_header_err(i, Location(i), targ, true, "Zone",
00929                         "is invalid.  Cleared.");
00930                 }
00931             }
00932         }
00933         else if (targ != NOTHING)
00934         {
00935             Log_header_err(i, Location(i), targ, true, "Zone",
00936                 "is invalid.  Cleared.");
00937             s_Zone(i, NOTHING);
00938         }
00939 
00940         // Check forwardlist
00941         //
00942         fp = fwdlist_get(i);
00943         dirty = false;
00944         if (fp)
00945         {
00946             for (j = 0; j < fp->count; j++)
00947             {
00948                 targ = fp->data[j];
00949                 if (  Good_obj(targ)
00950                    && Going(targ))
00951                 {
00952                     fp->data[j] = NOTHING;
00953                     dirty = true;
00954                 }
00955                 else if (  !Good_obj(targ)
00956                         && targ != NOTHING)
00957                 {
00958                     fp->data[j] = NOTHING;
00959                     dirty = true;
00960                 }
00961             }
00962         }
00963         if (dirty)
00964         {
00965             str = alloc_lbuf("purge_going");
00966             (void)fwdlist_rewrite(fp, str);
00967             atr_get_info(i, A_FORWARDLIST, &owner, &aflags);
00968             atr_add(i, A_FORWARDLIST, str, owner, aflags);
00969             free_lbuf(str);
00970         }
00971 
00972         if (check_type & DBCK_FULL)
00973         {
00974             // Check for wizards
00975             //
00976             if (Wizard(i))
00977             {
00978                 if (isPlayer(i))
00979                 {
00980                     Log_simple_err(i, NOTHING, "Player is a WIZARD.");
00981                 }
00982                 if (!Wizard(Owner(i)))
00983                 {
00984                     Log_header_err(i, NOTHING, Owner(i), true,
00985                                "Owner", "of a WIZARD object is not a wizard");
00986                 }
00987             }
00988         }
00989 
00990         switch (Typeof(i))
00991         {
00992         case TYPE_PLAYER:
00993             // Check home.
00994             //
00995             targ = Home(i);
00996             if (  !Good_obj(targ)
00997                || !Has_contents(targ))
00998             {
00999                 Log_simple_err(i, Location(i), "Bad home. Reset.");
01000                 s_Home(i, default_home());
01001             }
01002 
01003             // Check the location.
01004             //
01005             targ = Location(i);
01006             if (  !Good_obj(targ)
01007                || !Has_contents(targ))
01008             {
01009                 Log_pointer_err(NOTHING, i, NOTHING, targ, "Location",
01010                     "is invalid.  Moved to home.");
01011                 move_object(i, Home(i));
01012             }
01013 
01014             // Check for self-referential Next().
01015             //
01016             if (Next(i) == i)
01017             {
01018                 Log_simple_err(i, NOTHING,
01019                      "Next points to self.  Next cleared.");
01020                 s_Next(i, NOTHING);
01021             }
01022 
01023             if (check_type & DBCK_FULL)
01024             {
01025                 // Check wealth.
01026                 //
01027                 targ = mudconf.paylimit;
01028                 check_pennies(i, targ, "Wealth");
01029             }
01030             break;
01031 
01032         case TYPE_THING:
01033 
01034             // Check home.
01035             //
01036             targ = Home(i);
01037             if (  !Good_obj(targ)
01038                || !Has_contents(targ))
01039             {
01040                 if (!mudstate.bStandAlone)
01041                 {
01042                     if (  !Quiet(i)
01043                        && !Quiet(owner))
01044                     {
01045                         notify(owner, tprintf("Home reset on %s(#%d)",
01046                             Name(i), i));
01047                     }
01048                     else
01049                     {
01050                         Log_header_err(i, Location(i), targ, true, "Home",
01051                             "is invalid.  Cleared.");
01052                     }
01053                 }
01054                 s_Home(i, new_home(i));
01055             }
01056 
01057             // Check the location.
01058             //
01059             targ = Location(i);
01060             if (  !Good_obj(targ)
01061                || !Has_contents(targ))
01062             {
01063                 Log_pointer_err(NOTHING, i, NOTHING, targ, "Location",
01064                     "is invalid.  Moved to home.");
01065                 move_object(i, HOME);
01066             }
01067 
01068             // Check for self-referential Next().
01069             //
01070             if (Next(i) == i)
01071             {
01072                 Log_simple_err(i, NOTHING,
01073                     "Next points to self.  Next cleared.");
01074                 s_Next(i, NOTHING);
01075             }
01076             if (check_type & DBCK_FULL)
01077             {
01078                 // Check value.
01079                 //
01080                 targ = OBJECT_ENDOWMENT(mudconf.createmax);
01081                 check_pennies(i, targ, "Value");
01082             }
01083             break;
01084 
01085         case TYPE_ROOM:
01086 
01087             // Check the dropto.
01088             //
01089             targ = Dropto(i);
01090             if (Good_obj(targ))
01091             {
01092                 if (Going(targ))
01093                 {
01094                     s_Dropto(i, NOTHING);
01095                     if (!mudstate.bStandAlone)
01096                     {
01097                         if (  !Quiet(i)
01098                            && !Quiet(owner))
01099                         {
01100                             notify(owner, tprintf("Dropto removed from %s(#%d)",
01101                                 Name(i), i));
01102                         }
01103                     }
01104                     else
01105                     {
01106                         Log_header_err(i, NOTHING, targ, true, "Dropto",
01107                             "is invalid.  Removed.");
01108                     }
01109                 }
01110             }
01111             else if (  targ != NOTHING
01112                     && targ != HOME)
01113             {
01114                 Log_header_err(i, NOTHING, targ, true, "Dropto",
01115                     "is invalid.  Cleared.");
01116                 s_Dropto(i, NOTHING);
01117             }
01118             if (check_type & DBCK_FULL)
01119             {
01120                 // NEXT should be null.
01121                 //
01122                 if (Next(i) != NOTHING)
01123                 {
01124                     Log_header_err(i, NOTHING, Next(i), true, "Next pointer",
01125                         "should be NOTHING.  Reset.");
01126                     s_Next(i, NOTHING);
01127                 }
01128 
01129                 // LINK should be null.
01130                 //
01131                 if (Link(i) != NOTHING)
01132                 {
01133                     Log_header_err(i, NOTHING, Link(i), true, "Link pointer ",
01134                         "should be NOTHING.  Reset.");
01135                     s_Link(i, NOTHING);
01136                 }
01137 
01138                 // Check value.
01139                 //
01140                 check_pennies(i, 1, "Value");
01141             }
01142             break;
01143 
01144         case TYPE_EXIT:
01145 
01146             // If it points to something GOING, set it going.
01147             //
01148             targ = Location(i);
01149             if (Good_obj(targ))
01150             {
01151                 if (Going(targ))
01152                 {
01153                     s_Going(i);
01154                 }
01155             }
01156             else if (targ == HOME)
01157             {
01158                 // null case, HOME is always valid.
01159                 //
01160             }
01161             else if (targ != NOTHING)
01162             {
01163                 Log_header_err(i, Exits(i), targ, true, "Destination",
01164                     "is invalid.  Exit destroyed.");
01165                 s_Going(i);
01166             }
01167             else
01168             {
01169                 if (!Has_contents(targ))
01170                 {
01171                     Log_header_err(i, Exits(i), targ, true, "Destination",
01172                         "is not a valid type.  Exit destroyed.");
01173                     s_Going(i);
01174                 }
01175             }
01176 
01177             // Check for self-referential Next().
01178             //
01179             if (Next(i) == i)
01180             {
01181                 Log_simple_err(i, NOTHING,
01182                     "Next points to self.  Next cleared.");
01183                 s_Next(i, NOTHING);
01184             }
01185             if (check_type & DBCK_FULL)
01186             {
01187                 // CONTENTS should be null.
01188                 //
01189                 if (Contents(i) != NOTHING)
01190                 {
01191                     Log_header_err(i, Exits(i), Contents(i), true, "Contents",
01192                         "should be NOTHING.  Reset.");
01193                     s_Contents(i, NOTHING);
01194                 }
01195 
01196                 // LINK should be null.
01197                 //
01198                 if (Link(i) != NOTHING)
01199                 {
01200                     Log_header_err(i, Exits(i), Link(i), true, "Link",
01201                         "should be NOTHING.  Reset.");
01202                     s_Link(i, NOTHING);
01203                 }
01204 
01205                 // Check value.
01206                 //
01207                 check_pennies(i, 1, "Value");
01208             }
01209             break;
01210 
01211         case TYPE_GARBAGE:
01212             break;
01213 
01214         default:
01215 
01216             // Funny object type, destroy it.
01217             //
01218             Log_simple_err(i, NOTHING, "Funny object type.  Destroyed.");
01219             destroy_obj(i);
01220         }
01221     }
01222 }

static void check_exit_chains ( void   )  [static]

Definition at line 1412 of file object.cpp.

References check_loc_exits(), destroy_obj(), DO_WHOLE_DB, isExit, Log_simple_err(), Marked, NOTHING, and Unmark_all.

Referenced by do_dbck().

01413 {
01414     dbref i;
01415 
01416     Unmark_all(i);
01417     DO_WHOLE_DB(i)
01418     {
01419         check_loc_exits(i);
01420     }
01421     DO_WHOLE_DB(i)
01422     {
01423         if (  isExit(i)
01424            && !Marked(i))
01425         {
01426             Log_simple_err(i, NOTHING, "Disconnected exit.  Destroyed.");
01427             destroy_obj(i);
01428         }
01429     }
01430 }

static void check_floating ( void   )  [static]

Definition at line 1662 of file object.cpp.

References statedata::bStandAlone, DO_WHOLE_DB, Floating, Going, Good_owner, isRoom, Log_simple_err(), mark_place(), Marked, mudconf, mudstate, Name, NOTHING, notify, Owner, confdata::start_room, tprintf(), and Unmark_all.

Referenced by do_dbck().

01663 {
01664     dbref owner, i;
01665 
01666     // Mark everyplace you can get to via exits from the starting room.
01667     //
01668     Unmark_all(i);
01669     mark_place(mudconf.start_room);
01670 
01671     // Look for rooms not marked and not set FLOATING.
01672     //
01673     DO_WHOLE_DB(i)
01674     {
01675         if (  isRoom(i)
01676            && !Floating(i)
01677            && !Going(i)
01678            && !Marked(i))
01679         {
01680             owner = Owner(i);
01681             if (!mudstate.bStandAlone)
01682             {
01683                 if (Good_owner(owner))
01684                 {
01685                     notify(owner, tprintf( "You own a floating room: %s(#%d)",
01686                         Name(i), i));
01687                 }
01688             }
01689             else
01690             {
01691                 Log_simple_err(i, NOTHING, "Disconnected room.");
01692             }
01693         }
01694     }
01695 }

static void check_loc_contents ( dbref   )  [static]

Definition at line 1495 of file object.cpp.

References check_misplaced_obj(), check_type, Commer(), Contents, DBCK_FULL, Going, Good_obj, Has_location, isExit, Location, Log_pointer_err(), Log_simple_err(), Mark, Marked, Next, NOTHING, Owner, s_Contents, s_Next, and Wizard.

Referenced by check_contents_chains(), and check_misplaced_obj().

01496 {
01497     if (!Good_obj(loc))
01498     {
01499         return;
01500     }
01501 
01502     // Only check players, rooms, and things that aren't GOING.
01503     //
01504     if (  isExit(loc)
01505        || Going(loc))
01506     {
01507         return;
01508     }
01509 
01510     dbref back = NOTHING;
01511     dbref obj = Contents(loc);
01512     while (obj != NOTHING)
01513     {
01514         if (!Good_obj(obj))
01515         {
01516             // A bad pointer - terminate chain.
01517             //
01518             Log_pointer_err(back, loc, NOTHING, obj, "Contents list",
01519                 "is invalid.  Cleared.");
01520             if (back != NOTHING)
01521             {
01522                 s_Next(back, NOTHING);
01523             }
01524             else
01525             {
01526                 s_Contents(loc, NOTHING);
01527             }
01528             obj = NOTHING;
01529         }
01530         else if (!Has_location(obj))
01531         {
01532             // Not a player or thing - terminate chain.
01533             //
01534             Log_pointer_err(back, loc, NOTHING, obj, "",
01535                 "is not a player or thing.  Cleared.");
01536             if (back != NOTHING)
01537             {
01538                 s_Next(back, NOTHING);
01539             }
01540             else
01541             {
01542                 s_Contents(loc, NOTHING);
01543             }
01544             obj = NOTHING;
01545         }
01546         else if (Marked(obj))
01547         {
01548             // Already visited - either truncate or ignore.
01549             //
01550             if (Location(obj) != loc)
01551             {
01552                 // Location wrong - either truncate or fix.
01553                 //
01554                 check_misplaced_obj(&obj, back, loc);
01555             }
01556             else
01557             {
01558                 // Location right - recursive contents.
01559                 //
01560             }
01561         }
01562         else if (Location(obj) != loc)
01563         {
01564             // Location wrong - either truncate or fix.
01565             //
01566             check_misplaced_obj(&obj, back, loc);
01567         }
01568         if (obj != NOTHING)
01569         {
01570             // All OK (or all was made OK).
01571             //
01572             if (check_type & DBCK_FULL)
01573             {
01574                 // Check for wizard command-handlers inside nonwiz. Just warn
01575                 // if we find one.
01576                 //
01577                 if (Wizard(obj) && !Wizard(loc))
01578                 {
01579                     if (Commer(obj))
01580                     {
01581                         Log_simple_err(obj, loc,
01582                             "Wizard command handling object inside nonwizard.");
01583                     }
01584                 }
01585 
01586                 // Check for nonwizard objects inside wizard objects.
01587                 //
01588                 if (  Wizard(loc)
01589                    && !Wizard(obj)
01590                    && !Wizard(Owner(obj)))
01591                 {
01592                     Log_simple_err(obj, loc, "Nonwizard object inside wizard.");
01593                 }
01594             }
01595             Mark(obj);
01596             back = obj;
01597             obj = Next(obj);
01598         }
01599     }
01600 }

static void check_loc_exits ( dbref  loc  )  [static]

Definition at line 1241 of file object.cpp.

References check_type, DBCK_FULL, destroy_obj(), Exits, Going, Good_obj, HOME, isExit, Location, Log_header_err(), Log_pointer_err(), Mark, Marked, Next, NOTHING, Owner, s_Exits, s_Location, and s_Next.

Referenced by check_exit_chains().

01242 {
01243     if (!Good_obj(loc))
01244     {
01245         return;
01246     }
01247 
01248     // Only check players, rooms, and things that aren't GOING.
01249     //
01250     if (  isExit(loc)
01251        || Going(loc))
01252     {
01253         return;
01254     }
01255 
01256     // If marked, we've checked here already.
01257     //
01258     if (Marked(loc))
01259     {
01260         return;
01261     }
01262     Mark(loc);
01263 
01264     // Check all the exits.
01265     //
01266     dbref temp, exitloc, dest;
01267     dbref back = NOTHING;
01268     dbref exit = Exits(loc);
01269     while (exit != NOTHING)
01270     {
01271         exitloc = NOTHING;
01272         dest = NOTHING;
01273 
01274         if (Good_obj(exit))
01275         {
01276             exitloc = Exits(exit);
01277             dest = Location(exit);
01278         }
01279         if (!Good_obj(exit))
01280         {
01281             // A bad pointer - terminate chain.
01282             //
01283             Log_pointer_err(back, loc, NOTHING, exit, "Exit list",
01284                 "is invalid.  List nulled.");
01285             if (back != NOTHING)
01286             {
01287                 s_Next(back, NOTHING);
01288             }
01289             else
01290             {
01291                 s_Exits(loc, NOTHING);
01292             }
01293             exit = NOTHING;
01294         }
01295         else if (!isExit(exit))
01296         {
01297             // Not an exit - terminate chain.
01298             //
01299             Log_pointer_err(back, loc, NOTHING, exit, "Exitlist member",
01300                 "is not an exit.  List terminated.");
01301             if (back != NOTHING)
01302             {
01303                 s_Next(back, NOTHING);
01304             }
01305             else
01306             {
01307                 s_Exits(loc, NOTHING);
01308             }
01309             exit = NOTHING;
01310         }
01311         else if (Going(exit))
01312         {
01313             // Going - silently filter out.
01314             //
01315             temp = Next(exit);
01316             if (back != NOTHING)
01317             {
01318                 s_Next(back, temp);
01319             }
01320             else
01321             {
01322                 s_Exits(loc, temp);
01323             }
01324             destroy_obj(exit);
01325             exit = temp;
01326             continue;
01327         }
01328         else if (Marked(exit))
01329         {
01330             // Already in another list - terminate chain.
01331             //
01332             Log_pointer_err(back, loc, NOTHING, exit, "Exitlist member",
01333                 "is in another exitlist.  Cleared.");
01334             if (back != NOTHING)
01335             {
01336                 s_Next(back, NOTHING);
01337             }
01338             else
01339             {
01340                 s_Exits(loc, NOTHING);
01341             }
01342             exit = NOTHING;
01343         }
01344         else if (  !Good_obj(dest)
01345                 && dest != HOME
01346                 && dest != NOTHING)
01347         {
01348             // Destination is not in the db.  Null it.
01349             //
01350             Log_pointer_err(back, loc, NOTHING, exit, "Destination",
01351                 "is invalid.  Cleared.");
01352             s_Location(exit, NOTHING);
01353         }
01354         else if (exitloc != loc)
01355         {
01356             // Exit thinks it's in another place.  Check the exitlist there
01357             // and see if it contains this exit. If it does, then our exitlist
01358             // somehow pointed into the middle of their exitlist. If not,
01359             // assume we own the exit.'
01360             //
01361             check_loc_exits(exitloc);
01362             if (Marked(exit))
01363             {
01364                 // It's in the other list, give it up.
01365                 //
01366                 Log_pointer_err(back, loc, NOTHING, exit, "",
01367                     "is in another exitlist.  List terminated.");
01368                 if (back != NOTHING)
01369                 {
01370                     s_Next(back, NOTHING);
01371                 }
01372                 else
01373                 {
01374                     s_Exits(loc, NOTHING);
01375                 }
01376                 exit = NOTHING;
01377             }
01378             else
01379             {
01380                 // Not in the other list, assume in ours.
01381                 //
01382                 Log_header_err(exit, loc, exitloc, true,
01383                     "Not on chain for location", "Reset.");
01384                 s_Exits(exit, loc);
01385             }
01386         }
01387         if (exit != NOTHING)
01388         {
01389             // All OK (or all was made OK).
01390             //
01391             if (check_type & DBCK_FULL)
01392             {
01393                 // Make sure exit owner owns at least one of the source or
01394                 // destination.  Just warn if he doesn't.
01395                 //
01396                 temp = Owner(exit);
01397                 if (  temp != Owner(loc)
01398                    && temp != Owner(Location(exit)))
01399                 {
01400                     Log_header_err(exit, loc, temp, true, "Owner",
01401                         "does not own either the source or destination.");
01402                 }
01403             }
01404             Mark(exit);
01405             back = exit;
01406             exit = Next(exit);
01407         }
01408     }
01409     return;
01410 }

static void check_misplaced_obj ( dbref obj,
dbref  back,
dbref  loc 
) [static]

Definition at line 1451 of file object.cpp.

References check_loc_contents(), Contents, Good_obj, Location, Log_header_err(), Log_pointer_err(), Marked, NOTHING, s_Contents, s_Next, and Unmark.

Referenced by check_loc_contents().

01452 {
01453     // Object thinks it's in another place.  Check the contents list there
01454     // and see if it contains this object.  If it does, then our contents
01455     // list somehow pointed into the middle of their contents list and we
01456     // should truncate our list. If not, assume we own the object.
01457     //
01458     if (!Good_obj(*obj))
01459     {
01460         return;
01461     }
01462     loc = Location(*obj);
01463     Unmark(*obj);
01464     if (Good_obj(loc))
01465     {
01466         check_loc_contents(loc);
01467     }
01468     if (Marked(*obj))
01469     {
01470         // It's in the other list, give it up.
01471         //
01472         Log_pointer_err(back, loc, NOTHING, *obj, "",
01473             "is in another contents list.  Cleared.");
01474         if (back != NOTHING)
01475         {
01476             s_Next(back, NOTHING);
01477         }
01478         else
01479         {
01480             s_Contents(loc, NOTHING);
01481         }
01482         *obj = NOTHING;
01483     }
01484     else
01485     {
01486         // Not in the other list, assume in ours.
01487         //
01488         Log_header_err(*obj, loc, Contents(*obj), true, "Location",
01489             "is invalid.  Reset.");
01490         s_Contents(*obj, loc);
01491     }
01492     return;
01493 }

static void check_pennies ( dbref  thing,
int  limit,
const char *  qual 
) [static]

Definition at line 770 of file object.cpp.

References Going, isExit, isPlayer, isRoom, isThing, Log_header_err(), NOTHING, Pennies(), and s_Pennies().

Referenced by check_dead_refs().

00771 {
00772     if (Going(thing))
00773     {
00774         return;
00775     }
00776     int j = Pennies(thing);
00777     if (j)
00778     {
00779         if (isRoom(thing) || isExit(thing))
00780         {
00781             Log_header_err(thing, NOTHING, j, false, qual, "is strange.  Reset.");
00782             s_Pennies(thing, 0);
00783         }
00784         else if (j < 0)
00785         {
00786             Log_header_err(thing, NOTHING, j, false, qual, "is negative.");
00787         }
00788         else if (limit < j)
00789         {
00