Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

interp.c File Reference

#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "tables.h"
#include <unistd.h>

Include dependency graph for interp.c:

Go to the source code of this file.

Defines

#define END_MARKER   "END"
#define LOG_ALWAYS   1
#define LOG_NEVER   2
#define LOG_NORMAL   0

Functions

bool check_social args ((CHAR_DATA *ch, char *command, char *argument))
bool check_disabled (const struct cmd_type *command)
bool check_social (CHAR_DATA *ch, char *command, char *argument)
void do_commands (CHAR_DATA *ch, char *argument)
void do_disable (CHAR_DATA *ch, char *argument)
void do_function (CHAR_DATA *ch, DO_FUN *do_fun, char *argument)
void do_wizhelp (CHAR_DATA *ch, char *argument)
void interpret (CHAR_DATA *ch, char *argument)
bool is_number (char *arg)
void load_disabled ()
int mult_argument (char *argument, char *arg)
int number_argument (char *argument, char *arg)
char * one_argument (char *argument, char *arg_first)
void save_disabled ()

Variables

const struct cmd_type cmd_table []
DISABLED_DATAdisabled_first
bool fLogAll = FALSE


Define Documentation

#define END_MARKER   "END"
 

Definition at line 47 of file interp.c.

Referenced by load_disabled(), and save_disabled().

#define LOG_ALWAYS   1
 

Definition at line 54 of file interp.c.

Referenced by interpret().

#define LOG_NEVER   2
 

Definition at line 55 of file interp.c.

Referenced by interpret().

#define LOG_NORMAL   0
 

Definition at line 53 of file interp.c.


Function Documentation

bool check_social args (CHAR_DATA *ch, char *command, char *argument)   ) 
 

bool check_disabled const struct cmd_type command  ) 
 

Definition at line 1139 of file interp.c.

References disabled_data::command, disabled_first, cmd_type::do_fun, FALSE, disabled_data::next, and TRUE.

Referenced by do_commands(), do_wizhelp(), and interpret().

01140 {
01141     DISABLED_DATA *p;
01142     
01143     for (p = disabled_first; p ; p = p->next)
01144         if (p->command->do_fun == command->do_fun)
01145             return TRUE;
01146 
01147     return FALSE;
01148 }

bool check_social CHAR_DATA ch,
char *  command,
char *  argument
 

Definition at line 752 of file interp.c.

References act, AFF_CHARM, social_list::char_auto, social_list::char_found, social_list::char_no_arg, COMM_NOEMOTE, FALSE, get_char_room(), IS_AFFECTED, IS_AWAKE, IS_NPC, IS_SET, MAX_INPUT_LENGTH, social_list::name, social_list::next, number_bits(), one_argument(), social_list::others_auto, social_list::others_found, social_list::others_no_arg, POS_DEAD, POS_INCAP, POS_MORTAL, POS_SLEEPING, POS_STUNNED, send_to_char(), social_table, sociallist, str_cmp(), str_prefix(), TO_CHAR, TO_NOTVICT, TO_ROOM, TO_VICT, TRUE, and social_list::vict_found.

Referenced by interpret().

