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

olc.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 "tables.h"
#include "olc.h"
#include "vehicles.h"

Include dependency graph for olc.c:

Go to the source code of this file.

Functions

void add_reset (ROOM_INDEX_DATA *room, RESET_DATA *pReset, int index)
void aedit (CHAR_DATA *ch, char *argument)
AREA_DATA *get_area_data args ((int vnum))
void display_resets (CHAR_DATA *ch)
void do_aedit (CHAR_DATA *ch, char *argument)
void do_alist (CHAR_DATA *ch, char *argument)
void do_hedit (CHAR_DATA *ch, char *argument)
void do_medit (CHAR_DATA *ch, char *argument)
void do_oedit (CHAR_DATA *ch, char *argument)
void do_olc (CHAR_DATA *ch, char *argument)
void do_redit (CHAR_DATA *ch, char *argument)
void do_resets (CHAR_DATA *ch, char *argument)
void do_sedit (CHAR_DATA *ch, char *argument)
void do_vedit (CHAR_DATA *ch, char *argument)
bool edit_done (CHAR_DATA *ch)
AREA_DATAget_area_data (int vnum)
void hedit (CHAR_DATA *ch, char *argument)
void medit (CHAR_DATA *ch, char *argument)
void oedit (CHAR_DATA *ch, char *argument)
char * olc_ed_name (CHAR_DATA *ch)
char * olc_ed_vnum (CHAR_DATA *ch)
void redit (CHAR_DATA *ch, char *argument)
bool run_olc_editor (DESCRIPTOR_DATA *d)
void sedit (CHAR_DATA *ch, char *argument)
bool show_commands (CHAR_DATA *ch, char *argument)
void show_olc_cmds (CHAR_DATA *ch, const struct olc_cmd_type *olc_table)
void vedit (CHAR_DATA *ch, char *argument)

Variables

const struct olc_cmd_type aedit_table []
const struct editor_cmd_type editor_table []
const struct olc_cmd_type hedit_table []
const struct olc_cmd_type medit_table []
const struct olc_cmd_type oedit_table []
const struct olc_cmd_type redit_table []
const struct olc_cmd_type sedit_table []
const struct olc_cmd_type vedit_table []


Function Documentation

void add_reset ROOM_INDEX_DATA room,
RESET_DATA pReset,
int  index
 

Definition at line 1689 of file olc.c.

References reset_data::next, and room_index_data::reset_first.

Referenced by do_resets(), and REDIT().

01690 {
01691     RESET_DATA *reset;
01692     int iReset = 0;
01693 
01694     if (!room->reset_first)
01695     {
01696         room->reset_first = pReset;
01697         room->reset_last = pReset;
01698         pReset->next = NULL;
01699         return;
01700     }
01701 
01702     index--;
01703 
01704     if (index == 0)
01705     {                            /* First slot (1) selected. */
01706         pReset->next = room->reset_first;
01707         room->reset_first = pReset;
01708         return;
01709     }
01710 
01711     /*
01712      * If negative slot( <= 0 selected) then this will find the last.
01713      */
01714     for (reset = room->reset_first; reset->next; reset = reset->next)
01715     {
01716         if (++iReset == index)
01717             break;
01718     }
01719 
01720     pReset->next = reset->next;
01721     reset->next = pReset;
01722     if (!pReset->next)
01723         room->reset_last = pReset;
01724     return;
01725 }

void aedit CHAR_DATA ch,
char *  argument
 

Definition at line 536 of file olc.c.

References aedit_table, AREA_CHANGED, area_data::area_flags, area_flags, EDIT_AREA, edit_done(), flag_value(), interpret(), MAX_INPUT_LENGTH, NO_FLAG, one_argument(), send_to_char(), SET_BIT, smash_tilde(), str_cmp(), str_prefix(), and TOGGLE_BIT.

Referenced by run_olc_editor().

00537 {
00538     AREA_DATA *pArea;
00539     char command[MAX_INPUT_LENGTH];
00540     char arg[MAX_INPUT_LENGTH];
00541     int cmd;
00542     int value;
00543 
00544     EDIT_AREA (ch, pArea);
00545     smash_tilde (argument);
00546     strcpy (arg, argument);
00547     argument = one_argument (argument, command);
00548 
00549     if (ch->level < 59)
00550     {
00551         send_to_char ("AEdit:  You are not high enough in level to do this.\n\r",
00552                       ch);
00553         edit_done (ch);
00554         return;
00555     }
00556 
00557     if (!str_cmp (command, "done"))
00558     {
00559         edit_done (ch);
00560         return;
00561     }
00562 
00563     if (command[0] == '\0')
00564     {
00565         aedit_show (ch, argument);
00566         return;
00567     }
00568 
00569     if ((value = flag_value (area_flags, command)) != NO_FLAG)
00570     {
00571         TOGGLE_BIT (pArea->area_flags, value);
00572 
00573         send_to_char ("Flag toggled.\n\r", ch);
00574         return;
00575     }
00576 
00577     /* Search Table and Dispatch Command. */
00578     for (cmd = 0; aedit_table[cmd].name != NULL; cmd++)
00579     {
00580         if (!str_prefix (command, aedit_table[cmd].name))
00581         {
00582             if ((*aedit_table[cmd].olc_fun) (ch, argument))
00583             {
00584                 SET_BIT (pArea->area_flags, AREA_CHANGED);
00585                 return;
00586             }
00587             else
00588                 return;
00589         }
00590     }
00591 
00592     /* Default to Standard Interpreter. */
00593     interpret (ch, arg);
00594     return;
00595 }

