mux/src/walkdb.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "misc.h"
#include "attrs.h"
#include "command.h"

Include dependency graph for walkdb.cpp:

Go to the source code of this file.

Defines

#define ANY_OWNER   -2

Functions

static void bind_and_queue (dbref executor, dbref caller, dbref enactor, char *action, char *argstr, char *cargs[], int ncargs, int number)
void do_dolist (dbref executor, dbref caller, dbref enactor, int key, char *list, char *command, char *cargs[], int ncargs)
void do_find (dbref executor, dbref caller, dbref enactor, int key, char *name)
bool get_stats (dbref player, dbref who, STATS *info)
void do_stats (dbref executor, dbref caller, dbref enactor, int key, char *name)
int chown_all (dbref from_player, dbref to_player, dbref acting_player, int key)
void do_chownall (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *from, char *to)
static void er_mark_disabled (dbref player)
bool search_setup (dbref player, char *searchfor, SEARCH *parm)
void search_perform (dbref executor, dbref caller, dbref enactor, SEARCH *parm)
static void search_mark (dbref player, int key)
void do_search (dbref executor, dbref caller, dbref enactor, int key, char *arg)
void do_markall (dbref executor, dbref caller, dbref enactor, int key)
void do_apply_marked (dbref executor, dbref caller, dbref enactor, int key, char *command, char *cargs[], int ncargs)
void olist_push (void)
void olist_pop (void)
void olist_add (dbref item)
dbref olist_first (void)
dbref olist_next (void)


Define Documentation

#define ANY_OWNER   -2

Definition at line 372 of file walkdb.cpp.

Referenced by search_perform(), and search_setup().


Function Documentation

static void bind_and_queue ( dbref  executor,
dbref  caller,
dbref  enactor,
char *  action,
char *  argstr,
char *  cargs[],
int  ncargs,
int  number 
) [static]

Definition at line 18 of file walkdb.cpp.

References free_lbuf, statedata::global_regs, mudstate, mux_ltoa_t(), NOTHING, replace_tokens(), and wait_que().

Referenced by do_apply_marked(), and do_dolist().

00021 {
00022     char *command = replace_tokens(action, argstr, mux_ltoa_t(number), NULL);
00023     CLinearTimeAbsolute lta;
00024     wait_que(executor, caller, enactor, false, lta, NOTHING, 0, command,
00025         cargs, ncargs, mudstate.global_regs);
00026     free_lbuf(command);
00027 }

int chown_all ( dbref  from_player,
dbref  to_player,
dbref  acting_player,
int  key 
)

Definition at line 244 of file walkdb.cpp.

References add_quota(), CHOWN_NOZONE, CHOWN_OK, DO_WHOLE_DB, confdata::exit_quota, FLAG_WORD1, Flags, God, HALT, INHERIT, isPlayer, mudconf, NOTHING, notify, Owner, confdata::player_quota, confdata::room_quota, s_Flags, s_Owner, s_Zone, confdata::thing_quota, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by destroy_player(), do_chownall(), and do_toad().

00245 {
00246     if (!isPlayer(from_player))
00247     {
00248         from_player = Owner(from_player);
00249     }
00250     if (!isPlayer(to_player))
00251     {
00252         to_player = Owner(to_player);
00253     }
00254     int count     = 0;
00255     if (  God(from_player)
00256        && !God(acting_player))
00257     {
00258         notify(acting_player, "Permission denied.");
00259     }
00260     else
00261     {
00262         int i;
00263         int quota_out = 0;
00264         int quota_in  = 0;
00265         DO_WHOLE_DB(i)
00266         {
00267             if (  Owner(i) == from_player
00268                && Owner(i) != i)
00269             {
00270                 switch (Typeof(i))
00271                 {
00272                 case TYPE_PLAYER:
00273 
00274                     s_Owner(i, i);
00275                     quota_out += mudconf.player_quota;
00276                     break;
00277 
00278                 case TYPE_THING:
00279 
00280                     s_Owner(i, to_player);
00281                     quota_out += mudconf.thing_quota;
00282                     quota_in -= mudconf.thing_quota;
00283                     break;
00284 
00285                 case TYPE_ROOM:
00286 
00287                     s_Owner(i, to_player);
00288                     quota_out += mudconf.room_quota;
00289                     quota_in -= mudconf.room_quota;
00290                     break;
00291 
00292                 case TYPE_EXIT:
00293 
00294                     s_Owner(i, to_player);
00295                     quota_out += mudconf.exit_quota;
00296                     quota_in -= mudconf.exit_quota;
00297                     break;
00298 
00299                 default:
00300 
00301                     s_Owner(i, to_player);
00302                 }
00303                 s_Flags(i, FLAG_WORD1,
00304                     (Flags(i) & ~(CHOWN_OK | INHERIT)) | HALT);
00305 
00306                 if (key & CHOWN_NOZONE)
00307                 {
00308                     s_Zone(i, NOTHING);
00309                 }
00310                 count++;
00311             }
00312         }
00313         add_quota(from_player, quota_out);
00314         add_quota(to_player, quota_in);
00315     }
00316     return count;
00317 }