00753 {
00754     char arg[MAX_INPUT_LENGTH];
00755     CHAR_DATA *victim;
00756     int cmd;
00757     bool found;
00758     SOCIAL_LIST *slist;
00759     char temp[1000];
00760 
00761     found = FALSE;
00762     slist = sociallist;
00763 
00764     for (;slist; slist = slist->next)
00765     {
00766         if (slist->name == NULL)
00767             continue;
00768         
00769     if (command[0] == slist->name[0]
00770             && !str_prefix (command, slist->name))
00771         {
00772             found = TRUE;
00773             break;
00774         }
00775     }
00776 
00777     if (!found)
00778         return FALSE;
00779 
00780     if (!IS_NPC (ch) && IS_SET (ch->comm, COMM_NOEMOTE))
00781     {
00782         send_to_char ("You are anti-social!\n\r", ch);
00783         return TRUE;
00784     }
00785 
00786     switch (ch->position)
00787     {
00788         case POS_DEAD:
00789             send_to_char ("Lie still; you are DEAD.\n\r", ch);
00790             return TRUE;
00791 
00792         case POS_INCAP:
00793         case POS_MORTAL:
00794             send_to_char ("You are hurt far too bad for that.\n\r", ch);
00795             return TRUE;
00796 
00797         case POS_STUNNED:
00798             send_to_char ("You are too stunned to do that.\n\r", ch);
00799             return TRUE;
00800 
00801         case POS_SLEEPING:
00802             /*
00803              * I just know this is the path to a 12" 'if' statement.  :(
00804              * But two players asked for it already!  -- Furey
00805              */
00806             if (!str_cmp (social_table[cmd].name, "snore"))
00807                 break;
00808             send_to_char ("In your dreams, or what?\n\r", ch);
00809             return TRUE;
00810 
00811     }
00812 
00813     one_argument (argument, arg);
00814     victim = NULL;
00815     if (arg[0] == '\0')
00816     {
00817         act (slist->others_no_arg, ch, NULL, victim, TO_ROOM);
00818         act (slist->char_no_arg, ch, NULL, victim, TO_CHAR);
00819     }
00820     else if ((victim = get_char_room (ch, arg)) == NULL)
00821     {
00822         send_to_char ("They aren't here.\n\r", ch);
00823     }
00824     else if (victim == ch)
00825     {
00826         act (slist->others_auto, ch, NULL, victim, TO_ROOM);
00827         act (slist->char_auto, ch, NULL, victim, TO_CHAR);
00828     }
00829     else
00830     {
00831         act (slist->others_found, ch, NULL, victim, TO_NOTVICT);
00832         act (slist->char_found, ch, NULL, victim, TO_CHAR);
00833         act (slist->vict_found, ch, NULL, victim, TO_VICT);
00834 
00835         if (!IS_NPC (ch) && IS_NPC (victim)
00836             && !IS_AFFECTED (victim, AFF_CHARM)
00837             && IS_AWAKE (victim) && victim->desc == NULL)
00838         {
00839             switch (number_bits (4))
00840             {
00841                 case 0:
00842 
00843                 case 1:
00844                 case 2:
00845                 case 3:
00846                 case 4:
00847                 case 5:
00848                 case 6:
00849                 case 7:
00850                 case 8:
00851                     act (slist->others_found,
00852                          victim, NULL, ch, TO_NOTVICT);
00853                     act (slist->char_found, victim, NULL, ch,
00854                          TO_CHAR);
00855                     act (slist->vict_found, victim, NULL, ch,
00856                          TO_VICT);
00857                     break;
00858 
00859                 case 9:
00860                 case 10:
00861                 case 11:
00862                 case 12:
00863                     act ("$n slaps $N.", victim, NULL, ch, TO_NOTVICT);
00864                     act ("You slap $N.", victim, NULL, ch, TO_CHAR);
00865                     act ("$n slaps you.", victim, NULL, ch, TO_VICT);
00866                     break;
00867             }
00868         }
00869     }
00870 
00871     return TRUE;
00872 }

Here is the call graph for this function:

void do_commands CHAR_DATA ch,
char *  argument
 

Definition at line 986 of file interp.c.

References check_disabled(), cmd_table, get_trust(), LEVEL_HERO, MAX_STRING_LENGTH, and send_to_char().

00987 {
00988     char buf[MAX_STRING_LENGTH];
00989     int cmd;
00990     int col;
00991     int runner=1;
00992 
00993     col = 0;
00994     for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
00995     {
00996         if (cmd_table[cmd].level < LEVEL_HERO
00997             && cmd_table[cmd].level <= get_trust (ch) && cmd_table[cmd].show)
00998         {
00999             sprintf (buf, "{w[{g%-3d{w] {c%s%-12.12s{x ",runner, check_disabled(&cmd_table[cmd]) ? "{R" : "",
01000                 cmd_table[cmd].name);
01001             send_to_char (buf, ch);
01002         runner++;
01003             if (++col % 5 == 0)
01004                 send_to_char ("\n\r", ch);
01005         }
01006     }
01007 
01008     if (col % 5 != 0)
01009         send_to_char ("\n\r", ch);
01010     send_to_char("{RRed{x denotes a disabled command.\n\r",ch);
01011     return;
01012 }