Here is the call graph for this function:

AREA_DATA* get_area_data args (int vnum)   ) 
 

void display_resets CHAR_DATA ch  ) 
 

Definition at line 1470 of file olc.c.

References reset_data::arg1, reset_data::arg2, reset_data::arg3, reset_data::arg4, capitalize(), reset_data::command, dir_name, door_resets, EDIT_ROOM, flag_string(), get_mob_index(), get_obj_index(), get_room_index(), IS_SET, MAX_STRING_LENGTH, room_index_data::name, reset_data::next, mob_index_data::pShop, room_index_data::reset_first, room_index_data::room_flags, ROOM_PET_SHOP, send_to_char(), obj_index_data::short_descr, mob_index_data::short_descr, mob_index_data::vnum, room_index_data::vnum, wear_loc_strings, and WEAR_NONE.

Referenced by do_resets().

01471 {
01472     ROOM_INDEX_DATA *pRoom;
01473     RESET_DATA *pReset;
01474     MOB_INDEX_DATA *pMob = NULL;
01475     char buf[MAX_STRING_LENGTH];
01476     char final[MAX_STRING_LENGTH];
01477     int iReset = 0;
01478 
01479     EDIT_ROOM (ch, pRoom);
01480     final[0] = '\0';
01481 
01482     send_to_char
01483         (" No.  Loads    Description       Location         Vnum   Mx Mn Description"
01484          "\n\r"
01485          "==== ======== ============= =================== ======== ===== ==========="
01486          "\n\r", ch);
01487 
01488     for (pReset = pRoom->reset_first; pReset; pReset = pReset->next)
01489     {
01490         OBJ_INDEX_DATA *pObj;
01491         MOB_INDEX_DATA *pMobIndex;
01492         OBJ_INDEX_DATA *pObjIndex;
01493         OBJ_INDEX_DATA *pObjToIndex;
01494         ROOM_INDEX_DATA *pRoomIndex;
01495 
01496         final[0] = '\0';
01497         sprintf (final, "[%2d] ", ++iReset);
01498 
01499         switch (pReset->command)
01500         {
01501             default:
01502                 sprintf (buf, "Bad reset command: %c.", pReset->command);
01503                 strcat (final, buf);
01504                 break;
01505 
01506             case 'M':
01507                 if (!(pMobIndex = get_mob_index (pReset->arg1)))
01508                 {
01509                     sprintf (buf, "Load Mobile - Bad Mob %d\n\r",
01510                              pReset->arg1);
01511                     strcat (final, buf);
01512                     continue;
01513                 }
01514 
01515                 if (!(pRoomIndex = get_room_index (pReset->arg3)))
01516                 {
01517                     sprintf (buf, "Load Mobile - Bad Room %d\n\r",
01518                              pReset->arg3);
01519                     strcat (final, buf);
01520                     continue;
01521                 }
01522 
01523                 pMob = pMobIndex;
01524                 sprintf (buf,
01525                          "M[%5d] %-13.13s in room             R[%5d] %2d-%2d %-15.15s\n\r",
01526                          pReset->arg1, pMob->short_descr, pReset->arg3,
01527                          pReset->arg2, pReset->arg4, pRoomIndex->name);
01528                 strcat (final, buf);
01529 
01530                 /*
01531                  * Check for pet shop.
01532                  * -------------------
01533                  */
01534                 {
01535                     ROOM_INDEX_DATA *pRoomIndexPrev;
01536 
01537                     pRoomIndexPrev = get_room_index (pRoomIndex->vnum - 1);
01538                     if (pRoomIndexPrev
01539                         && IS_SET (pRoomIndexPrev->room_flags, ROOM_PET_SHOP))
01540                         final[5] = 'P';
01541                 }
01542 
01543                 break;
01544 
01545             case 'O':
01546                 if (!(pObjIndex = get_obj_index (pReset->arg1)))
01547                 {
01548                     sprintf (buf, "Load Object - Bad Object %d\n\r",
01549                              pReset->arg1);
01550                     strcat (final, buf);
01551                     continue;
01552                 }
01553 
01554                 pObj = pObjIndex;
01555 
01556                 if (!(pRoomIndex = get_room_index (pReset->arg3)))
01557                 {
01558                     sprintf (buf, "Load Object - Bad Room %d\n\r",
01559                              pReset->arg3);
01560                     strcat (final, buf);
01561                     continue;
01562                 }
01563 
01564                 sprintf (buf, "O[%5d] %-13.13s in room             "
01565                          "R[%5d]       %-15.15s\n\r",
01566                          pReset->arg1, pObj->short_descr,
01567                          pReset->arg3, pRoomIndex->name);
01568                 strcat (final, buf);
01569 
01570                 break;
01571 
01572             case 'P':
01573                 if (!(pObjIndex = get_obj_index (pReset->arg1)))
01574                 {
01575                     sprintf (buf, "Put Object - Bad Object %d\n\r",
01576                              pReset->arg1);
01577                     strcat (final, buf);
01578                     continue;
01579                 }
01580 
01581                 pObj = pObjIndex;
01582 
01583                 if (!(pObjToIndex = get_obj_index (pReset->arg3)))
01584                 {
01585                     sprintf (buf, "Put Object - Bad To Object %d\n\r",
01586                              pReset->arg3);
01587                     strcat (final, buf);
01588                     continue;
01589                 }
01590 
01591                 sprintf (buf,
01592                          "O[%5d] %-13.13s inside              O[%5d] %2d-%2d %-15.15s\n\r",
01593                          pReset->arg1,
01594                          pObj->short_descr,
01595                          pReset->arg3,
01596                          pReset->arg2, pReset->arg4,
01597                          pObjToIndex->short_descr);
01598                 strcat (final, buf);
01599 
01600                 break;
01601 
01602             case 'G':
01603             case 'E':
01604                 if (!(pObjIndex = get_obj_index (pReset->arg1)))
01605                 {
01606                     sprintf (buf, "Give/Equip Object - Bad Object %d\n\r",
01607                              pReset->arg1);
01608                     strcat (final, buf);
01609                     continue;
01610                 }
01611 
01612                 pObj = pObjIndex;
01613 
01614                 if (!pMob)
01615                 {
01616                     sprintf (buf,
01617                              "Give/Equip Object - No Previous Mobile\n\r");
01618                     strcat (final, buf);
01619                     break;
01620                 }
01621 
01622                 if (pMob->pShop)
01623                 {
01624                     sprintf (buf,
01625                              "O[%5d] %-13.13s in the inventory of S[%5d]       %-15.15s\n\r",
01626                              pReset->arg1,
01627                              pObj->short_descr, pMob->vnum,
01628                              pMob->short_descr);
01629                 }
01630                 else
01631                     sprintf (buf,
01632                              "O[%5d] %-13.13s %-19.19s M[%5d]       %-15.15s\n\r",
01633                              pReset->arg1,
01634                              pObj->short_descr,
01635                              (pReset->command == 'G') ?
01636                              flag_string (wear_loc_strings, WEAR_NONE)
01637                              : flag_string (wear_loc_strings, pReset->arg3),
01638                              pMob->vnum, pMob->short_descr);
01639                 strcat (final, buf);
01640 
01641                 break;
01642 
01643                 /*
01644                  * Doors are set in rs_flags don't need to be displayed.
01645                  * If you want to display them then uncomment the new_reset
01646                  * line in the case 'D' in load_resets in db.c and here.
01647                  */
01648             case 'D':
01649                 pRoomIndex = get_room_index (pReset->arg1);
01650                 sprintf (buf, "R[%5d] %s door of %-19.19s reset to %s\n\r",
01651                          pReset->arg1,
01652                          capitalize (dir_name[pReset->arg2]),
01653                          pRoomIndex->name,
01654                          flag_string (door_resets, pReset->arg3));
01655                 strcat (final, buf);
01656 
01657                 break;
01658                 /*
01659                  * End Doors Comment.
01660                  */
01661             case 'R':
01662                 if (!(pRoomIndex = get_room_index (pReset->arg1)))
01663                 {
01664                     sprintf (buf, "Randomize Exits - Bad Room %d\n\r",
01665                              pReset->arg1);
01666                     strcat (final, buf);
01667                     continue;
01668                 }
01669 
01670                 sprintf (buf, "R[%5d] Exits are randomized in %s\n\r",
01671                          pReset->arg1, pRoomIndex->name);
01672                 strcat (final, buf);
01673 
01674                 break;
01675         }
01676         send_to_char (final, ch);
01677     }
01678 
01679     return;
01680 }

