- Removed the do_oasis function and called the Xedit commands directly (thanks Rhade).

- Updated idle timer to keep track of imms too (thanks Jamdog).
- Standardized OLC messages.
- Removed special procedures that were replaced with trigedit.
- Updated README.WIN, README.MSVC8, and README.CYGWIN.
--Rumble
This commit is contained in:
Rumble 2007-03-28 12:53:48 +00:00
parent f34cc2c8ed
commit 7f65248b2a
26 changed files with 534 additions and 1006 deletions

View file

@ -8,7 +8,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "interpreter.h"
#include "handler.h"
@ -34,13 +33,7 @@ void aedit_setup_existing(struct descriptor_data *d, int real_num);
void aedit_save_internally(struct descriptor_data *d);
void aedit_save_to_disk(struct descriptor_data *d);
/*
* Utils and exported functions.
*/
/*------------------------------------------------------------------------*\
Utils and exported functions.
\*------------------------------------------------------------------------*/
/* Utils and exported functions. */
ACMD(do_oasis_aedit)
{
@ -48,7 +41,11 @@ ACMD(do_oasis_aedit)
struct descriptor_data *d;
int i;
if (CONFIG_NEW_SOCIALS == 0) {
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
if (CONFIG_NEW_SOCIALS == 0) {
send_to_char(ch, "Socials cannot be edited at the moment.\r\n");
return;
}
@ -81,9 +78,7 @@ ACMD(do_oasis_aedit)
return;
}
/*
* Give descriptor an OLC structure.
*/
/* Give descriptor an OLC structure. */
if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure.");
free(d->olc);
@ -115,7 +110,6 @@ ACMD(do_oasis_aedit)
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing actions.", GET_NAME(ch));
}
void aedit_setup_new(struct descriptor_data *d) {
CREATE(OLC_ACTION(d), struct social_messg, 1);
OLC_ACTION(d)->command = strdup(OLC_STORAGE(d));
@ -141,8 +135,6 @@ void aedit_setup_new(struct descriptor_data *d) {
OLC_VAL(d) = 0;
}
/*------------------------------------------------------------------------*/
void aedit_setup_existing(struct descriptor_data *d, int real_num) {
CREATE(OLC_ACTION(d), struct social_messg, 1);
OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command);
@ -181,8 +173,6 @@ void aedit_setup_existing(struct descriptor_data *d, int real_num) {
aedit_disp_menu(d);
}
void aedit_save_internally(struct descriptor_data *d) {
struct social_messg *new_soc_mess_list = NULL;
int i;
@ -212,9 +202,6 @@ void aedit_save_internally(struct descriptor_data *d) {
aedit_save_to_disk(d); /* autosave by Rumble */
}
/*------------------------------------------------------------------------*/
void aedit_save_to_disk(struct descriptor_data *d) {
FILE *fp;
int i;
@ -257,11 +244,7 @@ void aedit_save_to_disk(struct descriptor_data *d) {
remove_from_save_list(AEDIT_PERMISSION, SL_ACTION);
}
/*------------------------------------------------------------------------*/
/* Menu functions */
/* the main menu */
/* The Main Menu. */
void aedit_disp_menu(struct descriptor_data * d) {
struct social_messg *action = OLC_ACTION(d);
struct char_data *ch = d->character;
@ -332,10 +315,7 @@ void aedit_disp_menu(struct descriptor_data * d) {
}
/*
* The main loop
*/
/* The main loop. */
void aedit_parse(struct descriptor_data * d, char *arg) {
int i;

View file

@ -41,6 +41,10 @@ ACMD(do_oasis_cedit)
struct descriptor_data *d;
char buf1[MAX_STRING_LENGTH];
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
one_argument(argument, buf1);

View file

@ -44,6 +44,10 @@ ACMD(do_oasis_trigedit)
int number, real_num;
struct descriptor_data *d;
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
skip_spaces(&argument);
if (!*argument || !isdigit(*argument)) {

View file

@ -361,9 +361,9 @@ int delete_object(obj_rnum rnum)
struct obj_data *obj, *tmp;
int shop, j;
if (rnum == NOWHERE || rnum > top_of_objt)
return FALSE;
if (rnum == NOTHING || rnum > top_of_objt)
return NOTHING;
obj = &obj_proto[rnum];
zone_rnum zrnum = real_zone_by_thing(GET_OBJ_VNUM(obj));
@ -457,5 +457,5 @@ int delete_object(obj_rnum rnum)
save_objects(zrnum);
return TRUE;
return rnum;
}

View file

@ -9,7 +9,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "db.h"
@ -204,12 +203,8 @@ int in_save_list(zone_vnum zone, int type)
return FALSE;
}
/* -------------------------------------------------------------------------- */
/*
* Used from do_show(), ideally.
*/
void do_show_save_list(struct char_data *ch)
/* Used from do_show(), ideally. */
ACMD(do_show_save_list)
{
if (save_list == NULL)
send_to_char(ch, "All world files are up to date.\r\n");

View file

@ -6,18 +6,14 @@
************************************************************************/
#define STRING_TERMINATOR '~'
#define CONFIG_GENOLC_MOBPROG 0
/* from modify.c */
void smash_tilde(char *str);
void smash_tilde(char *str); /* from modify.c */
int genolc_checkstring(struct descriptor_data *d, char *arg);
int remove_from_save_list(zone_vnum, int type);
int add_to_save_list(zone_vnum, int type);
int in_save_list(zone_vnum, int type);
void strip_cr(char *);
void do_show_save_list(struct char_data *);
int save_all(void);
char *str_udup(const char *);
void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data *from);

View file

@ -111,6 +111,10 @@ ACMD(do_oasis_hedit)
struct descriptor_data *d;
int i;
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
if (!can_edit_zone(ch, HEDIT_PERMISSION)) {
send_to_char(ch, "You don't have access to editing help files.\r\n");
return;

View file

@ -183,6 +183,7 @@ ACMD(do_score);
ACMD(do_send);
ACMD(do_set);
ACMD(do_show);
ACMD(do_show_save_list);
ACMD(do_shutdown);
ACMD(do_sit);
ACMD(do_skillset);
@ -250,7 +251,7 @@ cpp_extern const struct command_info cmd_info[] = {
/* now, the main list */
{ "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 },
{ "advance" , "adv" , POS_DEAD , do_advance , LVL_GOD, 0 },
{ "aedit" , "aed" , POS_DEAD , do_oasis , LVL_GOD, SCMD_OASIS_AEDIT },
{ "aedit" , "aed" , POS_DEAD , do_oasis_aedit, LVL_GOD, 0 },
{ "alias" , "ali" , POS_DEAD , do_alias , 0, 0 },
{ "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK },
{ "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 },
@ -270,7 +271,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG },
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
{ "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT },
{ "cedit" , "cedit" , POS_DEAD , do_oasis_cedit, LVL_IMPL, 0 },
{ "changelog", "cha" , POS_DEAD , do_changelog, LVL_IMPL, 0 },
{ "check" , "ch" , POS_STANDING, do_not_here , 1, 0 },
{ "checkload", "checkl" , POS_DEAD , do_checkloadstatus, LVL_GOD, 0 },
@ -326,7 +327,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 },
{ "help" , "h" , POS_DEAD , do_help , 0, 0 },
{ "hedit" , "hedit" , POS_DEAD , do_oasis , LVL_GOD , SCMD_OASIS_HEDIT },
{ "hedit" , "hedit" , POS_DEAD , do_oasis_hedit, LVL_GOD , 0 },
{ "hindex" , "hind" , POS_DEAD , do_hindex , 0, 0 },
{ "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_IMPL, 0 },
{ "hide" , "hi" , POS_RESTING , do_hide , 1, 0 },
@ -362,8 +363,8 @@ cpp_extern const struct command_info cmd_info[] = {
{ "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD },
{ "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 },
{ "medit" , "med" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MEDIT },
{ "mlist" , "mlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MLIST },
{ "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 },
{ "mlist" , "mlist" , POS_DEAD , do_oasis_list , LVL_BUILDER, SCMD_OASIS_MLIST },
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_SQUELCH },
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
@ -381,9 +382,9 @@ cpp_extern const struct command_info cmd_info[] = {
{ "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN },
{ "order" , "ord" , POS_RESTING , do_order , 1, 0 },
{ "offer" , "off" , POS_STANDING, do_not_here , 1, 0 },
{ "olc" , "olc" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OLC_SAVEINFO },
{ "olist" , "olist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OLIST },
{ "oedit" , "oedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OEDIT },
{ "olc" , "olc" , POS_DEAD , do_show_save_list, LVL_BUILDER, 0 },
{ "olist" , "olist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_OLIST },
{ "oedit" , "oedit" , POS_DEAD , do_oasis_oedit, LVL_BUILDER, 0 },
{ "put" , "p" , POS_RESTING , do_put , 0, 0 },
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
@ -417,8 +418,8 @@ cpp_extern const struct command_info cmd_info[] = {
{ "rescue" , "resc" , POS_FIGHTING, do_rescue , 1, 0 },
{ "restore" , "resto" , POS_DEAD , do_restore , LVL_GOD, 0 },
{ "return" , "retu" , POS_DEAD , do_return , 0, 0 },
{ "redit" , "redit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_REDIT },
{ "rlist" , "rlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_RLIST },
{ "redit" , "redit" , POS_DEAD , do_oasis_redit, LVL_BUILDER, 0 },
{ "rlist" , "rlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST },
{ "rclone" , "rclone" , POS_DEAD , do_room_copy, LVL_BUILDER, 0 },
{ "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS },
@ -429,7 +430,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "save" , "sav" , POS_SLEEPING, do_save , 0, 0 },
{ "saveall" , "saveall" , POS_DEAD , do_saveall , LVL_BUILDER, 0},
{ "sell" , "sell" , POS_STANDING, do_not_here , 0, 0 },
{ "sedit" , "sedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_SEDIT },
{ "sedit" , "sedit" , POS_DEAD , do_oasis_sedit, LVL_BUILDER, 0 },
{ "send" , "send" , POS_SLEEPING, do_send , LVL_GOD, 0 },
{ "set" , "set" , POS_DEAD , do_set , LVL_IMMORT, 0 },
{ "shout" , "sho" , POS_RESTING , do_gen_comm , 0, SCMD_SHOUT },
@ -439,7 +440,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "sip" , "sip" , POS_RESTING , do_drink , 0, SCMD_SIP },
{ "skillset" , "skillset", POS_SLEEPING, do_skillset , LVL_GRGOD, 0 },
{ "sleep" , "sl" , POS_SLEEPING, do_sleep , 0, 0 },
{ "slist" , "slist" , POS_SLEEPING, do_oasis , LVL_BUILDER, SCMD_OASIS_SLIST },
{ "slist" , "slist" , POS_SLEEPING, do_oasis_list, LVL_BUILDER, SCMD_OASIS_SLIST },
{ "sneak" , "sneak" , POS_STANDING, do_sneak , 1, 0 },
{ "snoop" , "snoop" , POS_DEAD , do_snoop , LVL_GOD, 0 },
{ "socials" , "socials" , POS_DEAD , do_commands , 0, SCMD_SOCIALS },
@ -460,9 +461,9 @@ cpp_extern const struct command_info cmd_info[] = {
{ "toggle" , "toggle" , POS_DEAD , do_toggle , 0, 0 },
{ "track" , "track" , POS_STANDING, do_track , 0, 0 },
{ "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 },
{ "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT},
{ "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 },
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO },
{ "tlist" , "tlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TLIST },
{ "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST },
{ "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 },
{ "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
@ -497,8 +498,8 @@ cpp_extern const struct command_info cmd_info[] = {
{ "write" , "write" , POS_STANDING, do_write , 1, 0 },
{ "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 },
{ "zedit" , "zedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZEDIT },
{ "zlist" , "zlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZLIST },
{ "zedit" , "zedit" , POS_DEAD , do_oasis_zedit, LVL_BUILDER, 0 },
{ "zlist" , "zlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_ZLIST },
{ "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 },
{ "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },

View file

@ -212,24 +212,13 @@ struct alias_data {
#define SCMD_LOCK 3
#define SCMD_PICK 4
/* do_olc */
#define SCMD_OASIS_REDIT 0
#define SCMD_OASIS_OEDIT 1
#define SCMD_OASIS_ZEDIT 2
#define SCMD_OASIS_MEDIT 3
#define SCMD_OASIS_SEDIT 4
#define SCMD_OASIS_CEDIT 5
#define SCMD_OLC_SAVEINFO 7
#define SCMD_OASIS_RLIST 8
#define SCMD_OASIS_MLIST 9
#define SCMD_OASIS_OLIST 10
#define SCMD_OASIS_SLIST 11
#define SCMD_OASIS_ZLIST 12
#define SCMD_OASIS_TRIGEDIT 13
#define SCMD_OASIS_AEDIT 14
#define SCMD_OASIS_TLIST 15
#define SCMD_OASIS_LINKS 16
#define SCMD_OASIS_HEDIT 17
/* do_oasis_Xlist */
#define SCMD_OASIS_RLIST 0
#define SCMD_OASIS_MLIST 1
#define SCMD_OASIS_OLIST 2
#define SCMD_OASIS_SLIST 3
#define SCMD_OASIS_ZLIST 4
#define SCMD_OASIS_TLIST 5
/* do_last */
#define SCMD_LIST_ALL 1

View file

@ -49,6 +49,10 @@ ACMD(do_oasis_medit)
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments */
buf3 = two_arguments(argument, buf1, buf2);
@ -763,7 +767,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
case MEDIT_DELETE:
if (*arg == 'y' || *arg == 'Y') {
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))))
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))) != NOBODY)
write_to_output(d, "Mobile deleted.\r\n");
else
write_to_output(d, "Couldn't delete the mobile!\r\n");

View file

@ -7,7 +7,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "interpreter.h"
@ -24,15 +23,10 @@
#include "screen.h"
#include "dg_olc.h"
/******************************************************************************/
/** External Functions **/
/******************************************************************************/
/* External Functions */
int is_name(const char *str, const char *namelist);
/******************************************************************************/
/** Internal Data Structures **/
/******************************************************************************/
/* Internal Data Structures */
struct olc_scmd_info_t {
const char *text;
int con_type;
@ -51,131 +45,20 @@ struct olc_scmd_info_t {
const char *nrm, *grn, *cyn, *yel;
/******************************************************************************/
/** Internal Functions **/
/******************************************************************************/
/* Internal Functions */
void free_config(struct config_data *data);
/* -------------------------------------------------------------------------- */
/*
* Only player characters should be using OLC anyway.
*/
/* Only player characters should be using OLC anyway. */
void clear_screen(struct descriptor_data *d)
{
if (PRF_FLAGGED(d->character, PRF_CLS))
write_to_output(d, "");
}
/* -------------------------------------------------------------------------- */
/*
* Exported ACMD do_oasis function.
*
* This function is the OLC interface. It deals with all the
* generic OLC stuff, then passes control to the sub-olc sections.
*
* UPDATE:
* I believe that yes, putting the code together that is common in all of the
* olc functions is good to a certain extent, but the do_oasis command was
* getting ridiculous. Therefore, I have separated them into separate
* functions that get called from in do_oasis....yes, similar code, but it is
* easier to handle.... - Kip Potter
*/
ACMD(do_oasis)
{
/*
* No screwing around as a mobile.
*/
if (IS_NPC(ch) || !ch->desc)
return;
/*
* Prevent forcing people in OLC to edit other stuff.
* 'force' just lets command_interpreter() handle the input,
* regardless of the state of the victim.
* This can wreck havoc if people are i OLC already
* - ie. their input would have been redirected by nanny(), and
* never get to command_interpreter().
* -- Welcor 09/03
* - thanks to Mark Garringer (zizazat@hotmail.com) for the bug report.
*/
if (STATE(ch->desc) != CON_PLAYING)
return;
switch (subcmd) {
/*
* The command to see what needs to be saved, typically 'olc'.
*/
case SCMD_OLC_SAVEINFO:
do_show_save_list(ch);
break;
case SCMD_OASIS_CEDIT:
do_oasis_cedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_ZEDIT:
do_oasis_zedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_REDIT:
do_oasis_redit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_OEDIT:
do_oasis_oedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_MEDIT:
do_oasis_medit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_SEDIT:
do_oasis_sedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_RLIST:
case SCMD_OASIS_MLIST:
case SCMD_OASIS_OLIST:
case SCMD_OASIS_SLIST:
case SCMD_OASIS_ZLIST:
case SCMD_OASIS_TLIST:
do_oasis_list(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_LINKS:
do_oasis_links(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_TRIGEDIT:
do_oasis_trigedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_AEDIT:
do_oasis_aedit(ch, argument, cmd, subcmd);
break;
case SCMD_OASIS_HEDIT:
do_oasis_hedit(ch, argument, cmd, subcmd);
break;
default:
log("SYSERR: (OLC) Invalid subcmd passed to do_oasis, subcmd - (%d)", subcmd);
return;
}
return;
}
/*------------------------------------------------------------*\
Exported utilities
\*------------------------------------------------------------*/
/*
* Set the colour string pointers for that which this char will
* see at color level NRM. Changing the entries here will change
* the colour scheme throughout the OLC.
*/
/* Exported utilities */
/* Set the color string pointers for that which this char will see at color
* level NRM. Changing the entries here will change the colour scheme
* throughout the OLC. */
void get_char_colors(struct char_data *ch)
{
nrm = CCNRM(ch, C_NRM);
@ -184,23 +67,16 @@ void get_char_colors(struct char_data *ch)
yel = CCYEL(ch, C_NRM);
}
/*
* This procedure frees up the strings and/or the structures
* attatched to a descriptor, sets all flags back to how they
* should be.
*/
/* This procedure frees up the strings and/or the structures attatched to a
* descriptor, sets all flags back to how they should be. */
void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
{
/*
* Clean up WHAT?
*/
/* Clean up WHAT? */
if (d->olc == NULL)
return;
/*
* Check for a room. free_room doesn't perform
* sanity checks, we must be careful here.
*/
/* Check for a room. free_room doesn't perform sanity checks, we must be
* careful here. */
if (OLC_ROOM(d)) {
switch (cleanup_type) {
case CLEANUP_ALL:
@ -220,38 +96,28 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
}
}
/*
* Check for an existing object in the OLC. The strings
* aren't part of the prototype any longer. They get added
* with strdup().
*/
/* Check for an existing object in the OLC. The strings aren't part of the
* prototype any longer. They get added with strdup(). */
if (OLC_OBJ(d)) {
free_object_strings(OLC_OBJ(d));
free(OLC_OBJ(d));
}
/*
* Check for a mob. free_mobile() makes sure strings are not in
* the prototype.
*/
/* Check for a mob. free_mobile() makes sure strings are not in the
* prototype. */
if (OLC_MOB(d))
free_mobile(OLC_MOB(d));
/*
* Check for a zone. cleanup_type is irrelevant here, free() everything.
*/
/* Check for a zone. cleanup_type is irrelevant here, free() everything. */
if (OLC_ZONE(d)) {
free(OLC_ZONE(d)->name);
free(OLC_ZONE(d)->cmd);
free(OLC_ZONE(d));
}
/*
* Check for a shop. free_shop doesn't perform sanity checks, we must
* be careful here.
* OLC_SHOP(d) is a _copy_ - no pointers to the original. Just go ahead
* and free it all.
*/
/* Check for a shop. free_shop doesn't perform sanity checks, we must be
* careful here. OLC_SHOP(d) is a _copy_ - no pointers to the original. Just
* go ahead and free it all. */
if (OLC_SHOP(d))
free_shop(OLC_SHOP(d));
@ -284,33 +150,23 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
}
}
/* free storage if allocated (for tedit and aedit) */
/* and Triggers */
/*
* this is the command list - it's been copied to disk already,
* so just free it -- Welcor
*/
/* Free storage if allocated (tedit, aedit, and trigedit). This is the command
* list - it's been copied to disk already, so just free it -Welcor. */
if (OLC_STORAGE(d)) {
free(OLC_STORAGE(d));
OLC_STORAGE(d) = NULL;
}
/*
* Free this one regardless. If we've left olc, we've either made
* a fresh copy of it in the trig index, or we lost connection.
* Either way, we need to get rid of this.
*/
/* Free this one regardless. If we've left olc, we've either made a fresh
* copy of it in the trig index, or we lost connection. Either way, we need
* to get rid of this. */
if (OLC_TRIG(d)) {
free_trigger(OLC_TRIG(d));
OLC_TRIG(d) = NULL;
}
/*
* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM.
* Therefore it should not be free'd here.
*/
/* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM. Therefore it
* should not be free'd here. */
/*
* Restore descriptor playing status.
*/
/* Restore descriptor playing status. */
if (d->character) {
REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
act("$n stops using OLC.", TRUE, d->character, NULL, NULL, TO_ROOM);
@ -331,10 +187,8 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
d->olc = NULL;
}
/*
* This function is an exact duplicate of the tag_argument function found in
* one of the ascii patches located on the circlemud ftp website.
*/
/* This function is an exact duplicate of the tag_argument function found in
* one of the ascii patches located on the circlemud ftp website. */
void split_argument(char *argument, char *tag)
{
char *tmp = argument, *ttag = tag, *wrt = argument;
@ -360,34 +214,17 @@ void split_argument(char *argument, char *tag)
void free_config(struct config_data *data)
{
/****************************************************************************/
/** Free strings. **/
/****************************************************************************/
/* Free strings. */
free_strings(data, OASIS_CFG);
/****************************************************************************/
/** Free the data structure. **/
/****************************************************************************/
/* Free the data structure. */
free(data);
}
/******************************************************************************/
/** **/
/** Function : can_edit_zone() **/
/** **/
/** Description : Checks to see if a builder can modify the specified **/
/** zone. **/
/** **/
/** Arguments : **/
/** ch **/
/** The character requesting access to modify this zone. **/
/** rnum **/
/** The real number of the zone attempted to be modified. **/
/** **/
/** Returns : Returns TRUE if the builder has access, otherwise **/
/** FALSE. **/
/** **/
/******************************************************************************/
/* Checks to see if a builder can modify the specified zone. Ch is the imm
* requesting access to modify this zone. Rnum is the real number of the zone
* attempted to be modified. Returns TRUE if the builder has access, otherwisei
* FALSE. */
int can_edit_zone(struct char_data *ch, zone_rnum rnum)
{
/* no access if called with bad arguments */

View file

@ -346,7 +346,7 @@ int Crash_clean_file(char *name)
return FALSE;
/* Open so that permission problems will be flagged now, at boot time. */
if (!(fl = fopen(fname, "rw"))) {
if (!(fl = fopen(fname, "r"))) {
if (errno != ENOENT) /* if it fails, NOT because of no file */
log("SYSERR: OPENING OBJECT FILE %s (4): %s", fname, strerror(errno));
return FALSE;

View file

@ -62,6 +62,10 @@ ACMD(do_oasis_oedit)
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);
@ -1175,7 +1179,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
break;
case OEDIT_DELETE:
if (*arg == 'y' || *arg == 'Y') {
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))))
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))) != NOTHING)
write_to_output(d, "Object deleted.\r\n");
else
write_to_output(d, "Couldn't delete the object!\r\n");

View file

@ -40,6 +40,10 @@ ACMD(do_oasis_redit)
int number = NOWHERE, save = 0, real_num;
struct descriptor_data *d;
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);

View file

@ -60,6 +60,10 @@ ACMD(do_oasis_sedit)
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);

View file

@ -10,13 +10,11 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "db.h"
#include "interpreter.h"
#include "utils.h"
/* external globals */
extern int mini_mud;
@ -41,7 +39,6 @@ void ASSIGNMOB(mob_vnum mob, SPECIAL(fname));
void ASSIGNOBJ(obj_vnum obj, SPECIAL(fname));
/* functions to perform assignments */
void ASSIGNMOB(mob_vnum mob, SPECIAL(fname))
{
mob_rnum rnum;
@ -72,11 +69,7 @@ void ASSIGNROOM(room_vnum room, SPECIAL(fname))
log("SYSERR: Attempt to assign spec to non-existant room #%d", room);
}
/* ********************************************************************
* Assignments *
******************************************************************** */
/* Assignments */
/* assign special procedures to mobiles */
void assign_mobiles(void)
{

View file

@ -10,7 +10,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -39,23 +38,10 @@ void list_skills(struct char_data *ch);
SPECIAL(guild);
SPECIAL(dump);
SPECIAL(mayor);
void npc_steal(struct char_data *ch, struct char_data *victim);
SPECIAL(snake);
SPECIAL(thief);
SPECIAL(magic_user);
SPECIAL(guild_guard);
SPECIAL(puff);
SPECIAL(fido);
SPECIAL(janitor);
SPECIAL(cityguard);
SPECIAL(pet_shops);
SPECIAL(bank);
/* ********************************************************************
* Special procedures for mobiles *
******************************************************************** */
/* Special procedures for mobiles */
int spell_sort_info[MAX_SKILLS + 1];
int compare_spells(const void *x, const void *y)
@ -145,7 +131,6 @@ void list_skills(struct char_data *ch)
page_string(ch->desc, buf2, TRUE);
}
SPECIAL(guild)
{
int skill_num, percent;
@ -189,8 +174,6 @@ SPECIAL(guild)
return (TRUE);
}
SPECIAL(dump)
{
struct obj_data *k;
@ -224,7 +207,6 @@ SPECIAL(dump)
return (TRUE);
}
SPECIAL(mayor)
{
char actbuf[MAX_INPUT_LENGTH];
@ -318,324 +300,7 @@ SPECIAL(mayor)
return (FALSE);
}
/* ********************************************************************
* General special procedures for mobiles *
******************************************************************** */
void npc_steal(struct char_data *ch, struct char_data *victim)
{
int gold;
if (IS_NPC(victim))
return;
if (GET_LEVEL(victim) >= LVL_IMMORT)
return;
if (!CAN_SEE(ch, victim))
return;
if (AWAKE(victim) && (rand_number(0, GET_LEVEL(ch)) == 0)) {
act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, victim, TO_VICT);
act("$n tries to steal gold from $N.", TRUE, ch, 0, victim, TO_NOTVICT);
} else {
/* Steal some gold coins */
gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100;
if (gold > 0) {
GET_GOLD(ch) += gold;
GET_GOLD(victim) -= gold;
}
}
}
/*
* Quite lethal to low-level characters.
*/
SPECIAL(snake)
{
if (cmd || GET_POS(ch) != POS_FIGHTING || !FIGHTING(ch))
return (FALSE);
if (IN_ROOM(FIGHTING(ch)) != IN_ROOM(ch) || rand_number(0, GET_LEVEL(ch)) != 0)
return (FALSE);
act("$n bites $N!", 1, ch, 0, FIGHTING(ch), TO_NOTVICT);
act("$n bites you!", 1, ch, 0, FIGHTING(ch), TO_VICT);
call_magic(ch, FIGHTING(ch), 0, SPELL_POISON, GET_LEVEL(ch), CAST_SPELL);
return (TRUE);
}
SPECIAL(thief)
{
struct char_data *cons;
if (cmd || GET_POS(ch) != POS_STANDING)
return (FALSE);
for (cons = world[IN_ROOM(ch)].people; cons; cons = cons->next_in_room)
if (!IS_NPC(cons) && GET_LEVEL(cons) < LVL_IMMORT && !rand_number(0, 4)) {
npc_steal(ch, cons);
return (TRUE);
}
return (FALSE);
}
SPECIAL(magic_user)
{
struct char_data *vict;
if (cmd || GET_POS(ch) != POS_FIGHTING)
return (FALSE);
/* pseudo-randomly choose someone in the room who is fighting me */
for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room)
if (FIGHTING(vict) == ch && !rand_number(0, 4))
break;
/* if I didn't pick any of those, then just slam the guy I'm fighting */
if (vict == NULL && IN_ROOM(FIGHTING(ch)) == IN_ROOM(ch))
vict = FIGHTING(ch);
/* Hm...didn't pick anyone...I'll wait a round. */
if (vict == NULL)
return (TRUE);
if (GET_LEVEL(ch) > 13 && rand_number(0, 10) == 0)
cast_spell(ch, vict, NULL, SPELL_POISON);
if (GET_LEVEL(ch) > 7 && rand_number(0, 8) == 0)
cast_spell(ch, vict, NULL, SPELL_BLINDNESS);
if (GET_LEVEL(ch) > 12 && rand_number(0, 12) == 0) {
if (IS_EVIL(ch))
cast_spell(ch, vict, NULL, SPELL_ENERGY_DRAIN);
else if (IS_GOOD(ch))
cast_spell(ch, vict, NULL, SPELL_DISPEL_EVIL);
}
if (rand_number(0, 4))
return (TRUE);
switch (GET_LEVEL(ch)) {
case 4:
case 5:
cast_spell(ch, vict, NULL, SPELL_MAGIC_MISSILE);
break;
case 6:
case 7:
cast_spell(ch, vict, NULL, SPELL_CHILL_TOUCH);
break;
case 8:
case 9:
cast_spell(ch, vict, NULL, SPELL_BURNING_HANDS);
break;
case 10:
case 11:
cast_spell(ch, vict, NULL, SPELL_SHOCKING_GRASP);
break;
case 12:
case 13:
cast_spell(ch, vict, NULL, SPELL_LIGHTNING_BOLT);
break;
case 14:
case 15:
case 16:
case 17:
cast_spell(ch, vict, NULL, SPELL_COLOR_SPRAY);
break;
default:
cast_spell(ch, vict, NULL, SPELL_FIREBALL);
break;
}
return (TRUE);
}
/* ********************************************************************
* Special procedures for mobiles *
******************************************************************** */
SPECIAL(guild_guard)
{
int i;
struct char_data *guard = (struct char_data *)me;
const char *buf = "The guard humiliates you, and blocks your way.\r\n";
const char *buf2 = "The guard humiliates $n, and blocks $s way.";
if (!IS_MOVE(cmd) || AFF_FLAGGED(guard, AFF_BLIND))
return (FALSE);
if (GET_LEVEL(ch) >= LVL_IMMORT)
return (FALSE);
for (i = 0; guild_info[i].guild_room != NOWHERE; i++) {
/* Wrong guild or not trying to enter. */
if (GET_ROOM_VNUM(IN_ROOM(ch)) != guild_info[i].guild_room || cmd != guild_info[i].direction)
continue;
/* Allow the people of the guild through. */
if (!IS_NPC(ch) && GET_CLASS(ch) == guild_info[i].pc_class)
continue;
send_to_char(ch, "%s", buf);
act(buf2, FALSE, ch, 0, 0, TO_ROOM);
return (TRUE);
}
return (FALSE);
}
SPECIAL(puff)
{
char actbuf[MAX_INPUT_LENGTH];
if (cmd)
return (FALSE);
switch (rand_number(0, 60)) {
case 0:
do_say(ch, strcpy(actbuf, "My god! It's full of stars!"), 0, 0); /* strcpy: OK */
return (TRUE);
case 1:
do_say(ch, strcpy(actbuf, "How'd all those fish get up here?"), 0, 0); /* strcpy: OK */
return (TRUE);
case 2:
do_say(ch, strcpy(actbuf, "I'm a very female dragon."), 0, 0); /* strcpy: OK */
return (TRUE);
case 3:
do_say(ch, strcpy(actbuf, "I've got a peaceful, easy feeling."), 0, 0); /* strcpy: OK */
return (TRUE);
default:
return (FALSE);
}
}
SPECIAL(fido)
{
struct obj_data *i, *temp, *next_obj;
if (cmd || !AWAKE(ch))
return (FALSE);
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
if (!IS_CORPSE(i))
continue;
act("$n savagely devours a corpse.", FALSE, ch, 0, 0, TO_ROOM);
for (temp = i->contains; temp; temp = next_obj) {
next_obj = temp->next_content;
obj_from_obj(temp);
obj_to_room(temp, IN_ROOM(ch));
}
extract_obj(i);
return (TRUE);
}
return (FALSE);
}
SPECIAL(janitor)
{
struct obj_data *i;
if (cmd || !AWAKE(ch))
return (FALSE);
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
if (!CAN_WEAR(i, ITEM_WEAR_TAKE))
continue;
if (GET_OBJ_TYPE(i) != ITEM_DRINKCON && GET_OBJ_COST(i) >= 15)
continue;
act("$n picks up some trash.", FALSE, ch, 0, 0, TO_ROOM);
obj_from_room(i);
obj_to_char(i, ch);
return (TRUE);
}
return (FALSE);
}
SPECIAL(cityguard)
{
struct char_data *tch, *evil, *spittle;
int max_evil, min_cha;
if (cmd || !AWAKE(ch) || FIGHTING(ch))
return (FALSE);
max_evil = 1000;
min_cha = 6;
spittle = evil = NULL;
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) {
if (!CAN_SEE(ch, tch))
continue;
if (!IS_NPC(tch) && PLR_FLAGGED(tch, PLR_KILLER)) {
act("$n screams 'HEY!!! You're one of those PLAYER KILLERS!!!!!!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, tch, TYPE_UNDEFINED);
return (TRUE);
}
if (!IS_NPC(tch) && PLR_FLAGGED(tch, PLR_THIEF)) {
act("$n screams 'HEY!!! You're one of those PLAYER THIEVES!!!!!!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, tch, TYPE_UNDEFINED);
return (TRUE);
}
if (FIGHTING(tch) && GET_ALIGNMENT(tch) < max_evil && (IS_NPC(tch) || IS_NPC(FIGHTING(tch)))) {
max_evil = GET_ALIGNMENT(tch);
evil = tch;
}
if (GET_CHA(tch) < min_cha) {
spittle = tch;
min_cha = GET_CHA(tch);
}
}
if (evil && GET_ALIGNMENT(FIGHTING(evil)) >= 0) {
act("$n screams 'PROTECT THE INNOCENT! BANZAI! CHARGE! ARARARAGGGHH!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, evil, TYPE_UNDEFINED);
return (TRUE);
}
/* Reward the socially inept. */
if (spittle && !rand_number(0, 9)) {
static int spit_social;
if (!spit_social)
spit_social = find_command("spit");
if (spit_social > 0) {
char spitbuf[MAX_NAME_LENGTH + 1];
strncpy(spitbuf, GET_NAME(spittle), sizeof(spitbuf)); /* strncpy: OK */
spitbuf[sizeof(spitbuf) - 1] = '\0';
do_action(ch, spitbuf, spit_social, 0);
return (TRUE);
}
}
return (FALSE);
}
#define PET_PRICE(pet) (GET_LEVEL(pet) * 300)
SPECIAL(pet_shops)
{
char buf[MAX_STRING_LENGTH], pet_name[256];
@ -699,13 +364,7 @@ SPECIAL(pet_shops)
return (FALSE);
}
/* ********************************************************************
* Special procedures for objects *
******************************************************************** */
/* Special procedures for objects */
SPECIAL(bank)
{
int amount;

View file

@ -42,6 +42,10 @@ ACMD(do_oasis_zedit)
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
return;
/* Parse any arguments. */
buf3 = two_arguments(argument, buf1, buf2);
@ -670,7 +674,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
case 'q':
case 'Q':
if (OLC_ZONE(d)->age || OLC_ZONE(d)->number) {
write_to_output(d, "Do you wish to save your changes? (y/n) : ");
write_to_output(d, "Do you wish to save your changes? : ");
OLC_MODE(d) = ZEDIT_CONFIRM_SAVESTRING;
} else {
write_to_output(d, "No changes made.\r\n");