Here is the call graph for this function:

void do_disable CHAR_DATA ch,
char *  argument
 

Definition at line 1046 of file interp.c.

References alloc_mem(), cmd_table, disabled_data::command, disabled_data::disabled_by, disabled_first, free_mem(), free_string(), get_trust(), IS_NPC, disabled_data::level, cmd_type::name, disabled_data::next, save_disabled(), send_to_char(), str_cmp(), and str_dup().

01047 {
01048     int i;
01049     DISABLED_DATA *p,*q;
01050     char buf[100];
01051     
01052     if (IS_NPC(ch))
01053     {
01054         send_to_char ("RETURN first.\n\r",ch);
01055         return;
01056     }   
01057     if (!argument[0]) /* Nothing specified. Show disabled commands. */
01058     {
01059         if (!disabled_first) /* Any disabled at all ? */
01060         {
01061             send_to_char ("There are no commands disabled.\n\r",ch);
01062             return;
01063         }
01064         send_to_char ("Disabled commands:\n\r"
01065                       "Command      Level   Disabled by\n\r",ch);
01066                         
01067         for (p = disabled_first; p; p = p->next)
01068         {
01069             sprintf (buf, "%-12s %5d   %-12s\n\r",p->command->name, p->level, p->disabled_by);
01070             send_to_char (buf,ch);
01071         }
01072         return;
01073     }
01074     for (p = disabled_first; p ; p = p->next)
01075         if (!str_cmp(argument, p->command->name))
01076             break;
01077     if (p) /* this command is disabled */
01078     {
01079         if (ch->level < p->level)
01080         {
01081             send_to_char ("This command was disabled by a higher power.\n\r",ch);
01082             return;
01083         }
01084         if (disabled_first == p) /* node to be removed == head ? */
01085             disabled_first = p->next;
01086         else /* Find the node before this one */
01087         {
01088             for (q = disabled_first; q->next != p; q = q->next); /* empty for */
01089             q->next = p->next;
01090         }
01091         
01092         free_string (p->disabled_by); /* free name of disabler */
01093         free_mem (p,sizeof(DISABLED_DATA)); /* free node */
01094         save_disabled(); /* save to disk */
01095         send_to_char ("Command enabled.\n\r",ch);
01096     }
01097     else /* not a disabled command, check if that command exists */
01098     {
01099         /* IQ test */
01100         if (!str_cmp(argument,"disable"))
01101         {
01102             send_to_char ("You cannot disable the disable command.\n\r",ch);
01103             return;
01104         }
01105 
01106         /* Search for the command */
01107         for (i = 0; cmd_table[i].name[0] != '\0'; i++)
01108             if (!str_cmp(cmd_table[i].name, argument))
01109                 break;
01110 
01111         /* Found? */                
01112         if (cmd_table[i].name[0] == '\0')
01113         {
01114             send_to_char ("No such command.\n\r",ch);
01115             return;
01116         }
01117 
01118         /* Can the imm use this command at all ? */             
01119         if (cmd_table[i].level > get_trust(ch))
01120         {
01121             send_to_char ("You don't have access to that command; you cannot disable it.\n\r",ch);
01122             return;
01123         }
01124         
01125         /* Disable the command */
01126         
01127         p = alloc_mem (sizeof(DISABLED_DATA));
01128 
01129         p->command = &cmd_table[i];
01130         p->disabled_by = str_dup (ch->name); /* save name of disabler */
01131         p->level = get_trust(ch); /* save trust */
01132         p->next = disabled_first;
01133         disabled_first = p; /* add before the current first element */
01134         
01135         send_to_char ("Command disabled.\n\r",ch);
01136         save_disabled(); /* save to disk */
01137     }
01138 }

Here is the call graph for this function:

void do_function CHAR_DATA ch,
DO_FUN *  do_fun,
char *  argument
 

Definition at line 736 of file interp.c.

References free_string(), and str_dup().