Here is the call graph for this function:

void do_aedit CHAR_DATA ch,
char *  argument
 

Definition at line 1187 of file olc.c.

References ED_AREA, get_area_data(), IS_BUILDER, IS_NPC, is_number(), MAX_STRING_LENGTH, one_argument(), send_to_char(), and str_cmp().

01188 {
01189     AREA_DATA *pArea;
01190     int value;
01191     char arg[MAX_STRING_LENGTH];
01192 
01193     if (IS_NPC (ch))
01194         return;
01195 
01196     pArea = ch->in_room->area;
01197 
01198     argument = one_argument (argument, arg);
01199 
01200     if (is_number (arg))
01201     {
01202         value = atoi (arg);
01203         if (!(pArea = get_area_data (value)))
01204         {
01205             send_to_char ("That area vnum does not exist.\n\r", ch);
01206             return;
01207         }
01208     }
01209     else if (!str_cmp (arg, "create"))
01210     {
01211         if (ch->pcdata->security < 9)
01212         {
01213             send_to_char ("AEdit : Insufficient security to create area.\n\r",
01214                           ch);
01215             return;
01216         }
01217 
01218         aedit_create (ch, "");
01219         ch->desc->editor = ED_AREA;
01220         return;
01221     }
01222 
01223     if (!IS_BUILDER (ch, pArea))
01224     {
01225         send_to_char ("Insufficient security to edit areas.\n\r", ch);
01226         return;
01227     }
01228 
01229     ch->desc->pEdit = (void *) pArea;
01230     ch->desc->editor = ED_AREA;
01231     return;
01232 }

Here is the call graph for this function:

void do_alist CHAR_DATA ch,
char *  argument
 

Definition at line 1975 of file olc.c.

References add_buf(), area_first, buf_string(), area_data::builders, area_data::cont, area_data::file_name, free_buf(), IS_NPC, MAX_STRING_LENGTH, area_data::max_vnum, area_data::min_vnum, area_data::name, new_buf(), area_data::next, page_to_char(), area_data::r_used, area_data::security, and area_data::vnum.