void do_apply_marked ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  command,
char *  cargs[],
int  ncargs 
)

Definition at line 1120 of file walkdb.cpp.

References alloc_sbuf, bind_and_queue(), CF_DBCHECK, confdata::control_flags, DO_WHOLE_DB, er_mark_disabled(), free_sbuf, Marked, mudconf, mux_ltoa(), notify, Quiet, and UNUSED_PARAMETER.

01122 {
01123     UNUSED_PARAMETER(key);
01124 
01125     if (mudconf.control_flags & CF_DBCHECK)
01126     {
01127         er_mark_disabled(executor);
01128         return;
01129     }
01130     char *buff = alloc_sbuf("do_apply_marked");
01131     int i;
01132     int number = 0;
01133     DO_WHOLE_DB(i)
01134     {
01135         if (Marked(i))
01136         {
01137             buff[0] = '#';
01138             mux_ltoa(i, buff+1);
01139             number++;
01140             bind_and_queue(executor, caller, enactor, command, buff,
01141                 cargs, ncargs, number);
01142         }
01143     }
01144     free_sbuf(buff);
01145     if (!Quiet(executor))
01146     {
01147         notify(executor, "Done.");
01148     }
01149 }

void do_chownall ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  from,
char *  to 
)

Definition at line 320 of file walkdb.cpp.

References chown_all(), init_match(), isPlayer, match_absolute(), match_neighbor(), match_player(), noisy_match_result(), NOTHING, notify, Quiet, tprintf(), TYPE_PLAYER, and UNUSED_PARAMETER.

00329 {
00330     UNUSED_PARAMETER(caller);
00331     UNUSED_PARAMETER(enactor);
00332     UNUSED_PARAMETER(nargs);
00333 
00334     init_match(executor, from, TYPE_PLAYER);
00335     match_neighbor();
00336     match_absolute();
00337     match_player();
00338 
00339     dbref victim = noisy_match_result();
00340     if (NOTHING == victim)
00341     {
00342         return;
00343     }
00344     else if (!isPlayer(victim))
00345     {
00346         notify(executor, "Victim must be a player.");
00347         return;
00348     }
00349 
00350     dbref recipient = executor;
00351     if (  NULL  != to
00352        && to[0] != '\0')
00353     {
00354         init_match(executor, to, TYPE_PLAYER);
00355         match_neighbor();
00356         match_absolute();
00357         match_player();
00358         recipient = noisy_match_result();
00359         if (NOTHING == recipient)
00360         {
00361             return;
00362         }
00363     }
00364 
00365     int count = chown_all(victim, recipient, executor, key);
00366     if (!Quiet(executor))
00367     {
00368         notify(executor, tprintf("%d objects @chowned.", count));
00369     }
00370 }

void do_dolist ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  list,
char *  command,
char *  cargs[],
int  ncargs 
)

Definition at line 35 of file walkdb.cpp.

References A_SEMAPHORE, alloc_lbuf, bind_and_queue(), DOLIST_DELIMIT, DOLIST_NOTIFY, EV_STRIP_CURLY, free_lbuf, statedata::global_regs, mudstate, NOTHING, notify, parse_to(), and wait_que().