Referenced by char_update(), check_assist(), damage(), do_delete(), do_deny(), do_enter(), do_examine(), do_gain(), do_give(), do_goto(), do_imotd(), do_load(), do_look(), do_motd(), do_mset(), do_murder(), do_oset(), do_read(), do_reboot(), do_recall(), do_rset(), do_rules(), do_sacrifice(), do_score(), do_score2(), do_set(), do_setskill(), do_shutdown(), do_stand(), do_stat(), do_steal(), do_story(), do_string(), do_transfer(), do_violate(), do_vnum(), do_wake(), do_wizlist(), extract_char(), find_keeper(), get_obj(), get_tithe(), mob_hit(), move_char(), nanny(), null_class(), parse_gen_groups(), spec_executioner(), spec_guard(), spec_mayor(), spec_nasty(), spell_farsight(), spell_gate(), spell_summon(), spell_teleport(), and spell_word_of_recall().

00737 {
00738     char *command_string;
00739 
00740     /* copy the string */
00741     command_string = str_dup (argument);
00742 
00743     /* dispatch the command */
00744     (*do_fun) (ch, command_string);
00745 
00746     /* free the string */
00747     free_string (command_string);
00748 }

Here is the call graph for this function:

void do_wizhelp CHAR_DATA ch,
char *  argument
 

Definition at line 1014 of file interp.c.

References check_disabled(), cmd_table, get_trust(), LEVEL_HERO, MAX_LEVEL, MAX_STRING_LENGTH, and send_to_char().

01015 {
01016     char buf[MAX_STRING_LENGTH];
01017     int cmd;
01018     int col;
01019     int clevel;
01020     col = 0;
01021 
01022     for( clevel = LEVEL_HERO + 1; clevel < MAX_LEVEL + 1; clevel++ ) 
01023     {
01024         for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
01025     { 
01026             if ( cmd_table[cmd].level >= LEVEL_HERO
01027             &&   cmd_table[cmd].level <= get_trust( ch ) 
01028             &&   cmd_table[cmd].show
01029         &&   cmd_table[cmd].level == clevel)
01030         {
01031             sprintf( buf, "{c[{x%-2d{c] %s%-12s{x", cmd_table[cmd].level, check_disabled(&cmd_table[cmd]) ? "{R" : "",cmd_table[cmd].name );
01032             send_to_char( buf, ch );
01033             if ( ++col % 5 == 0 )
01034             send_to_char( "\n\r", ch );
01035         }
01036     }
01037     }
01038  
01039     if ( col % 5 != 0 )
01040     send_to_char( "\n\r", ch );
01041     send_to_char("\n\r{RRed{x denotes a disabled command.\n\r",ch);
01042     return;
01043 }

Here is the call graph for this function:

void interpret CHAR_DATA ch,
char *  argument
 

Definition at line 521 of file interp.c.

References AFF_HIDE, check_disabled(), check_enhanced_disabled(), check_social(), cmd_table, cmd_type::do_fun, FALSE, fLogAll, get_trust(), IS_NPC, IS_SET, cmd_type::log, LOG_ALWAYS, log_buf, LOG_NEVER, log_string(), MAX_INPUT_LENGTH, MAX_STRING_LENGTH, nAllocPerm, nAllocString, one_argument(), PLR_FREEZE, PLR_LOG, POS_DEAD, POS_FIGHTING, POS_INCAP, POS_MORTAL, POS_RESTING, POS_SITTING, POS_SLEEPING, POS_STUNNED, cmd_type::position, REMOVE_BIT, send_to_char(), smash_dollar(), str_cmp(), str_prefix(), tail_chain(), TRUE, WIZ_SECURE, wiznet(), and write_to_buffer().

Referenced by aedit(), cedit(), do_at(), do_force(), do_mpat(), do_mpforce(), do_mpgforce(), do_mpvforce(), do_order(), hedit(), medit(), mpedit(), oedit(), program_flow(), redit(), sedit(), substitute_alias(), and vedit().