01976 {
01977     char buf[MAX_STRING_LENGTH];
01978     char result[MAX_STRING_LENGTH * 2];    /* May need tweaking. */
01979     AREA_DATA *pArea;
01980     BUFFER *buffer;
01981     buffer = new_buf();
01982     unsigned long int ma,perc;
01983     unsigned long int used;
01984     unsigned long int rem;
01985 
01986     if (IS_NPC (ch))
01987         return;
01988 
01989     sprintf (result, "[{c%3s{x] [{c%-13s{x] ({c%-9s{C-{c%9s{x) [{c%-12s{x] {c%3s{x [{c%-6s{x] [{c%-6s{x] [{c%-4s{x]\n\r",
01990              "Num", "Area Name", "lvnum", "uvnum", "Filename", "Sec",
01991              "Bldrs", "Cont", "Used");
01992     add_buf(buffer, result);
01993 
01994     for (pArea = area_first; pArea; pArea = pArea->next)
01995     {
01996         ma = pArea->max_vnum - pArea->min_vnum;
01997          
01998         if (ma > 0)
01999             used = (100 * pArea->r_used) / ma;
02000          
02001         
02002         sprintf (buf,
02003                  "[{c%3d{x] {W%-15.15s{x ({c%-9d{C-{c%9d{x) {w%-12.12s{x [{c%3d{x] [{W%-6.6s{x] [{c%-6.6s{x] [{c%3d%s{x]\n\r",
02004                  pArea->vnum, pArea->name, pArea->min_vnum, pArea->max_vnum,
02005                  pArea->file_name, pArea->security, pArea->builders,pArea->cont,used,"%");
02006         //strcat (result, buf);
02007     add_buf(buffer, buf);
02008     }
02009 
02010     page_to_char (buf_string(buffer), ch);
02011     free_buf(buffer);
02012 
02013     return;
02014 }

Here is the call graph for this function:

void do_hedit CHAR_DATA ch,
char *  argument
 

Definition at line 1132 of file olc.c.

References ED_HELP, FALSE, help_first, is_name(), help_data::keyword, MAX_INPUT_LENGTH, MIL, help_data::next, one_argument(), send_to_char(), str_cmp(), and TRUE.

01133 {
01134     HELP_DATA *pHelp;
01135     char arg1[MIL];
01136     char argall[MAX_INPUT_LENGTH],argone[MAX_INPUT_LENGTH];
01137     bool found = FALSE;
01138 
01139     strcpy(arg1,argument);
01140     
01141     if(argument[0] != '\0')
01142     {
01143         /* Taken from do_help */
01144         argall[0] = '\0';
01145         while (argument[0] != '\0' )
01146         {
01147             argument = one_argument(argument,argone);
01148             if (argall[0] != '\0')
01149                 strcat(argall," ");
01150             strcat(argall,argone);
01151         }
01152 
01153         for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next )
01154         {
01155             if ( is_name( argall, pHelp->keyword ) )
01156             {
01157                 ch->desc->pEdit=(void *)pHelp;
01158                 ch->desc->editor= ED_HELP;
01159                 found = TRUE;
01160                 return;
01161             }
01162         }
01163     }
01164 
01165     if(!found)
01166     {
01167         argument = one_argument(arg1, arg1);
01168         
01169         if(!str_cmp(arg1,"make"))
01170         {
01171             if (argument[0] == '\0')
01172             {
01173                 send_to_char("Syntax: edit help new [topic]\n\r",ch);
01174                 return;
01175             }
01176             if (hedit_make(ch, argument) )
01177                 ch->desc->editor = ED_HELP;
01178             return;
01179         }
01180     }
01181 
01182     send_to_char( "HEdit:  There is no default help to edit.\n\r", ch );
01183     return;
01184 }

Here is the call graph for this function:

void do_medit CHAR_DATA ch,
char *  argument
 

Definition at line 1397 of file olc.c.

References mob_index_data::area, AREA_CHANGED, area_data::area_flags, ED_MOBILE, get_mob_index(), get_vnum_area(), IS_BUILDER, IS_NPC, is_number(), MAX_STRING_LENGTH, one_argument(), send_to_char(), SET_BIT, and str_cmp().

01398 {
01399     MOB_INDEX_DATA *pMob;
01400     AREA_DATA *pArea;
01401     int value;
01402     char arg1[MAX_STRING_LENGTH];
01403 
01404     argument = one_argument (argument, arg1);
01405 
01406     if (IS_NPC (ch))
01407         return;
01408 
01409     if (is_number (arg1))
01410     {
01411         value = atoi (arg1);
01412         if (!(pMob = get_mob_index (value)))
01413         {
01414             send_to_char ("MEdit:  That vnum does not exist.\n\r", ch);
01415             return;
01416         }
01417 
01418         if (!IS_BUILDER (ch, pMob->area))
01419         {
01420             send_to_char ("Insufficient security to modify mobs.\n\r", ch);
01421             return;
01422         }
01423 
01424         ch->desc->pEdit = (void *) pMob;
01425         ch->desc->editor = ED_MOBILE;
01426         return;
01427     }
01428     else
01429     {
01430         if (!str_cmp (arg1, "create"))
01431         {
01432             value = atoi (argument);
01433             if (arg1[0] == '\0' || value == 0)
01434             {
01435                 send_to_char ("Syntax:  edit mobile create [vnum]\n\r", ch);
01436                 return;
01437             }
01438 
01439             pArea = get_vnum_area (value);
01440 
01441             if (!pArea)
01442             {
01443                 send_to_char
01444                     ("OEdit:  That vnum is not assigned an area.\n\r", ch);
01445                 return;
01446             }
01447 
01448             if (!IS_BUILDER (ch, pArea))
01449             {
01450                 send_to_char ("Insufficient security to modify mobs.\n\r",
01451                               ch);
01452                 return;
01453             }
01454 
01455             if (medit_create (ch, argument))
01456             {
01457                 SET_BIT (pArea->area_flags, AREA_CHANGED);
01458                 ch->desc->editor = ED_MOBILE;
01459             }
01460             return;
01461         }
01462     }
01463 
01464     send_to_char ("MEdit:  There is no default mobile to edit.\n\r", ch);
01465     return;
01466 }