00037 {
00038     if (!list || *list == '\0')
00039     {
00040         notify(executor, "That's terrific, but what should I do with the list?");
00041         return;
00042     }
00043     char *objstring, delimiter = ' ';
00044     int number = 0;
00045     char *curr = list;
00046 
00047     if (key & DOLIST_DELIMIT)
00048     {
00049         char *tempstr = parse_to(&curr, ' ', EV_STRIP_CURLY);
00050         if (strlen(tempstr) > 1)
00051         {
00052             notify(executor, "The delimiter must be a single character!");
00053             return;
00054         }
00055         delimiter = *tempstr;
00056     }
00057     while (curr && *curr)
00058     {
00059         while (*curr == delimiter)
00060         {
00061             curr++;
00062         }
00063         if (*curr)
00064         {
00065             number++;
00066             objstring = parse_to(&curr, delimiter, EV_STRIP_CURLY);
00067             bind_and_queue(executor, caller, enactor, command, objstring,
00068                 cargs, ncargs, number);
00069         }
00070     }
00071     if (key & DOLIST_NOTIFY)
00072     {
00073         char *tbuf = alloc_lbuf("dolist.notify_cmd");
00074         strcpy(tbuf, "@notify/quiet me");
00075         CLinearTimeAbsolute lta;
00076         wait_que(executor, caller, enactor, false, lta, NOTHING, A_SEMAPHORE,
00077             tbuf, cargs, ncargs, mudstate.global_regs);
00078         free_lbuf(tbuf);
00079     }
00080 }

void do_find ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  name 
)

Definition at line 84 of file walkdb.cpp.

References Controls, free_lbuf, confdata::many_coins, mudconf, notify, notify_quiet, parse_range(), payfor(), PureName(), confdata::searchcost, string_match(), tprintf(), TYPE_EXIT, Typeof, unparse_object(), and UNUSED_PARAMETER.

00085 {
00086     UNUSED_PARAMETER(caller);
00087     UNUSED_PARAMETER(enactor);
00088     UNUSED_PARAMETER(key);
00089 
00090     char *buff;
00091 
00092     if (!payfor(executor, mudconf.searchcost))
00093     {
00094         buff = tprintf("You don't have enough %s.", mudconf.many_coins);
00095         notify_quiet(executor, buff);
00096         return;
00097     }
00098 
00099     dbref i, low_bound, high_bound;
00100     parse_range(&name, &low_bound, &high_bound);
00101     for (i = low_bound; i <= high_bound; i++)
00102     {
00103         if (  (Typeof(i) != TYPE_EXIT)
00104            && Controls(executor, i)
00105            && (!*name || string_match(PureName(i), name)))
00106         {
00107             buff = unparse_object(executor, i, false);
00108             notify(executor, buff);
00109             free_lbuf(buff);
00110         }
00111     }
00112     notify(executor, "***End of List***");
00113 }

void do_markall ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key 
)

Definition at line 1091 of file walkdb.cpp.

References CF_DBCHECK, confdata::control_flags, er_mark_disabled(), Mark_all, MARK_CLEAR, MARK_SET, mudconf, notify, Quiet, Unmark_all, and UNUSED_PARAMETER.

01092 {
01093     UNUSED_PARAMETER(caller);
01094     UNUSED_PARAMETER(enactor);
01095 
01096     int i;
01097 
01098     if (mudconf.control_flags & CF_DBCHECK)
01099     {
01100         er_mark_disabled(executor);
01101         return;
01102     }
01103     if (key == MARK_SET)
01104     {
01105         Mark_all(i);
01106     }
01107     else if (key == MARK_CLEAR)
01108     {
01109         Unmark_all(i);
01110     }
01111     if (!Quiet(executor))
01112     {
01113         notify(executor, "Done.");
01114     }
01115 }

void do_search ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  arg 
)

Definition at line 897 of file walkdb.cpp.

References alloc_lbuf, CF_DBCHECK, confdata::control_flags, er_mark_disabled(), Exits, free_lbuf, Location, mudconf, NOTHING, notify, NOTYPE, olist_first(), olist_next(), olist_pop(), olist_push(), Owner, search_type::s_rst_type, search_type::s_wizard, safe_chr, safe_str, search_mark(), search_perform(), search_setup(), SRCH_SEARCH, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, and unparse_object().