00522 {
00523     extern int nAllocPerm;
00524     extern int nAllocString;
00525     char command[MAX_INPUT_LENGTH];
00526     char logline[MAX_INPUT_LENGTH];
00527     int cmd;
00528     int trust;
00529     bool found;
00530     int string_count = nAllocString ;
00531     int perm_count = nAllocPerm ;
00532     char cmd_copy[MAX_INPUT_LENGTH] ;
00533     char buf[MAX_STRING_LENGTH] ;
00534 
00535     
00536 
00537     /*
00538      * Strip leading spaces.
00539      */
00540     while (isspace (*argument))
00541         argument++;
00542     if (argument[0] == '\0')
00543         return;
00544 
00545     strcpy(cmd_copy, argument) ;
00546     
00547     /*
00548      * No hiding.
00549      */
00550     REMOVE_BIT (ch->affected_by, AFF_HIDE);
00551 
00552     /*
00553      * Implement freeze command.
00554      */
00555     
00556     if (!IS_NPC (ch) && IS_SET (ch->act, PLR_FREEZE))
00557     {
00558         send_to_char ("You're totally frozen!\n\r", ch);
00559         return;
00560     }
00561 
00562     /*
00563      * Grab the command word.
00564      * Special parsing so ' can be a command,
00565      * also no spaces needed after punctuation.
00566      */
00567     strcpy (logline, argument);
00568     if (!isalpha (argument[0]) && !isdigit (argument[0]))
00569     {
00570         command[0] = argument[0];
00571         command[1] = '\0';
00572         argument++;
00573         while (isspace (*argument))
00574             argument++;
00575     }
00576     else
00577     {
00578         argument = one_argument (argument, command);
00579     }
00580 
00581     /*
00582      * Look for command in command table.
00583      */
00584     /*char specbuf[MSL];
00585     sprintf(specbuf, "%s \n\r", command);
00586     send_to_char(specbuf,ch);*/
00587     /*command stopper*/
00588 
00589          
00590     found = FALSE;
00591     trust = get_trust (ch);
00592     for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
00593     {
00594         if (command[0] == cmd_table[cmd].name[0]
00595             && !str_prefix (command, cmd_table[cmd].name)
00596             && cmd_table[cmd].level <= trust)
00597         {
00598             found = TRUE;
00599             break;
00600         }
00601     }
00602 
00603     /*
00604      * Log and snoop.
00605      */
00606     smash_dollar(logline);
00607     
00608     if (cmd_table[cmd].log == LOG_NEVER)
00609         strcpy (logline, "");
00610 
00611     /* Replaced original block of code with fix from Edwin
00612      * to prevent crashes due to dollar signs in logstrings.
00613      * I threw in the above call to smash_dollar() just for
00614      * the sake of overkill :) JR -- 10/15/00
00615      */
00616     if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
00617         ||   fLogAll
00618         ||   cmd_table[cmd].log == LOG_ALWAYS )
00619     {
00620         char    s[2*MAX_INPUT_LENGTH],*ps;
00621         int     i;
00622 
00623         ps=s; 
00624         if (!str_cmp(ch->name, "Tribul") || !str_cmp(ch->name, "Mike"))
00625     {
00626     }
00627     else
00628     {
00629         sprintf( log_buf, "Log %s: %s", ch->name, logline );
00630     }
00631         /* Make sure that was is displayed is what is typed */
00632         for (i=0;log_buf[i];i++)
00633         { 
00634             *ps++=log_buf[i];  
00635             if (log_buf[i]=='$')
00636                 *ps++='$';
00637             if (log_buf[i]=='{')
00638                 *ps++='{';
00639         }
00640         *ps=0;
00641         wiznet(s,ch,NULL,WIZ_SECURE,0,get_trust(ch));
00642         log_string( log_buf );
00643     }
00644 
00645     if (ch->desc != NULL && ch->desc->snoop_by != NULL)
00646     {
00647         write_to_buffer (ch->desc->snoop_by, "% ", 2);
00648         write_to_buffer (ch->desc->snoop_by, logline, 0);
00649         write_to_buffer (ch->desc->snoop_by, "\n\r", 2);
00650     }
00651 
00652     if (!found)
00653     {
00654         /*
00655          * Look for command in socials table.
00656          */
00657         if (!check_social (ch, command, argument))
00658             send_to_char ("Huh?\n\r", ch);
00659         return;
00660     }
00661     else if (check_disabled (&cmd_table[cmd]) && ch->level != 61)
00662     {
00663         send_to_char ("This command has been temporarily disabled.\n\r",ch);
00664         return;
00665     }
00666     else if (check_enhanced_disabled(ch, &cmd_table[cmd]))
00667     {
00668         send_to_char("This command has been {RDisabled{x.\n\r",ch);
00669         return;
00670     }
00671 
00672 
00673     /*
00674      * Character not in position for command?
00675      */
00676     if (ch->position < cmd_table[cmd].position)
00677     {
00678         switch (ch->position)
00679         {
00680             case POS_DEAD:
00681                 send_to_char ("Lie still; you are DEAD.\n\r", ch);
00682                 break;
00683 
00684             case POS_MORTAL:
00685             case POS_INCAP:
00686                 send_to_char ("You are hurt far too bad for that.\n\r", ch);
00687                 break;
00688 
00689             case POS_STUNNED:
00690                 send_to_char ("You are too stunned to do that.\n\r", ch);
00691                 break;
00692 
00693             case POS_SLEEPING:
00694                 send_to_char ("In your dreams, or what?\n\r", ch);
00695                 break;
00696 
00697             case POS_RESTING:
00698                 send_to_char ("Nah... You feel too relaxed...\n\r", ch);
00699                 break;
00700 
00701             case POS_SITTING:
00702                 send_to_char ("Better stand up first.\n\r", ch);
00703                 break;
00704 
00705             case POS_FIGHTING:
00706                 send_to_char ("No way!  You are still fighting!\n\r", ch);
00707                 break;
00708 
00709         }
00710         return;
00711     }
00712 
00713     /*
00714      * Dispatch the command.
00715      */
00716     (*cmd_table[cmd].do_fun) (ch, argument);
00717    /* if (string_count < nAllocString)
00718     {
00719         sprintf(buf,
00720                 "Memcheck : Increase in strings :: %s : %s", ch->name, cmd_copy) ;
00721         wiznet(buf, NULL, NULL, WIZ_MEMCHECK,0,0) ;
00722     }
00723     if (perm_count < nAllocPerm)
00724     {
00725         sprintf(buf,
00726                 "Increase in perms :: %s : %s", ch->name, cmd_copy) ;
00727         wiznet(buf, NULL, NULL, WIZ_MEMCHECK, 0,0) ;
00728     }*/
00729 
00730 
00731     tail_chain ();
00732     return;
00733 }