Here is the call graph for this function:

void do_oedit CHAR_DATA ch,
char *  argument
 

Definition at line 1318 of file olc.c.

References obj_index_data::area, AREA_CHANGED, area_data::area_flags, ED_OBJECT, get_obj_index(), get_vnum_area(), IS_BUILDER, IS_NPC, is_number(), MAX_STRING_LENGTH, one_argument(), send_to_char(), SET_BIT, and str_cmp().

01319 {
01320     OBJ_INDEX_DATA *pObj;
01321     AREA_DATA *pArea;
01322     char arg1[MAX_STRING_LENGTH];
01323     int value;
01324 
01325  if (ch->level < 55) 
01326 {
01327 send_to_char("OEdit: You're not high enough level to do this.\n\r",ch);
01328 return;
01329 }   
01330  if (IS_NPC (ch))
01331         return;
01332 
01333     argument = one_argument (argument, arg1);
01334 
01335     if (is_number (arg1))
01336     {
01337         value = atoi (arg1);
01338         if (!(pObj = get_obj_index (value)))
01339         {
01340             send_to_char ("OEdit:  That vnum does not exist.\n\r", ch);
01341             return;
01342         }
01343 
01344         if (!IS_BUILDER (ch, pObj->area))
01345         {
01346             send_to_char ("Insufficient security to modify objects.\n\r", ch);
01347             return;
01348         }
01349 
01350         ch->desc->pEdit = (void *) pObj;
01351         ch->desc->editor = ED_OBJECT;
01352         return;
01353     }
01354     else
01355     {
01356         if (!str_cmp (arg1, "create"))
01357         {
01358             value = atoi (argument);
01359             if (argument[0] == '\0' || value == 0)
01360             {
01361                 send_to_char ("Syntax:  edit object create [vnum]\n\r", ch);
01362                 return;
01363             }
01364 
01365             pArea = get_vnum_area (value);
01366 
01367             if (!pArea)
01368             {
01369                 send_to_char
01370                     ("OEdit:  That vnum is not assigned an area.\n\r", ch);
01371                 return;
01372             }
01373 
01374             if (!IS_BUILDER (ch, pArea))
01375             {
01376                 send_to_char ("Insufficient security to modify objects.\n\r",
01377                               ch);
01378                 return;
01379             }
01380 
01381             if (oedit_create (ch, argument))
01382             {
01383                 SET_BIT (pArea->area_flags, AREA_CHANGED);
01384                 ch->desc->editor = ED_OBJECT;
01385             }
01386             return;
01387         }
01388     }
01389 
01390     send_to_char ("OEdit:  There is no default object to edit.\n\r", ch);
01391     return;
01392 }

Here is the call graph for this function:

void do_olc CHAR_DATA ch,
char *  argument
 

Definition at line 830 of file olc.c.

References editor_cmd_type::do_fun, do_help(), editor_table, IS_NPC, MAX_INPUT_LENGTH, one_argument(), and str_prefix().

00831 {
00832     char command[MAX_INPUT_LENGTH];
00833     int cmd;
00834 
00835     if (IS_NPC (ch))
00836         return;
00837 
00838     argument = one_argument (argument, command);
00839 
00840     if (command[0] == '\0')
00841     {
00842         do_help (ch, "olc");
00843         return;
00844     }
00845 
00846     /* Search Table and Dispatch Command. */
00847     for (cmd = 0; editor_table[cmd].name != NULL; cmd++)
00848     {
00849         if (!str_prefix (command, editor_table[cmd].name))
00850         {
00851             (*editor_table[cmd].do_fun) (ch, argument);
00852             return;
00853         }
00854     }
00855 
00856     /* Invalid command, send help. */
00857     do_help (ch, "olc");
00858     return;
00859 }

Here is the call graph for this function:

void do_redit CHAR_DATA ch,
char *  argument
 

Definition at line 1237 of file olc.c.

References room_index_data::area, AREA_CHANGED, char_from_room(), char_to_room(), ED_ROOM, get_room_index(), IS_BUILDER, IS_NPC, IS_NULLSTR, MAX_STRING_LENGTH, one_argument(), reset_room(), send_to_char(), SET_BIT, and str_cmp().