00898 {
00899     char *buff, *outbuf, *bp;
00900     dbref thing, from, to;
00901     SEARCH searchparm;
00902 
00903     if ((key != SRCH_SEARCH) && (mudconf.control_flags & CF_DBCHECK))
00904     {
00905         er_mark_disabled(executor);
00906         return;
00907     }
00908     if (!search_setup(executor, arg, &searchparm))
00909     {
00910         return;
00911     }
00912     olist_push();
00913     search_perform(executor, caller, enactor, &searchparm);
00914     bool destitute = true;
00915     bool flag;
00916 
00917     // If we are doing a @mark command, handle that here.
00918     //
00919     if (key != SRCH_SEARCH)
00920     {
00921         search_mark(executor, key);
00922         olist_pop();
00923         return;
00924     }
00925     outbuf = alloc_lbuf("do_search.outbuf");
00926 
00927     int rcount = 0;
00928     int ecount = 0;
00929     int tcount = 0;
00930     int pcount = 0;
00931 
00932     // Room search.
00933     //
00934     if (  searchparm.s_rst_type == TYPE_ROOM
00935        || searchparm.s_rst_type == NOTYPE)
00936     {
00937         flag = true;
00938         for (thing = olist_first(); thing != NOTHING; thing = olist_next())
00939         {
00940             if (Typeof(thing) != TYPE_ROOM)
00941             {
00942                 continue;
00943             }
00944             if (flag)
00945             {
00946                 flag = false;
00947                 destitute = false;
00948                 notify(executor, "\nROOMS:");
00949             }
00950             buff = unparse_object(executor, thing, false);
00951             notify(executor, buff);
00952             free_lbuf(buff);
00953             rcount++;
00954         }
00955     }
00956 
00957     // Exit search.
00958     //
00959     if (  searchparm.s_rst_type == TYPE_EXIT
00960        || searchparm.s_rst_type == NOTYPE)
00961     {
00962         flag = true;
00963         for (thing = olist_first(); thing != NOTHING; thing = olist_next())
00964         {
00965             if (Typeof(thing) != TYPE_EXIT)
00966             {
00967                 continue;
00968             }
00969             if (flag)
00970             {
00971                 flag = false;
00972                 destitute = false;
00973                 notify(executor, "\nEXITS:");
00974             }
00975             from = Exits(thing);
00976             to = Location(thing);
00977 
00978             bp = outbuf;
00979             buff = unparse_object(executor, thing, false);
00980             safe_str(buff, outbuf, &bp);
00981             free_lbuf(buff);
00982 
00983             safe_str(" [from ", outbuf, &bp);
00984             buff = unparse_object(executor, from, false);
00985             safe_str(((from == NOTHING) ? "NOWHERE" : buff), outbuf, &bp);
00986             free_lbuf(buff);
00987 
00988             safe_str(" to ", outbuf, &bp);
00989             buff = unparse_object(executor, to, false);
00990             safe_str(((to == NOTHING) ? "NOWHERE" : buff), outbuf, &bp);
00991             free_lbuf(buff);
00992 
00993             safe_chr(']', outbuf, &bp);
00994             *bp = '\0';
00995             notify(executor, outbuf);
00996             ecount++;
00997         }
00998     }
00999 
01000     // Object search
01001     //
01002     if (  searchparm.s_rst_type == TYPE_THING
01003        || searchparm.s_rst_type == NOTYPE)
01004     {
01005         flag = true;
01006         for (thing = olist_first(); thing != NOTHING; thing = olist_next())
01007         {
01008             if (Typeof(thing) != TYPE_THING)
01009             {
01010                 continue;
01011             }
01012             if (flag)
01013             {
01014                 flag = false;
01015                 destitute = false;
01016                 notify(executor, "\nOBJECTS:");
01017             }
01018             bp = outbuf;
01019             buff = unparse_object(executor, thing, false);
01020             safe_str(buff, outbuf, &bp);
01021             free_lbuf(buff);
01022 
01023             safe_str(" [owner: ", outbuf, &bp);
01024             buff = unparse_object(executor, Owner(thing), false);
01025             safe_str(buff, outbuf, &bp);
01026             free_lbuf(buff);
01027 
01028             safe_chr(']', outbuf, &bp);
01029             *bp = '\0';
01030             notify(executor, outbuf);
01031             tcount++;
01032         }
01033     }
01034 
01035     // Player search
01036     //
01037     if (  searchparm.s_rst_type == TYPE_PLAYER
01038        || searchparm.s_rst_type == NOTYPE)
01039     {
01040         flag = true;
01041         for (thing = olist_first(); thing != NOTHING; thing = olist_next())
01042         {
01043             if (Typeof(thing) != TYPE_PLAYER)
01044             {
01045                 continue;
01046             }
01047             if (flag)
01048             {
01049                 flag = false;
01050                 destitute = false;
01051                 notify(executor, "\nPLAYERS:");
01052             }
01053             bp = outbuf;
01054             buff = unparse_object(executor, thing, 0);
01055             safe_str(buff, outbuf, &bp);
01056             free_lbuf(buff);
01057             if (searchparm.s_wizard)
01058             {
01059                 safe_str(" [location: ", outbuf, &bp);
01060                 buff = unparse_object(executor, Location(thing), false);
01061                 safe_str(buff, outbuf, &bp);
01062                 free_lbuf(buff);
01063                 safe_chr(']', outbuf, &bp);
01064             }
01065             *bp = '\0';
01066             notify(executor, outbuf);
01067             pcount++;
01068         }
01069     }
01070 
01071     // If nothing found matching search criteria.
01072     //
01073     if (destitute)
01074     {
01075         notify(executor, "Nothing found.");
01076     }
01077     else
01078     {
01079         sprintf(outbuf,
01080             "\nFound:  Rooms...%d  Exits...%d  Objects...%d  Players...%d",
01081             rcount, ecount, tcount, pcount);
01082         notify(executor, outbuf);
01083     }
01084     free_lbuf(outbuf);
01085     olist_pop();
01086 }