Here is the call graph for this function:

bool is_number char *  arg  ) 
 

Definition at line 879 of file interp.c.

References FALSE, and TRUE.

Referenced by AEDIT(), CEDIT(), change_exit(), cmd_eval(), do_advance(), do_aedit(), do_asave(), do_cedit(), do_disconnect(), do_drop(), do_give(), do_lag(), do_medit(), do_memory_stringspace(), do_mload(), do_mpdamage(), do_mpdelay(), do_mpedit(), do_mpmload(), do_mpoload(), do_mpremove(), do_mpvforce(), do_mset(), do_oedit(), do_oflagall(), do_oload(), do_resets(), do_rset(), do_scroll(), do_setskill(), do_skills(), do_spells(), do_sset(), do_tithe(), do_trust(), do_who(), do_who_clan(), do_who_kingdom(), find_location(), get_tithe(), HEDIT(), main(), MEDIT(), mp_give_trigger(), OEDIT(), parse_note(), REDIT(), and VEDIT().

00880 {
00881 
00882     if (*arg == '\0')
00883         return FALSE;
00884 
00885     if (*arg == '+' || *arg == '-')
00886         arg++;
00887 
00888     for (; *arg != '\0'; arg++)
00889     {
00890         if (!isdigit (*arg))
00891             return FALSE;
00892     }
00893 
00894     return TRUE;
00895 }

void load_disabled  ) 
 

Definition at line 1152 of file interp.c.

References alloc_mem(), bug(), cmd_table, disabled_data::command, disabled_data::disabled_by, DISABLED_FILE, disabled_first, END_MARKER, fread_number(), fread_word(), disabled_data::level, disabled_data::next, str_cmp(), str_dup(), and twiddle().

Referenced by boot_db().