01238 {
01239     ROOM_INDEX_DATA *pRoom;
01240     char arg1[MAX_STRING_LENGTH];
01241 
01242     if (IS_NPC (ch))
01243         return;
01244 
01245     argument = one_argument (argument, arg1);
01246 
01247     pRoom = ch->in_room;
01248 
01249     if (!str_cmp (arg1, "reset"))
01250     {                            /* redit reset */
01251         if (!IS_BUILDER (ch, pRoom->area))
01252         {
01253             send_to_char ("Insufficient security to modify room.\n\r", ch);
01254             return;
01255         }
01256 
01257         reset_room (pRoom);
01258         send_to_char ("Room reset.\n\r", ch);
01259 
01260         return;
01261     }
01262     else if (!str_cmp (arg1, "create"))
01263     {                            /* redit create <vnum> */
01264         if (argument[0] == '\0' || atoi (argument) == 0)
01265         {
01266             send_to_char ("Syntax:  edit room create [vnum]\n\r", ch);
01267             return;
01268         }
01269 
01270         if (redit_create (ch, argument))
01271         {                        /* pEdit == nuevo cuarto */
01272             ch->desc->editor = ED_ROOM;
01273             char_from_room (ch);
01274             char_to_room (ch, ch->desc->pEdit);
01275             SET_BIT (((ROOM_INDEX_DATA *) ch->desc->pEdit)->area->area_flags,
01276                      AREA_CHANGED);
01277         }
01278 
01279         return;
01280     }
01281     else if (!IS_NULLSTR (arg1))
01282     {                            /* redit <vnum> */
01283         pRoom = get_room_index (atoi (arg1));
01284 
01285         if (!pRoom)
01286         {
01287             send_to_char ("REdit : Nonexistant room.\n\r", ch);
01288             return;
01289         }
01290 
01291         if (!IS_BUILDER (ch, pRoom->area))
01292         {
01293             send_to_char ("REdit : Insufficient security to modify room.\n\r",
01294                           ch);
01295             return;
01296         }
01297 
01298         char_from_room (ch);
01299         char_to_room (ch, pRoom);
01300     }
01301 
01302     if (!IS_BUILDER (ch, pRoom->area))
01303     {
01304         send_to_char ("REdit : Insufficient security to modify room.\n\r",
01305                       ch);
01306         return;
01307     }
01308 
01309     ch->desc->pEdit = (void *) pRoom;
01310     ch->desc->editor = ED_ROOM;
01311 
01312     return;
01313 }

Here is the call graph for this function:

void do_resets CHAR_DATA ch,
char *  argument
 

Definition at line 1729 of file olc.c.

References add_reset(), AREA_CHANGED, reset_data::arg1, reset_data::arg2, reset_data::arg3, reset_data::arg4, reset_data::command, display_resets(), flag_value(), free_reset_data(), get_mob_index(), get_obj_index(), IS_BUILDER, is_number(), ITEM_CONTAINER, ITEM_CORPSE_NPC, obj_index_data::item_type, MAX_INPUT_LENGTH, new_reset_data(), reset_data::next, NO_FLAG, one_argument(), room_index_data::reset_first, room_index_data::reset_last, send_to_char(), SET_BIT, str_cmp(), str_prefix(), wear_loc_flags, and WEAR_NONE.