void do_stats ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  name 
)

Definition at line 186 of file walkdb.cpp.

References statedata::db_top, statedata::freelist, get_stats(), lookup_player(), mudstate, NOTHING, notify, Owner, stats_type::s_exits, stats_type::s_garbage, stats_type::s_players, stats_type::s_rooms, stats_type::s_things, stats_type::s_total, STAT_ALL, STAT_ME, STAT_PLAYER, tprintf(), and UNUSED_PARAMETER.

00187 {
00188     UNUSED_PARAMETER(caller);
00189     UNUSED_PARAMETER(enactor);
00190 
00191     dbref owner;
00192 
00193     switch (key)
00194     {
00195     case STAT_ALL:
00196 
00197         owner = NOTHING;
00198         break;
00199 
00200     case STAT_ME:
00201 
00202         owner = Owner(executor);
00203         break;
00204 
00205     case STAT_PLAYER:
00206 
00207         if (!(name && *name))
00208         {
00209             int nNextFree = mudstate.freelist;
00210             if (mudstate.freelist == NOTHING)
00211             {
00212                 nNextFree = mudstate.db_top;
00213             }
00214             notify(executor, tprintf("The universe contains %d objects (next free is #%d).",
00215                 mudstate.db_top, nNextFree));
00216             return;
00217         }
00218         owner = lookup_player(executor, name, true);
00219         if (owner == NOTHING)
00220         {
00221             notify(executor, "Not found.");
00222             return;
00223         }
00224         break;
00225 
00226     default:
00227 
00228         notify(executor, "Illegal combination of switches.");
00229         return;
00230     }
00231 
00232     STATS statinfo;
00233     if (!get_stats(executor, owner, &statinfo))
00234     {
00235         return;
00236     }
00237     notify(executor, tprintf(
00238      "%d objects = %d rooms, %d exits, %d things, %d players. (%d garbage)",
00239                statinfo.s_total, statinfo.s_rooms, statinfo.s_exits,
00240                statinfo.s_things, statinfo.s_players,
00241                statinfo.s_garbage));
00242 }

static void er_mark_disabled ( dbref  player  )  [static]

Definition at line 374 of file walkdb.cpp.

References notify.

Referenced by do_apply_marked(), do_markall(), and do_search().

00375 {
00376     notify(player,
00377      "The mark commands are not allowed while DB cleaning is enabled.");
00378     notify(player,
00379      "Use the '@disable cleaning' command to disable automatic cleaning.");
00380     notify(player,
00381      "Remember to '@unmark_all' before re-enabling automatic cleaning.");
00382 }

bool get_stats ( dbref  player,
dbref  who,
STATS info 
)

Definition at line 118 of file walkdb.cpp.

References Controls, DO_WHOLE_DB, Going, Good_obj, info(), confdata::many_coins, mudconf, NOPERM_MESSAGE, NOTHING, notify, Owner, payfor(), confdata::searchcost, Stat_Any, tprintf(), TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by do_stats(), and FUNCTION().

00119 {
00120     // Do we have permission?
00121     //
00122     if (Good_obj(who) && !Controls(player, who) && !Stat_Any(player))
00123     {
00124         notify(player, NOPERM_MESSAGE);
00125         return false;
00126     }
00127 
00128     // Can we afford it?
00129     //
00130     if (!payfor(player, mudconf.searchcost))
00131     {
00132         notify(player, tprintf("You don't have enough %s.", mudconf.many_coins));
00133         return false;
00134     }
00135     info->s_total = 0;
00136     info->s_rooms = 0;
00137     info->s_exits = 0;
00138     info->s_things = 0;
00139     info->s_players = 0;
00140     info->s_garbage = 0;
00141 
00142     dbref i;
00143     DO_WHOLE_DB(i)
00144     {
00145         if ((who == NOTHING) || (who == Owner(i)))
00146         {
00147             info->s_total++;
00148             if (Going(i) && (Typeof(i) != TYPE_ROOM))
00149             {
00150                 info->s_garbage++;
00151                 continue;
00152             }
00153             switch (Typeof(i))
00154             {
00155             case TYPE_ROOM:
00156 
00157                 info->s_rooms++;
00158                 break;
00159 
00160             case TYPE_EXIT:
00161 
00162                 info->s_exits++;
00163                 break;
00164 
00165             case TYPE_THING:
00166 
00167                 info->s_things++;
00168                 break;
00169 
00170             case TYPE_PLAYER:
00171 
00172                 info->s_players++;
00173                 break;
00174 
00175             default:
00176 
00177                 info->s_garbage++;
00178             }
00179         }
00180     }
00181     return true;
00182 }