01153 {
01154     FILE *fp;
01155     DISABLED_DATA *p;
01156     char *name;
01157     int i;
01158     
01159     disabled_first = NULL;
01160     
01161     fp = fopen (DISABLED_FILE, "r");
01162     
01163     if (!fp) /* No disabled file.. no disabled commands : */
01164         return;
01165         
01166     name = fread_word (fp);
01167     
01168     while (str_cmp(name, END_MARKER)) /* as long as name is NOT END_MARKER :) */
01169     {
01170         twiddle();
01171         /* Find the command in the table */
01172         for (i = 0; cmd_table[i].name[0] ; i++)
01173             if (!str_cmp(cmd_table[i].name, name))
01174                 break;
01175                 
01176         if (!cmd_table[i].name[0]) /* command does not exist? */
01177         {
01178             bug ("Skipping uknown command in " DISABLED_FILE " file.",0);
01179             fread_number(fp); /* level */
01180             fread_word(fp); /* disabled_by */
01181         }
01182         else /* add new disabled command */
01183         {
01184             p = alloc_mem(sizeof(DISABLED_DATA));
01185             p->command = &cmd_table[i];
01186             p->level = fread_number(fp);
01187             p->disabled_by = str_dup(fread_word(fp)); 
01188             p->next = disabled_first;
01189             
01190             disabled_first = p;
01191 
01192         }
01193         
01194         name = fread_word(fp);
01195     }
01196 
01197     fclose (fp);        
01198 }

Here is the call graph for this function:

int mult_argument char *  argument,
char *  arg
 

Definition at line 926 of file interp.c.

Referenced by do_buy().

00927 {
00928     char *pdot;
00929     int number;
00930 
00931     for (pdot = argument; *pdot != '\0'; pdot++)
00932     {
00933         if (*pdot == '*')
00934         {
00935             *pdot = '\0';
00936             number = atoi (argument);
00937             *pdot = '*';
00938             strcpy (arg, pdot + 1);
00939             return number;
00940         }
00941     }
00942 
00943     strcpy (arg, argument);
00944     return 1;
00945 }

int number_argument char *  argument,
char *  arg
 

Definition at line 902 of file interp.c.

Referenced by do_look(), get_char_room(), get_char_world(), get_obj_carry(), get_obj_keeper(), get_obj_list(), get_obj_wear(), and get_obj_world().

00903 {
00904     char *pdot;
00905     int number;
00906 
00907     for (pdot = argument; *pdot != '\0'; pdot++)
00908     {
00909         if (*pdot == '.')
00910         {
00911             *pdot = '\0';
00912             number = atoi (argument);
00913             *pdot = '.';
00914             strcpy (arg, pdot + 1);
00915             return number;
00916         }
00917     }
00918 
00919     strcpy (arg, argument);
00920     return 1;
00921 }

char* one_argument char *  argument,
char *  arg_first
 

Definition at line 953 of file interp.c.

References LOWER.