01730 {
01731     char arg1[MAX_INPUT_LENGTH];
01732     char arg2[MAX_INPUT_LENGTH];
01733     char arg3[MAX_INPUT_LENGTH];
01734     char arg4[MAX_INPUT_LENGTH];
01735     char arg5[MAX_INPUT_LENGTH];
01736     char arg6[MAX_INPUT_LENGTH];
01737     char arg7[MAX_INPUT_LENGTH];
01738     RESET_DATA *pReset = NULL;
01739 
01740     argument = one_argument (argument, arg1);
01741     argument = one_argument (argument, arg2);
01742     argument = one_argument (argument, arg3);
01743     argument = one_argument (argument, arg4);
01744     argument = one_argument (argument, arg5);
01745     argument = one_argument (argument, arg6);
01746     argument = one_argument (argument, arg7);
01747 
01748     if (!IS_BUILDER (ch, ch->in_room->area))
01749     {
01750         send_to_char ("Resets: Invalid security for editing this area.\n\r",
01751                       ch);
01752         return;
01753     }
01754 
01755     /*
01756      * Display resets in current room.
01757      * -------------------------------
01758      */
01759     if (arg1[0] == '\0')
01760     {
01761         if (ch->in_room->reset_first)
01762         {
01763             send_to_char ("Resets: M = mobile, R = room, O = object, "
01764                           "P = pet, S = shopkeeper\n\r", ch);
01765             display_resets (ch);
01766         }
01767         else
01768             send_to_char ("No resets in this room.\n\r", ch);
01769     }
01770 
01771 
01772     /*
01773      * Take index number and search for commands.
01774      * ------------------------------------------
01775      */
01776     if (is_number (arg1))
01777     {
01778         ROOM_INDEX_DATA *pRoom = ch->in_room;
01779 
01780         /*
01781          * Delete a reset.
01782          * ---------------
01783          */
01784         if (!str_cmp (arg2, "delete"))
01785         {
01786             int insert_loc = atoi (arg1);
01787 
01788             if (!ch->in_room->reset_first)
01789             {
01790                 send_to_char ("No resets in this area.\n\r", ch);
01791                 return;
01792             }
01793 
01794             if (insert_loc - 1 <= 0)
01795             {
01796                 pReset = pRoom->reset_first;
01797                 pRoom->reset_first = pRoom->reset_first->next;
01798                 if (!pRoom->reset_first)
01799                     pRoom->reset_last = NULL;
01800             }
01801             else
01802             {
01803                 int iReset = 0;
01804                 RESET_DATA *prev = NULL;
01805 
01806                 for (pReset = pRoom->reset_first;
01807                      pReset; pReset = pReset->next)
01808                 {
01809                     if (++iReset == insert_loc)
01810                         break;
01811                     prev = pReset;
01812                 }
01813 
01814                 if (!pReset)
01815                 {
01816                     send_to_char ("Reset not found.\n\r", ch);
01817                     return;
01818                 }
01819 
01820                 if (prev)
01821                     prev->next = prev->next->next;
01822                 else
01823                     pRoom->reset_first = pRoom->reset_first->next;
01824 
01825                 for (pRoom->reset_last = pRoom->reset_first;
01826                      pRoom->reset_last->next;
01827                      pRoom->reset_last = pRoom->reset_last->next);
01828             }
01829 
01830             free_reset_data (pReset);
01831             send_to_char ("Reset deleted.\n\r", ch);
01832         }
01833         else
01834             /*
01835              * Add a reset.
01836              * ------------
01837              */
01838             if ((!str_cmp (arg2, "mob") && is_number (arg3))
01839                 || (!str_cmp (arg2, "obj") && is_number (arg3)))
01840         {
01841             /*
01842              * Check for Mobile reset.
01843              * -----------------------
01844              */
01845             if (!str_cmp (arg2, "mob"))
01846             {
01847                 if (get_mob_index (is_number (arg3) ? atoi (arg3) : 1) ==
01848                     NULL)
01849                 {
01850                     send_to_char ("Mob doesn't exist.\n\r", ch);
01851                     return;
01852                 }
01853                 pReset = new_reset_data ();
01854                 pReset->command = 'M';
01855                 pReset->arg1 = atoi (arg3);
01856                 pReset->arg2 = is_number (arg4) ? atoi (arg4) : 1;    /* Max # */
01857                 pReset->arg3 = ch->in_room->vnum;
01858                 pReset->arg4 = is_number (arg5) ? atoi (arg5) : 1;    /* Min # */
01859             }
01860             else
01861                 /*
01862                  * Check for Object reset.
01863                  * -----------------------
01864                  */
01865             if (!str_cmp (arg2, "obj"))
01866             {
01867                 pReset = new_reset_data ();
01868                 pReset->arg1 = atoi (arg3);
01869                 /*
01870                  * Inside another object.
01871                  * ----------------------
01872                  */
01873                 if (!str_prefix (arg4, "inside"))
01874                 {
01875                     OBJ_INDEX_DATA *temp;
01876 
01877                     temp = get_obj_index (is_number (arg5) ? atoi (arg5) : 1);
01878                     if ((temp->item_type != ITEM_CONTAINER) &&
01879                         (temp->item_type != ITEM_CORPSE_NPC))
01880                     {
01881                         send_to_char ("Object 2 is not a container.\n\r", ch);
01882                         return;
01883                     }
01884                     pReset->command = 'P';
01885                     pReset->arg2 = is_number (arg6) ? atoi (arg6) : 1;
01886                     pReset->arg3 = is_number (arg5) ? atoi (arg5) : 1;
01887                     pReset->arg4 = is_number (arg7) ? atoi (arg7) : 1;
01888                 }
01889                 else
01890                     /*
01891                      * Inside the room.
01892                      * ----------------
01893                      */
01894                 if (!str_cmp (arg4, "room"))
01895                 {
01896                     if (get_obj_index (atoi (arg3)) == NULL)
01897                     {
01898                         send_to_char ("Vnum doesn't exist.\n\r", ch);
01899                         return;
01900                     }
01901                     pReset->command = 'O';
01902                     pReset->arg2 = 0;
01903                     pReset->arg3 = ch->in_room->vnum;
01904                     pReset->arg4 = 0;
01905                 }
01906                 else
01907                     /*
01908                      * Into a Mobile's inventory.
01909                      * --------------------------
01910                      */
01911                 {
01912                     if (flag_value (wear_loc_flags, arg4) == NO_FLAG)
01913                     {
01914                         send_to_char ("Resets: '? wear-loc'\n\r", ch);
01915                         return;
01916                     }
01917                     if (get_obj_index (atoi (arg3)) == NULL)
01918                     {
01919                         send_to_char ("Vnum doesn't exist.\n\r", ch);
01920                         return;
01921                     }
01922                     pReset->arg1 = atoi (arg3);
01923                     pReset->arg3 = flag_value (wear_loc_flags, arg4);
01924                     if (pReset->arg3 == WEAR_NONE)
01925                         pReset->command = 'G';
01926                     else
01927                         pReset->command = 'E';
01928                 }
01929             }
01930             add_reset (ch->in_room, pReset, atoi (arg1));
01931             SET_BIT (ch->in_room->area->area_flags, AREA_CHANGED);
01932             send_to_char ("Reset added.\n\r", ch);
01933         }
01934         else if (!str_cmp (arg2, "random") && is_number (arg3))
01935         {
01936             if (atoi (arg3) < 1 || atoi (arg3) > 6)
01937             {
01938                 send_to_char ("Invalid argument.\n\r", ch);
01939                 return;
01940             }
01941             pReset = new_reset_data ();
01942             pReset->command = 'R';
01943             pReset->arg1 = ch->in_room->vnum;
01944             pReset->arg2 = atoi (arg3);
01945             add_reset (ch->in_room, pReset, atoi (arg1));
01946             SET_BIT (ch->in_room->area->area_flags, AREA_CHANGED);
01947             send_to_char ("Random exits reset added.\n\r", ch);
01948         }
01949         else
01950         {
01951             send_to_char ("Syntax: RESET <number> OBJ <vnum> <wear_loc>\n\r",
01952                           ch);
01953             send_to_char
01954                 ("        RESET <number> OBJ <vnum> inside <vnum> [limit] [count]\n\r",
01955                  ch);
01956             send_to_char ("        RESET <number> OBJ <vnum> room\n\r", ch);
01957             send_to_char
01958                 ("        RESET <number> MOB <vnum> [max #x area] [max #x room]\n\r",
01959                  ch);
01960             send_to_char ("        RESET <number> DELETE\n\r", ch);
01961             send_to_char ("        RESET <number> RANDOM [#x exits]\n\r", ch);
01962         }
01963     }
01964 
01965     return;
01966 }