void olist_add ( dbref  item  ) 

Definition at line 1189 of file walkdb.cpp.

References alloc_lbuf, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, objlist_block::next, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.

Referenced by find_wild_attrs(), and search_perform().

01190 {
01191     OBLOCK *op;
01192 
01193     if (!mudstate.olist->head)
01194     {
01195         op = (OBLOCK *) alloc_lbuf("olist_add.first");
01196         mudstate.olist->head = mudstate.olist->tail = op;
01197         mudstate.olist->count = 0;
01198         op->next = NULL;
01199     }
01200     else if (mudstate.olist->count >= OBLOCK_SIZE)
01201     {
01202         op = (OBLOCK *) alloc_lbuf("olist_add.next");
01203         mudstate.olist->tail->next = op;
01204         mudstate.olist->tail = op;
01205         mudstate.olist->count = 0;
01206         op->next = NULL;
01207     }
01208     else
01209     {
01210         op = mudstate.olist->tail;
01211     }
01212     op->data[mudstate.olist->count++] = item;
01213 }

dbref olist_first ( void   ) 

Definition at line 1217 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, NOTHING, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), FUNCTION(), grep_util(), lattr_handler(), and search_mark().

01218 {
01219     if (!mudstate.olist->head)
01220     {
01221         return NOTHING;
01222     }
01223     if (  (mudstate.olist->head == mudstate.olist->tail)
01224        && (mudstate.olist->count == 0))
01225     {
01226         return NOTHING;
01227     }
01228     mudstate.olist->cblock = mudstate.olist->head;
01229     mudstate.olist->citm = 0;
01230     return mudstate.olist->cblock->data[mudstate.olist->citm++];
01231 }

dbref olist_next ( void   ) 

Definition at line 1233 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, mudstate, objlist_block::next, NOTHING, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), FUNCTION(), grep_util(), lattr_handler(), and search_mark().

01234 {
01235     if (!mudstate.olist->cblock)
01236     {
01237         return NOTHING;
01238     }
01239     if (  (mudstate.olist->cblock == mudstate.olist->tail)
01240        && (mudstate.olist->citm >= mudstate.olist->count))
01241     {
01242         return NOTHING;
01243     }
01244     dbref thing = mudstate.olist->cblock->data[mudstate.olist->citm++];
01245     if (mudstate.olist->citm >= OBLOCK_SIZE)
01246     {
01247         mudstate.olist->cblock = mudstate.olist->cblock->next;
01248         mudstate.olist->citm = 0;
01249     }
01250     return thing;
01251 }

void olist_pop ( void   ) 

Definition at line 1174 of file walkdb.cpp.

References free_lbuf, objlist_stack::head, MEMFREE, mudstate, objlist_block::next, objlist_stack::next, and statedata::olist.

Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), FUNCTION(), grep_util(), lattr_handler(), and CGuests::WipeAttrs().

01175 {
01176     OLSTK *ol = mudstate.olist->next;
01177     OBLOCK *op, *onext;
01178     for (op = mudstate.olist->head; op != NULL; op = onext)
01179     {
01180         onext = op->next;
01181         free_lbuf(op);
01182     }
01183     MEMFREE(mudstate.olist);
01184     mudstate.olist = ol;
01185 }

void olist_push ( void   ) 

Definition at line 1158 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_stack::head, ISOUTOFMEMORY, MEMALLOC, mudstate, objlist_stack::next, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), FUNCTION(), grep_util(), lattr_handler(), and CGuests::WipeAttrs().

01159 {
01160     OLSTK *ol = (OLSTK *)MEMALLOC(sizeof(OLSTK));
01161     ISOUTOFMEMORY(ol);
01162     ol->next = mudstate.olist;
01163     mudstate.olist = ol;
01164 
01165     ol->head = NULL;