Referenced by act_new(), AEDIT(), aedit(), ban_site(), builder_note(), cedit(), change_exit(), check_social(), cmd_eval(), code_note(), do_advance(), do_aedit(), do_alias(), do_allow(), do_at(), do_backstab(), do_banish(), do_bash(), do_buy(), do_cast(), do_cedit(), do_clone(), do_close(), do_colour(), do_cset(), do_deny(), do_dirt(), do_disconnect(), do_drink(), do_drop(), do_dsay(), do_eat(), do_enhanced_disable(), do_examine(), do_fill(), do_flag(), do_follow(), do_force(), do_freeze(), do_gain(), do_get(), do_give(), do_group(), do_guild(), do_heal(), do_hedit(), do_help(), do_immtitle(), do_incognito(), do_invis(), do_kick(), do_kill(), do_kingdom_recruiter(), do_kingdom_set_rank(), do_lag(), do_list(), do_load(), do_lock(), do_log(), do_look(), do_map(), do_medit(), do_memory_stringspace(), do_mfind(), do_mload(), do_mpassist(), do_mpat(), do_mpcall(), do_mpcast(), do_mpdamage(), do_mpdelay(), do_mpdump(), do_mpechoaround(), do_mpechoat(), do_mpedit(), do_mpforce(), do_mpgforce(), do_mpgoto(), do_mpgtransfer(), do_mpjunk(), do_mpkill(), do_mpmload(), do_mpoload(), do_mpotransfer(), do_mppurge(), do_mpremember(), do_mpremove(), do_mpstat(), do_mptransfer(), do_mpvforce(), do_mset(), do_mstat(), do_murder(), do_nochannels(), do_noemote(), do_noshout(), do_notell(), do_oedit(), do_ofind(), do_oflagall(), do_olc(), do_oload(), do_open(), do_order(), do_oset(), do_ostat(), do_pardon(), do_pecho(), do_pick(), do_play(), do_pload(), do_pour(), do_punload(), do_purge(), do_put(), do_quaff(), do_recite(), do_redit(), do_remove(), do_rename(), do_rescue(), do_resets(), do_restore(), do_rflagall(), do_roar(), do_rset(), do_rstat(), do_sacrifice(), do_scan(), do_scroll(), do_sedit(), do_sell(), do_set(), do_set_leader(), do_setskill(), do_skills(), do_slay(), do_slookup(), do_smallmap(), do_snoop(), do_sockets(), do_spells(), do_split(), do_sset(), do_stat(), do_steal(), do_string(), do_switch(), do_tell(), do_transfer(), do_trip(), do_trust(), do_unalias(), do_unlock(), do_value(), do_vedit(), do_vnum(), do_wake(), do_wear(), do_who(), do_who_clan(), do_who_kingdom(), do_whois(), do_zap(), expand_arg(), flag_value(), get_tithe(), hedit(), help_lookup(), interpret(), is_exact_name(), is_full_name(), is_name(), load_old_mob(), MEDIT(), medit(), mob_interpret(), mp_give_trigger(), mpedit(), nanny(), note_remove(), oedit(), OEDIT(), parse_gen_groups(), parse_note(), program_flow(), REDIT(), redit(), sedit(), show_help(), show_string(), spell_ventriloquate(), string_add(), substitute_alias(), vedit(), and vinterpret().

00954 {
00955     char cEnd;
00956 
00957     while (isspace (*argument))
00958         argument++;
00959 
00960     cEnd = ' ';
00961     if (*argument == '\'' || *argument == '"')
00962         cEnd = *argument++;
00963 
00964     while (*argument != '\0')
00965     {
00966         if (*argument == cEnd)
00967         {
00968             argument++;
00969             break;
00970         }
00971         *arg_first = LOWER (*argument);
00972         arg_first++;
00973         argument++;
00974     }
00975     *arg_first = '\0';
00976 
00977     while (isspace (*argument))
00978         argument++;
00979 
00980     return argument;
00981 }

void save_disabled  ) 
 

Definition at line 1201 of file interp.c.

References bug(), disabled_data::command, disabled_data::disabled_by, DISABLED_FILE, disabled_first, END_MARKER, disabled_data::level, cmd_type::name, disabled_data::next, and unlink().

Referenced by do_disable(), and main().

01202 {
01203     FILE *fp;
01204     DISABLED_DATA *p;
01205     
01206     if (!disabled_first) /* delete file if no commands are disabled */
01207     {
01208         unlink (DISABLED_FILE);
01209         return;
01210     }
01211     
01212     fp = fopen (DISABLED_FILE, "w");
01213     
01214     if (!fp)
01215     {
01216         bug ("Could not open " DISABLED_FILE " for writing",0);
01217         return;
01218     }
01219     
01220     for (p = disabled_first; p ; p = p->next)
01221         fprintf (fp, "%s %d %s\n", p->command->name, p->level, p->disabled_by);
01222         
01223     fprintf (fp, "%s\n",END_MARKER);
01224         
01225     fclose (fp);
01226 }

Here is the call graph for this function:


Variable Documentation

const struct cmd_type cmd_table[]
 

Definition at line 69 of file interp.c.

Referenced by create_disable_thread(), do_commands(), do_disable(), do_enhanced_disable(), do_wizhelp(), interpret(), load_disabled(), and load_enhanced_disable().

DISABLED_DATA* disabled_first
 

Definition at line 45 of file interp.c.

Referenced by check_disabled(), do_disable(), load_disabled(), and save_disabled().

bool fLogAll = FALSE
 

Definition at line 62 of file interp.c.

Referenced by do_log(), and interpret().


Generated on Thu Jan 13 22:00:51 2005 for Beyond the Shadows by  doxygen 1.4.0