Here is the call graph for this function:

void do_sedit CHAR_DATA ch,
char *  argument
 

Definition at line 1035 of file olc.c.

References ED_SOCIAL, FALSE, MAX_INPUT_LENGTH, social_list::name, social_list::next, one_argument(), send_to_char(), sociallist, str_cmp(), and str_prefix().

01036 {
01037     /* Variable declarations */
01038     SOCIAL_LIST *pSocial;
01039     char arg1[MAX_INPUT_LENGTH];
01040     char argall[MAX_INPUT_LENGTH];
01041     char argone[MAX_INPUT_LENGTH];
01042     bool found = FALSE;
01043 
01044     strcpy(arg1, argument);
01045 
01046     if (argument[0] != '\0')
01047     {
01048         argall[0] = '\0';
01049 
01050         
01051     }
01052 
01053     if (!found)
01054     {
01055         argument = one_argument(arg1, arg1);
01056 
01057         /* Verify whether correct format of command. */
01058         if (!str_cmp(arg1, "create"))
01059         {
01060             if (argument[0] == '\0')
01061             {
01062                 send_to_char("Syntax: blah blah blah dumb social [topic]\n\r", ch);
01063                 return;
01064             }
01065 
01066             if (sedit_create(ch, argument))
01067             {    ch->desc->editor = ED_SOCIAL;    }
01068            
01069             return;
01070         }
01071     else
01072     {
01073         for (pSocial = sociallist;pSocial;pSocial = pSocial->next)
01074         {
01075             if (!str_prefix(pSocial->name, arg1))
01076             {
01077                 ch->desc->pEdit = (void*)pSocial;
01078                 ch->desc->editor = ED_SOCIAL;
01079                 return;
01080             }
01081         }
01082     }
01083     }
01084 
01085     send_to_char("SEdit: There is no social to edit.\n\r", ch);
01086     return;
01087 }

Here is the call graph for this function:

void do_vedit CHAR_DATA ch,
char *  argument
 

Definition at line 931 of file olc.c.

References colourconv2(), ED_VEHICLE, MIL, MSL, vehicle_data::name, vehicle_data::next, one_argument(), send_to_char(), str_cmp(), str_prefix(), and v_list.

00932 {
00933     VDATA *vehicle;
00934     char arg1[MIL];
00935     char argall[MIL];
00936     char argone[MIL];
00937     char pbuf[MSL];
00938 
00939     strcpy(arg1,argument);
00940 
00941     if (argument[0] == '\0')
00942     {
00943         argall[0] = '\0';
00944     }
00945 
00946     argument = one_argument(argument, arg1);
00947     if (!str_cmp(arg1, "create"))
00948     {
00949         if (argument[0] == '\0')
00950         {
00951             send_to_char("VEdit: Syntax: vedit [create <vehicle] vehicle\n\r",ch);
00952             return;
00953         }
00954         if (vedit_create(ch,argument))
00955             ch->desc->editor = ED_VEHICLE;
00956         return;
00957     }
00958     else
00959     {
00960         for (vehicle=v_list;vehicle;vehicle = vehicle->next)
00961         {
00962             if (vehicle->name == NULL)
00963                 continue;
00964             colourconv2(pbuf,vehicle->name);
00965             if (!str_prefix(arg1,pbuf))
00966             {
00967                 ch->desc->pEdit = (void*)vehicle;
00968                 ch->desc->editor = ED_VEHICLE;
00969                 return;
00970             }
00971         }
00972         send_to_char("VEdit: Vehicle Not Found.\n\r",ch);
00973     }
00974     return;
00975 }

Here is the call graph for this function:

bool edit_done CHAR_DATA ch  ) 
 

Definition at line 521 of file olc.c.

References FALSE.

Referenced by aedit(), cedit(), hedit(), medit(), mpedit(), oedit(), redit(), sedit(), and vedit().

00522 {
00523     ch->desc->pEdit = NULL;
00524     ch->desc->editor = 0;
00525     return FALSE;
00526 }

AREA_DATA* get_area_data int  vnum  ) 
 

Definition at line 501 of file olc.c.

References area_first, area_data::next, and area_data::vnum.

Referenced by do_aedit(), and do_asave().

00502 {
00503     AREA_DATA *pArea;
00504 
00505     for (pArea = area_first; pArea; pArea = pArea->next)
00506     {
00507         if (pArea->vnum == vnum)
00508             return pArea;
00509     }
00510 
00511     return 0;
00512 }

void hedit CHAR_DATA ch