8 Commits

Author SHA1 Message Date
Thomas Arp 744286a1f7 Merge branch 'master' into kaizen/reformatting-and-linting 2025-07-02 22:46:56 +02:00
Thomas Arp df3aefe9b8 Merge branch 'master' into kaizen/reformatting-and-linting
# Conflicts:
#	src/act.comm.c
#	src/act.informative.c
#	src/aedit.c
#	src/comm.c
#	src/comm.h
#	src/dg_olc.h
2025-07-02 22:31:44 +02:00
welcor 0e110b93d5 Actually ue typedefs for obj_data, char_data and descriptor_data.
Some linting in a couple of files. Massive commit...
2025-04-20 02:22:15 +02:00
welcor b489a72c58 Switch to using atoidx whenever we are handling an IDXTYPE. cleanup and linting of asciimap.c 2024-12-31 00:18:53 +01:00
welcor 9c5787129b Merge branch 'master' into kaizen/reformatting-and-linting
# Conflicts:
#	src/sysdep.h
2024-12-30 13:07:05 +01:00
welcor fdb6ff3771 act-files formatted 2024-10-01 00:09:30 +02:00
welcor 5c44f0575e clang-format file added, quest.c and .h formatted 2024-09-30 22:36:30 +02:00
welcor e6085172d5 KAIZEN formatting and linting, header files 2024-09-17 01:04:36 +02:00
115 changed files with 10770 additions and 10644 deletions
+55
View File
@@ -0,0 +1,55 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: Align
AlignTrailingComments: true
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
BeforeLambdaBody: true
BeforeWhile: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: AfterColon
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: false
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseBlocks: true
IndentWidth: 2
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
TabWidth: 2
...
+1
View File
@@ -0,0 +1 @@
select foo.com 1745106858 Welcor
+98 -88
View File
@@ -22,15 +22,15 @@
#include "act.h"
#include "modify.h"
static bool legal_communication(char * arg);
static bool legal_communication(char *arg);
static bool legal_communication(char * arg)
static bool legal_communication(char *arg)
{
while (*arg) {
if (*arg == '@') {
arg++;
if (*arg == '(' || *arg == ')' || *arg == '<' || *arg == '>')
return FALSE;
return FALSE;
}
arg++;
}
@@ -45,8 +45,8 @@ ACMD(do_say)
send_to_char(ch, "Yes, but WHAT do you want to say?\r\n");
else {
char buf[MAX_INPUT_LENGTH + 14], *msg;
struct char_data *vict;
char_data *vict;
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument);
@@ -74,7 +74,7 @@ ACMD(do_say)
ACMD(do_gsay)
{
skip_spaces(&argument);
if (!GROUP(ch)) {
send_to_char(ch, "But you are not a member of a group!\r\n");
return;
@@ -82,20 +82,21 @@ ACMD(do_gsay)
if (!*argument)
send_to_char(ch, "Yes, but WHAT do you want to group-say?\r\n");
else {
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument);
send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch), argument, CCNRM(ch, C_NRM));
parse_at(argument);
send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch),
argument, CCNRM(ch, C_NRM));
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
else
send_to_char(ch, "%sYou group-say, '%s'%s\r\n", CCGRN(ch, C_NRM), argument, CCNRM(ch, C_NRM));
}
}
}
static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg)
static void perform_tell(char_data *ch, char_data *vict, char *arg)
{
char buf[MAX_STRING_LENGTH], *msg;
@@ -107,7 +108,7 @@ static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg
send_to_char(ch, "%s", CONFIG_OK);
else {
snprintf(buf, sizeof(buf), "%sYou tell $N, '%s'%s", CCRED(ch, C_NRM), arg, CCNRM(ch, C_NRM));
msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
add_history(ch, msg, HIST_TELL);
}
@@ -115,7 +116,7 @@ static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg
GET_LAST_TELL(vict) = GET_IDNUM(ch);
}
static int is_tell_ok(struct char_data *ch, struct char_data *vict)
static int is_tell_ok(char_data *ch, char_data *vict)
{
if (!ch)
log("SYSERR: is_tell_ok called with no characters");
@@ -127,11 +128,12 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
send_to_char(ch, "You can't tell other people while you have notell on.\r\n");
else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))
send_to_char(ch, "The walls seem to absorb your words.\r\n");
else if (!IS_NPC(vict) && !vict->desc) /* linkless */
else if (!IS_NPC(vict) && !vict->desc) /* linkless */
act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else if (PLR_FLAGGED(vict, PLR_WRITING))
act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || (ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)))
else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || (
ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)))
act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else
return (TRUE);
@@ -143,8 +145,8 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
* called frequently, and should IMHO be kept as tight as possible. */
ACMD(do_tell)
{
struct char_data *vict = NULL;
char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants
char_data *vict = NULL;
char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants
half_chop(argument, buf, buf2);
@@ -158,12 +160,12 @@ ACMD(do_tell)
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(buf2);
perform_tell(ch, vict, buf2);
}
}
}
ACMD(do_reply)
{
struct char_data *tch = character_list;
char_data *tch = character_list;
if (IS_NPC(ch))
return;
@@ -178,8 +180,8 @@ ACMD(do_reply)
/* Make sure the person you're replying to is still playing by searching
* for them. Note, now last tell is stored as player IDnum instead of
* a pointer, which is much better because it's safer, plus will still
* work if someone logs out and back in again. A descriptor list based
* search would be faster although we could not find link dead people.
* work if someone logs out and back in again. A descriptor list based
* search would be faster although we could not find link dead people.
* Not that they can hear tells anyway. :) -gg 2/24/98 */
while (tch && (IS_NPC(tch) || GET_IDNUM(tch) != GET_LAST_TELL(ch)))
tch = tch->next;
@@ -190,14 +192,14 @@ ACMD(do_reply)
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument);
perform_tell(ch, tch, argument);
}
}
}
}
ACMD(do_spec_comm)
{
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
const char *action_sing, *action_plur, *action_others;
switch (subcmd) {
@@ -237,7 +239,7 @@ ACMD(do_spec_comm)
snprintf(buf1, sizeof(buf1), "$n %s you, '%s'", action_plur, buf2);
act(buf1, FALSE, ch, 0, vict, TO_VICT);
if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT)))
if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT)))
send_to_char(ch, "%s", CONFIG_OK);
else
send_to_char(ch, "You %s %s, '%s'\r\n", action_sing, GET_NAME(vict), buf2);
@@ -247,7 +249,7 @@ ACMD(do_spec_comm)
ACMD(do_write)
{
struct obj_data *paper, *pen = NULL;
obj_data *paper, *pen = NULL;
char *papername, *penname;
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
@@ -326,8 +328,8 @@ ACMD(do_write)
ACMD(do_page)
{
struct descriptor_data *d;
struct char_data *vict;
descriptor_data *d;
char_data *vict;
char buf2[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
half_chop(argument, arg, buf2);
@@ -342,19 +344,19 @@ ACMD(do_page)
snprintf(buf, sizeof(buf), "\007\007*$n* %s", buf2);
if (!str_cmp(arg, "all")) {
if (GET_LEVEL(ch) > LVL_GOD) {
for (d = descriptor_list; d; d = d->next)
if (STATE(d) == CON_PLAYING && d->character)
act(buf, FALSE, ch, 0, d->character, TO_VICT);
for (d = descriptor_list; d; d = d->next)
if (STATE(d) == CON_PLAYING && d->character)
act(buf, FALSE, ch, 0, d->character, TO_VICT);
} else
send_to_char(ch, "You will never be godly enough to do that!\r\n");
send_to_char(ch, "You will never be godly enough to do that!\r\n");
return;
}
if ((vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) {
act(buf, FALSE, ch, 0, vict, TO_VICT);
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
send_to_char(ch, "%s", CONFIG_OK);
else
act(buf, FALSE, ch, 0, vict, TO_CHAR);
act(buf, FALSE, ch, 0, vict, TO_CHAR);
} else
send_to_char(ch, "There is no such person in the game!\r\n");
}
@@ -363,28 +365,28 @@ ACMD(do_page)
/* Generalized communication function by Fred C. Merkel (Torg). */
ACMD(do_gen_comm)
{
struct descriptor_data *i;
descriptor_data *i;
char color_on[24];
char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes
char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes
bool emoting = FALSE;
/* Array of flags which must _not_ be set in order for comm to be heard. */
int channels[] = {
0,
PRF_NOSHOUT,
PRF_NOGOSS,
PRF_NOAUCT,
PRF_NOGRATZ,
PRF_NOGOSS,
0
0,
PRF_NOSHOUT,
PRF_NOGOSS,
PRF_NOAUCT,
PRF_NOGRATZ,
PRF_NOGOSS,
0
};
int hist_type[] = {
HIST_HOLLER,
HIST_SHOUT,
HIST_GOSSIP,
HIST_AUCTION,
HIST_GRATS,
HIST_HOLLER,
HIST_SHOUT,
HIST_GOSSIP,
HIST_AUCTION,
HIST_GRATS,
};
/* com_msgs: [0] Message if you can't perform the action because of noshout
@@ -392,35 +394,42 @@ ACMD(do_gen_comm)
* [2] message if you're not on the channel
* [3] a color string. */
const char *com_msgs[][4] = {
{"You cannot holler!!\r\n",
"holler",
"",
KYEL},
{"You cannot shout!!\r\n",
"shout",
"Turn off your noshout flag first!\r\n",
KYEL},
{"You cannot gossip!!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
KYEL},
{"You cannot auction!!\r\n",
"auction",
"You aren't even on the channel!\r\n",
KMAG},
{"You cannot congratulate!\r\n",
"congrat",
"You aren't even on the channel!\r\n",
KGRN},
{"You cannot gossip your emotions!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
KYEL}
{
"You cannot holler!!\r\n",
"holler",
"",
KYEL
},
{
"You cannot shout!!\r\n",
"shout",
"Turn off your noshout flag first!\r\n",
KYEL
},
{
"You cannot gossip!!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
KYEL
},
{
"You cannot auction!!\r\n",
"auction",
"You aren't even on the channel!\r\n",
KMAG
},
{
"You cannot congratulate!\r\n",
"congrat",
"You aren't even on the channel!\r\n",
KGRN
},
{
"You cannot gossip your emotions!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
KYEL
}
};
if (PLR_FLAGGED(ch, PLR_NOSHOUT)) {
@@ -443,7 +452,8 @@ ACMD(do_gen_comm)
/* Level_can_shout defined in config.c. */
if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) {
send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT, com_msgs[subcmd][1]);
send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT,
com_msgs[subcmd][1]);
return;
}
/* Make sure the char is on the channel. */
@@ -474,12 +484,12 @@ ACMD(do_gen_comm)
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
else {
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument);
snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "",
com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP);
add_history(ch, msg, hist_type[subcmd]);
}
@@ -488,7 +498,7 @@ ACMD(do_gen_comm)
/* Now send all the strings out. */
for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character )
if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character)
continue;
if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING)))
continue;
@@ -497,10 +507,10 @@ ACMD(do_gen_comm)
continue;
if (subcmd == SCMD_SHOUT && ((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) ||
!AWAKE(i->character)))
!AWAKE(i->character)))
continue;
snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM);
snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM);
msg = act(buf2, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP);
add_history(i->character, msg, hist_type[subcmd]);
}
@@ -518,8 +528,8 @@ ACMD(do_qcomm)
send_to_char(ch, "%c%s? Yes, fine, %s we must, but WHAT??\r\n", UPPER(*CMD_NAME), CMD_NAME + 1, CMD_NAME);
else {
char buf[MAX_STRING_LENGTH];
struct descriptor_data *i;
descriptor_data *i;
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument);
+11 -12
View File
@@ -57,7 +57,7 @@ char *find_exdesc(char *word, struct extra_descr_data *list);
void space_to_minus(char *str);
/** @todo Move to a help module? */
int search_help(const char *argument, int level);
void free_history(struct char_data *ch, int type);
void free_history(char_data *ch, int type);
void free_recent_players(void);
/* functions with subcommands */
/* do_commands */
@@ -109,10 +109,10 @@ ACMD(do_whois);
****************************************************************************/
/* Utility Functions */
/** @todo Compare with needs of find_eq_pos_script. */
int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg);
void name_from_drinkcon(struct obj_data *obj);
void name_to_drinkcon(struct obj_data *obj, int type);
void weight_change_object(struct obj_data *obj, int weight);
int find_eq_pos(char_data *ch, obj_data *obj, char *arg);
void name_from_drinkcon(obj_data *obj);
void name_to_drinkcon(obj_data *obj, int type);
void weight_change_object(obj_data *obj, int weight);
/* functions with subcommands */
/* do_drop */
ACMD(do_drop);
@@ -268,7 +268,6 @@ ACMD(do_action);
ACMD(do_gmote);
/*****************************************************************************
* Begin Functions and defines for act.wizard.c
****************************************************************************/
@@ -276,11 +275,11 @@ ACMD(do_gmote);
/** @todo should probably be moved to a more general file handler module */
void clean_llog_entries(void);
/** @todo This should be moved to a more general utility file */
int script_command_interpreter(struct char_data *ch, char *arg);
room_rnum find_target_room(struct char_data *ch, char *rawroomstr);
void perform_immort_vis(struct char_data *ch);
void snoop_check(struct char_data *ch);
bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name);
int script_command_interpreter(char_data *ch, char *arg);
room_rnum find_target_room(char_data *ch, char *rawroomstr);
void perform_immort_vis(char_data *ch);
void snoop_check(char_data *ch);
bool change_player_name(char_data *ch, char_data *vict, char *new_name);
bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr);
/* Functions with subcommands */
/* do_date */
@@ -327,7 +326,7 @@ ACMD(do_plist);
ACMD(do_purge);
ACMD(do_recent);
ACMD(do_restore);
void return_to_char(struct char_data * ch);
void return_to_char(char_data *ch);
ACMD(do_return);
ACMD(do_saveall);
ACMD(do_send);
+615 -540
View File
File diff suppressed because it is too large Load Diff
+391 -372
View File
File diff suppressed because it is too large Load Diff
+109 -129
View File
@@ -27,18 +27,18 @@
/* local only functions */
/* do_simple_move utility functions */
static int has_boat(struct char_data *ch);
static int has_boat(char_data *ch);
/* do_gen_door utility functions */
static int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname);
static int has_key(struct char_data *ch, obj_vnum key);
static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd);
static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd);
static int find_door(char_data *ch, const char *type, char *dir, const char *cmdname);
static int has_key(char_data *ch, obj_vnum key);
static void do_doorcmd(char_data *ch, obj_data *obj, int door, int scmd);
static int ok_pick(char_data *ch, obj_vnum keynum, int pickproof, int scmd);
/* simple function to determine if char can walk on water */
static int has_boat(struct char_data *ch)
static int has_boat(char_data *ch)
{
struct obj_data *obj;
obj_data *obj;
int i;
if (GET_LEVEL(ch) > LVL_IMMORT)
@@ -61,9 +61,9 @@ static int has_boat(struct char_data *ch)
}
/* Simple function to determine if char can fly. */
static int has_flight(struct char_data *ch)
static int has_flight(char_data *ch)
{
struct obj_data *obj;
obj_data *obj;
int i;
if (GET_LEVEL(ch) > LVL_IMMORT)
@@ -86,9 +86,9 @@ static int has_flight(struct char_data *ch)
}
/* Simple function to determine if char can scuba. */
static int has_scuba(struct char_data *ch)
static int has_scuba(char_data *ch)
{
struct obj_data *obj;
obj_data *obj;
int i;
if (GET_LEVEL(ch) > LVL_IMMORT)
@@ -126,7 +126,7 @@ static int has_scuba(struct char_data *ch)
* @param need_specials_check If TRUE will cause
* @retval int 1 for a successful move (ch is now in a new location)
* or 0 for a failed move (ch is still in the original location). */
int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
int do_simple_move(char_data *ch, int dir, int need_specials_check)
{
/* Begin Local variable definitions */
/*---------------------------------------------------------------------*/
@@ -166,8 +166,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
return 0;
/* Charm effect: Does it override the movement? */
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master))
{
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) {
send_to_char(ch, "The thought of leaving your master makes you weep.\r\n");
act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM);
return (0);
@@ -175,28 +174,23 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
/* Water, No Swimming Rooms: Does the deep water prevent movement? */
if ((SECT(was_in) == SECT_WATER_NOSWIM) ||
(SECT(going_to) == SECT_WATER_NOSWIM))
{
if (!has_boat(ch))
{
(SECT(going_to) == SECT_WATER_NOSWIM)) {
if (!has_boat(ch)) {
send_to_char(ch, "You need a boat to go there.\r\n");
return (0);
}
}
/* Flying Required: Does lack of flying prevent movement? */
if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING))
{
if (!has_flight(ch))
{
if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) {
if (!has_flight(ch)) {
send_to_char(ch, "You need to be flying to go there!\r\n");
return (0);
}
}
/* Underwater Room: Does lack of underwater breathing prevent movement? */
if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER))
{
if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) {
if (!has_scuba(ch) && !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
send_to_char(ch, "You need to be able to breathe water to go there!\r\n");
return (0);
@@ -204,10 +198,8 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
}
/* Houses: Can the player walk into the house? */
if (ROOM_FLAGGED(was_in, ROOM_ATRIUM))
{
if (!House_can_enter(ch, GET_ROOM_VNUM(going_to)))
{
if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) {
if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) {
send_to_char(ch, "That's private property -- no trespassing!\r\n");
return (0);
}
@@ -223,15 +215,15 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
return (0);
}
if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (GET_LEVEL(ch) < LVL_GRGOD)) {
if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (
GET_LEVEL(ch) < LVL_GRGOD)) {
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
return (0);
}
/* Room Size Capacity: Is the room full of people already? */
if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) &&
num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE)
{
num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) {
if (CONFIG_TUNNEL_SIZE > 1)
send_to_char(ch, "There isn't enough room for you to go there!\r\n");
else
@@ -240,8 +232,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
}
/* Room Level Requirements: Is ch privileged enough to enter the room? */
if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD)
{
if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) {
send_to_char(ch, "You aren't godly enough to use that room!\r\n");
return (0);
}
@@ -250,11 +241,10 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
* move points. */
/* move points needed is avg. move loss for src and destination sect type */
need_movement = (movement_loss[SECT(was_in)] +
movement_loss[SECT(going_to)]) / 2;
movement_loss[SECT(going_to)]) / 2;
/* Move Point Requirement Check */
if (GET_MOVE(ch) < need_movement && !IS_NPC(ch))
{
if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) {
if (need_specials_check && ch->master)
send_to_char(ch, "You are too exhausted to follow.\r\n");
else
@@ -274,8 +264,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
GET_MOVE(ch) -= need_movement;
/* Generate the leave message and display to others in the was_in room. */
if (!AFF_FLAGGED(ch, AFF_SNEAK))
{
if (!AFF_FLAGGED(ch, AFF_SNEAK)) {
snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]);
act(leave_message, TRUE, ch, 0, 0, TO_ROOM);
}
@@ -307,9 +296,9 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
look_at_room(ch, 0);
/* ... and Kill the player if the room is a death trap. */
if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT)
{
mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name);
if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) {
mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to),
world[going_to].name);
death_cry(ch);
extract_char(ch);
return (0);
@@ -319,15 +308,13 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
/* Fire memory and greet triggers, check and see if the greet trigger
* prevents movement, and if so, move the player back to the previous room. */
entry_memory_mtrigger(ch);
if (!greet_mtrigger(ch, dir))
{
if (!greet_mtrigger(ch, dir)) {
char_from_room(ch);
char_to_room(ch, was_in);
look_at_room(ch, 0);
/* Failed move, return a failure */
return (0);
}
else
} else
greet_memory_mtrigger(ch);
/*---------------------------------------------------------------------*/
/* End: Post-move operations. */
@@ -337,7 +324,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
return (1);
}
int perform_move(struct char_data *ch, int dir, int need_specials_check)
int perform_move(char_data *ch, int dir, int need_specials_check)
{
room_rnum was_in;
struct follow_type *k, *next;
@@ -348,7 +335,8 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check)
send_to_char(ch, "Alas, you cannot go that way...\r\n");
else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE)
send_to_char(ch, "Alas, you cannot go that way...\r\n");
else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) {
else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || (
!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) {
if (EXIT(ch, dir)->keyword)
send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword));
else
@@ -364,9 +352,9 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check)
for (k = ch->followers; k; k = next) {
next = k->next;
if ((IN_ROOM(k->follower) == was_in) &&
(GET_POS(k->follower) >= POS_STANDING)) {
act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR);
perform_move(k->follower, dir, 1);
(GET_POS(k->follower) >= POS_STANDING)) {
act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR);
perform_move(k->follower, dir, 1);
}
}
return (1);
@@ -380,18 +368,18 @@ ACMD(do_move)
perform_move(ch, subcmd, 0);
}
static int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname)
static int find_door(char_data *ch, const char *type, char *dir, const char *cmdname)
{
int door;
if (*dir) { /* a direction was specified */
if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */
if (*dir) { /* a direction was specified */
if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */
if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */
send_to_char(ch, "That's not a direction.\r\n");
return (-1);
}
}
if (EXIT(ch, door)) { /* Braces added according to indent. -gg */
if (EXIT(ch, door)) { /* Braces added according to indent. -gg */
if (EXIT(ch, door)->keyword) {
if (is_name(type, EXIT(ch, door)->keyword))
return (door);
@@ -400,40 +388,34 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
return (-1);
}
} else
return (door);
return (door);
} else {
send_to_char(ch, "I really don't see how you can %s anything there.\r\n", cmdname);
return (-1);
}
} else { /* try to locate the keyword */
} else { /* try to locate the keyword */
if (!*type) {
send_to_char(ch, "What is it you want to %s?\r\n", cmdname);
return (-1);
}
for (door = 0; door < DIR_COUNT; door++)
{
if (EXIT(ch, door))
{
if (EXIT(ch, door)->keyword)
{
if (isname(type, EXIT(ch, door)->keyword))
{
for (door = 0; door < DIR_COUNT; door++) {
if (EXIT(ch, door)) {
if (EXIT(ch, door)->keyword) {
if (isname(type, EXIT(ch, door)->keyword)) {
if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR)))
return door;
else if (is_abbrev(cmdname, "open"))
{
else if (is_abbrev(cmdname, "open")) {
if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
return door;
else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))
return door;
}
else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))) )
} else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))))
return door;
else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))) )
else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))))
return door;
else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) )
else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)))
return door;
else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) )
else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)))
return door;
}
}
@@ -457,9 +439,9 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
}
}
int has_key(struct char_data *ch, obj_vnum key)
int has_key(char_data *ch, obj_vnum key)
{
struct obj_data *o;
obj_data *o;
if (key == NOTHING)
return (0);
@@ -483,20 +465,20 @@ int has_key(struct char_data *ch, obj_vnum key)
/* cmd_door is required external from act.movement.c */
const char *cmd_door[] =
{
"open",
"close",
"unlock",
"lock",
"pick"
"open",
"close",
"unlock",
"lock",
"pick"
};
static const int flags_door[] =
{
NEED_CLOSED | NEED_UNLOCKED,
NEED_OPEN,
NEED_CLOSED | NEED_LOCKED,
NEED_CLOSED | NEED_UNLOCKED,
NEED_CLOSED | NEED_LOCKED
NEED_CLOSED | NEED_UNLOCKED,
NEED_OPEN,
NEED_CLOSED | NEED_LOCKED,
NEED_CLOSED | NEED_UNLOCKED,
NEED_CLOSED | NEED_LOCKED
};
#define EXITN(room, door) (world[room].dir_option[door])
@@ -516,7 +498,7 @@ static const int flags_door[] =
(TOGGLE_BIT(GET_OBJ_VAL(obj, 1), CONT_LOCKED)) :\
(TOGGLE_BIT(EXITN(room, door)->exit_info, EX_LOCKED)))
static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int scmd)
static void do_doorcmd(char_data *ch, obj_data *obj, int door, int scmd)
{
char buf[MAX_STRING_LENGTH];
size_t len;
@@ -576,18 +558,18 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int
/* Notify the room. */
if (len < sizeof(buf))
snprintf(buf + len, sizeof(buf) - len, "%s%s.",
obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door");
obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door");
if (!obj || IN_ROOM(obj) != NOWHERE)
act(buf, FALSE, ch, obj, obj ? 0 : EXIT(ch, door)->keyword, TO_ROOM);
/* Notify the other room */
if (back && (scmd == SCMD_OPEN || scmd == SCMD_CLOSE))
send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n",
back->keyword ? fname(back->keyword) : "door", cmd_door[scmd],
scmd == SCMD_CLOSE ? "d" : "ed");
send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n",
back->keyword ? fname(back->keyword) : "door", cmd_door[scmd],
scmd == SCMD_CLOSE ? "d" : "ed");
}
static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd)
static int ok_pick(char_data *ch, obj_vnum keynum, int pickproof, int scmd)
{
int percent, skill_lvl;
@@ -628,8 +610,8 @@ ACMD(do_gen_door)
int door = -1;
obj_vnum keynum;
char type[MAX_INPUT_LENGTH], dir[MAX_INPUT_LENGTH];
struct obj_data *obj = NULL;
struct char_data *victim = NULL;
obj_data *obj = NULL;
char_data *victim = NULL;
skip_spaces(&argument);
if (!*argument) {
@@ -655,18 +637,16 @@ ACMD(do_gen_door)
send_to_char(ch, "But it's currently open!\r\n");
else if (!(DOOR_IS_LOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_LOCKED))
send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n");
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum)) )
{
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((
!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum))) {
send_to_char(ch, "It is locked, but you have the key.\r\n");
do_doorcmd(ch, obj, door, SCMD_UNLOCK);
do_doorcmd(ch, obj, door, subcmd);
}
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (!has_key(ch, keynum)) )
{
} else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((
!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (!has_key(ch, keynum))) {
send_to_char(ch, "It is locked, and you do not have the key!\r\n");
}
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
(GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))))
} else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
(GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))))
send_to_char(ch, "It seems to be locked.\r\n");
else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK)))
send_to_char(ch, "You don't seem to have the proper key.\r\n");
@@ -683,7 +663,7 @@ ACMD(do_enter)
one_argument(argument, buf);
if (*buf) { /* an argument was supplied, search for door
if (*buf) { /* an argument was supplied, search for door
* keyword */
for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door))
@@ -699,12 +679,12 @@ ACMD(do_enter)
/* try to locate an entrance */
for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door))
if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1);
return;
}
if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1);
return;
}
send_to_char(ch, "You can't seem to find anything to enter.\r\n");
}
}
@@ -718,12 +698,12 @@ ACMD(do_leave)
else {
for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door))
if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1);
return;
}
if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1);
return;
}
send_to_char(ch, "I see no obvious exits to the outside.\r\n");
}
}
@@ -737,16 +717,16 @@ ACMD(do_stand)
case POS_SITTING:
send_to_char(ch, "You stand up.\r\n");
act("$n clambers to $s feet.", TRUE, ch, 0, 0, TO_ROOM);
/* Were they sitting in something? */
/* Were they sitting in something? */
char_from_furniture(ch);
/* Will be sitting after a successful bash and may still be fighting. */
/* Will be sitting after a successful bash and may still be fighting. */
GET_POS(ch) = FIGHTING(ch) ? POS_FIGHTING : POS_STANDING;
break;
case POS_RESTING:
send_to_char(ch, "You stop resting, and stand up.\r\n");
act("$n stops resting, and clambers on $s feet.", TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_STANDING;
/* Were they sitting in something. */
/* Were they sitting in something. */
char_from_furniture(ch);
break;
case POS_SLEEPING:
@@ -758,7 +738,7 @@ ACMD(do_stand)
default:
send_to_char(ch, "You stop floating around, and put your feet on the ground.\r\n");
act("$n stops floating around, and puts $s feet on the ground.",
TRUE, ch, 0, 0, TO_ROOM);
TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_STANDING;
break;
}
@@ -767,8 +747,8 @@ ACMD(do_stand)
ACMD(do_sit)
{
char arg[MAX_STRING_LENGTH];
struct obj_data *furniture;
struct char_data *tempch;
obj_data *furniture;
char_data *tempch;
int found;
one_argument(argument, arg);
@@ -799,7 +779,7 @@ ACMD(do_sit)
} else {
if (OBJ_SAT_IN_BY(furniture) == NULL)
OBJ_SAT_IN_BY(furniture) = ch;
for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch ; tempch = NEXT_SITTING(tempch)) {
for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch; tempch = NEXT_SITTING(tempch)) {
if (NEXT_SITTING(tempch))
continue;
NEXT_SITTING(tempch) = ch;
@@ -884,7 +864,7 @@ ACMD(do_sleep)
default:
send_to_char(ch, "You stop floating around, and lie down to sleep.\r\n");
act("$n stops floating around, and lie down to sleep.",
TRUE, ch, 0, 0, TO_ROOM);
TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_SLEEPING;
break;
}
@@ -893,7 +873,7 @@ ACMD(do_sleep)
ACMD(do_wake)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
int self = 0;
one_argument(argument, arg);
@@ -932,7 +912,7 @@ ACMD(do_wake)
ACMD(do_follow)
{
char buf[MAX_INPUT_LENGTH];
struct char_data *leader;
char_data *leader;
one_argument(argument, buf);
@@ -942,9 +922,9 @@ ACMD(do_follow)
return;
}
} else {
if (ch->master != (char_data*) NULL) {
send_to_char(ch, "You are following %s.\r\n",
GET_NAME(ch->master));
if (ch->master != (char_data *)NULL) {
send_to_char(ch, "You are following %s.\r\n",
GET_NAME(ch->master));
} else {
send_to_char(ch, "Whom do you wish to follow?\r\n");
}
@@ -957,7 +937,7 @@ ACMD(do_follow)
}
if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) {
act("But you only feel like following $N!", FALSE, ch, 0, ch->master, TO_CHAR);
} else { /* Not Charmed follow person */
} else { /* Not Charmed follow person */
if (leader == ch) {
if (!ch->master) {
send_to_char(ch, "You are already following yourself.\r\n");
@@ -980,9 +960,9 @@ ACMD(do_follow)
ACMD(do_unfollow)
{
if (ch->master) {
if (AFF_FLAGGED(ch, AFF_CHARM)) {
send_to_char(ch, "You feel compelled to follow %s.\r\n",
GET_NAME(ch->master));
if (AFF_FLAGGED(ch, AFF_CHARM)) {
send_to_char(ch, "You feel compelled to follow %s.\r\n",
GET_NAME(ch->master));
} else {
stop_follower(ch);
}
+75 -73
View File
@@ -24,7 +24,7 @@
ACMD(do_assist)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *helpee, *opponent;
char_data *helpee, *opponent;
if (FIGHTING(ch)) {
send_to_char(ch, "You're already fighting! How can you assist someone else?\r\n");
@@ -46,14 +46,14 @@ ACMD(do_assist)
opponent = FIGHTING(helpee);
else
for (opponent = world[IN_ROOM(ch)].people;
opponent && (FIGHTING(opponent) != helpee);
opponent = opponent->next_in_room);
opponent && (FIGHTING(opponent) != helpee);
opponent = opponent->next_in_room);
if (!opponent)
act("But nobody is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
else if (!CAN_SEE(ch, opponent))
act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
/* prevent accidental pkill */
/* prevent accidental pkill */
else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent))
send_to_char(ch, "You cannot kill other players.\r\n");
else {
@@ -68,9 +68,9 @@ ACMD(do_assist)
ACMD(do_hit)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
one_argument(argument, arg);
one_argument(argument, arg);
if (!*arg)
send_to_char(ch, "Hit who?\r\n");
@@ -82,23 +82,24 @@ ACMD(do_hit)
} else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict))
act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR);
else {
if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch))
if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch))
check_killer(ch, vict);
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */
hit(ch, vict, TYPE_UNDEFINED); /* first */
else hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */
WAIT_STATE(ch, PULSE_VIOLENCE + 2);
} else
send_to_char(ch, "You're fighting the best you can!\r\n");
}
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */
hit(ch, vict, TYPE_UNDEFINED); /* first */
else
hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */
WAIT_STATE(ch, PULSE_VIOLENCE + 2);
} else
send_to_char(ch, "You're fighting the best you can!\r\n");
}
}
ACMD(do_kill)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
if (GET_LEVEL(ch) < LVL_GRGOD || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
do_hit(ch, argument, cmd, subcmd);
@@ -125,7 +126,7 @@ ACMD(do_kill)
ACMD(do_backstab)
{
char buf[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
int percent, prob;
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_BACKSTAB)) {
@@ -164,7 +165,7 @@ ACMD(do_backstab)
return;
}
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BACKSTAB);
if (AWAKE(vict) && (percent > prob))
@@ -179,7 +180,7 @@ ACMD(do_order)
{
char name[MAX_INPUT_LENGTH], message[MAX_INPUT_LENGTH];
bool found = FALSE;
struct char_data *vict;
char_data *vict;
struct follow_type *k;
half_chop(argument, name, message);
@@ -208,7 +209,7 @@ ACMD(do_order)
send_to_char(ch, "%s", CONFIG_OK);
command_interpreter(vict, message);
}
} else { /* This is order "followers" */
} else { /* This is order "followers" */
char buf[MAX_STRING_LENGTH];
snprintf(buf, sizeof(buf), "$n issues the order '%s'.", message);
@@ -232,7 +233,7 @@ ACMD(do_order)
ACMD(do_flee)
{
int i, attempt, loss;
struct char_data *was_fighting;
char_data *was_fighting;
if (GET_POS(ch) < POS_FIGHTING) {
send_to_char(ch, "You are in pretty bad shape, unable to flee!\r\n");
@@ -242,22 +243,22 @@ ACMD(do_flee)
for (i = 0; i < 6; i++) {
attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */
if (CAN_GO(ch, attempt) &&
!ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) {
!ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) {
act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM);
was_fighting = FIGHTING(ch);
if (do_simple_move(ch, attempt, TRUE)) {
send_to_char(ch, "You flee head over heels.\r\n");
send_to_char(ch, "You flee head over heels.\r\n");
if (was_fighting && !IS_NPC(ch)) {
loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting);
loss *= GET_LEVEL(was_fighting);
gain_exp(ch, -loss);
loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting);
loss *= GET_LEVEL(was_fighting);
gain_exp(ch, -loss);
}
if (FIGHTING(ch))
stop_fighting(ch);
if (was_fighting && ch == FIGHTING(was_fighting))
stop_fighting(was_fighting);
if (FIGHTING(ch))
stop_fighting(ch);
if (was_fighting && ch == FIGHTING(was_fighting))
stop_fighting(was_fighting);
} else {
act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM);
act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM);
}
return;
}
@@ -268,7 +269,7 @@ ACMD(do_flee)
ACMD(do_bash)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
int percent, prob;
one_argument(argument, arg);
@@ -302,7 +303,7 @@ ACMD(do_bash)
return;
}
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BASH);
if (MOB_FLAGGED(vict, MOB_NOBASH))
@@ -318,7 +319,7 @@ ACMD(do_bash)
* first to make sure they don't flee, then we can't bash them! So now
* we only set them sitting if they didn't flee. -gg 9/21/98
*/
if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */
if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */
WAIT_STATE(vict, PULSE_VIOLENCE);
if (IN_ROOM(ch) == IN_ROOM(vict))
GET_POS(vict) = POS_SITTING;
@@ -330,7 +331,7 @@ ACMD(do_bash)
ACMD(do_rescue)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict, *tmp_ch;
char_data *vict, *tmp_ch;
int percent, prob;
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_RESCUE)) {
@@ -353,21 +354,21 @@ ACMD(do_rescue)
return;
}
for (tmp_ch = world[IN_ROOM(ch)].people; tmp_ch &&
(FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room);
(FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room);
if ((FIGHTING(vict) != NULL) && (FIGHTING(ch) == FIGHTING(vict)) && (tmp_ch == NULL)) {
tmp_ch = FIGHTING(vict);
if (FIGHTING(tmp_ch) == ch) {
send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch)));
return;
}
tmp_ch = FIGHTING(vict);
if (FIGHTING(tmp_ch) == ch) {
send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch)));
return;
}
}
if (!tmp_ch) {
act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);
return;
}
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_RESCUE);
if (percent > prob) {
@@ -393,51 +394,51 @@ ACMD(do_rescue)
EVENTFUNC(event_whirlwind)
{
struct char_data *ch, *tch;
char_data *ch, *tch;
struct mud_event_data *pMudEvent;
struct list_data *room_list;
int count;
/* This is just a dummy check, but we'll do it anyway */
if (event_obj == NULL)
return 0;
/* For the sake of simplicity, we will place the event data in easily
* referenced pointers */
pMudEvent = (struct mud_event_data *) event_obj;
ch = (struct char_data *) pMudEvent->pStruct;
* referenced pointers */
pMudEvent = (struct mud_event_data *)event_obj;
ch = (char_data *)pMudEvent->pStruct;
/* When using a list, we have to make sure to allocate the list as it
* uses dynamic memory */
room_list = create_list();
/* We search through the "next_in_room", and grab all NPCs and add them
* to our list */
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room)
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room)
if (IS_NPC(tch))
add_to_list(tch, room_list);
/* If our list is empty or has "0" entries, we free it from memory and
* close off our event */
* close off our event */
if (room_list->iSize == 0) {
free_list(room_list);
send_to_char(ch, "There is no one in the room to whirlwind!\r\n");
return 0;
}
/* We spit out some ugly colour, making use of the new colour options,
* to let the player know they are performing their whirlwind strike */
send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n");
/* Lets grab some a random NPC from the list, and hit() them up */
for (count = dice(1, 4); count > 0; count--) {
tch = random_from_list(room_list);
hit(ch, tch, TYPE_UNDEFINED);
}
/* Now that our attack is done, let's free out list */
free_list(room_list);
/* The "return" of the event function is the time until the event is called
* again. If we return 0, then the event is freed and removed from the list, but
* any other numerical response will be the delay until the next call */
@@ -452,12 +453,12 @@ EVENTFUNC(event_whirlwind)
* mud event and list systems. */
ACMD(do_whirlwind)
{
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_WHIRLWIND)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
if ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL) {
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
return;
@@ -465,22 +466,22 @@ ACMD(do_whirlwind)
if (GET_POS(ch) < POS_FIGHTING) {
send_to_char(ch, "You must be on your feet to perform a whirlwind.\r\n");
return;
return;
}
/* First thing we do is check to make sure the character is not in the middle
* of a whirl wind attack.
*
*
* "char_had_mud_event() will sift through the character's event list to see if
* an event of type "eWHIRLWIND" currently exists. */
if (char_has_mud_event(ch, eWHIRLWIND)) {
send_to_char(ch, "You are already attempting that!\r\n");
return;
return;
}
send_to_char(ch, "You begin to spin rapidly in circles.\r\n");
act("$n begins to rapidly spin in a circle!", FALSE, ch, 0, 0, TO_ROOM);
/* NEW_EVENT() will add a new mud event to the event list of the character.
* This function below adds a new event of "eWHIRLWIND", to "ch", and passes "NULL" as
* additional data. The event will be called in "3 * PASSES_PER_SEC" or 3 seconds */
@@ -491,7 +492,7 @@ ACMD(do_whirlwind)
ACMD(do_kick)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
int percent, prob;
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_KICK)) {
@@ -509,6 +510,8 @@ ACMD(do_kick)
return;
}
}
log("ch class = %d vict class = %d", GET_CLASS(ch), GET_CLASS(vict));
if (vict == ch) {
send_to_char(ch, "Aren't we funny today...\r\n");
return;
@@ -528,11 +531,10 @@ ACMD(do_kick)
ACMD(do_bandage)
{
char arg[MAX_INPUT_LENGTH];
struct char_data * vict;
char_data *vict;
int percent, prob;
if (!GET_SKILL(ch, SKILL_BANDAGE))
{
if (!GET_SKILL(ch, SKILL_BANDAGE)) {
send_to_char(ch, "You are unskilled in the art of bandaging.\r\n");
return;
}
@@ -556,21 +558,21 @@ ACMD(do_bandage)
WAIT_STATE(ch, PULSE_VIOLENCE * 2);
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BANDAGE);
if (percent <= prob) {
act("Your attempt to bandage fails.", FALSE, ch, 0, 0, TO_CHAR);
act("$n tries to bandage $N, but fails miserably.", TRUE, ch,
0, vict, TO_NOTVICT);
act("$n tries to bandage $N, but fails miserably.", TRUE, ch,
0, vict, TO_NOTVICT);
damage(vict, vict, 2, TYPE_SUFFERING);
return;
}
act("You successfully bandage $N.", FALSE, ch, 0, vict, TO_CHAR);
act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0,
vict, TO_NOTVICT);
act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0,
vict, TO_NOTVICT);
act("Someone bandages you, and you feel a bit better now.",
FALSE, ch, 0, vict, TO_VICT);
FALSE, ch, 0, vict, TO_VICT);
GET_HIT(vict) = 0;
}
+237 -251
View File
@@ -32,8 +32,8 @@
/* Local defined utility functions */
/* do_group utility functions */
static void print_group(struct char_data *ch);
static void display_group_list(struct char_data * ch);
static void print_group(char_data *ch);
static void display_group_list(char_data *ch);
ACMD(do_quit)
{
@@ -72,7 +72,7 @@ ACMD(do_quit)
ch->desc->snoop_by = NULL;
}
extract_char(ch); /* Char is saved before extracting. */
extract_char(ch); /* Char is saved before extracting. */
}
}
@@ -109,7 +109,7 @@ ACMD(do_sneak)
if (AFF_FLAGGED(ch, AFF_SNEAK))
affect_from_char(ch, SKILL_SNEAK);
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
if (percent > GET_SKILL(ch, SKILL_SNEAK) + dex_app_skill[GET_DEX(ch)].sneak)
return;
@@ -135,7 +135,7 @@ ACMD(do_hide)
if (AFF_FLAGGED(ch, AFF_HIDE))
REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);
percent = rand_number(1, 101); /* 101% is a complete failure */
percent = rand_number(1, 101); /* 101% is a complete failure */
if (percent > GET_SKILL(ch, SKILL_HIDE) + dex_app_skill[GET_DEX(ch)].hide)
return;
@@ -145,8 +145,8 @@ ACMD(do_hide)
ACMD(do_steal)
{
struct char_data *vict;
struct obj_data *obj;
char_data *vict;
obj_data *obj;
char vict_name[MAX_INPUT_LENGTH], obj_name[MAX_INPUT_LENGTH];
int percent, gold, eq_pos, pcsteal = 0, ohoh = 0;
@@ -173,73 +173,73 @@ ACMD(do_steal)
percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket;
if (GET_POS(vict) < POS_SLEEPING)
percent = -1; /* ALWAYS SUCCESS, unless heavy object. */
percent = -1; /* ALWAYS SUCCESS, unless heavy object. */
if (!CONFIG_PT_ALLOWED && !IS_NPC(vict))
pcsteal = 1;
if (!AWAKE(vict)) /* Easier to steal from sleeping people. */
if (!AWAKE(vict)) /* Easier to steal from sleeping people. */
percent -= 50;
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
percent = 101; /* Failure */
percent = 101; /* Failure */
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
if (!(obj = get_obj_in_list_vis(ch, obj_name, NULL, vict->carrying))) {
for (eq_pos = 0; eq_pos < NUM_WEARS; eq_pos++)
if (GET_EQ(vict, eq_pos) &&
(isname(obj_name, GET_EQ(vict, eq_pos)->name)) &&
CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) {
obj = GET_EQ(vict, eq_pos);
break;
}
if (GET_EQ(vict, eq_pos) &&
(isname(obj_name, GET_EQ(vict, eq_pos)->name)) &&
CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) {
obj = GET_EQ(vict, eq_pos);
break;
}
if (!obj) {
act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR);
return;
} else { /* It is equipment */
if ((GET_POS(vict) > POS_STUNNED)) {
send_to_char(ch, "Steal the equipment now? Impossible!\r\n");
return;
} else {
act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR);
return;
} else { /* It is equipment */
if ((GET_POS(vict) > POS_STUNNED)) {
send_to_char(ch, "Steal the equipment now? Impossible!\r\n");
return;
} else {
if (!give_otrigger(obj, vict, ch) ||
!receive_mtrigger(ch, vict, obj) ) {
!receive_mtrigger(ch, vict, obj)) {
send_to_char(ch, "Impossible!\r\n");
return;
}
act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR);
act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT);
obj_to_char(unequip_char(vict, eq_pos), ch);
}
act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR);
act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT);
obj_to_char(unequip_char(vict, eq_pos), ch);
}
}
} else { /* obj found in inventory */
} else { /* obj found in inventory */
percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */
percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */
if (percent > GET_SKILL(ch, SKILL_STEAL)) {
ohoh = TRUE;
send_to_char(ch, "Oops..\r\n");
act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
} else { /* Steal the item */
if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) {
ohoh = TRUE;
send_to_char(ch, "Oops..\r\n");
act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
} else { /* Steal the item */
if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) {
if (!give_otrigger(obj, vict, ch) ||
!receive_mtrigger(ch, vict, obj) ) {
!receive_mtrigger(ch, vict, obj)) {
send_to_char(ch, "Impossible!\r\n");
return;
}
if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) {
obj_from_char(obj);
obj_to_char(obj, ch);
send_to_char(ch, "Got it!\r\n");
}
} else
send_to_char(ch, "You cannot carry that much.\r\n");
if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) {
obj_from_char(obj);
obj_to_char(obj, ch);
send_to_char(ch, "Got it!\r\n");
}
} else
send_to_char(ch, "You cannot carry that much.\r\n");
}
}
} else { /* Steal some coins */
} else { /* Steal some coins */
if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) {
ohoh = TRUE;
send_to_char(ch, "Oops..\r\n");
@@ -250,14 +250,14 @@ ACMD(do_steal)
gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100;
gold = MIN(1782, gold);
if (gold > 0) {
increase_gold(ch, gold);
decrease_gold(vict, gold);
increase_gold(ch, gold);
decrease_gold(vict, gold);
if (gold > 1)
send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold);
else
send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n");
send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold);
else
send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n");
} else {
send_to_char(ch, "You couldn't get any gold...\r\n");
send_to_char(ch, "You couldn't get any gold...\r\n");
}
}
}
@@ -315,61 +315,62 @@ ACMD(do_title)
}
}
static void print_group(struct char_data *ch)
static void print_group(char_data *ch)
{
struct char_data * k;
char_data *k;
send_to_char(ch, "Your group consists of:\r\n");
while ((k = (struct char_data *) simple_list(ch->group->members)) != NULL)
while ((k = (char_data *)simple_list(ch->group->members)) != NULL)
send_to_char(ch, "%-*s: %s[%4d/%-4d]H [%4d/%-4d]M [%4d/%-4d]V%s\r\n",
count_color_chars(GET_NAME(k))+22, GET_NAME(k),
GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM),
GET_HIT(k), GET_MAX_HIT(k),
GET_MANA(k), GET_MAX_MANA(k),
GET_MOVE(k), GET_MAX_MOVE(k),
CCNRM(ch, C_NRM));
count_color_chars(GET_NAME(k)) + 22, GET_NAME(k),
GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM),
GET_HIT(k), GET_MAX_HIT(k),
GET_MANA(k), GET_MAX_MANA(k),
GET_MOVE(k), GET_MAX_MOVE(k),
CCNRM(ch, C_NRM));
}
static void display_group_list(struct char_data * ch)
static void display_group_list(char_data *ch)
{
struct group_data * group;
struct group_data *group;
int count = 0;
if (group_list->iSize) {
send_to_char(ch, "# Group Leader # of Members In Zone\r\n"
"---------------------------------------------------\r\n");
while ((group = (struct group_data *) simple_list(group_list)) != NULL) {
if (IS_SET(GROUP_FLAGS(group), GROUP_NPC))
continue;
"---------------------------------------------------\r\n");
while ((group = (struct group_data *)simple_list(group_list)) != NULL) {
if (IS_SET(GROUP_FLAGS(group), GROUP_NPC))
continue;
if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON))
send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n",
++count,
IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM),
GET_NAME(GROUP_LEADER(group)), group->members->iSize, zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name,
CCNRM(ch, C_NRM));
send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n",
++count,
IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM),
GET_NAME(GROUP_LEADER(group)), group->members->iSize,
zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name,
CCNRM(ch, C_NRM));
else
send_to_char(ch, "%-2d) Hidden\r\n", ++count);
}
}
}
if (count)
send_to_char(ch, "\r\n"
"%sSeeking Members%s\r\n"
"%sClosed%s\r\n",
CCGRN(ch, C_NRM), CCNRM(ch, C_NRM),
CCRED(ch, C_NRM), CCNRM(ch, C_NRM));
"%sSeeking Members%s\r\n"
"%sClosed%s\r\n",
CCGRN(ch, C_NRM), CCNRM(ch, C_NRM),
CCRED(ch, C_NRM), CCNRM(ch, C_NRM));
else
send_to_char(ch, "\r\n"
"Currently no groups formed.\r\n");
"Currently no groups formed.\r\n");
}
/* Vatiken's Group System: Version 1.1 */
ACMD(do_group)
{
char buf[MAX_STRING_LENGTH];
struct char_data *vict;
char_data *vict;
argument = one_argument(argument, buf);
@@ -380,7 +381,7 @@ ACMD(do_group)
send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n");
return;
}
if (is_abbrev(buf, "new")) {
if (GROUP(ch))
send_to_char(ch, "You are already in a group.\r\n");
@@ -405,8 +406,8 @@ ACMD(do_group)
} else if (!IS_SET(GROUP_FLAGS(GROUP(vict)), GROUP_OPEN)) {
send_to_char(ch, "That group isn't accepting members.\r\n");
return;
}
join_group(ch, GROUP(vict));
}
join_group(ch, GROUP(vict));
} else if (is_abbrev(buf, "kick")) {
skip_spaces(&argument);
if (!(vict = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM))) {
@@ -415,18 +416,18 @@ ACMD(do_group)
} else if (vict == ch) {
send_to_char(ch, "There are easier ways to leave the group.\r\n");
return;
} else if (!GROUP(ch) ) {
} else if (!GROUP(ch)) {
send_to_char(ch, "But you are not part of a group.\r\n");
return;
} else if (GROUP_LEADER(GROUP(ch)) != ch ) {
} else if (GROUP_LEADER(GROUP(ch)) != ch) {
send_to_char(ch, "Only the group's leader can kick members out.\r\n");
return;
} else if (GROUP(vict) != GROUP(ch)) {
act("$E$u is not a member of your group!", FALSE, ch, 0, vict, TO_CHAR);
return;
}
}
send_to_char(ch, "You have kicked %s out of the group.\r\n", GET_NAME(vict));
send_to_char(vict, "You have been kicked out of the group.\r\n");
send_to_char(vict, "You have been kicked out of the group.\r\n");
leave_group(vict);
} else if (is_abbrev(buf, "regroup")) {
if (!GROUP(ch)) {
@@ -441,12 +442,12 @@ ACMD(do_group)
join_group(ch, GROUP(vict));
}
} else if (is_abbrev(buf, "leave")) {
if (!GROUP(ch)) {
send_to_char(ch, "But you aren't part of a group!\r\n");
return;
}
leave_group(ch);
} else if (is_abbrev(buf, "option")) {
skip_spaces(&argument);
@@ -459,14 +460,16 @@ ACMD(do_group)
}
if (is_abbrev(argument, "open")) {
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN);
send_to_char(ch, "The group is now %s to new members.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed");
send_to_char(ch, "The group is now %s to new members.\r\n",
IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed");
} else if (is_abbrev(argument, "anonymous")) {
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_ANON);
send_to_char(ch, "The group location is now %s to other players.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible");
} else
send_to_char(ch, "The group location is now %s to other players.\r\n",
IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible");
} else
send_to_char(ch, "The flag options are: Open, Anonymous\r\n");
} else {
send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n");
send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n");
}
}
@@ -481,10 +484,10 @@ ACMD(do_report)
}
send_to_group(NULL, group, "%s reports: %d/%dH, %d/%dM, %d/%dV\r\n",
GET_NAME(ch),
GET_HIT(ch), GET_MAX_HIT(ch),
GET_MANA(ch), GET_MAX_MANA(ch),
GET_MOVE(ch), GET_MAX_MOVE(ch));
GET_NAME(ch),
GET_HIT(ch), GET_MAX_HIT(ch),
GET_MANA(ch), GET_MAX_MANA(ch),
GET_MOVE(ch), GET_MAX_MOVE(ch));
}
ACMD(do_split)
@@ -492,8 +495,8 @@ ACMD(do_split)
char buf[MAX_INPUT_LENGTH];
int amount, num = 0, share, rest;
size_t len;
struct char_data *k;
char_data *k;
if (IS_NPC(ch))
return;
@@ -509,9 +512,9 @@ ACMD(do_split)
send_to_char(ch, "You don't seem to have that much gold to split.\r\n");
return;
}
if (GROUP(ch))
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL)
while ((k = (char_data *)simple_list(GROUP(ch)->members)) != NULL)
if (IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k))
num++;
@@ -527,25 +530,25 @@ ACMD(do_split)
/* Abusing signed/unsigned to make sizeof work. */
len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n",
GET_NAME(ch), amount, share);
GET_NAME(ch), amount, share);
if (rest && len < sizeof(buf)) {
snprintf(buf + len, sizeof(buf) - len,
"%d coin%s %s not splitable, so %s keeps the money.\r\n", rest,
(rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch));
"%d coin%s %s not splitable, so %s keeps the money.\r\n", rest,
(rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch));
}
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL)
while ((k = (char_data *)simple_list(GROUP(ch)->members)) != NULL)
if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) {
increase_gold(k, share);
send_to_char(k, "%s", buf);
}
increase_gold(k, share);
send_to_char(k, "%s", buf);
}
send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n",
amount, num, share);
amount, num, share);
if (rest) {
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
}
} else {
send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
@@ -556,7 +559,7 @@ ACMD(do_split)
ACMD(do_use)
{
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
struct obj_data *mag_item;
obj_data *mag_item;
half_chop(argument, arg, buf);
if (!*arg) {
@@ -570,8 +573,8 @@ ACMD(do_use)
case SCMD_RECITE:
case SCMD_QUAFF:
if (!(mag_item = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) {
send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg);
return;
send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg);
return;
}
break;
case SCMD_USE:
@@ -579,8 +582,8 @@ ACMD(do_use)
return;
default:
log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd);
/* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(),
* but in the function which handles 'quaff', 'recite', and 'use'. */
/* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(),
* but in the function which handles 'quaff', 'recite', and 'use'. */
return;
}
}
@@ -599,7 +602,7 @@ ACMD(do_use)
break;
case SCMD_USE:
if ((GET_OBJ_TYPE(mag_item) != ITEM_WAND) &&
(GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) {
(GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) {
send_to_char(ch, "You can't seem to figure out how to use it.\r\n");
return;
}
@@ -647,16 +650,16 @@ ACMD(do_display)
switch (LOWER(argument[i])) {
case 'h':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);
break;
break;
case 'm':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);
break;
break;
case 'v':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);
break;
break;
default:
send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n");
return;
send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n");
return;
}
}
}
@@ -673,64 +676,64 @@ ACMD(do_gen_tog)
char arg[MAX_INPUT_LENGTH];
const char *tog_messages[][2] = {
{"You are now safe from summoning by other players.\r\n",
"You may now be summoned by other players.\r\n"},
{"Nohassle disabled.\r\n",
"Nohassle enabled.\r\n"},
{"Brief mode off.\r\n",
"Brief mode on.\r\n"},
{"Compact mode off.\r\n",
"Compact mode on.\r\n"},
{"You can now hear tells.\r\n",
"You are now deaf to tells.\r\n"},
{"You can now hear auctions.\r\n",
"You are now deaf to auctions.\r\n"},
{"You can now hear shouts.\r\n",
"You are now deaf to shouts.\r\n"},
{"You can now hear gossip.\r\n",
"You are now deaf to gossip.\r\n"},
{"You can now hear the congratulation messages.\r\n",
"You are now deaf to the congratulation messages.\r\n"},
{"You can now hear the Wiz-channel.\r\n",
"You are now deaf to the Wiz-channel.\r\n"},
{"You are no longer part of the Quest.\r\n",
"Okay, you are part of the Quest!\r\n"},
{"You will no longer see the room flags.\r\n",
"You will now see the room flags.\r\n"},
{"You will now have your communication repeated.\r\n",
"You will no longer have your communication repeated.\r\n"},
{"HolyLight mode off.\r\n",
"HolyLight mode on.\r\n"},
{"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n",
"Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"},
{"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"},
{"Will no longer track through doors.\r\n",
"Will now track through doors.\r\n"},
{"Will no longer clear screen in OLC.\r\n",
"Will now clear screen in OLC.\r\n"},
{"Buildwalk Off.\r\n",
"Buildwalk On.\r\n"},
{"AFK flag is now off.\r\n",
"AFK flag is now on.\r\n"},
{"Autoloot disabled.\r\n",
"Autoloot enabled.\r\n"},
{"Autogold disabled.\r\n",
"Autogold enabled.\r\n"},
{"Autosplit disabled.\r\n",
"Autosplit enabled.\r\n"},
{"Autosacrifice disabled.\r\n",
"Autosacrifice enabled.\r\n"},
{"Autoassist disabled.\r\n",
"Autoassist enabled.\r\n"},
{"Automap disabled.\r\n",
"Automap enabled.\r\n"},
{"Autokey disabled.\r\n",
"Autokey enabled.\r\n"},
{"Autodoor disabled.\r\n",
"Autodoor enabled.\r\n"},
{"ZoneResets disabled.\r\n",
"ZoneResets enabled.\r\n"}
{"You are now safe from summoning by other players.\r\n",
"You may now be summoned by other players.\r\n"},
{"Nohassle disabled.\r\n",
"Nohassle enabled.\r\n"},
{"Brief mode off.\r\n",
"Brief mode on.\r\n"},
{"Compact mode off.\r\n",
"Compact mode on.\r\n"},
{"You can now hear tells.\r\n",
"You are now deaf to tells.\r\n"},
{"You can now hear auctions.\r\n",
"You are now deaf to auctions.\r\n"},
{"You can now hear shouts.\r\n",
"You are now deaf to shouts.\r\n"},
{"You can now hear gossip.\r\n",
"You are now deaf to gossip.\r\n"},
{"You can now hear the congratulation messages.\r\n",
"You are now deaf to the congratulation messages.\r\n"},
{"You can now hear the Wiz-channel.\r\n",
"You are now deaf to the Wiz-channel.\r\n"},
{"You are no longer part of the Quest.\r\n",
"Okay, you are part of the Quest!\r\n"},
{"You will no longer see the room flags.\r\n",
"You will now see the room flags.\r\n"},
{"You will now have your communication repeated.\r\n",
"You will no longer have your communication repeated.\r\n"},
{"HolyLight mode off.\r\n",
"HolyLight mode on.\r\n"},
{"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n",
"Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"},
{"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"},
{"Will no longer track through doors.\r\n",
"Will now track through doors.\r\n"},
{"Will no longer clear screen in OLC.\r\n",
"Will now clear screen in OLC.\r\n"},
{"Buildwalk Off.\r\n",
"Buildwalk On.\r\n"},
{"AFK flag is now off.\r\n",
"AFK flag is now on.\r\n"},
{"Autoloot disabled.\r\n",
"Autoloot enabled.\r\n"},
{"Autogold disabled.\r\n",
"Autogold enabled.\r\n"},
{"Autosplit disabled.\r\n",
"Autosplit enabled.\r\n"},
{"Autosacrifice disabled.\r\n",
"Autosacrifice enabled.\r\n"},
{"Autoassist disabled.\r\n",
"Autoassist enabled.\r\n"},
{"Automap disabled.\r\n",
"Automap enabled.\r\n"},
{"Autokey disabled.\r\n",
"Autokey enabled.\r\n"},
{"Autodoor disabled.\r\n",
"Autodoor enabled.\r\n"},
{"ZoneResets disabled.\r\n",
"ZoneResets enabled.\r\n"}
};
if (IS_NPC(ch))
@@ -784,7 +787,7 @@ ACMD(do_gen_tog)
break;
case SCMD_CLS:
result = PRF_TOG_CHK(ch, PRF_CLS);
break;
break;
case SCMD_BUILDWALK:
if (GET_LEVEL(ch) < LVL_BUILDER) {
send_to_char(ch, "Builders only, sorry.\r\n");
@@ -793,14 +796,14 @@ ACMD(do_gen_tog)
result = PRF_TOG_CHK(ch, PRF_BUILDWALK);
if (PRF_FLAGGED(ch, PRF_BUILDWALK)) {
one_argument(argument, arg);
for (i=0; *arg && *(sector_types[i]) != '\n'; i++)
for (i = 0; *arg && *(sector_types[i]) != '\n'; i++)
if (is_abbrev(arg, sector_types[i]))
break;
if (*(sector_types[i]) == '\n')
i=0;
if (*(sector_types[i]) == '\n')
i = 0;
GET_BUILDWALK_SECTOR(ch) = i;
send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]);
mudlog(CMP, GET_LEVEL(ch), TRUE,
"OLC: %s turned buildwalk on. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch));
} else
@@ -857,35 +860,32 @@ ACMD(do_gen_tog)
return;
}
static void show_happyhour(struct char_data *ch)
static void show_happyhour(char_data *ch)
{
char happyexp[80], happygold[80], happyqp[80];
int secs_left;
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD))
{
if (HAPPY_TIME)
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
else
secs_left = 0;
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) {
if (HAPPY_TIME)
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
else
secs_left = 0;
sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM));
sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM));
sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM));
sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM));
sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM));
sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM));
send_to_char(ch, "tbaMUD Happy Hour!\r\n"
"------------------\r\n"
"%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n",
(IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "",
(IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "",
(IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "",
CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM) );
}
else
{
send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
send_to_char(ch, "tbaMUD Happy Hour!\r\n"
"------------------\r\n"
"%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n",
(IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "",
(IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "",
(IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "",
CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM));
} else {
send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
}
}
@@ -894,8 +894,7 @@ ACMD(do_happyhour)
char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH];
int num;
if (GET_LEVEL(ch) < LVL_GOD)
{
if (GET_LEVEL(ch) < LVL_GOD) {
show_happyhour(ch);
return;
}
@@ -903,20 +902,15 @@ ACMD(do_happyhour)
/* Only Imms get here, so check args */
two_arguments(argument, arg, val);
if (is_abbrev(arg, "experience"))
{
if (is_abbrev(arg, "experience")) {
num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_EXP = num;
send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP);
}
else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins")))
{
} else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins"))) {
num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_GOLD = num;
send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD);
}
else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks")))
{
} else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks"))) {
num = MIN(MAX((atoi(val)), 0), 1000);
if (HAPPY_TIME && !num)
game_info("Happyhour has been stopped!");
@@ -925,47 +919,39 @@ ACMD(do_happyhour)
HAPPY_TIME = num;
send_to_char(ch, "Happy Hour Time set to %d ticks (%d hours %d mins and %d secs)\r\n",
HAPPY_TIME,
(HAPPY_TIME*SECS_PER_MUD_HOUR)/3600,
((HAPPY_TIME*SECS_PER_MUD_HOUR)%3600) / 60,
(HAPPY_TIME*SECS_PER_MUD_HOUR)%60 );
}
else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints")))
{
HAPPY_TIME,
(HAPPY_TIME * SECS_PER_MUD_HOUR) / 3600,
((HAPPY_TIME * SECS_PER_MUD_HOUR) % 3600) / 60,
(HAPPY_TIME * SECS_PER_MUD_HOUR) % 60);
} else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints"))) {
num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_QP = num;
send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP);
}
else if (is_abbrev(arg, "show"))
{
} else if (is_abbrev(arg, "show")) {
show_happyhour(ch);
}
else if (is_abbrev(arg, "default"))
{
} else if (is_abbrev(arg, "default")) {
HAPPY_EXP = 100;
HAPPY_GOLD = 50;
HAPPY_QP = 50;
HAPPY_QP = 50;
HAPPY_TIME = 48;
game_info("A Happyhour has started!");
}
else
{
} else {
send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n"
" %shappyhour show %s- display current settings (what mortals see)\r\n"
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
" %shappyhour qp <num> %s- set qp percentage gain\r\n"
" %shappyhour exp <num> %s- set exp percentage gain\r\n"
" %shappyhour gold <num> %s- set gold percentage gain\r\n"
" \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n"
"Configure the happyhour settings and start a happyhour.\r\n"
"Currently 1 hour IRL = %d ticks\r\n"
"If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n",
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
(3600 / SECS_PER_MUD_HOUR) );
" %shappyhour show %s- display current settings (what mortals see)\r\n"
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
" %shappyhour qp <num> %s- set qp percentage gain\r\n"
" %shappyhour exp <num> %s- set exp percentage gain\r\n"
" %shappyhour gold <num> %s- set gold percentage gain\r\n"
" \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n"
"Configure the happyhour settings and start a happyhour.\r\n"
"Currently 1 hour IRL = %d ticks\r\n"
"If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n",
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
(3600 / SECS_PER_MUD_HOUR));
}
}
+58 -40
View File
@@ -30,8 +30,8 @@ ACMD(do_action)
char arg[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH];
int act_nr;
struct social_messg *action;
struct char_data *vict;
struct obj_data *targ;
char_data *vict;
obj_data *targ;
if ((act_nr = find_action(cmd)) < 0) {
send_to_char(ch, "That action is not supported.\r\n");
@@ -65,7 +65,8 @@ ACMD(do_action)
if (!vict) {
if (action->char_obj_found) {
targ = get_obj_in_list_vis(ch, arg, NULL, ch->carrying);
if (!targ) targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents);
if (!targ)
targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents);
if (targ) {
act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR);
act(action->others_obj_found, action->hide, ch, targ, 0, TO_ROOM);
@@ -92,9 +93,9 @@ ACMD(do_action)
act("$N is not in a proper position for that.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else {
if (*part) {
act(action->char_body_found, 0, ch, (struct obj_data *)part, vict, TO_CHAR | TO_SLEEP);
act(action->others_body_found, action->hide, ch, (struct obj_data *)part, vict, TO_NOTVICT);
act(action->vict_body_found, action->hide, ch, (struct obj_data *)part, vict, TO_VICT);
act(action->char_body_found, 0, ch, (obj_data *)part, vict, TO_CHAR | TO_SLEEP);
act(action->others_body_found, action->hide, ch, (obj_data *)part, vict, TO_NOTVICT);
act(action->vict_body_found, action->hide, ch, (obj_data *)part, vict, TO_VICT);
} else {
act(action->char_found, 0, ch, 0, vict, TO_CHAR | TO_SLEEP);
act(action->others_found, action->hide, ch, 0, vict, TO_NOTVICT);
@@ -128,7 +129,8 @@ void create_command_list(void)
/* count the commands in the command list */
i = 0;
while(*cmd_info[i].command != '\n') i++;
while (*cmd_info[i].command != '\n')
i++;
i++;
CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2);
@@ -137,21 +139,21 @@ void create_command_list(void)
i = 0;
j = 0;
k = 0;
while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) {
while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) {
if ((i < RESERVE_CMDS) || (j > top_of_socialt) ||
(str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1))
(str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1))
complete_cmd_info[k++] = cmd_info[i++];
else {
soc_mess_list[j].act_nr = k;
complete_cmd_info[k].command = soc_mess_list[j].command;
complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as;
complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position;
complete_cmd_info[k].command_pointer = do_action;
complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char;
complete_cmd_info[k++].subcmd = 0;
soc_mess_list[j].act_nr = k;
complete_cmd_info[k].command = soc_mess_list[j].command;
complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as;
complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position;
complete_cmd_info[k].command_pointer = do_action;
complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char;
complete_cmd_info[k++].subcmd = 0;
}
}
complete_cmd_info[k] = cmd_info[i];
complete_cmd_info[k] = cmd_info[i];
log("Command info rebuilt, %d total commands.", k);
}
@@ -166,29 +168,45 @@ void free_social_messages(void)
struct social_messg *mess;
int i;
for (i = 0;i <= top_of_socialt;i++) {
for (i = 0; i <= top_of_socialt; i++) {
mess = &soc_mess_list[i];
free_action(mess);
}
free(soc_mess_list);
}
void free_action(struct social_messg *mess) {
if (mess->command) free(mess->command);
if (mess->sort_as) free(mess->sort_as);
if (mess->char_no_arg) free(mess->char_no_arg);
if (mess->others_no_arg) free(mess->others_no_arg);
if (mess->char_found) free(mess->char_found);
if (mess->others_found) free(mess->others_found);
if (mess->vict_found) free(mess->vict_found);
if (mess->char_body_found) free(mess->char_body_found);
if (mess->others_body_found) free(mess->others_body_found);
if (mess->vict_body_found) free(mess->vict_body_found);
if (mess->not_found) free(mess->not_found);
if (mess->char_auto) free(mess->char_auto);
if (mess->others_auto) free(mess->others_auto);
if (mess->char_obj_found) free(mess->char_obj_found);
if (mess->others_obj_found) free(mess->others_obj_found);
void free_action(struct social_messg *mess)
{
if (mess->command)
free(mess->command);
if (mess->sort_as)
free(mess->sort_as);
if (mess->char_no_arg)
free(mess->char_no_arg);
if (mess->others_no_arg)
free(mess->others_no_arg);
if (mess->char_found)
free(mess->char_found);
if (mess->others_found)
free(mess->others_found);
if (mess->vict_found)
free(mess->vict_found);
if (mess->char_body_found)
free(mess->char_body_found);
if (mess->others_body_found)
free(mess->others_body_found);
if (mess->vict_body_found)
free(mess->vict_body_found);
if (mess->not_found)
free(mess->not_found);
if (mess->char_auto)
free(mess->char_auto);
if (mess->others_auto)
free(mess->others_auto);
if (mess->char_obj_found)
free(mess->char_obj_found);
if (mess->others_obj_found)
free(mess->others_obj_found);
memset(mess, 0, sizeof(struct social_messg));
}
@@ -222,11 +240,11 @@ ACMD(do_gmote)
int act_nr, length;
char arg[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
struct social_messg *action;
struct char_data *vict = NULL;
char_data *vict = NULL;
half_chop(argument, buf, arg);
if(subcmd)
if (subcmd)
for (length = strlen(buf), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
if (!strncmp(complete_cmd_info[cmd].command, buf, length))
break;
@@ -242,13 +260,13 @@ ACMD(do_gmote)
return;
}
action = &soc_mess_list[act_nr];
action = &soc_mess_list[act_nr];
if (!action->char_found)
*arg = '\0';
if (!*arg) {
if(!action->others_no_arg || !*action->others_no_arg) {
if (!action->others_no_arg || !*action->others_no_arg) {
send_to_char(ch, "Who are you going to do that to?\r\n");
return;
}
@@ -257,7 +275,7 @@ action = &soc_mess_list[act_nr];
send_to_char(ch, "%s\r\n", action->not_found);
return;
} else if (vict == ch) {
if(!action->others_auto || !*action->others_auto) {
if (!action->others_auto || !*action->others_auto) {
send_to_char(ch, "%s\r\n", action->char_auto);
return;
}
@@ -265,7 +283,7 @@ action = &soc_mess_list[act_nr];
} else {
if (GET_POS(vict) < action->min_victim_position) {
act("$N is not in a proper position for that.",
FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
return;
}
snprintf(buf, sizeof(buf), "Gemote: %s", action->others_found);
+1770 -1763
View File
File diff suppressed because it is too large Load Diff
+681 -654
View File
File diff suppressed because it is too large Load Diff
+297 -270
View File
@@ -15,12 +15,8 @@
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "spells.h"
#include "house.h"
#include "constants.h"
#include "dg_scripts.h"
#include "asciimap.h"
/******************************************************************************
@@ -33,29 +29,28 @@
#define DEFAULT_MAP_SIZE CONFIG_MAP_SIZE
#define MAX_MAP_SIZE (CANVAS_WIDTH - 1)/4
#define MAX_MAP_SIZE ((CANVAS_WIDTH - 1)/4)
#define MAX_MAP CANVAS_WIDTH
#define MAX_MAP_DIR 10
#define MAX_MAP_FOLLOW 10
#define MAX_MAP_DIR 10
#define SECT_EMPTY 30 /* anything greater than num sect types */
#define SECT_STRANGE (SECT_EMPTY + 1)
#define SECT_HERE (SECT_STRANGE + 1)
#define SECT_EMPTY 30 /* anything greater than num sect types */
#define SECT_STRANGE (SECT_EMPTY + 1)
#define SECT_HERE (SECT_STRANGE + 1)
#define DOOR_NS -1
#define DOOR_EW -2
#define DOOR_UP -3
#define DOOR_DOWN -4
#define DOOR_DIAGNE -5
#define DOOR_DIAGNW -6
#define VDOOR_NS -7
#define VDOOR_EW -8
#define VDOOR_DIAGNE -9
#define VDOOR_DIAGNW -10
#define DOOR_UP_AND_NE -11
#define DOOR_DOWN_AND_SE -12
#define DOOR_NONE -13
#define DOOR_NS (-1)
#define DOOR_EW (-2)
#define DOOR_UP (-3)
#define DOOR_DOWN (-4)
#define DOOR_DIAGNE (-5)
#define DOOR_DIAGNW (-6)
#define VDOOR_NS (-7)
#define VDOOR_EW (-8)
#define VDOOR_DIAGNE (-9)
#define VDOOR_DIAGNW (-10)
#define DOOR_UP_AND_NE (-11)
#define DOOR_DOWN_AND_SE (-12)
#define DOOR_NONE (-13)
#define NUM_DOOR_TYPES 13
#define MAP_CIRCLE 0
@@ -64,46 +59,44 @@
#define MAP_NORMAL 0
#define MAP_COMPACT 1
static bool show_worldmap(struct char_data *ch);
struct map_info_type
{
int sector_type;
int sector_type;
char disp[20];
};
static struct map_info_type door_info[] =
{
{ DOOR_NONE, " " },
{ DOOR_DOWN_AND_SE, "\tr-\tn\\ " },
{ DOOR_UP_AND_NE, "\tr+\tn/ " },
{ VDOOR_DIAGNW, " \tm+\tn " },
{ VDOOR_DIAGNE, " \tm+\tn "},
{ VDOOR_EW, " \tm+\tn " },
{ VDOOR_NS, " \tm+\tn "},
{ DOOR_DIAGNW, " \\ " },
{ DOOR_DIAGNE, " / " },
{ DOOR_DOWN, "\tr-\tn " },
{ DOOR_UP, "\tr+\tn " },
{ DOOR_EW, " - " },
{ DOOR_NS, " | " }
{DOOR_NONE, " "},
{DOOR_DOWN_AND_SE, "\tr-\tn\\ "},
{DOOR_UP_AND_NE, "\tr+\tn/ "},
{VDOOR_DIAGNW, " \tm+\tn "},
{VDOOR_DIAGNE, " \tm+\tn "},
{VDOOR_EW, " \tm+\tn "},
{VDOOR_NS, " \tm+\tn "},
{DOOR_DIAGNW, " \\ "},
{DOOR_DIAGNE, " / "},
{DOOR_DOWN, "\tr-\tn "},
{DOOR_UP, "\tr+\tn "},
{DOOR_EW, " - "},
{DOOR_NS, " | "}
};
static struct map_info_type compact_door_info[] =
{
{ DOOR_NONE, " " },
{ DOOR_DOWN_AND_SE, "\tR\\\tn" },
{ DOOR_UP_AND_NE, "\tR/\tn" },
{ VDOOR_DIAGNW, "\tm+\tn" },
{ VDOOR_DIAGNE, "\tm+\tn"},
{ VDOOR_EW, " \tm+\tn " },
{ VDOOR_NS, " \tm+\tn "},
{ DOOR_DIAGNW,"\\" },
{ DOOR_DIAGNE,"/" },
{ DOOR_DOWN, "\tr-\tn" },
{ DOOR_UP, "\tr+\tn" },
{ DOOR_EW, "-" },
{ DOOR_NS, " | " }
{DOOR_NONE, " "},
{DOOR_DOWN_AND_SE, "\tR\\\tn"},
{DOOR_UP_AND_NE, "\tR/\tn"},
{VDOOR_DIAGNW, "\tm+\tn"},
{VDOOR_DIAGNE, "\tm+\tn"},
{VDOOR_EW, " \tm+\tn "},
{VDOOR_NS, " \tm+\tn "},
{DOOR_DIAGNW, "\\"},
{DOOR_DIAGNE, "/"},
{DOOR_DOWN, "\tr-\tn"},
{DOOR_UP, "\tr+\tn"},
{DOOR_EW, "-"},
{DOOR_NS, " | "}
};
/* Add new sector types below for both map_info and world_map_info */
@@ -111,76 +104,76 @@ static struct map_info_type compact_door_info[] =
/* New sectors also need to be added to the perform_map function below */
static struct map_info_type map_info[] =
{
{ SECT_INSIDE, "\tc[\tn.\tc]\tn" }, /* 0 */
{ SECT_CITY, "\tc[\twC\tc]\tn" },
{ SECT_FIELD, "\tc[\tg,\tc]\tn" },
{ SECT_FOREST, "\tc[\tgY\tc]\tn" },
{ SECT_HILLS, "\tc[\tMm\tc]\tn" },
{ SECT_MOUNTAIN, "\tc[\trM\tc]\tn" }, /* 5 */
{ SECT_WATER_SWIM, "\tc[\tc~\tc]\tn" },
{ SECT_WATER_NOSWIM, "\tc[\tb=\tc]\tn" },
{ SECT_FLYING, "\tc[\tC^\tc]\tn" },
{ SECT_UNDERWATER, "\tc[\tbU\tc]\tn" },
{ -1, "" }, /* 10 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 15 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 20 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 25 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ SECT_EMPTY, " " }, /* 30 */
{ SECT_STRANGE, "\tc[\tR?\tc]\tn" },
{ SECT_HERE, "\tc[\tB!\tc]\tn" },
{SECT_INSIDE, "\tc[\tn.\tc]\tn"}, /* 0 */
{SECT_CITY, "\tc[\twC\tc]\tn"},
{SECT_FIELD, "\tc[\tg,\tc]\tn"},
{SECT_FOREST, "\tc[\tgY\tc]\tn"},
{SECT_HILLS, "\tc[\tMm\tc]\tn"},
{SECT_MOUNTAIN, "\tc[\trM\tc]\tn"}, /* 5 */
{SECT_WATER_SWIM, "\tc[\tc~\tc]\tn"},
{SECT_WATER_NOSWIM, "\tc[\tb=\tc]\tn"},
{SECT_FLYING, "\tc[\tC^\tc]\tn"},
{SECT_UNDERWATER, "\tc[\tbU\tc]\tn"},
{-1, ""}, /* 10 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 15 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 20 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 25 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{SECT_EMPTY, " "}, /* 30 */
{SECT_STRANGE, "\tc[\tR?\tc]\tn"},
{SECT_HERE, "\tc[\tB!\tc]\tn"},
};
static struct map_info_type world_map_info[] =
{
{ SECT_INSIDE, "\tn." }, /* 0 */
{ SECT_CITY, "\twC" },
{ SECT_FIELD, "\tg," },
{ SECT_FOREST, "\tgY" },
{ SECT_HILLS, "\tMm" },
{ SECT_MOUNTAIN, "\trM" }, /* 5 */
{ SECT_WATER_SWIM, "\tc~" },
{ SECT_WATER_NOSWIM, "\tb=" },
{ SECT_FLYING, "\tC^" },
{ SECT_UNDERWATER, "\tbU" },
{ -1, "" }, /* 10 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 15 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 20 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" }, /* 25 */
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ -1, "" },
{ SECT_EMPTY, " " }, /* 30 */
{ SECT_STRANGE, "\tR?" },
{ SECT_HERE, "\tB!" },
{SECT_INSIDE, "\tn."}, /* 0 */
{SECT_CITY, "\twC"},
{SECT_FIELD, "\tg,"},
{SECT_FOREST, "\tgY"},
{SECT_HILLS, "\tMm"},
{SECT_MOUNTAIN, "\trM"}, /* 5 */
{SECT_WATER_SWIM, "\tc~"},
{SECT_WATER_NOSWIM, "\tb="},
{SECT_FLYING, "\tC^"},
{SECT_UNDERWATER, "\tbU"},
{-1, ""}, /* 10 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 15 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 20 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""}, /* 25 */
{-1, ""},
{-1, ""},
{-1, ""},
{-1, ""},
{SECT_EMPTY, " "}, /* 30 */
{SECT_STRANGE, "\tR?"},
{SECT_HERE, "\tB!"},
};
@@ -191,11 +184,14 @@ static int offsets_worldmap[4][2] ={ {-1, 0},{ 0, 1},{ 1, 0},{ 0, -1} };
static int door_offsets[6][2] ={ {-1, 0},{ 0, 1},{ 1, 0},{ 0, -1},{ -1, 1},{ 1, 1} };
static int door_marks[6] = { DOOR_NS, DOOR_EW, DOOR_NS, DOOR_EW, DOOR_UP, DOOR_DOWN };
*/
static int offsets[10][2] ={ {-2, 0},{ 0, 2},{ 2, 0},{ 0, -2},{0, 0},{ 0, 0},{ -2, -2},{ -2, 2},{2, 2},{ 2, -2} };
static int offsets_worldmap[10][2] ={ {-1, 0},{ 0, 1},{ 1, 0},{ 0, -1},{0, 0},{ 0, 0},{ -1, -1},{ -1, 1},{1, 1},{ 1, -1} };
static int door_offsets[10][2] ={ {-1, 0},{ 0, 1},{ 1, 0},{ 0, -1},{ -1, 1},{ 1, 1},{ -1, -1},{ -1, 1},{ 1, 1},{ 1, -1} };
static int door_marks[10] = { DOOR_NS, DOOR_EW, DOOR_NS, DOOR_EW, DOOR_UP, DOOR_DOWN, DOOR_DIAGNW, DOOR_DIAGNE, DOOR_DIAGNW, DOOR_DIAGNE};
static int vdoor_marks[4] = { VDOOR_NS, VDOOR_EW, VDOOR_NS, VDOOR_EW };
static int offsets[10][2] = {{-2, 0}, {0, 2}, {2, 0}, {0, -2}, {0, 0}, {0, 0}, {-2, -2}, {-2, 2}, {2, 2}, {2, -2}};
static int offsets_worldmap[10][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {0, 0}, {0, 0}, {-1, -1}, {-1, 1}, {1, 1},
{1, -1}};
static int door_offsets[10][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {-1, -1}, {-1, 1}, {1, 1},
{1, -1}};
static int door_marks[10] = {DOOR_NS, DOOR_EW, DOOR_NS, DOOR_EW, DOOR_UP, DOOR_DOWN, DOOR_DIAGNW, DOOR_DIAGNE,
DOOR_DIAGNW, DOOR_DIAGNE};
static int vdoor_marks[4] = {VDOOR_NS, VDOOR_EW, VDOOR_NS, VDOOR_EW};
/******************************************************************************
* End Local (File Scope) Defines and Global Variables
*****************************************************************************/
@@ -203,118 +199,139 @@ static int vdoor_marks[4] = { VDOOR_NS, VDOOR_EW, VDOOR_NS, VDOOR_EW };
/******************************************************************************
* Begin Local (File Scope) Function Prototypes
*****************************************************************************/
static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, int max, sh_int xpos, sh_int ypos, bool worldmap);
static void MapArea(room_rnum room, const char_data *ch, int x, int y, int min, int max, int xpos, int ypos,
bool worldmap);
static char *StringMap(int centre, int size);
static char *WorldMap(int centre, int size, int mapshape, int maptype );
static char *WorldMap(int centre, int size, int mapshape, int maptype);
static char *CompactStringMap(int centre, int size);
static void perform_map( struct char_data *ch, char *argument, bool worldmap );
static void perform_map(char_data *ch, char *argument, bool worldmap);
static bool show_worldmap(const char_data *ch);
/******************************************************************************
* End Local (File Scope) Function Prototypes
*****************************************************************************/
bool can_see_map(struct char_data *ch) {
bool can_see_map(const char_data *ch)
{
/* Is the map funcionality disabled? */
if (CONFIG_MAP == MAP_OFF)
return FALSE;
else if ((CONFIG_MAP == MAP_IMM_ONLY) && (GET_LEVEL(ch) < LVL_IMMORT))
if (CONFIG_MAP == MAP_OFF || (CONFIG_MAP == MAP_IMM_ONLY && GET_LEVEL(ch) < LVL_IMMORT))
return FALSE;
return TRUE;
}
/* MapArea function - create the actual map */
static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min, int max, sh_int xpos, sh_int ypos, bool worldmap)
static void MapArea(const room_rnum room, const char_data *ch, const int x, const int y, // NOLINT(*-no-recursion)
const int min, const int max, const int xpos, const int ypos, const bool worldmap)
{
room_rnum prospect_room;
struct room_direction_data *pexit;
int door, ew_size=0, ns_size=0, x_exit_pos=0, y_exit_pos=0;
sh_int prospect_xpos, prospect_ypos;
int door;
const int ew_size = 0, ns_size = 0, x_exit_pos = 0, y_exit_pos = 0;
int prospect_xpos, prospect_ypos;
if (map[x][y] < 0)
return; /* this is a door */
/* marks the room as visited */
if(room == IN_ROOM(ch))
if (room == IN_ROOM(ch))
map[x][y] = SECT_HERE;
else
map[x][y] = SECT(room);
if ( (x < min) || ( y < min) || ( x > max ) || ( y > max) ) return;
if (x < min || y < min || x > max || y > max)
return;
/* Check for exits */
for ( door = 0; door < MAX_MAP_DIR; door++ ) {
for (door = 0; door < MAX_MAP_DIR; door++) {
if( door < MAX_MAP_FOLLOW &&
xpos+door_offsets[door][0] >= 0 &&
xpos+door_offsets[door][0] <= ns_size &&
ypos+door_offsets[door][1] >= 0 &&
ypos+door_offsets[door][1] <= ew_size)
{ /* Virtual exit */
if (xpos + door_offsets[door][0] >= 0 &&
xpos + door_offsets[door][0] <= ns_size &&
ypos + door_offsets[door][1] >= 0 &&
ypos + door_offsets[door][1] <= ew_size) { /* Virtual exit */
// linting tells me vdoor_marks will have an index out of bounds here, since doors can have more values than
// vdoor_marks contains. Either we're not actually getting here for those values, or we're not getting here at all.
// Adding a guard for now. --welcor 20241230
if (door < sizeof(vdoor_marks))
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = vdoor_marks[door];
map[x+door_offsets[door][0]][y+door_offsets[door][1]] = vdoor_marks[door] ;
if (map[x+offsets[door][0]][y+offsets[door][1]] == SECT_EMPTY )
MapArea(room,ch,x + offsets[door][0], y + offsets[door][1], min, max, xpos+door_offsets[door][0], ypos+door_offsets[door][1], worldmap);
if (map[x + offsets[door][0]][y + offsets[door][1]] == SECT_EMPTY)
MapArea(room, ch, x + offsets[door][0], y + offsets[door][1], min, max, xpos + door_offsets[door][0],
ypos + door_offsets[door][1], worldmap);
continue;
}
if ( (pexit = world[room].dir_option[door]) != NULL &&
(pexit->to_room > 0 ) && (pexit->to_room != NOWHERE) &&
(!IS_SET(pexit->exit_info, EX_CLOSED)) &&
(!IS_SET(pexit->exit_info, EX_HIDDEN) || PRF_FLAGGED(ch, PRF_HOLYLIGHT)) )
{ /* A real exit */
if ((pexit = world[room].dir_option[door]) != NULL &&
pexit->to_room > 0 && pexit->to_room != NOWHERE &&
!IS_SET(pexit->exit_info, EX_CLOSED) &&
(!IS_SET(pexit->exit_info, EX_HIDDEN) || PRF_FLAGGED(ch, PRF_HOLYLIGHT))) { /* A real exit */
/* But is the door here... */
switch (door) {
case NORTH:
if(xpos > 0 || ypos!=y_exit_pos) continue;
if (xpos > 0 || ypos != y_exit_pos)
continue;
break;
case SOUTH:
if(xpos < ns_size || ypos!=y_exit_pos) continue;
if (xpos < ns_size || ypos != y_exit_pos)
continue;
break;
case EAST:
if(ypos < ew_size || xpos!=x_exit_pos) continue;
if (ypos < ew_size || xpos != x_exit_pos)
continue;
break;
case WEST:
if(ypos > 0 || xpos!=x_exit_pos) continue;
if (ypos > 0 || xpos != x_exit_pos)
continue;
break;
case NORTHWEST:
if(xpos > 0 || ypos!=y_exit_pos || ypos > 0 || xpos!=x_exit_pos) continue;
if (xpos > 0 || ypos != y_exit_pos || ypos > 0 || xpos != x_exit_pos)
continue;
break;
case NORTHEAST:
if(xpos > 0 || ypos!=y_exit_pos || ypos < ew_size || xpos!=x_exit_pos) continue;
if (xpos > 0 || ypos != y_exit_pos || ypos < ew_size || xpos != x_exit_pos)
continue;
break;
case SOUTHEAST:
if(xpos < ns_size || ypos!=y_exit_pos || ypos < ew_size || xpos!=x_exit_pos) continue;
if (xpos < ns_size || ypos != y_exit_pos || ypos < ew_size || xpos != x_exit_pos)
continue;
break;
case SOUTHWEST:
if(xpos < ns_size || ypos!=y_exit_pos || ypos > 0 || xpos!=x_exit_pos) continue;
if (xpos < ns_size || ypos != y_exit_pos || ypos > 0 || xpos != x_exit_pos)
continue;
break;
case UP:
case DOWN:
/* no check for up/down here */
break;
default:
log("Default case reached in switch in door check in asciimap. "
"Are any directions unaccounted for? door = %d", door);
}
/* if ( (x < min) || ( y < min) || ( x > max ) || ( y > max) ) return;*/
/* if ( (x < min) || ( y < min) || ( x > max ) || ( y > max) ) return;*/
prospect_room = pexit->to_room;
/* one way into area OR maze */
if ( world[prospect_room].dir_option[rev_dir[door]] &&
world[prospect_room].dir_option[rev_dir[door]]->to_room != room) {
map[x][y] = SECT_STRANGE;
/* one way into area OR maze */
if (world[prospect_room].dir_option[rev_dir[door]] &&
world[prospect_room].dir_option[rev_dir[door]]->to_room != room) {
map[x][y] = SECT_STRANGE;
return;
}
}
if(!worldmap) {
if ((map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_NONE) ||
(map[x+door_offsets[door][0]][y+door_offsets[door][1]] == SECT_EMPTY) ) {
map[x+door_offsets[door][0]][y+door_offsets[door][1]] = door_marks[door];
if (!worldmap) {
if (map[x + door_offsets[door][0]][y + door_offsets[door][1]] == DOOR_NONE ||
map[x + door_offsets[door][0]][y + door_offsets[door][1]] == SECT_EMPTY) {
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = door_marks[door];
} else {
if ( ((door == NORTHEAST) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_UP)) ||
((door == UP) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DIAGNE)) ) {
map[x+door_offsets[door][0]][y+door_offsets[door][1]] = DOOR_UP_AND_NE;
}
else if ( ((door == SOUTHEAST) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DOWN)) ||
((door == DOWN) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_DIAGNW)) ) {
map[x+door_offsets[door][0]][y+door_offsets[door][1]] = DOOR_DOWN_AND_SE;
if ((door == NORTHEAST && map[x + door_offsets[door][0]][y + door_offsets[door][1]] == DOOR_UP) ||
(door == UP && map[x + door_offsets[door][0]][y + door_offsets[door][1]] == DOOR_DIAGNE)) {
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = DOOR_UP_AND_NE;
} else if ((door == SOUTHEAST && map[x + door_offsets[door][0]][y + door_offsets[door][1]] == DOOR_DOWN)
||
(door == DOWN && map[x + door_offsets[door][0]][y + door_offsets[door][1]] == DOOR_DIAGNW)) {
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = DOOR_DOWN_AND_SE;
}
}
}
@@ -324,81 +341,86 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min,
case NORTH:
prospect_xpos = ns_size;
case SOUTH:
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size/2;
break;
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size / 2;
break;
case WEST:
prospect_ypos = ew_size;
case EAST:
prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size/2;
prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size / 2;
break;
case NORTHEAST:
case NORTHWEST:
case SOUTHEAST:
case SOUTHWEST:
prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size/2;
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size/2;
prospect_xpos = world[prospect_room].dir_option[rev_dir[door]] ? x_exit_pos : ns_size / 2;
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size / 2;
break;
case UP:
case DOWN:
/* no check for up/down here */
break;
default:
log("Default case reached in prospect switch in asciimap. Are any directions unaccounted for? door = %d", door);
}
if(worldmap) {
if ( door < MAX_MAP_FOLLOW && map[x+offsets_worldmap[door][0]][y+offsets_worldmap[door][1]] == SECT_EMPTY )
MapArea(pexit->to_room,ch,x + offsets_worldmap[door][0], y + offsets_worldmap[door][1], min, max, prospect_xpos, prospect_ypos, worldmap);
if (worldmap) {
if (map[x + offsets_worldmap[door][0]][y + offsets_worldmap[door][1]] == SECT_EMPTY)
MapArea(pexit->to_room, ch, x + offsets_worldmap[door][0], y + offsets_worldmap[door][1], min, max,
prospect_xpos, prospect_ypos, worldmap);
} else {
if ( door < MAX_MAP_FOLLOW && map[x+offsets[door][0]][y+offsets[door][1]] == SECT_EMPTY )
MapArea(pexit->to_room,ch,x + offsets[door][0], y + offsets[door][1], min, max, prospect_xpos, prospect_ypos, worldmap);
if (map[x + offsets[door][0]][y + offsets[door][1]] == SECT_EMPTY)
MapArea(pexit->to_room, ch, x + offsets[door][0], y + offsets[door][1], min, max, prospect_xpos,
prospect_ypos, worldmap);
}
} /* end if exit there */
}
return;
}
/* Returns a string representation of the map */
// ReSharper disable once CppDFAConstantParameter
static char *StringMap(int centre, int size)
{
static char strmap[MAX_MAP*MAX_MAP*11 + MAX_MAP*2 + 1];
static char strmap[MAX_MAP * MAX_MAP * 11 + MAX_MAP * 2 + 1];
char *mp = strmap;
char *tmp;
int x, y;
/* every row */
for (x = centre - CANVAS_HEIGHT/2; x <= centre + CANVAS_HEIGHT/2; x++) {
for (x = centre - CANVAS_HEIGHT / 2; x <= centre + CANVAS_HEIGHT / 2; x++) {
/* every column */
for (y = centre - CANVAS_WIDTH/6; y <= centre + CANVAS_WIDTH/6; y++) {
if (abs(centre - x)<=size && abs(centre-y)<=size)
tmp = (map[x][y]<0) ? \
door_info[NUM_DOOR_TYPES + map[x][y]].disp : \
map_info[map[x][y]].disp ;
for (y = centre - CANVAS_WIDTH / 6; y <= centre + CANVAS_WIDTH / 6; y++) {
if (abs(centre - x) <= size && abs(centre - y) <= size)
tmp = map[x][y] < 0 ? door_info[NUM_DOOR_TYPES + map[x][y]].disp : map_info[map[x][y]].disp;
else
tmp = map_info[SECT_EMPTY].disp;
tmp = map_info[SECT_EMPTY].disp;
strcpy(mp, tmp);
mp += strlen(tmp);
}
strcpy(mp, "\r\n");
mp+=2;
mp += 2;
}
*mp='\0';
*mp = '\0';
return strmap;
}
static char *WorldMap(int centre, int size, int mapshape, int maptype )
// ReSharper disable once CppDFAConstantParameter
static char *WorldMap(int centre, int size, int mapshape, int maptype)
{
static char strmap[MAX_MAP*MAX_MAP*4 + MAX_MAP*2 + 1];
static char strmap[MAX_MAP * MAX_MAP * 4 + MAX_MAP * 2 + 1];
char *mp = strmap;
int x, y;
int xmin, xmax, ymin, ymax;
switch(maptype) {
case MAP_COMPACT:
xmin = centre - size;
xmax = centre + size;
ymin = centre - 2*size;
ymax = centre + 2*size;
break;
default:
xmin = centre - CANVAS_HEIGHT/2;
xmax = centre + CANVAS_HEIGHT/2;
ymin = centre - CANVAS_WIDTH/2;
ymax = centre + CANVAS_WIDTH/2;
if (maptype == MAP_COMPACT) {
xmin = centre - size;
xmax = centre + size;
ymin = centre - 2 * size;
ymax = centre + 2 * size;
} else {
xmin = centre - CANVAS_HEIGHT / 2;
xmax = centre + CANVAS_HEIGHT / 2;
ymin = centre - CANVAS_WIDTH / 2;
ymax = centre + CANVAS_WIDTH / 2;
}
@@ -407,26 +429,28 @@ static char *WorldMap(int centre, int size, int mapshape, int maptype )
for (x = xmin; x <= xmax; x++) {
/* every column */
/* for (y = centre - (2*size) ; y <= centre + (2*size) ; y++) { */
for (y = ymin ; y <= ymax ; y++) {
for (y = ymin; y <= ymax; y++) {
if((mapshape == MAP_RECTANGLE && abs(centre - y) <= size*2 && abs(centre - x) <= size ) ||
((mapshape == MAP_CIRCLE) && (centre-x)*(centre-x) + (centre-y)*(centre-y)/4 <= (size * size + 1))) {
if ((mapshape == MAP_RECTANGLE && abs(centre - y) <= size * 2 && abs(centre - x) <= size) ||
(mapshape == MAP_CIRCLE && (centre - x) * (centre - x) + (centre - y) * (centre - y) / 4 <= size * size +
1)) {
strcpy(mp, world_map_info[map[x][y]].disp);
mp += strlen(world_map_info[map[x][y]].disp);
} else {
strcpy(mp++, " ");
strcpy(mp++, " ");
}
}
strcpy(mp, "\tn\r\n");
mp+=4;
mp += 4;
}
*mp='\0';
*mp = '\0';
return strmap;
}
// ReSharper disable once CppDFAConstantParameter
static char *CompactStringMap(int centre, int size)
{
static char strmap[MAX_MAP*MAX_MAP*12 + MAX_MAP*2 + 1];
static char strmap[MAX_MAP * MAX_MAP * 12 + MAX_MAP * 2 + 1];
char *mp = strmap;
int x, y;
@@ -434,56 +458,53 @@ static char *CompactStringMap(int centre, int size)
for (x = centre - size; x <= centre + size; x++) {
/* every column */
for (y = centre - size; y <= centre + size; y++) {
strcpy(mp, (map[x][y]<0) ? \
compact_door_info[NUM_DOOR_TYPES + map[x][y]].disp : \
map_info[map[x][y]].disp);
mp += strlen((map[x][y]<0) ? \
compact_door_info[NUM_DOOR_TYPES + map[x][y]].disp : \
map_info[map[x][y]].disp);
strcpy(mp, map[x][y] < 0 ? compact_door_info[NUM_DOOR_TYPES + map[x][y]].disp : map_info[map[x][y]].disp);
mp += strlen(map[x][y] < 0 ? compact_door_info[NUM_DOOR_TYPES + map[x][y]].disp : map_info[map[x][y]].disp);
}
strcpy(mp, "\r\n");
mp+=2;
mp += 2;
}
*mp='\0';
*mp = '\0';
return strmap;
}
/* Display a nicely formatted map with a legend */
static void perform_map( struct char_data *ch, char *argument, bool worldmap )
static void perform_map(char_data *ch, char *argument, bool worldmap)
{
int size = DEFAULT_MAP_SIZE;
int centre, x, y, min, max;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], buf1[MAX_STRING_LENGTH], buf2[
MAX_STRING_LENGTH];
int count = 0;
int ew_size=0, ns_size=0;
const int ew_size = 0, ns_size = 0;
int mapshape = MAP_CIRCLE;
two_arguments( argument, arg1 , arg2 );
if(*arg1)
{
size = atoi(arg1);
two_arguments(argument, arg1, arg2);
if (*arg1) {
size = parse_int(arg1);
}
if (*arg2)
{
if (is_abbrev(arg2, "normal")) worldmap=FALSE;
else if (is_abbrev(arg2, "world")) worldmap=TRUE;
if (*arg2) {
if (is_abbrev(arg2, "normal"))
worldmap = FALSE;
else if (is_abbrev(arg2, "world"))
worldmap = TRUE;
else {
send_to_char(ch, "Usage: \tymap <distance> [ normal | world ]\tn");
return;
}
}
if(size<0) {
if (size < 0) {
size = -size;
mapshape = MAP_RECTANGLE;
}
size = URANGE(1,size,MAX_MAP_SIZE);
size = URANGE(1, size, MAX_MAP_SIZE);
centre = MAX_MAP/2;
centre = MAX_MAP / 2;
if(worldmap) {
min = centre - 2*size;
max = centre + 2*size;
if (worldmap) {
min = centre - 2 * size;
max = centre + 2 * size;
} else {
min = centre - size;
max = centre + size;
@@ -491,19 +512,19 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
/* Blank the map */
for (x = 0; x < MAX_MAP; ++x)
for (y = 0; y < MAX_MAP; ++y)
map[x][y]= (!(y%2) && !worldmap) ? DOOR_NONE : SECT_EMPTY;
for (y = 0; y < MAX_MAP; ++y)
map[x][y] = !(y % 2) && !worldmap ? DOOR_NONE : SECT_EMPTY;
/* starts the mapping with the centre room */
MapArea(IN_ROOM(ch), ch, centre, centre, min, max, ns_size/2, ew_size/2, worldmap);
MapArea(IN_ROOM(ch), ch, centre, centre, min, max, ns_size / 2, ew_size / 2, worldmap);
/* marks the center, where ch is */
map[centre][centre] = SECT_HERE;
/* Feel free to put your own MUD name or header in here */
send_to_char(ch, " \tY-\tytbaMUD Map System\tY-\tn\r\n"
"\tD .-.__--.,--.__.-.\tn\r\n" );
"\tD .-.__--.,--.__.-.\tn\r\n");
// TODO switch to snprintf
count += sprintf(buf + count, "\tn\tn\tn%s Up\\\\", door_info[NUM_DOOR_TYPES + DOOR_UP].disp);
count += sprintf(buf + count, "\tn\tn\tn%s Down\\\\", door_info[NUM_DOOR_TYPES + DOOR_DOWN].disp);
count += sprintf(buf + count, "\tn%s You\\\\", map_info[SECT_HERE].disp);
@@ -521,18 +542,18 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
strcpy(buf, strfrmt(buf, LEGEND_WIDTH, CANVAS_HEIGHT + 2, FALSE, TRUE, TRUE));
/* Start with an empty column */
strcpy(buf1, strfrmt("",0, CANVAS_HEIGHT + 2, FALSE, FALSE, TRUE));
strcpy(buf1, strfrmt("", 0, CANVAS_HEIGHT + 2, FALSE, FALSE, TRUE));
/* Paste the legend */
strcpy(buf2, strpaste(buf1, buf, "\tD | \tn"));
/* Set up the map */
memset(buf, ' ', CANVAS_WIDTH);
count = (CANVAS_WIDTH);
if(worldmap)
count += sprintf(buf + count , "\r\n%s", WorldMap(centre, size, mapshape, MAP_NORMAL));
count = CANVAS_WIDTH;
if (worldmap)
count += sprintf(buf + count, "\r\n%s", WorldMap(centre, size, mapshape, MAP_NORMAL));
else
count += sprintf(buf + count , "\r\n%s", StringMap(centre, size));
count += sprintf(buf + count, "\r\n%s", StringMap(centre, size));
memset(buf + count, ' ', CANVAS_WIDTH);
strcpy(buf + count + CANVAS_WIDTH, "\r\n");
/* Paste it on */
@@ -543,13 +564,13 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
send_to_char(ch, "%s", buf2);
send_to_char(ch, "\tD `.-.__--.,-.__.-.-'\tn\r\n");
return;
}
/* Display a string with the map beside it */
void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
void str_and_map(char *str, char_data *ch, room_vnum target_room)
{
int size, centre, x, y, min, max, char_size;
int ew_size=0, ns_size=0;
int ew_size = 0, ns_size = 0;
bool worldmap;
/* Check MUDs map config options - if disabled, just show room decsription */
@@ -560,48 +581,54 @@ void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
worldmap = show_worldmap(ch);
if(!PRF_FLAGGED(ch, PRF_AUTOMAP)) {
if (!PRF_FLAGGED(ch, PRF_AUTOMAP)) {
send_to_char(ch, "%s", strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
return;
}
size = CONFIG_MINIMAP_SIZE;
centre = MAX_MAP/2;
min = centre - 2*size;
max = centre + 2*size;
centre = MAX_MAP / 2;
min = centre - 2 * size;
max = centre + 2 * size;
for (x = 0; x < MAX_MAP; ++x)
for (y = 0; y < MAX_MAP; ++y)
map[x][y]= (!(y%2) && !worldmap) ? DOOR_NONE : SECT_EMPTY;
map[x][y] = !(y % 2) && !worldmap ? DOOR_NONE : SECT_EMPTY;
/* starts the mapping with the center room */
MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldmap );
MapArea(target_room, ch, centre, centre, min, max, ns_size / 2, ew_size / 2, worldmap);
map[centre][centre] = SECT_HERE;
/* char_size = rooms + doors + padding */
if(worldmap)
if (worldmap)
char_size = size * 4 + 5;
else
char_size = 3*(size+1) + (size) + 4;
char_size = 3 * (size + 1) + size + 4;
if(worldmap)
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " \tn"));
if (worldmap)
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size * 2 + 1, FALSE, TRUE, TRUE),
WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " \tn"));
else
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), CompactStringMap(centre, size), " \tn"));
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size * 2 + 1, FALSE, TRUE, TRUE),
CompactStringMap(centre, size), " \tn"));
}
static bool show_worldmap(struct char_data *ch) {
static bool show_worldmap(const char_data *ch)
{
room_rnum rm = IN_ROOM(ch);
zone_rnum zn = GET_ROOM_ZONE(rm);
if (ROOM_FLAGGED(rm, ROOM_WORLDMAP)) return TRUE;
if (ZONE_FLAGGED(zn, ZONE_WORLDMAP)) return TRUE;
if (ROOM_FLAGGED(rm, ROOM_WORLDMAP))
return TRUE;
if (ZONE_FLAGGED(zn, ZONE_WORLDMAP))
return TRUE;
return FALSE;
}
ACMD(do_map) {
ACMD(do_map)
{
if (!can_see_map(ch)) {
send_to_char(ch, "Sorry, the map is disabled!\r\n");
return;
+2 -2
View File
@@ -16,8 +16,8 @@
#define MAP_IMM_ONLY 2
/* Exported function prototypes */
bool can_see_map(struct char_data *ch);
void str_and_map(char *str, struct char_data *ch, room_vnum target_room );
bool can_see_map(const char_data *ch);
void str_and_map(char *str, char_data *ch, room_vnum target_room);
ACMD(do_map);
#endif /* ASCIIMAP_H_*/
+39 -41
View File
@@ -14,7 +14,6 @@
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "ban.h"
@@ -28,44 +27,44 @@ static char *invalid_list[MAX_INVALID_NAMES];
/* local utility functions */
static void write_ban_list(void);
static void _write_one_node(FILE *fp, struct ban_list_element *node);
static void write_one_node(FILE *fp, struct ban_list_element *node);
static const char *ban_types[] = {
"no",
"new",
"select",
"all",
"ERROR"
"no",
"new",
"select",
"all",
"ERROR"
};
void load_banned(void)
{
FILE *fl;
int i, date;
int i;
char site_name[BANNED_SITE_LENGTH + 1], ban_type[100];
char name[MAX_NAME_LENGTH + 1];
char name[MAX_NAME_LENGTH + 1], date_str[30];
struct ban_list_element *next_node;
ban_list = 0;
if (!(fl = fopen(BAN_FILE, "r"))) {
if ((fl = fopen(BAN_FILE, "r")) != NULL) {
if (errno != ENOENT) {
log("SYSERR: Unable to open banfile '%s': %s", BAN_FILE, strerror(errno));
} else
log(" Ban file '%s' doesn't exist.", BAN_FILE);
return;
}
while (fscanf(fl, " %s %s %d %s ", ban_type, site_name, &date, name) == 4) {
while (fscanf(fl, " %s %s %s %s ", ban_type, site_name, date_str, name) == 4) {
CREATE(next_node, struct ban_list_element, 1);
strncpy(next_node->site, site_name, BANNED_SITE_LENGTH); /* strncpy: OK (n_n->site:BANNED_SITE_LENGTH+1) */
strncpy(next_node->site, site_name, BANNED_SITE_LENGTH); /* strncpy: OK (n_n->site:BANNED_SITE_LENGTH+1) */
next_node->site[BANNED_SITE_LENGTH] = '\0';
strncpy(next_node->name, name, MAX_NAME_LENGTH); /* strncpy: OK (n_n->name:MAX_NAME_LENGTH+1) */
strncpy(next_node->name, name, MAX_NAME_LENGTH); /* strncpy: OK (n_n->name:MAX_NAME_LENGTH+1) */
next_node->name[MAX_NAME_LENGTH] = '\0';
next_node->date = date;
next_node->date = parse_int(date_str);
for (i = BAN_NOT; i <= BAN_ALL; i++)
if (!strcmp(ban_type, ban_types[i]))
next_node->type = i;
next_node->type = i;
next_node->next = ban_list;
ban_list = next_node;
@@ -81,25 +80,25 @@ int isbanned(char *hostname)
char *nextchar;
if (!hostname || !*hostname)
return (0);
return 0;
i = 0;
for (nextchar = hostname; *nextchar; nextchar++)
*nextchar = LOWER(*nextchar);
for (banned_node = ban_list; banned_node; banned_node = banned_node->next)
if (strstr(hostname, banned_node->site)) /* if hostname is a substring */
if (strstr(hostname, banned_node->site)) /* if hostname is a substring */
i = MAX(i, banned_node->type);
return (i);
return i;
}
static void _write_one_node(FILE *fp, struct ban_list_element *node)
static void write_one_node(FILE *fp, struct ban_list_element *node) // NOLINT(*-no-recursion)
{
if (node) {
_write_one_node(fp, node->next);
write_one_node(fp, node->next);
fprintf(fp, "%s %s %ld %s\n", ban_types[node->type],
node->site, (long) node->date, node->name);
node->site, node->date, node->name);
}
}
@@ -107,13 +106,12 @@ static void write_ban_list(void)
{
FILE *fl;
if (!(fl = fopen(BAN_FILE, "w"))) {
if ((fl = fopen(BAN_FILE, "w")) == NULL) {
perror("SYSERR: Unable to open '" BAN_FILE "' for writing");
return;
}
_write_one_node(fl, ban_list);/* recursively write from end to start */
write_one_node(fl, ban_list); /* recursively write from end to start */
fclose(fl);
return;
}
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-15.15s %-16.16s\r\n"
@@ -130,21 +128,21 @@ ACMD(do_ban)
return;
}
send_to_char(ch, BAN_LIST_FORMAT,
"Banned Site Name",
"Ban Type",
"Banned On",
"Banned By");
"Banned Site Name",
"Ban Type",
"Banned On",
"Banned By");
send_to_char(ch, BAN_LIST_FORMAT,
"---------------------------------",
"---------------------------------",
"---------------------------------",
"---------------------------------");
"---------------------------------",
"---------------------------------",
"---------------------------------",
"---------------------------------");
for (ban_node = ban_list; ban_node; ban_node = ban_node->next) {
if (ban_node->date) {
strftime(timestr, sizeof(timestr), "%a %b %d %Y", localtime(&(ban_node->date)));
} else
strcpy(timestr, "Unknown"); /* strcpy: OK (strlen("Unknown") < 16) */
strcpy(timestr, "Unknown"); /* strcpy: OK (strlen("Unknown") < 16) */
send_to_char(ch, BAN_LIST_FORMAT, ban_node->site, ban_types[ban_node->type], timestr, ban_node->name);
}
@@ -168,11 +166,11 @@ ACMD(do_ban)
}
CREATE(ban_node, struct ban_list_element, 1);
strncpy(ban_node->site, site, BANNED_SITE_LENGTH); /* strncpy: OK (b_n->site:BANNED_SITE_LENGTH+1) */
strncpy(ban_node->site, site, BANNED_SITE_LENGTH); /* strncpy: OK (b_n->site:BANNED_SITE_LENGTH+1) */
ban_node->site[BANNED_SITE_LENGTH] = '\0';
for (nextchar = ban_node->site; *nextchar; nextchar++)
*nextchar = LOWER(*nextchar);
strncpy(ban_node->name, GET_NAME(ch), MAX_NAME_LENGTH); /* strncpy: OK (b_n->size:MAX_NAME_LENGTH+1) */
strncpy(ban_node->name, GET_NAME(ch), MAX_NAME_LENGTH); /* strncpy: OK (b_n->size:MAX_NAME_LENGTH+1) */
ban_node->name[MAX_NAME_LENGTH] = '\0';
ban_node->date = time(0);
@@ -184,7 +182,7 @@ ACMD(do_ban)
ban_list = ban_node;
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s has banned %s for %s players.",
GET_NAME(ch), site, ban_types[ban_node->type]);
GET_NAME(ch), site, ban_types[ban_node->type]);
send_to_char(ch, "Site banned.\r\n");
write_ban_list();
}
@@ -216,19 +214,19 @@ ACMD(do_unban)
REMOVE_FROM_LIST(ban_node, ban_list, next);
send_to_char(ch, "Site unbanned.\r\n");
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s removed the %s-player ban on %s.",
GET_NAME(ch), ban_types[ban_node->type], ban_node->site);
// ReSharper disable once CppDFANullDereference
GET_NAME(ch), ban_types[ban_node->type], ban_node->site);
free(ban_node);
write_ban_list();
}
/* Check for invalid names (i.e., profanity, etc.) Written by Sharon P Garza. */
int valid_name(char *newname)
int valid_name(const char *newname)
{
int i, vowels = 0;
struct descriptor_data *dt;
descriptor_data *dt;
char tempname[MAX_INPUT_LENGTH];
/* Make sure someone isn't trying to create this same name. We want to do a
@@ -290,7 +288,7 @@ void read_invalid_list(void)
FILE *fp;
char temp[256];
if (!(fp = fopen(XNAME_FILE, "r"))) {
if ((fp = fopen(XNAME_FILE, "r")) != NULL) {
perror("SYSERR: Unable to open '" XNAME_FILE "' for reading");
return;
}
+12 -12
View File
@@ -1,18 +1,18 @@
/**
* @file boards.h
* Header file for the bulletin board system (boards.c).
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*
* @todo Utility functions that could easily be moved elsewhere have been
* marked. Suggest a review of all utility functions (aka. non ACMDs) and
* determine if the utility functions should be placed into a lower level
* shared module.
* shared module.
*
*/
#ifndef _BAN_H_
@@ -26,18 +26,18 @@
#define BANNED_SITE_LENGTH 50
struct ban_list_element {
char site[BANNED_SITE_LENGTH+1];
int type;
time_t date;
char name[MAX_NAME_LENGTH+1];
struct ban_list_element *next;
char site[BANNED_SITE_LENGTH+1];
int type;
time_t date;
char name[MAX_NAME_LENGTH+1];
struct ban_list_element *next;
};
/* Global functions */
/* Utility Functions */
void load_banned(void);
int isbanned(char *hostname);
int valid_name(char *newname);
int valid_name(const char *newname);
void read_invalid_list(void);
void free_invalid_list(void);
/* Command functions without subcommands */
+98 -96
View File
@@ -46,13 +46,13 @@
/* Format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end. Be sure
* to also change NUM_OF_BOARDS in board.h*/
struct board_info_type board_info[NUM_OF_BOARDS] = {
{3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 0},
{3098, LVL_IMMORT, LVL_IMMORT, LVL_GRGOD, LIB_ETC "board.immortal", 0},
{3097, LVL_IMMORT, LVL_GRGOD, LVL_IMPL, LIB_ETC "board.freeze", 0},
{3096, 0, 0, LVL_IMMORT, LIB_ETC "board.social", 0},
{1226, 0, 0, LVL_IMPL, LIB_ETC "board.builder", 0},
{1227, 0, 0, LVL_IMPL, LIB_ETC "board.staff", 0},
{1228, 0, 0, LVL_IMPL, LIB_ETC "board.advertising", 0},
{3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 0},
{3098, LVL_IMMORT, LVL_IMMORT, LVL_GRGOD, LIB_ETC "board.immortal", 0},
{3097, LVL_IMMORT, LVL_GRGOD, LVL_IMPL, LIB_ETC "board.freeze", 0},
{3096, 0, 0, LVL_IMMORT, LIB_ETC "board.social", 0},
{1226, 0, 0, LVL_IMPL, LIB_ETC "board.builder", 0},
{1227, 0, 0, LVL_IMPL, LIB_ETC "board.staff", 0},
{1228, 0, 0, LVL_IMPL, LIB_ETC "board.advertising", 0},
};
/* local (file scope) global variables */
@@ -63,7 +63,7 @@ static struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES];
/* local static utility functions */
static int find_slot(void);
static int find_board(struct char_data *ch);
static int find_board(const char_data *ch);
static void init_boards(void);
static void board_reset_board(int board_type);
static void board_clear_board(int board_type);
@@ -75,29 +75,29 @@ static int find_slot(void)
for (i = 0; i < INDEX_SIZE; i++)
if (!msg_storage_taken[i]) {
msg_storage_taken[i] = 1;
return (i);
return i;
}
return (-1);
return -1;
}
/* search the room ch is standing in to find which board he's looking at */
static int find_board(struct char_data *ch)
static int find_board(const char_data *ch)
{
struct obj_data *obj;
obj_data *obj;
int i;
for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next_content)
for (i = 0; i < NUM_OF_BOARDS; i++)
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
return (i);
return i;
if (GET_LEVEL(ch) >= LVL_IMMORT)
for (obj = ch->carrying; obj; obj = obj->next_content)
for (i = 0; i < NUM_OF_BOARDS; i++)
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
return (i);
return i;
return (-1);
return -1;
}
static void init_boards(void)
@@ -112,12 +112,12 @@ static void init_boards(void)
for (i = 0; i < NUM_OF_BOARDS; i++) {
if ((BOARD_RNUM(i) = real_object(BOARD_VNUM(i))) == NOTHING) {
log("SYSERR: Fatal board error: board vnum %d does not exist!",
BOARD_VNUM(i));
BOARD_VNUM(i));
fatal_error = 1;
}
num_of_msgs[i] = 0;
for (j = 0; j < MAX_BOARD_MESSAGES; j++) {
memset((char *) &(msg_index[i][j]), 0, sizeof(struct board_msginfo));
memset((char *)&msg_index[i][j], 0, sizeof(struct board_msginfo));
msg_index[i][j].slot_num = -1;
}
board_load_board(i);
@@ -131,17 +131,17 @@ SPECIAL(gen_board)
{
int board_type;
static int loaded = 0;
struct obj_data *board = (struct obj_data *)me;
obj_data *board = (obj_data *)me;
/* These were originally globals for some unknown reason. */
int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
if (!loaded) {
init_boards();
loaded = 1;
}
if (!ch->desc)
return (0);
return 0;
ACMD_READ = find_command("read");
ACMD_WRITE = find_command("write");
@@ -151,41 +151,42 @@ SPECIAL(gen_board)
if (cmd != ACMD_WRITE && cmd != ACMD_LOOK && cmd != ACMD_EXAMINE &&
cmd != ACMD_READ && cmd != ACMD_REMOVE)
return (0);
return 0;
if ((board_type = find_board(ch)) == -1) {
log("SYSERR: degenerate board! (what the hell...)");
return (0);
return 0;
}
if (cmd == ACMD_WRITE)
return (board_write_message(board_type, ch, argument, board));
else if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE)
return (board_show_board(board_type, ch, argument, board));
else if (cmd == ACMD_READ)
return (board_display_msg(board_type, ch, argument, board));
else if (cmd == ACMD_REMOVE)
return (board_remove_msg(board_type, ch, argument, board));
else
return (0);
return board_write_message(board_type, ch, argument, board);
if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE)
return board_show_board(board_type, ch, argument, board);
if (cmd == ACMD_READ)
return board_display_msg(board_type, ch, argument, board);
if (cmd == ACMD_REMOVE)
return board_remove_msg(board_type, ch, argument, board);
return 0;
}
int board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
// ReSharper disable once CppDFAConstantFunctionResult
int board_write_message(int board_type, char_data *ch, char *arg, obj_data *board)
{
time_t ct;
char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[100];
if (GET_LEVEL(ch) < WRITE_LVL(board_type)) {
send_to_char(ch, "You are not holy enough to write on this board.\r\n");
return (1);
return 1;
}
if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) {
send_to_char(ch, "The board is full.\r\n");
return (1);
return 1;
}
if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) {
send_to_char(ch, "The board is malfunctioning - sorry.\r\n");
log("SYSERR: Board: failed to find empty slot on write.");
return (1);
return 1;
}
/* skip blanks */
skip_spaces(&arg);
@@ -196,7 +197,7 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct
if (!*arg) {
send_to_char(ch, "We must have a headline!\r\n");
return (1);
return 1;
}
ct = time(0);
strftime(tmstr, sizeof(tmstr), "%a %b %d %Y", localtime(&ct));
@@ -204,49 +205,50 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct
snprintf(buf2, sizeof(buf2), "(%s)", GET_NAME(ch));
snprintf(buf, sizeof(buf), "%s %-12s :: %s", tmstr, buf2, arg);
NEW_MSG_INDEX(board_type).heading = strdup(buf);
NEW_MSG_INDEX(board_type).level = GET_LEVEL(ch);
NEW_MSG_INDEX(board_type).level = (int)GET_LEVEL(ch);
send_to_char(ch, "Write your message.\r\n");
send_editor_help(ch->desc);
act("$n starts to write a message.", TRUE, ch, 0, 0, TO_ROOM);
string_write(ch->desc, &(msg_storage[NEW_MSG_INDEX(board_type).slot_num]),
MAX_MESSAGE_LENGTH, board_type + BOARD_MAGIC, NULL);
string_write(ch->desc, &msg_storage[NEW_MSG_INDEX(board_type).slot_num],
MAX_MESSAGE_LENGTH, board_type + BOARD_MAGIC, NULL);
num_of_msgs[board_type]++;
return (1);
return 1;
}
int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int board_show_board(int board_type, char_data *ch, char *arg, obj_data *board)
{
int i;
char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
if (!ch->desc)
return (0);
return 0;
one_argument(arg, tmp);
if (!*tmp || !isname(tmp, board->name))
return (0);
return 0;
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
send_to_char(ch, "You try but fail to understand the holy words.\r\n");
return (1);
return 1;
}
act("$n studies the board.", TRUE, ch, 0, 0, TO_ROOM);
if (!num_of_msgs[board_type])
send_to_char(ch, "This is a bulletin board. Usage: READ/REMOVE <messg #>, WRITE <header>.\r\nThe board is empty.\r\n");
send_to_char(
ch, "This is a bulletin board. Usage: READ/REMOVE <messg #>, WRITE <header>.\r\nThe board is empty.\r\n");
else {
size_t len = 0;
int nlen;
len = snprintf(buf, sizeof(buf),
"This is a bulletin board. Usage: READ/REMOVE <messg #>, WRITE <header>.\r\n"
"You will need to look at the board to save your message.\r\n"
"There are %d messages on the board.\r\n",
num_of_msgs[board_type]);
"This is a bulletin board. Usage: READ/REMOVE <messg #>, WRITE <header>.\r\n"
"You will need to look at the board to save your message.\r\n"
"There are %d messages on the board.\r\n",
num_of_msgs[board_type]);
#if NEWEST_AT_TOP
for (i = num_of_msgs[board_type] - 1; i >= 0; i--) {
if (!MSG_HEADING(board_type, i))
@@ -270,40 +272,40 @@ int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj
#endif
page_string(ch->desc, buf, TRUE);
}
return (1);
return 1;
fubar:
log("SYSERR: Board %d is fubar'd.", board_type);
send_to_char(ch, "Sorry, the board isn't working.\r\n");
return (1);
return 1;
}
int board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int board_display_msg(int board_type, char_data *ch, char *arg, obj_data *board)
{
char number[MAX_INPUT_LENGTH], buffer[MAX_STRING_LENGTH];
int msg, ind;
one_argument(arg, number);
if (!*number)
return (0);
if (isname(number, board->name)) /* so "read board" works */
return (board_show_board(board_type, ch, arg, board));
if (!is_number(number)) /* read 2.mail, look 2.sword */
return (0);
if (!(msg = atoi(number)))
return (0);
return 0;
if (isname(number, board->name)) /* so "read board" works */
return board_show_board(board_type, ch, arg, board);
if (!is_number(number)) /* read 2.mail, look 2.sword */
return 0;
if ((msg = parse_int(number)) == 0)
return 0;
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
send_to_char(ch, "You try but fail to understand the holy words.\r\n");
return (1);
return 1;
}
if (!num_of_msgs[board_type]) {
send_to_char(ch, "The board is empty!\r\n");
return (1);
return 1;
}
if (msg < 1 || msg > num_of_msgs[board_type]) {
send_to_char(ch, "That message exists only in your imagination.\r\n");
return (1);
return 1;
}
#if NEWEST_AT_TOP
ind = num_of_msgs[board_type] - msg;
@@ -314,45 +316,45 @@ int board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) {
send_to_char(ch, "Sorry, the board is not working.\r\n");
log("SYSERR: Board is screwed up. (Room #%d)", GET_ROOM_VNUM(IN_ROOM(ch)));
return (1);
return 1;
}
if (!(MSG_HEADING(board_type, ind))) {
if (!MSG_HEADING(board_type, ind)) {
send_to_char(ch, "That message appears to be screwed up.\r\n");
return (1);
return 1;
}
if (!(msg_storage[MSG_SLOTNUM(board_type, ind)])) {
if (!msg_storage[MSG_SLOTNUM(board_type, ind)]) {
send_to_char(ch, "That message seems to be empty.\r\n");
return (1);
return 1;
}
snprintf(buffer, sizeof(buffer), "Message %d : %s\r\n\r\n%s\r\n", msg,
MSG_HEADING(board_type, ind),
msg_storage[MSG_SLOTNUM(board_type, ind)]);
MSG_HEADING(board_type, ind),
msg_storage[MSG_SLOTNUM(board_type, ind)]);
page_string(ch->desc, buffer, TRUE);
return (1);
return 1;
}
int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int board_remove_msg(int board_type, char_data *ch, char *arg, obj_data *board)
{
int ind, msg, slot_num;
char number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
struct descriptor_data *d;
descriptor_data *d;
one_argument(arg, number);
if (!*number || !is_number(number))
return (0);
if (!(msg = atoi(number)))
return (0);
return 0;
if ((msg = parse_int(number)) == 0)
return 0;
if (!num_of_msgs[board_type]) {
send_to_char(ch, "The board is empty!\r\n");
return (1);
return 1;
}
if (msg < 1 || msg > num_of_msgs[board_type]) {
send_to_char(ch, "That message exists only in your imagination.\r\n");
return (1);
return 1;
}
#if NEWEST_AT_TOP
ind = num_of_msgs[board_type] - msg;
@@ -361,28 +363,28 @@ int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
#endif
if (!MSG_HEADING(board_type, ind)) {
send_to_char(ch, "That message appears to be screwed up.\r\n");
return (1);
return 1;
}
snprintf(buf, sizeof(buf), "(%s)", GET_NAME(ch));
if (GET_LEVEL(ch) < REMOVE_LVL(board_type) &&
!(strstr(MSG_HEADING(board_type, ind), buf))) {
!strstr(MSG_HEADING(board_type, ind), buf)) {
send_to_char(ch, "You are not holy enough to remove other people's messages.\r\n");
return (1);
return 1;
}
if (GET_LEVEL(ch) < MSG_LEVEL(board_type, ind)) {
send_to_char(ch, "You can't remove a message holier than yourself.\r\n");
return (1);
return 1;
}
slot_num = MSG_SLOTNUM(board_type, ind);
if (slot_num < 0 || slot_num >= INDEX_SIZE) {
send_to_char(ch, "That message is majorly screwed up.\r\n");
log("SYSERR: The board is seriously screwed up. (Room #%d)", GET_ROOM_VNUM(IN_ROOM(ch)));
return (1);
return 1;
}
for (d = descriptor_list; d; d = d->next)
if (STATE(d) == CON_PLAYING && d->str == &(msg_storage[slot_num])) {
if (STATE(d) == CON_PLAYING && d->str == &msg_storage[slot_num]) {
send_to_char(ch, "At least wait until the author is finished before removing it!\r\n");
return (1);
return 1;
}
if (msg_storage[slot_num])
free(msg_storage[slot_num]);
@@ -403,7 +405,7 @@ int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
act(buf, FALSE, ch, 0, 0, TO_ROOM);
board_save_board(board_type);
return (1);
return 1;
}
void board_save_board(int board_type)
@@ -416,26 +418,26 @@ void board_save_board(int board_type)
remove(FILENAME(board_type));
return;
}
if (!(fl = fopen(FILENAME(board_type), "wb"))) {
if ((fl = fopen(FILENAME(board_type), "wb")) == NULL) {
perror("SYSERR: Error writing board");
return;
}
fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
fwrite(&num_of_msgs[board_type], sizeof(int), 1, fl);
for (i = 0; i < num_of_msgs[board_type]; i++) {
if ((tmp1 = MSG_HEADING(board_type, i)) != NULL)
msg_index[board_type][i].heading_len = strlen(tmp1) + 1;
msg_index[board_type][i].heading_len = (int)strlen(tmp1) + 1;
else
msg_index[board_type][i].heading_len = 0;
if (MSG_SLOTNUM(board_type, i) < 0 ||
MSG_SLOTNUM(board_type, i) >= INDEX_SIZE ||
(!(tmp2 = msg_storage[MSG_SLOTNUM(board_type, i)])))
MSG_SLOTNUM(board_type, i) >= INDEX_SIZE ||
(tmp2 = msg_storage[MSG_SLOTNUM(board_type, i)]) == NULL)
msg_index[board_type][i].message_len = 0;
else
msg_index[board_type][i].message_len = strlen(tmp2) + 1;
msg_index[board_type][i].message_len = (int)strlen(tmp2) + 1;
fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
fwrite(&msg_index[board_type][i], sizeof(struct board_msginfo), 1, fl);
if (tmp1)
fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
if (tmp2)
@@ -451,12 +453,12 @@ void board_load_board(int board_type)
int i, len1, len2;
char *tmp1, *tmp2;
if (!(fl = fopen(FILENAME(board_type), "rb"))) {
if ((fl = fopen(FILENAME(board_type), "rb")) == NULL) {
if (errno != ENOENT)
perror("SYSERR: Error reading board");
return;
}
if (fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl) != 1)
if (fread(&num_of_msgs[board_type], sizeof(int), 1, fl) != 1)
return;
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
@@ -464,7 +466,7 @@ void board_load_board(int board_type)
return;
}
for (i = 0; i < num_of_msgs[board_type]; i++) {
if (fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl) != 1) {
if (fread(&msg_index[board_type][i], sizeof(struct board_msginfo), 1, fl) != 1) {
if (feof(fl))
log("SYSERR: Unexpected EOF encountered in board file %d! Resetting.", board_type);
else if (ferror(fl))
@@ -540,7 +542,7 @@ void board_clear_board(int board_type)
if (msg_storage[MSG_SLOTNUM(board_type, i)])
free(msg_storage[MSG_SLOTNUM(board_type, i)]);
msg_storage_taken[MSG_SLOTNUM(board_type, i)] = 0;
memset((char *)&(msg_index[board_type][i]),0,sizeof(struct board_msginfo));
memset((char *)&msg_index[board_type][i], 0, sizeof(struct board_msginfo));
msg_index[board_type][i].slot_num = -1;
}
num_of_msgs[board_type] = 0;
+25 -25
View File
@@ -1,41 +1,41 @@
/**
* @file boards.h
* Header file for the bulletin board system (boards.c).
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _BOARDS_H_
#define _BOARDS_H_
#define NUM_OF_BOARDS 7 /* change if needed! */
#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */
#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */
#define NUM_OF_BOARDS 7 /* change if needed! */
#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */
#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */
#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5)
#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5)
#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */
#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */
struct board_msginfo {
int slot_num; /* pos of message in "master index" */
char *heading; /* pointer to message's heading */
int level; /* level of poster */
int heading_len; /* size of header (for file write) */
int message_len; /* size of message text (for file write) */
int slot_num; /* pos of message in "master index" */
char *heading; /* pointer to message's heading */
int level; /* level of poster */
int heading_len; /* size of header (for file write) */
int message_len; /* size of message text (for file write) */
};
struct board_info_type {
obj_vnum vnum; /* vnum of this board */
int read_lvl; /* min level to read messages on this board */
int write_lvl; /* min level to write messages on this board */
int remove_lvl; /* min level to remove messages from this board */
char filename[50]; /* file to save this board to */
obj_rnum rnum; /* rnum of this board */
obj_vnum vnum; /* vnum of this board */
int read_lvl; /* min level to read messages on this board */
int write_lvl; /* min level to write messages on this board */
int remove_lvl; /* min level to remove messages from this board */
char filename[50]; /* file to save this board to */
obj_rnum rnum; /* rnum of this board */
};
#define BOARD_VNUM(i) (board_info[i].vnum)
@@ -51,10 +51,10 @@ struct board_info_type {
#define MSG_LEVEL(i, j) (msg_index[i][j].level)
SPECIAL(gen_board);
int board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int board_display_msg(int board_type, char_data *ch, char *arg, obj_data *board);
int board_show_board(int board_type, char_data *ch, char *arg, obj_data *board);
int board_remove_msg(int board_type, char_data *ch, char *arg, obj_data *board);
int board_write_message(int board_type, char_data *ch, char *arg, obj_data *board);
void board_save_board(int board_type);
void board_load_board(int board_type);
void board_clear_all(void);
+2 -2
View File
@@ -1,9 +1,9 @@
/**
* @file bsd-snprintf.h
* Used if your OS does not provide snprintf() or vsnprintf().
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
* of, and continuation of, CircleMUD.
*/
/* This file taken from openbsd-compat of OpenSSH 3.1:
+128 -125
View File
@@ -13,7 +13,6 @@
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "spells.h"
@@ -30,18 +29,18 @@
/* local, file scope restricted functions */
static mob_vnum castle_virtual(mob_vnum offset);
static room_rnum castle_real_room(room_vnum roomoffset);
static struct char_data *find_npc_by_name(struct char_data *chAtChar, const char *pszName, int iLen);
static int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, int iProhibited_direction);
static int member_of_staff(struct char_data *chChar);
static int member_of_royal_guard(struct char_data *chChar);
static struct char_data *find_guard(struct char_data *chAtChar);
static struct char_data *get_victim(struct char_data *chAtChar);
static int banzaii(struct char_data *ch);
static int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim);
static int is_trash(struct obj_data *i);
static void fry_victim(struct char_data *ch);
static int castle_cleaner(struct char_data *ch, int cmd, int gripe);
static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname);
static char_data *find_npc_by_name(const char_data *chAtChar, const char *pszName, int iLen);
static int block_way(char_data *ch, int cmd, char *arg, room_vnum iIn_room, int iProhibited_direction);
static int member_of_staff(const char_data *chChar);
static int member_of_royal_guard(const char_data *chChar);
static char_data *find_guard(const char_data *chAtChar);
static char_data *get_victim(const char_data *chAtChar);
static int banzaii(char_data *ch);
static int do_npc_rescue(char_data *ch_hero, char_data *ch_victim);
static int is_trash(const obj_data *i);
static void fry_victim(char_data *ch);
static int castle_cleaner(char_data *ch, int cmd, int gripe);
static int castle_twin_proc(char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname);
static void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc));
/* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */
SPECIAL(CastleGuard);
@@ -129,86 +128,86 @@ void assign_kings_castle(void)
/* Routine: member_of_staff. Used to see if a character is a member of the
* castle staff. Used mainly by BANZAI:ng NPC:s. */
static int member_of_staff(struct char_data *chChar)
static int member_of_staff(const char_data *chChar)
{
int ch_num;
if (!IS_NPC(chChar))
return (FALSE);
return FALSE;
ch_num = GET_MOB_VNUM(chChar);
if (ch_num == castle_virtual(1))
return (TRUE);
return TRUE;
if (ch_num > castle_virtual(2) && ch_num < castle_virtual(15))
return (TRUE);
return TRUE;
if (ch_num > castle_virtual(15) && ch_num < castle_virtual(18))
return (TRUE);
return TRUE;
if (ch_num > castle_virtual(18) && ch_num < castle_virtual(30))
return (TRUE);
return TRUE;
return (FALSE);
return FALSE;
}
/* Function: member_of_royal_guard. Returns TRUE if the character is a guard on
* duty, otherwise FALSE. Used by Peter the captain of the royal guard. */
static int member_of_royal_guard(struct char_data *chChar)
static int member_of_royal_guard(const char_data *chChar)
{
int ch_num;
if (!chChar || !IS_NPC(chChar))
return (FALSE);
return FALSE;
ch_num = GET_MOB_VNUM(chChar);
if (ch_num == castle_virtual(3) || ch_num == castle_virtual(6))
return (TRUE);
return TRUE;
if (ch_num > castle_virtual(7) && ch_num < castle_virtual(12))
return (TRUE);
return TRUE;
if (ch_num > castle_virtual(23) && ch_num < castle_virtual(26))
return (TRUE);
return TRUE;
return (FALSE);
return FALSE;
}
/* Function: find_npc_by_name. Returns a pointer to an npc by the given name.
* Used by Tim and Tom. */
static struct char_data *find_npc_by_name(struct char_data *chAtChar,
static char_data *find_npc_by_name(const char_data *chAtChar,
const char *pszName, int iLen)
{
struct char_data *ch;
char_data *ch;
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
if (IS_NPC(ch) && !strncmp(pszName, ch->player.short_descr, iLen))
return (ch);
return ch;
return (NULL);
return NULL;
}
/* Function: find_guard. Returns the pointer to a guard on duty. Used by Peter
/* Function: find_guard. Returns the pointer to a guard on duty. Used by Peter
* the Captain of the Royal Guard */
static struct char_data *find_guard(struct char_data *chAtChar)
static char_data *find_guard(const char_data *chAtChar)
{
struct char_data *ch;
char_data *ch;
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
if (!FIGHTING(ch) && member_of_royal_guard(ch))
return (ch);
return ch;
return (NULL);
return NULL;
}
/* Function: get_victim. Returns a pointer to a randomly chosen character in
* the same room, fighting someone in the castle staff. Used by BANZAII-ing
/* Function: get_victim. Returns a pointer to a randomly chosen character in
* the same room, fighting someone in the castle staff. Used by BANZAII-ing
* characters and King Welmar... */
static struct char_data *get_victim(struct char_data *chAtChar)
static char_data *get_victim(const char_data *chAtChar)
{
struct char_data *ch;
char_data *ch;
int iNum_bad_guys = 0, iVictim;
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
@@ -216,11 +215,11 @@ static struct char_data *get_victim(struct char_data *chAtChar)
iNum_bad_guys++;
if (!iNum_bad_guys)
return (NULL);
return NULL;
iVictim = rand_number(0, iNum_bad_guys); /* How nice, we give them a chance */
if (!iVictim)
return (NULL);
return NULL;
iNum_bad_guys = 0;
@@ -234,39 +233,40 @@ static struct char_data *get_victim(struct char_data *chAtChar)
if (++iNum_bad_guys != iVictim)
continue;
return (ch);
return ch;
}
return (NULL);
return NULL;
}
/* Banzaii. Makes a character banzaii on attackers of the castle staff. Used
/* Banzaii. Makes a character banzaii on attackers of the castle staff. Used
* by Guards, Tim, Tom, Dick, David, Peter, Master, and the King. */
static int banzaii(struct char_data *ch)
static int banzaii(char_data *ch)
{
struct char_data *chOpponent;
char_data *chOpponent;
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING || !(chOpponent = get_victim(ch)))
return (FALSE);
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING || (chOpponent = get_victim(ch)) == NULL)
return FALSE;
act("$n roars: 'Protect the Kingdom of Great King Welmar! BANZAIIII!!!'",
FALSE, ch, 0, 0, TO_ROOM);
hit(ch, chOpponent, TYPE_UNDEFINED);
return (TRUE);
return TRUE;
}
/* Do_npc_rescue. Makes ch_hero rescue ch_victim. Used by Tim and Tom. */
static int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim)
static int do_npc_rescue(char_data *ch_hero, char_data *ch_victim)
{
struct char_data *ch_bad_guy;
char_data *ch_bad_guy;
for (ch_bad_guy = world[IN_ROOM(ch_hero)].people;
ch_bad_guy && (FIGHTING(ch_bad_guy) != ch_victim);
ch_bad_guy = ch_bad_guy->next_in_room);
ch_bad_guy && FIGHTING(ch_bad_guy) != ch_victim;
ch_bad_guy = ch_bad_guy->next_in_room)
;
/* NO WAY I'll rescue the one I'm fighting! */
if (!ch_bad_guy || ch_bad_guy == ch_hero)
return (FALSE);
return FALSE;
act("You bravely rescue $N.\r\n", FALSE, ch_hero, 0, ch_victim, TO_CHAR);
act("You are rescued by $N, your loyal friend!\r\n",
@@ -280,54 +280,54 @@ static int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim)
set_fighting(ch_hero, ch_bad_guy);
set_fighting(ch_bad_guy, ch_hero);
return (TRUE);
return TRUE;
}
/* Procedure to block a person trying to enter a room. Used by Tim/Tom at Kings
/* Procedure to block a person trying to enter a room. Used by Tim/Tom at Kings
* bedroom and Dick/David at treasury. */
static int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room,
static int block_way(char_data *ch, int cmd, char *arg, room_vnum iIn_room,
int iProhibited_direction)
{
if (cmd != ++iProhibited_direction)
return (FALSE);
return FALSE;
if (ch->player.short_descr && !strncmp(ch->player.short_descr, "King Welmar", 11))
return (FALSE);
return FALSE;
if (IN_ROOM(ch) != real_room(iIn_room))
return (FALSE);
return FALSE;
if (!member_of_staff(ch))
act("The guard roars at $n and pushes $m back.", FALSE, ch, 0, 0, TO_ROOM);
send_to_char(ch, "The guard roars: 'Entrance is Prohibited!', and pushes you back.\r\n");
return (TRUE);
return TRUE;
}
/* Routine to check if an object is trash. Used by James the Butler and the
/* Routine to check if an object is trash. Used by James the Butler and the
* Cleaning Lady. */
static int is_trash(struct obj_data *i)
static int is_trash(const obj_data *i)
{
if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE))
return (FALSE);
return FALSE;
if (GET_OBJ_TYPE(i) == ITEM_DRINKCON || GET_OBJ_COST(i) <= 10)
return (TRUE);
return TRUE;
return (FALSE);
return FALSE;
}
/* Fry_victim. Finds a suitabe victim, and cast some _NASTY_ spell on him. Used
/* Fry_victim. Finds a suitabe victim, and cast some _NASTY_ spell on him. Used
* by King Welmar. */
static void fry_victim(struct char_data *ch)
static void fry_victim(char_data *ch)
{
struct char_data *tch;
char_data *tch;
if (ch->points.mana < 10)
return;
/* Find someone suitable to fry ! */
if (!(tch = get_victim(ch)))
if ((tch = get_victim(ch)) == NULL)
return;
switch (rand_number(0, 8)) {
@@ -358,8 +358,6 @@ static void fry_victim(struct char_data *ch)
}
ch->points.mana -= 10;
return;
}
/* King_welmar. Control the actions and movements of the King. */
@@ -397,18 +395,19 @@ SPECIAL(king_welmar)
path_index = 0;
}
}
if (cmd || (GET_POS(ch) < POS_SLEEPING) ||
if (cmd || GET_POS(ch) < POS_SLEEPING ||
(GET_POS(ch) == POS_SLEEPING && !move))
return (FALSE);
return FALSE;
if (GET_POS(ch) == POS_FIGHTING) {
fry_victim(ch);
return (FALSE);
} else if (banzaii(ch))
return (FALSE);
return FALSE;
}
if (banzaii(ch))
return FALSE;
if (!move)
return (FALSE);
return FALSE;
switch (path[path_index]) {
case '0':
@@ -471,36 +470,40 @@ SPECIAL(king_welmar)
case '.':
move = FALSE;
break;
default:
log("default case hit in king_welmar spec proc. path_index=%d path[path_index] = %c",
path_index, path[path_index]);
break;
}
path_index++;
return (FALSE);
return FALSE;
}
/* Training_master. Acts actions to the training room, if his students are
* present. Also allowes warrior-class to practice. Used by the Training
/* Training_master. Acts actions to the training room, if his students are
* present. Also allowes warrior-class to practice. Used by the Training
* Master. */
SPECIAL(training_master)
{
struct char_data *pupil1, *pupil2 = NULL, *tch;
char_data *pupil1, *pupil2 = NULL, *tch;
if (!AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
return (FALSE);
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
return FALSE;
if (cmd)
return (FALSE);
return FALSE;
if (banzaii(ch) || rand_number(0, 2))
return (FALSE);
return FALSE;
if (!(pupil1 = find_npc_by_name(ch, "Brian", 5)))
return (FALSE);
if ((pupil1 = find_npc_by_name(ch, "Brian", 5)) == NULL)
return FALSE;
if (!(pupil2 = find_npc_by_name(ch, "Mick", 4)))
return (FALSE);
if ((pupil2 = find_npc_by_name(ch, "Mick", 4)) == NULL)
return FALSE;
if (FIGHTING(pupil1) || FIGHTING(pupil2))
return (FALSE);
return FALSE;
if (rand_number(0, 1)) {
tch = pupil1;
@@ -562,7 +565,7 @@ SPECIAL(training_master)
break;
}
return (FALSE);
return FALSE;
}
SPECIAL(tom)
@@ -576,12 +579,12 @@ SPECIAL(tim)
}
/* Common routine for the Castle Twins. */
static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname)
static int castle_twin_proc(char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname)
{
struct char_data *king, *twin;
char_data *king, *twin;
if (!AWAKE(ch))
return (FALSE);
return FALSE;
if (cmd)
return block_way(ch, cmd, arg, castle_virtual(ctlnum), 1);
@@ -595,18 +598,18 @@ static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum
do_npc_rescue(ch, king);
}
if ((twin = find_npc_by_name(ch, twinname, strlen(twinname))) != NULL)
if ((twin = find_npc_by_name(ch, twinname, (int)strlen(twinname))) != NULL)
if (FIGHTING(twin) && 2 * GET_HIT(twin) < GET_HIT(ch))
do_npc_rescue(ch, twin);
if (GET_POS(ch) != POS_FIGHTING)
banzaii(ch);
return (FALSE);
return FALSE;
}
/* Routine for James the Butler. Complains if he finds any trash. This doesn't
/* Routine for James the Butler. Complains if he finds any trash. This doesn't
* make sure he _can_ carry it. */
SPECIAL(James)
{
@@ -614,12 +617,12 @@ SPECIAL(James)
}
/* Common code for James and the Cleaning Woman. */
static int castle_cleaner(struct char_data *ch, int cmd, int gripe)
static int castle_cleaner(char_data *ch, int cmd, int gripe)
{
struct obj_data *i;
obj_data *i;
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
return (FALSE);
return FALSE;
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
if (!is_trash(i))
@@ -632,10 +635,10 @@ static int castle_cleaner(struct char_data *ch, int cmd, int gripe)
}
obj_from_room(i);
obj_to_char(i, ch);
return (TRUE);
return TRUE;
}
return (FALSE);
return FALSE;
}
/* Routine for the Cleaning Woman. Picks up any trash she finds. */
@@ -647,36 +650,36 @@ SPECIAL(cleaning)
/* CastleGuard. Standard routine for ordinary castle guards. */
SPECIAL(CastleGuard)
{
if (cmd || !AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
return (FALSE);
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
return FALSE;
return (banzaii(ch));
return banzaii(ch);
}
/* DicknDave. Routine for the guards Dick and David. */
SPECIAL(DicknDavid)
{
if (!AWAKE(ch))
return (FALSE);
return FALSE;
if (!cmd && GET_POS(ch) != POS_FIGHTING)
banzaii(ch);
return (block_way(ch, cmd, argument, castle_virtual(36), 1));
return block_way(ch, cmd, argument, castle_virtual(36), 1);
}
/*Peter. Routine for Captain of the Guards. */
SPECIAL(peter)
{
struct char_data *ch_guard = NULL;
char_data *ch_guard = NULL;
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
return (FALSE);
return FALSE;
if (banzaii(ch))
return (FALSE);
return FALSE;
if (!(rand_number(0, 3)) && (ch_guard = find_guard(ch)))
if (!rand_number(0, 3) && (ch_guard = find_guard(ch)) != NULL)
switch (rand_number(0, 5)) {
case 0:
act("$N comes sharply into attention as $n inspects $M.",
@@ -725,32 +728,32 @@ SPECIAL(peter)
break;
}
return (FALSE);
return FALSE;
}
/* Procedure for Jerry and Michael in x08 of King's Castle. Code by Sapowox
/* Procedure for Jerry and Michael in x08 of King's Castle. Code by Sapowox
* modified by Pjotr.(Original code from Master) */
SPECIAL(jerry)
{
struct char_data *gambler1, *gambler2 = NULL, *tch;
char_data *gambler1, *gambler2 = NULL, *tch;
if (!AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
return (FALSE);
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
return FALSE;
if (cmd)
return (FALSE);
return FALSE;
if (banzaii(ch) || rand_number(0, 2))
return (FALSE);
return FALSE;
if (!(gambler1 = ch))
return (FALSE);
if ((gambler1 = ch) == NULL)
return FALSE;
if (!(gambler2 = find_npc_by_name(ch, "Michael", 7)))
return (FALSE);
if ((gambler2 = find_npc_by_name(ch, "Michael", 7)) == NULL)
return FALSE;
if (FIGHTING(gambler1) || FIGHTING(gambler2))
return (FALSE);
return FALSE;
if (rand_number(0, 1)) {
tch = gambler1;
@@ -808,5 +811,5 @@ SPECIAL(jerry)
FALSE, gambler1, 0, gambler2, TO_VICT);
break;
}
return (FALSE);
return FALSE;
}
+31 -31
View File
@@ -19,20 +19,20 @@
#include "modify.h"
/* local scope functions, not used externally */
static void cedit_disp_menu(struct descriptor_data *d);
static void cedit_save_internally(struct descriptor_data *d);
static void cedit_disp_game_play_options(struct descriptor_data *d);
static void cedit_disp_crash_save_options(struct descriptor_data *d);
static void cedit_disp_room_numbers(struct descriptor_data *d);
static void cedit_disp_operation_options(struct descriptor_data *d);
static void cedit_disp_autowiz_options(struct descriptor_data *d);
static void cedit_disp_menu(descriptor_data *d);
static void cedit_save_internally(descriptor_data *d);
static void cedit_disp_game_play_options(descriptor_data *d);
static void cedit_disp_crash_save_options(descriptor_data *d);
static void cedit_disp_room_numbers(descriptor_data *d);
static void cedit_disp_operation_options(descriptor_data *d);
static void cedit_disp_autowiz_options(descriptor_data *d);
static void reassign_rooms(void);
static void cedit_setup(struct descriptor_data *d);
static void cedit_setup(descriptor_data *d);
ACMD(do_oasis_cedit)
{
struct descriptor_data *d;
descriptor_data *d;
char buf1[MAX_STRING_LENGTH];
/* No building as a mob or while being forced. */
@@ -72,7 +72,7 @@ ACMD(do_oasis_cedit)
cedit_save_to_disk();
}
static void cedit_setup(struct descriptor_data *d)
static void cedit_setup(descriptor_data *d)
{
/* Create the config_data struct. */
CREATE(OLC_CONFIG(d), struct config_data, 1);
@@ -178,7 +178,7 @@ static void cedit_setup(struct descriptor_data *d)
cedit_disp_menu(d);
}
static void cedit_save_internally(struct descriptor_data *d)
static void cedit_save_internally(descriptor_data *d)
{
/* see if we need to reassign spec procs on rooms */
int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps);
@@ -578,7 +578,7 @@ int save_config( IDXTYPE nowhere )
}
/* Menu functions - The main menu. */
static void cedit_disp_menu(struct descriptor_data *d)
static void cedit_disp_menu(descriptor_data *d)
{
get_char_colors(d->character);
@@ -606,7 +606,7 @@ static void cedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_MAIN_MENU;
}
static void cedit_disp_game_play_options(struct descriptor_data *d)
static void cedit_disp_game_play_options(descriptor_data *d)
{
int m_opt;
m_opt = OLC_CONFIG(d)->play.map_option;
@@ -679,7 +679,7 @@ static void cedit_disp_game_play_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_GAME_OPTIONS_MENU;
}
static void cedit_disp_crash_save_options(struct descriptor_data *d)
static void cedit_disp_crash_save_options(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -707,7 +707,7 @@ static void cedit_disp_crash_save_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_CRASHSAVE_OPTIONS_MENU;
}
static void cedit_disp_room_numbers(struct descriptor_data *d)
static void cedit_disp_room_numbers(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -733,7 +733,7 @@ static void cedit_disp_room_numbers(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU;
}
static void cedit_disp_operation_options(struct descriptor_data *d)
static void cedit_disp_operation_options(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -785,7 +785,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU;
}
static void cedit_disp_autowiz_options(struct descriptor_data *d)
static void cedit_disp_autowiz_options(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -804,7 +804,7 @@ static void cedit_disp_autowiz_options(struct descriptor_data *d)
}
/* The event handler. */
void cedit_parse(struct descriptor_data *d, char *arg)
void cedit_parse(descriptor_data *d, char *arg)
{
char *oldtext = NULL;
@@ -1520,12 +1520,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the room's vnum where mortals should load into : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the room's vnum where mortals should load into : ");
} else {
OLC_CONFIG(d)->room_nums.mortal_start_room = atoi(arg);
OLC_CONFIG(d)->room_nums.mortal_start_room = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1535,12 +1535,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the room's vnum where immortals should load into : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the room's vnum where immortals should load into : ");
} else {
OLC_CONFIG(d)->room_nums.immort_start_room = atoi(arg);
OLC_CONFIG(d)->room_nums.immort_start_room = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1550,12 +1550,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the room's vnum where frozen people should load into : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the room's vnum where frozen people should load into : ");
} else {
OLC_CONFIG(d)->room_nums.frozen_start_room = atoi(arg);
OLC_CONFIG(d)->room_nums.frozen_start_room = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1565,12 +1565,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the vnum for donation room #1 : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the vnum for donation room #1 : ");
} else {
OLC_CONFIG(d)->room_nums.donation_room_1 = atoi(arg);
OLC_CONFIG(d)->room_nums.donation_room_1 = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1580,12 +1580,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the vnum for donation room #2 : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the vnum for donation room #2 : ");
} else {
OLC_CONFIG(d)->room_nums.donation_room_2 = atoi(arg);
OLC_CONFIG(d)->room_nums.donation_room_2 = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1595,12 +1595,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d,
"That is an invalid choice!\r\n"
"Enter the vnum for donation room #3 : ");
} else if (real_room(atoi(arg)) == NOWHERE) {
} else if (real_room(atoidx(arg)) == NOWHERE) {
write_to_output(d,
"That room doesn't exist!\r\n"
"Enter the vnum for donation room #3 : ");
} else {
OLC_CONFIG(d)->room_nums.donation_room_3 = atoi(arg);
OLC_CONFIG(d)->room_nums.donation_room_3 = atoidx(arg);
cedit_disp_room_numbers(d);
}
break;
@@ -1729,7 +1729,7 @@ static void reassign_rooms(void)
assign_rooms();
}
void cedit_string_cleanup(struct descriptor_data *d, int terminator)
void cedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case CEDIT_MENU:
+4 -4
View File
@@ -1343,7 +1343,7 @@ int thaco(int class_num, int level)
/* Roll the 6 stats for a character... each stat is made of the sum of the best
* 3 out of 4 rolls of a 6-sided die. Each class then decides which priority
* will be given for the best to worst stats. */
void roll_real_abils(struct char_data *ch)
void roll_real_abils(char_data *ch)
{
int i, j, k, temp;
ubyte table[6];
@@ -1410,7 +1410,7 @@ void roll_real_abils(struct char_data *ch)
}
/* Some initializations for characters, including initial skills */
void do_start(struct char_data *ch)
void do_start(char_data *ch)
{
GET_LEVEL(ch) = 1;
GET_EXP(ch) = 1;
@@ -1459,7 +1459,7 @@ void do_start(struct char_data *ch)
/* This function controls the change to maxmove, maxmana, and maxhp for each
* class every time they gain a level. */
void advance_level(struct char_data *ch)
void advance_level(char_data *ch)
{
int add_hp, add_mana = 0, add_move = 0, i;
@@ -1537,7 +1537,7 @@ int backstab_mult(int level)
/* invalid_class is used by handler.c to determine if a piece of equipment is
* usable by a particular class, based on the ITEM_ANTI_{class} bitvectors. */
int invalid_class(struct char_data *ch, struct obj_data *obj)
int invalid_class(char_data *ch, obj_data *obj)
{
if (OBJ_FLAGGED(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch))
return TRUE;
+8 -8
View File
@@ -1,13 +1,13 @@
/**
* @file class.h
* Header file for class specific functions and variables.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _CLASS_H_
@@ -15,12 +15,12 @@
/* Functions available through class.c */
int backstab_mult(int level);
void do_start(struct char_data *ch);
void do_start(char_data *ch);
bitvector_t find_class_bitvector(const char *arg);
int invalid_class(struct char_data *ch, struct obj_data *obj);
int invalid_class(char_data *ch, obj_data *obj);
int level_exp(int chclass, int level);
int parse_class(char arg);
void roll_real_abils(struct char_data *ch);
void roll_real_abils(char_data *ch);
byte saving_throws(int class_num, int type, int level);
int thaco(int class_num, int level);
const char *title_female(int chclass, int level);
+277 -273
View File
File diff suppressed because it is too large Load Diff
+19 -25
View File
@@ -13,24 +13,18 @@
#ifndef _COMM_H_
#define _COMM_H_
#define NUM_RESERVED_DESCS 8
#define NUM_RESERVED_DESCS 8
#define COPYOVER_FILE "copyover.dat"
/* comm.c */
void close_socket(struct descriptor_data *d);
void close_socket(descriptor_data *d);
void game_info(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__
((format (printf, 2, 3)));
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1,
2)));
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format
(printf, 2, 3)));
void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1,
2)));
void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...) __attribute__ ((format
(printf, 3, 4)));
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
__attribute__ ((format (printf, 3, 4)));
size_t send_to_char(const char_data *ch, const char *messg, ...) __attribute__((format (printf, 2, 3)));
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format (printf, 2, 3)));
void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
void send_to_group(const char_data *ch, const struct group_data *group, const char * msg, ...) __attribute__ ((format(printf, 3, 4)));
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) __attribute__ ((format (printf, 3, 4)));
/* Act type settings and flags */
#define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */
@@ -38,29 +32,29 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
#define TO_NOTVICT 3 /**< act() type: to everyone in room, not ch or vict_obj. */
#define TO_CHAR 4 /**< act() type: to ch. */
#define TO_GMOTE 5 /**< act() type: to gemote channel (global emote) */
#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */
#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */
#define DG_NO_TRIG 256 /**< act() flag: don't check act trigger */
/* act functions */
void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj, void *vict_obj, struct char_data *to);
char * act(const char *str, int hide_invisible, struct char_data *ch, struct obj_data *obj, void *vict_obj, int type);
void perform_act(const char *orig, char_data *ch, obj_data *obj, void *vict_obj, char_data *to);
char * act(const char *str, int hide_invisible, char_data *ch, obj_data *obj, void *vict_obj, int type);
/* I/O functions */
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
int write_to_descriptor(socket_t desc, const char *txt);
size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3)));
size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args);
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
ssize_t write_to_descriptor(socket_t desc, const char *txt);
size_t write_to_output(descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3)));
size_t vwrite_to_output(descriptor_data *d, const char *format, va_list args);
typedef RETSIGTYPE sigfunc(int);
void echo_off(struct descriptor_data *d);
void echo_on(struct descriptor_data *d);
void echo_off(descriptor_data *d);
void echo_on(descriptor_data *d);
void game_loop(socket_t mother_desc);
void heartbeat(int heart_pulse);
void heartbeat(unsigned long heart_pulse);
void copyover_recover(void);
extern struct descriptor_data *descriptor_list;
extern descriptor_data *descriptor_list;
extern int buf_largecount;
extern int buf_overflows;
extern int buf_switches;
+52 -52
View File
@@ -46,14 +46,14 @@ struct config_data config_info; /* Game configuration list. */
struct room_data *world = NULL; /* array of rooms */
room_rnum top_of_world = 0; /* ref to top element of world */
struct char_data *character_list = NULL; /* global linked list of chars */
char_data *character_list = NULL; /* global linked list of chars */
struct index_data *mob_index; /* index table for mobile file */
struct char_data *mob_proto; /* prototypes for mobs */
char_data *mob_proto; /* prototypes for mobs */
mob_rnum top_of_mobt = 0; /* top of mobile index table */
struct obj_data *object_list = NULL; /* global linked list of objs */
obj_data *object_list = NULL; /* global linked list of objs */
struct index_data *obj_index; /* index table for object file */
struct obj_data *obj_proto; /* prototypes for objs */
obj_data *obj_proto; /* prototypes for objs */
obj_rnum top_of_objt = 0; /* top of object index table */
struct zone_data *zone_table; /* zone table */
@@ -128,9 +128,9 @@ static int converting = FALSE;
/* Local (file scope) utility functions */
static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits);
static int check_object_spell_number(struct obj_data *obj, int val);
static int check_object_level(struct obj_data *obj, int val);
static int check_object(struct obj_data *);
static int check_object_spell_number(obj_data *obj, int val);
static int check_object_level(obj_data *obj, int val);
static int check_object(obj_data *);
static void load_zones(FILE *fl, char *zonename);
static int file_to_string(const char *name, char *buf);
static int file_to_string_alloc(const char *name, char **buf);
@@ -501,8 +501,8 @@ static void free_extra_descriptions(struct extra_descr_data *edesc)
void destroy_db(void)
{
ssize_t cnt, itr;
struct char_data *chtmp, *i = character_list;
struct obj_data *objtmp;
char_data *chtmp, *i = character_list;
obj_data *objtmp;
/* Active Mobiles & Players */
while (i) {
@@ -1040,17 +1040,17 @@ void index_boot(int mode)
log(" %d rooms, %d bytes.", rec_count, size[0]);
break;
case DB_BOOT_MOB:
CREATE(mob_proto, struct char_data, rec_count);
CREATE(mob_proto, char_data, rec_count);
CREATE(mob_index, struct index_data, rec_count);
size[0] = sizeof(struct index_data) * rec_count;
size[1] = sizeof(struct char_data) * rec_count;
size[1] = sizeof(char_data) * rec_count;
log(" %d mobs, %d bytes in index, %d bytes in prototypes.", rec_count, size[0], size[1]);
break;
case DB_BOOT_OBJ:
CREATE(obj_proto, struct obj_data, rec_count);
CREATE(obj_proto, obj_data, rec_count);
CREATE(obj_index, struct index_data, rec_count);
size[0] = sizeof(struct index_data) * rec_count;
size[1] = sizeof(struct obj_data) * rec_count;
size[1] = sizeof(obj_data) * rec_count;
log(" %d objs, %d bytes in index, %d bytes in prototypes.", rec_count, size[0], size[1]);
break;
case DB_BOOT_ZON:
@@ -2349,7 +2349,7 @@ static int hsort(const void *a, const void *b)
return (str_cmp(a1->keywords, b1->keywords));
}
int vnum_mobile(char *searchname, struct char_data *ch)
int vnum_mobile(char *searchname, char_data *ch)
{
int nr, found = 0;
@@ -2362,7 +2362,7 @@ int vnum_mobile(char *searchname, struct char_data *ch)
return (found);
}
int vnum_object(char *searchname, struct char_data *ch)
int vnum_object(char *searchname, char_data *ch)
{
int nr, found = 0;
@@ -2375,7 +2375,7 @@ int vnum_object(char *searchname, struct char_data *ch)
return (found);
}
int vnum_room(char *searchname, struct char_data *ch)
int vnum_room(char *searchname, char_data *ch)
{
int nr, found = 0;
@@ -2387,7 +2387,7 @@ int vnum_room(char *searchname, struct char_data *ch)
return (found);
}
int vnum_trig(char *searchname, struct char_data *ch)
int vnum_trig(char *searchname, char_data *ch)
{
int nr, found = 0;
for (nr = 0; nr < top_of_trigt; nr++)
@@ -2398,11 +2398,11 @@ int vnum_trig(char *searchname, struct char_data *ch)
}
/* create a character, and add it to the char list */
struct char_data *create_char(void)
char_data *create_char(void)
{
struct char_data *ch;
char_data *ch;
CREATE(ch, struct char_data, 1);
CREATE(ch, char_data, 1);
clear_char(ch);
new_mobile_data(ch);
@@ -2415,7 +2415,7 @@ struct char_data *create_char(void)
return (ch);
}
void new_mobile_data(struct char_data *ch)
void new_mobile_data(char_data *ch)
{
ch->events = NULL;
ch->group = NULL;
@@ -2423,10 +2423,10 @@ void new_mobile_data(struct char_data *ch)
/* create a new mobile from a prototype */
struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
{
mob_rnum i;
struct char_data *mob;
char_data *mob;
if (type == VIRTUAL) {
if ((i = real_mobile(nr)) == NOBODY) {
@@ -2436,7 +2436,7 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
} else
i = nr;
CREATE(mob, struct char_data, 1);
CREATE(mob, char_data, 1);
clear_char(mob);
*mob = mob_proto[i];
@@ -2470,11 +2470,11 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
}
/* create an object, and add it to the object list */
struct obj_data *create_obj(void)
obj_data *create_obj(void)
{
struct obj_data *obj;
obj_data *obj;
CREATE(obj, struct obj_data, 1);
CREATE(obj, obj_data, 1);
clear_object(obj);
obj->next = object_list;
object_list = obj;
@@ -2487,9 +2487,9 @@ struct obj_data *create_obj(void)
}
/* create a new object from a prototype */
struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
{
struct obj_data *obj;
obj_data *obj;
obj_rnum i = type == VIRTUAL ? real_object(nr) : nr;
if (i == NOTHING || i > top_of_objt) {
@@ -2497,7 +2497,7 @@ struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
return (NULL);
}
CREATE(obj, struct obj_data, 1);
CREATE(obj, obj_data, 1);
clear_object(obj);
*obj = obj_proto[i];
obj->next = object_list;
@@ -2565,7 +2565,7 @@ void zone_update(void)
reset_zone(update_u->zone_to_reset);
mudlog(CMP, LVL_IMPL+1, FALSE, "Auto zone reset: %s (Zone %d)",
zone_table[update_u->zone_to_reset].name, zone_table[update_u->zone_to_reset].number);
struct descriptor_data *pt;
descriptor_data *pt;
for (pt = descriptor_list; pt; pt = pt->next)
if (IS_PLAYING(pt) && pt->character && PRF_FLAGGED(pt->character, PRF_ZONERESETS))
send_to_char(pt->character, "%s[Auto zone reset: %s (Zone %d)]%s",
@@ -2603,12 +2603,12 @@ static void log_zone_error(zone_rnum zone, int cmd_no, const char *message)
void reset_zone(zone_rnum zone)
{
int cmd_no, last_cmd = 0;
struct char_data *mob = NULL;
struct obj_data *obj, *obj_to;
char_data *mob = NULL;
obj_data *obj, *obj_to;
room_vnum rvnum;
room_rnum rrnum;
struct char_data *tmob=NULL; /* for trigger assignment */
struct obj_data *tobj=NULL; /* for trigger assignment */
char_data *tmob=NULL; /* for trigger assignment */
obj_data *tobj=NULL; /* for trigger assignment */
for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) {
@@ -2835,7 +2835,7 @@ void reset_zone(zone_rnum zone)
/* for use in reset_zone; return TRUE if zone 'nr' is free of PC's */
int is_empty(zone_rnum zone_nr)
{
struct descriptor_data *i;
descriptor_data *i;
for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING)
@@ -3226,7 +3226,7 @@ static void free_followers(struct follow_type *k)
}
/* release memory allocated for a char struct */
void free_char(struct char_data *ch)
void free_char(char_data *ch)
{
int i;
struct alias_data *a;
@@ -3320,7 +3320,7 @@ void free_char(struct char_data *ch)
}
/* release memory allocated for an obj struct */
void free_obj(struct obj_data *obj)
void free_obj(obj_data *obj)
{
if (GET_OBJ_RNUM(obj) == NOWHERE) {
free_object_strings(obj);
@@ -3357,7 +3357,7 @@ static int file_to_string_alloc(const char *name, char **buf)
{
int temppage;
char temp[MAX_STRING_LENGTH];
struct descriptor_data *in_use;
descriptor_data *in_use;
for (in_use = descriptor_list; in_use; in_use = in_use->next)
if (in_use->showstr_vector && *in_use->showstr_vector == *buf)
@@ -3435,7 +3435,7 @@ static int file_to_string(const char *name, char *buf)
}
/* clear some of the the working variables of a char */
void reset_char(struct char_data *ch)
void reset_char(char_data *ch)
{
int i;
@@ -3467,9 +3467,9 @@ void reset_char(struct char_data *ch)
}
/* clear ALL the working variables of a char; do NOT free any space alloc'ed */
void clear_char(struct char_data *ch)
void clear_char(char_data *ch)
{
memset((char *) ch, 0, sizeof(struct char_data));
memset((char *) ch, 0, sizeof(char_data));
IN_ROOM(ch) = NOWHERE;
GET_PFILEPOS(ch) = -1;
@@ -3484,9 +3484,9 @@ void clear_char(struct char_data *ch)
ch->points.max_mana = 100;
}
void clear_object(struct obj_data *obj)
void clear_object(obj_data *obj)
{
memset((char *) obj, 0, sizeof(struct obj_data));
memset((char *) obj, 0, sizeof(obj_data));
obj->item_number = NOTHING;
IN_ROOM(obj) = NOWHERE;
@@ -3495,7 +3495,7 @@ void clear_object(struct obj_data *obj)
/* Called during character creation after picking character class (and then
* never again for that character). */
void init_char(struct char_data *ch)
void init_char(char_data *ch)
{
int i;
@@ -3597,7 +3597,7 @@ room_rnum real_room(room_vnum vnum)
bot = 0;
top = top_of_world;
if (world[bot].number > vnum || world[top].number < vnum)
if (vnum == NOWHERE || world[bot].number > vnum || world[top].number < vnum)
return (NOWHERE);
/* perform binary search on world-table */
@@ -3623,7 +3623,7 @@ mob_rnum real_mobile(mob_vnum vnum)
top = top_of_mobt;
/* quickly reject out-of-range vnums */
if (mob_index[bot].vnum > vnum || mob_index[top].vnum < vnum)
if (vnum == NOBODY || mob_index[bot].vnum > vnum || mob_index[top].vnum < vnum)
return (NOBODY);
/* perform binary search on mob-table */
@@ -3649,7 +3649,7 @@ obj_rnum real_object(obj_vnum vnum)
top = top_of_objt;
/* quickly reject out-of-range vnums */
if (obj_index[bot].vnum > vnum || obj_index[top].vnum < vnum)
if (vnum == NOTHING || obj_index[bot].vnum > vnum || obj_index[top].vnum < vnum)
return (NOTHING);
/* perform binary search on obj-table */
@@ -3674,7 +3674,7 @@ zone_rnum real_zone(zone_vnum vnum)
bot = 0;
top = top_of_zone_table;
if (zone_table[bot].number > vnum || zone_table[top].number < vnum)
if (vnum == NOWHERE || zone_table[bot].number > vnum || zone_table[top].number < vnum)
return (NOWHERE);
/* perform binary search on zone-table */
@@ -3692,7 +3692,7 @@ zone_rnum real_zone(zone_vnum vnum)
}
/* Extend later to include more checks and add checks for unknown bitvectors. */
static int check_object(struct obj_data *obj)
static int check_object(obj_data *obj)
{
char objname[MAX_INPUT_LENGTH + 32];
int error = FALSE, y;
@@ -3770,7 +3770,7 @@ static int check_object(struct obj_data *obj)
return (error);
}
static int check_object_spell_number(struct obj_data *obj, int val)
static int check_object_spell_number(obj_data *obj, int val)
{
int error = FALSE;
const char *spellname;
@@ -3804,7 +3804,7 @@ static int check_object_spell_number(struct obj_data *obj, int val)
return (error);
}
static int check_object_level(struct obj_data *obj, int val)
static int check_object_level(obj_data *obj, int val)
{
int error = FALSE;
+165 -166
View File
@@ -15,98 +15,98 @@
/* arbitrary constants used by index_boot() (must be unique) */
#define DB_BOOT_WLD 0
#define DB_BOOT_MOB 1
#define DB_BOOT_OBJ 2
#define DB_BOOT_ZON 3
#define DB_BOOT_SHP 4
#define DB_BOOT_HLP 5
#define DB_BOOT_TRG 6
#define DB_BOOT_WLD 0
#define DB_BOOT_MOB 1
#define DB_BOOT_OBJ 2
#define DB_BOOT_ZON 3
#define DB_BOOT_SHP 4
#define DB_BOOT_HLP 5
#define DB_BOOT_TRG 6
#define DB_BOOT_QST 7
#if defined(CIRCLE_MACINTOSH)
#define LIB_WORLD ":world:"
#define LIB_TEXT ":text:"
#define LIB_TEXT_HELP ":text:help:"
#define LIB_MISC ":misc:"
#define LIB_ETC ":etc:"
#define LIB_PLRTEXT ":plrtext:"
#define LIB_PLROBJS ":plrobjs:"
#define LIB_PLRVARS ":plrvars:"
#define LIB_PLRFILES ":plrfiles:"
#define LIB_HOUSE ":house:"
#define SLASH ":"
#define LIB_WORLD ":world:"
#define LIB_TEXT ":text:"
#define LIB_TEXT_HELP ":text:help:"
#define LIB_MISC ":misc:"
#define LIB_ETC ":etc:"
#define LIB_PLRTEXT ":plrtext:"
#define LIB_PLROBJS ":plrobjs:"
#define LIB_PLRVARS ":plrvars:"
#define LIB_PLRFILES ":plrfiles:"
#define LIB_HOUSE ":house:"
#define SLASH ":"
#elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS)
#define LIB_WORLD "world/"
#define LIB_TEXT "text/"
#define LIB_TEXT_HELP "text/help/"
#define LIB_MISC "misc/"
#define LIB_ETC "etc/"
#define LIB_PLRTEXT "plrtext/"
#define LIB_PLROBJS "plrobjs/"
#define LIB_PLRVARS "plrvars/"
#define LIB_HOUSE "house/"
#define LIB_PLRFILES "plrfiles/"
#define SLASH "/"
#define LIB_WORLD "world/"
#define LIB_TEXT "text/"
#define LIB_TEXT_HELP "text/help/"
#define LIB_MISC "misc/"
#define LIB_ETC "etc/"
#define LIB_PLRTEXT "plrtext/"
#define LIB_PLROBJS "plrobjs/"
#define LIB_PLRVARS "plrvars/"
#define LIB_HOUSE "house/"
#define LIB_PLRFILES "plrfiles/"
#define SLASH "/"
#else
#error "Unknown path components."
#endif
#define SUF_OBJS "objs"
#define SUF_TEXT "text"
#define SUF_MEM "mem"
#define SUF_PLR "plr"
#define SUF_OBJS "objs"
#define SUF_TEXT "text"
#define SUF_MEM "mem"
#define SUF_PLR "plr"
#if defined(CIRCLE_AMIGA)
#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */
#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "/pause" /* autorun: don't restart mud */
#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */
#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "/pause" /* autorun: don't restart mud */
#elif defined(CIRCLE_MACINTOSH)
#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "::pause" /* autorun: don't restart mud */
#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "::pause" /* autorun: don't restart mud */
#else
#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */
#define PAUSE_FILE "../pause" /* autorun: don't restart mud */
#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */
#define PAUSE_FILE "../pause" /* autorun: don't restart mud */
#endif
/* names of various files and directories */
#define INDEX_FILE "index" /* index of world files */
#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */
#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */
#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */
#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */
#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */
#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */
#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */
#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */
#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */
#define INDEX_FILE "index" /* index of world files */
#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */
#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */
#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */
#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */
#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */
#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */
#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */
#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */
#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */
#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */
#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */
#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */
#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */
#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */
#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP <CR> */
#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP <CR> imms */
#define INFO_FILE LIB_TEXT"info" /* for INFO */
#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */
#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */
#define BACKGROUND_FILE LIB_TEXT"background"/* for the background story */
#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */
#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */
#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */
#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */
#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */
#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */
#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */
#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP <CR> */
#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP <CR> imms */
#define INFO_FILE LIB_TEXT"info" /* for INFO */
#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */
#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */
#define BACKGROUND_FILE LIB_TEXT"background" /* for the background story */
#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */
#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */
#define HELP_FILE "help.hlp"
#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */
#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */
#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */
#define MESS_FILE LIB_MISC"messages" /* damage messages */
#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */
#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/
#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */
#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */
#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */
#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */
#define MESS_FILE LIB_MISC"messages" /* damage messages */
#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */
#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/
#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */
/* BEGIN: Assumed default locations for logfiles, mainly used in do_file. */
/**/
@@ -129,109 +129,108 @@
/**/
/* END: Assumed default locations for logfiles, mainly used in do_file. */
#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */
#define PLAYER_FILE LIB_ETC"players" /* the player database */
#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */
#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */
#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */
#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */
#define TIME_FILE LIB_ETC"time" /* for calendar system */
#define CHANGE_LOG_FILE "../changelog" /* for the changelog */
#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */
#define PLAYER_FILE LIB_ETC"players" /* the player database */
#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */
#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */
#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */
#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */
#define TIME_FILE LIB_ETC"time" /* for calendar system */
#define CHANGE_LOG_FILE "../changelog" /* for the changelog */
/* new bitvector data for use in player_index_element */
#define PINDEX_DELETED (1 << 0) /* deleted player */
#define PINDEX_NODELETE (1 << 1) /* protected player */
#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting*/
#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist*/
#define PINDEX_DELETED (1 << 0) /* deleted player */
#define PINDEX_NODELETE (1 << 1) /* protected player */
#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting */
#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist */
#define REAL 0
#define VIRTUAL 1
/* structure for the reset commands */
struct reset_com {
char command; /* current command */
char command; /* current command */
bool if_flag; /* if TRUE: exe only if preceding exe'd */
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
int line; /* line number this command appears on */
char *sarg1; /* string argument */
char *sarg2; /* string argument */
bool if_flag; /* if TRUE: exe only if preceding exe'd */
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
int line; /* line number this command appears on */
char *sarg1; /* string argument */
char *sarg2; /* string argument */
/* Commands:
* 'M': Read a mobile
* 'O': Read an object
* 'G': Give obj to mob
* 'P': Put obj in obj
* 'G': Obj to char
* 'E': Obj to char equip
* 'D': Set state of door
* 'T': Trigger command
* 'V': Assign a variable */
/* Commands:
* 'M': Read a mobile
* 'O': Read an object
* 'G': Give obj to mob
* 'P': Put obj in obj
* 'G': Obj to char
* 'E': Obj to char equip
* 'D': Set state of door
* 'T': Trigger command
* 'V': Assign a variable */
};
/* zone definition structure. for the 'zone-table' */
struct zone_data {
char *name; /* name of this zone */
char *builders; /* namelist of builders allowed to */
/* modify this zone. */
int lifespan; /* how long between resets (minutes) */
int age; /* current age of this zone (minutes) */
room_vnum bot; /* starting room number for this zone */
room_vnum top; /* upper limit for rooms in this zone */
char *name; /* name of this zone */
char *builders; /* namelist of builders allowed to modify this zone. */
int lifespan; /* how long between resets (minutes) */
int age; /* current age of this zone (minutes) */
room_vnum bot; /* starting room number for this zone */
room_vnum top; /* upper limit for rooms in this zone */
int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */
int min_level; /* Minimum level a player must be to enter this zone */
int max_level; /* Maximum level a player must be to enter this zone */
int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */
int min_level; /* Minimum level a player must be to enter this zone */
int max_level; /* Maximum level a player must be to enter this zone */
int reset_mode; /* conditions for reset (see below) */
zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */
int reset_mode; /* conditions for reset (see below) */
zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */
/* Reset mode:
* 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone.
* 2: Just reset. */
/* Reset mode:
* 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone.
* 2: Just reset. */
};
/* for queueing zones for update */
struct reset_q_element {
zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next;
zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next;
};
/* structure for the update queue */
struct reset_q_type {
struct reset_q_element *head;
struct reset_q_element *tail;
struct reset_q_element *head;
struct reset_q_element *tail;
};
/* Added level, flags, and last, primarily for pfile autocleaning. You can also
* use them to keep online statistics, and add race, class, etc if you like. */
struct player_index_element {
char *name;
long id;
int level;
int flags;
time_t last;
char *name;
long id;
int level;
int flags;
time_t last;
};
struct help_index_element {
char *index; /*Future Use */
char *keywords; /*Keyword Place holder and sorter */
char *entry; /*Entries for help files with Keywords at very top*/
int duplicate; /*Duplicate entries for multple keywords*/
int min_level; /*Min Level to read help entry*/
char *index; /* Future Use */
char *keywords; /* Keyword Place holder and sorter */
char *entry; /* Entries for help files with Keywords at very top */
int duplicate; /* Duplicate entries for multple keywords */
int min_level; /* Min Level to read help entry */
};
/* The ban defines and structs were moved to ban.h */
/* for the "buffered" rent and house object loading */
struct obj_save_data_t {
struct obj_data *obj;
int locate;
struct obj_save_data_t *next;
obj_data *obj;
int locate;
struct obj_save_data_t *next;
};
typedef struct obj_save_data_t obj_save_data;
@@ -256,7 +255,7 @@ void free_text_files(void);
void free_help_table(void);
void free_player_index(void);
void load_help(FILE *fl, char *name);
void new_mobile_data(struct char_data *ch);
void new_mobile_data(char_data *ch);
zone_rnum real_zone(zone_vnum vnum);
room_rnum real_room(room_vnum vnum);
@@ -265,45 +264,45 @@ obj_rnum real_object(obj_vnum vnum);
/* Public Procedures from objsave.c */
void Crash_save_all(void);
void Crash_idlesave(struct char_data *ch);
void Crash_crashsave(struct char_data *ch);
int Crash_load(struct char_data *ch);
void Crash_listrent(struct char_data *ch, char *name);
void Crash_idlesave(char_data *ch);
void Crash_crashsave(char_data *ch);
int Crash_load(char_data *ch);
void Crash_listrent(char_data *ch, char *name);
int Crash_clean_file(char *name);
int Crash_delete_crashfile(struct char_data *ch);
int Crash_delete_crashfile(char_data *ch);
int Crash_delete_file(char *name);
void update_obj_file(void);
void Crash_rentsave(struct char_data *ch, int cost);
void Crash_rentsave(char_data *ch, int cost);
obj_save_data *objsave_parse_objects(FILE *fl);
int objsave_save_obj_record(struct obj_data *obj, FILE *fl, int location);
int objsave_save_obj_record(obj_data *obj, FILE *fl, int location);
/* Special functions */
SPECIAL(receptionist);
SPECIAL(cryogenicist);
/* Functions from players.c */
void tag_argument(char *argument, char *tag);
int load_char(const char *name, struct char_data *ch);
void save_char(struct char_data *ch);
void init_char(struct char_data *ch);
struct char_data* create_char(void);
struct char_data *read_mobile(mob_vnum nr, int type);
int vnum_mobile(char *searchname, struct char_data *ch);
void clear_char(struct char_data *ch);
void reset_char(struct char_data *ch);
void free_char(struct char_data *ch);
int load_char(const char *name, char_data *ch);
void save_char(char_data *ch);
void init_char(char_data *ch);
char_data* create_char(void);
char_data *read_mobile(mob_vnum nr, int type);
int vnum_mobile(char *searchname, char_data *ch);
void clear_char(char_data *ch);
void reset_char(char_data *ch);
void free_char(char_data *ch);
void save_player_index(void);
long get_ptable_by_name(const char *name);
void remove_player(int pfilepos);
void clean_pfiles(void);
void build_player_index(void);
struct obj_data *create_obj(void);
void clear_object(struct obj_data *obj);
void free_obj(struct obj_data *obj);
struct obj_data *read_object(obj_vnum nr, int type);
int vnum_object(char *searchname, struct char_data *ch);
int vnum_room(char *, struct char_data *);
int vnum_trig(char *, struct char_data *);
obj_data *create_obj(void);
void clear_object(obj_data *obj);
void free_obj(obj_data *obj);
obj_data *read_object(obj_vnum nr, int type);
int vnum_object(char *searchname, char_data *ch);
int vnum_room(char *, char_data *);
int vnum_trig(char *, char_data *);
void setup_dir(FILE *fl, int room, int dir);
void index_boot(int mode);
@@ -366,15 +365,15 @@ extern room_rnum top_of_world;
extern struct zone_data *zone_table;
extern zone_rnum top_of_zone_table;
extern struct char_data *character_list;
extern char_data *character_list;
extern struct index_data *mob_index;
extern struct char_data *mob_proto;
extern char_data *mob_proto;
extern mob_rnum top_of_mobt;
extern struct index_data *obj_index;
extern struct obj_data *object_list;
extern struct obj_data *obj_proto;
extern obj_data *object_list;
extern obj_data *obj_proto;
extern obj_rnum top_of_objt;
extern struct social_messg *soc_mess_list;
+1 -1
View File
@@ -188,7 +188,7 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
void send_to_zone(char *messg, zone_rnum zone)
{
struct descriptor_data *i;
descriptor_data *i;
if (!messg || !*messg)
return;
+3 -3
View File
@@ -214,7 +214,7 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
}
}
void dg_obj_trigger(char *line, struct obj_data *obj)
void dg_obj_trigger(char *line, obj_data *obj)
{
char junk[8];
int vnum, rnum, count;
@@ -251,8 +251,8 @@ void dg_obj_trigger(char *line, struct obj_data *obj)
void assign_triggers(void *i, int type)
{
struct char_data *mob = NULL;
struct obj_data *obj = NULL;
char_data *mob = NULL;
obj_data *obj = NULL;
struct room_data *room = NULL;
int rnum;
struct trig_proto_list *trg_proto;
+16 -16
View File
@@ -1,18 +1,18 @@
/**
* @file dg_event.h
* This file contains defines for the simplified event system to allow trigedit
* This file contains defines for the simplified event system to allow trigedit
* to use the "wait" command, causing a delay in the middle of a script.
* This system could easily be expanded by coders who wish to implement
* an event driven mud.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
* is attributed to:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
*/
#ifndef _DG_EVENT_H_
#define _DG_EVENT_H_
@@ -30,10 +30,10 @@
/** The event structure. Events get attached to the queue and are executed
* when their turn comes up in the queue. */
struct event {
EVENTFUNC(*func); /**< The function called when this event comes up. */
void *event_obj; /**< event_obj is passed to func when func is called */
struct q_element *q_el; /**< Where this event is located in the queue */
bool isMudEvent; /**< used by the memory routines */
EVENTFUNC(*func); /**< The function called when this event comes up. */
void *event_obj; /**< event_obj is passed to func when func is called */
struct q_element *q_el; /**< Where this event is located in the queue */
bool isMudEvent; /**< used by the memory routines */
};
/**************************************************************************
* End event structures and defines.
@@ -47,15 +47,15 @@ struct event {
/** The priority queue. */
struct dg_queue {
struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */
struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */
struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */
struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */
};
/** Queued elements. */
struct q_element {
void *data; /**< The event to be handled. */
long key; /**< When the event should be handled. */
struct q_element *prev, *next; /**< Points to other q_elements in line. */
void *data; /**< The event to be handled. */
long key; /**< When the event should be handled. */
struct q_element *prev, *next; /**< Points to other q_elements in line. */
};
/**************************************************************************
* End priority queue structures and defines.
+8 -8
View File
@@ -119,12 +119,12 @@ void extract_script(void *thing, int type)
switch (type) {
case MOB_TRIGGER:
mob = (struct char_data *)thing;
mob = (char_data *)thing;
sc = SCRIPT(mob);
SCRIPT(mob) = NULL;
break;
case OBJ_TRIGGER:
obj = (struct obj_data *)thing;
obj = (obj_data *)thing;
sc = SCRIPT(obj);
SCRIPT(obj) = NULL;
break;
@@ -137,8 +137,8 @@ void extract_script(void *thing, int type)
#if 1 /* debugging */
{
struct char_data *i = character_list;
struct obj_data *j = object_list;
char_data *i = character_list;
obj_data *j = object_list;
room_rnum k;
if (sc) {
for ( ; i ; i = i->next)
@@ -185,12 +185,12 @@ void free_proto_script(void *thing, int type)
switch (type) {
case MOB_TRIGGER:
mob = (struct char_data *)thing;
mob = (char_data *)thing;
proto = mob->proto_script;
mob->proto_script = NULL;
break;
case OBJ_TRIGGER:
obj = (struct obj_data *)thing;
obj = (obj_data *)thing;
proto = obj->proto_script;
obj->proto_script = NULL;
break;
@@ -202,8 +202,8 @@ void free_proto_script(void *thing, int type)
}
#if 1 /* debugging */
{
struct char_data *i = character_list;
struct obj_data *j = object_list;
char_data *i = character_list;
obj_data *j = object_list;
room_rnum k;
if (proto) {
for ( ; i ; i = i->next)
+10 -10
View File
@@ -35,9 +35,9 @@
* the spell is set to TAR_IGNORE. Also, group spells are not permitted. */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd)
{
struct char_data *caster = NULL;
struct char_data *tch = NULL;
struct obj_data *tobj = NULL;
char_data *caster = NULL;
char_data *tch = NULL;
obj_data *tobj = NULL;
struct room_data *caster_room = NULL;
char *s, *t;
int spellnum, target = 0;
@@ -46,13 +46,13 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, cha
/* need to get the caster or the room of the temporary caster */
switch (type) {
case MOB_TRIGGER:
caster = (struct char_data *)go;
caster = (char_data *)go;
break;
case WLD_TRIGGER:
caster_room = (struct room_data *)go;
break;
case OBJ_TRIGGER:
caster_room = dg_room_of_obj((struct obj_data *)go);
caster_room = dg_room_of_obj((obj_data *)go);
if (!caster_room) {
script_log("dg_do_cast: unknown room for object-caster!");
return;
@@ -131,7 +131,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, cha
/* set the caster's name to that of the object, or the gods.... */
if (type==OBJ_TRIGGER)
caster->player.short_descr =
strdup(((struct obj_data *)go)->short_description);
strdup(((obj_data *)go)->short_description);
else if (type==WLD_TRIGGER)
caster->player.short_descr = strdup("The gods");
caster->next_in_room = caster_room->people;
@@ -152,7 +152,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, cha
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
int script_type, char *cmd)
{
struct char_data *ch = NULL;
char_data *ch = NULL;
int value=0, duration=0;
char junk[MAX_INPUT_LENGTH]; /* will be set to "dg_affect" */
char charname[MAX_INPUT_LENGTH], property[MAX_INPUT_LENGTH];
@@ -238,7 +238,7 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
affect_to_char(ch, &af);
}
void send_char_pos(struct char_data *ch, int dam)
void send_char_pos(char_data *ch, int dam)
{
switch (GET_POS(ch)) {
case POS_MORTALLYW:
@@ -269,7 +269,7 @@ void send_char_pos(struct char_data *ch, int dam)
/* Used throughout the xxxcmds.c files for checking if a char can be targetted
* - allow_gods is false when called by %force%, for instance, while true for
* %teleport%. - Welcor */
int valid_dg_target(struct char_data *ch, int bitvector)
int valid_dg_target(char_data *ch, int bitvector)
{
if (IS_NPC(ch))
return TRUE; /* all npcs are allowed as targets */
@@ -286,7 +286,7 @@ int valid_dg_target(struct char_data *ch, int bitvector)
return FALSE; /* The rest are gods with nohassle on... */
}
void script_damage(struct char_data *vict, int dam)
void script_damage(char_data *vict, int dam)
{
if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) {
send_to_char(vict, "Being the cool immortal you are, you sidestep a trap, "
+10 -10
View File
@@ -320,7 +320,7 @@ ACMD(do_mzoneecho)
if (!*room_number || !*msg)
mob_log(ch, "mzoneecho called with too few args");
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
else if ((zone = real_zone_by_thing(atoidx(room_number))) == NOWHERE)
mob_log(ch, "mzoneecho called for nonexistant zone");
else {
@@ -355,7 +355,7 @@ ACMD(do_mload)
target = two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoidx(arg2)) == NOBODY)) {
mob_log(ch, "mload: bad syntax");
return;
}
@@ -366,7 +366,7 @@ ACMD(do_mload)
if (!target || !*target) {
rnum = IN_ROOM(ch);
} else {
if (!isdigit(*target) || (rnum = real_room(atoi(target))) == NOWHERE) {
if (!isdigit(*target) || (rnum = real_room(atoidx(target))) == NOWHERE) {
mob_log(ch, "mload: room target vnum doesn't exist "
"(loading mob vnum %d to room %s)", number, target);
return;
@@ -699,7 +699,7 @@ ACMD(do_mforce)
}
if (!str_cmp(arg, "all")) {
struct descriptor_data *i;
descriptor_data *i;
char_data *vch;
for (i = descriptor_list; i ; i = i->next) {
@@ -914,10 +914,10 @@ ACMD(do_mtransform)
mob_log(ch, "mtransform: bad argument");
else {
if (isdigit(*arg))
m = read_mobile(atoi(arg), VIRTUAL);
m = read_mobile(atoidx(arg), VIRTUAL);
else {
keep_hp = 0;
m = read_mobile(atoi(arg+1), VIRTUAL);
m = read_mobile(atoidx(arg+1), VIRTUAL);
}
if (m==NULL) {
mob_log(ch, "mtransform: bad mobile vnum");
@@ -1070,7 +1070,7 @@ ACMD(do_mdoor)
newexit->exit_info = (sh_int)asciiflag_conv(value);
break;
case 3: /* key */
newexit->key = atoi(value);
newexit->key = atoidx(value);
break;
case 4: /* name */
if (newexit->keyword)
@@ -1079,7 +1079,7 @@ ACMD(do_mdoor)
strcpy(newexit->keyword, value);
break;
case 5: /* room */
if ((to_room = real_room(atoi(value))) != NOWHERE)
if ((to_room = real_room(atoidx(value))) != NOWHERE)
newexit->to_room = to_room;
else
mob_log(ch, "mdoor: invalid door target");
@@ -1091,7 +1091,7 @@ ACMD(do_mdoor)
ACMD(do_mfollow)
{
char buf[MAX_INPUT_LENGTH];
struct char_data *leader;
char_data *leader;
struct follow_type *j, *k;
if (!MOB_OR_IMPL(ch)) {
@@ -1176,5 +1176,5 @@ ACMD(do_mrecho)
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
mob_log(ch, "mrecho called with too few args");
else
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
send_to_range(atoidx(start), atoidx(finish), "%s\r\n", msg);
}
+14 -14
View File
@@ -88,7 +88,7 @@ room_rnum obj_room(obj_data *obj)
/* returns the real room number, or NOWHERE if not found or invalid */
static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
{
int tmp;
room_vnum tmp;
room_rnum location;
char_data *target_mob;
obj_data *target_obj;
@@ -101,7 +101,7 @@ static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
if (isdigit(*roomstr) && !strchr(roomstr, '.'))
{
tmp = atoi(roomstr);
tmp = atoidx(roomstr);
if ((location = real_room(tmp)) == NOWHERE)
return NOWHERE;
}
@@ -220,7 +220,7 @@ static OCMD(do_ozoneecho)
if (!*room_number || !*msg)
obj_log(obj, "ozoneecho called with too few args");
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
else if ((zone = real_zone_by_thing(atoidx(room_number))) == NOWHERE)
obj_log(obj, "ozoneecho called for nonexistant zone");
else {
@@ -275,7 +275,7 @@ static OCMD(do_orecho)
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
obj_log(obj, "orecho: too few args");
else
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
send_to_range(atoidx(start), atoidx(finish), "%s\r\n", msg);
}
@@ -300,7 +300,7 @@ static OCMD(do_otransform)
{
char arg[MAX_INPUT_LENGTH];
obj_data *o, tmpobj;
struct char_data *wearer=NULL;
char_data *wearer=NULL;
int pos = 0;
one_argument(argument, arg);
@@ -310,7 +310,7 @@ static OCMD(do_otransform)
else if (!isdigit(*arg))
obj_log(obj, "otransform: bad argument");
else {
o = read_object(atoi(arg), VIRTUAL);
o = read_object(atoidx(arg), VIRTUAL);
if (o==NULL) {
obj_log(obj, "otransform: bad object vnum");
return;
@@ -459,7 +459,7 @@ static OCMD(do_dgoload)
target = two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0))
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoidx(arg2)) == NOTHING))
{
obj_log(obj, "oload: bad syntax");
return;
@@ -477,7 +477,7 @@ static OCMD(do_dgoload)
if (!target || !*target) {
rnum = room;
} else {
if (!isdigit(*target) || (rnum = real_room(atoi(target))) == NOWHERE) {
if (!isdigit(*target) || (rnum = real_room(atoidx(target))) == NOWHERE) {
obj_log(obj, "oload: room target vnum doesn't exist "
"(loading mob vnum %d to room %s)", number, target);
return;
@@ -671,7 +671,7 @@ static OCMD(do_odoor)
newexit->exit_info = (sh_int)asciiflag_conv(value);
break;
case 3: /* key */
newexit->key = atoi(value);
newexit->key = atoidx(value);
break;
case 4: /* name */
if (newexit->keyword)
@@ -680,7 +680,7 @@ static OCMD(do_odoor)
strcpy(newexit->keyword, value);
break;
case 5: /* room */
if ((to_room = real_room(atoi(value))) != NOWHERE)
if ((to_room = real_room(atoidx(value))) != NOWHERE)
newexit->to_room = to_room;
else
obj_log(obj, "odoor: invalid door target");
@@ -693,7 +693,7 @@ static OCMD(do_osetval)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
int position, new_value, worn_on;
struct char_data *worn_by = NULL;
char_data *worn_by = NULL;
two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2 || !is_number(arg1) || !is_number(arg2)) {
@@ -725,8 +725,8 @@ static OCMD(do_osetval)
static OCMD(do_oat)
{
room_rnum loc = NOWHERE;
struct char_data *ch;
struct obj_data *object;
char_data *ch;
obj_data *object;
char arg[MAX_INPUT_LENGTH], *command;
command = any_one_arg(argument, arg);
@@ -743,7 +743,7 @@ static OCMD(do_oat)
return;
}
if (isdigit(*arg)) loc = real_room(atoi(arg));
if (isdigit(*arg)) loc = real_room(atoidx(arg));
else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch);
if (loc == NOWHERE) {
+20 -20
View File
@@ -24,17 +24,17 @@
/* local functions */
static void trigedit_disp_menu(struct descriptor_data *d);
static void trigedit_disp_types(struct descriptor_data *d);
static void trigedit_disp_menu(descriptor_data *d);
static void trigedit_disp_types(descriptor_data *d);
static void trigedit_create_index(int znum, char *type);
static void trigedit_setup_new(struct descriptor_data *d);
static void trigedit_setup_new(descriptor_data *d);
/* Trigedit */
ACMD(do_oasis_trigedit)
{
int number, real_num;
struct descriptor_data *d;
descriptor_data *d;
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
@@ -115,9 +115,9 @@ void script_save_to_disk(FILE *fp, void *item, int type)
struct trig_proto_list *t;
if (type==MOB_TRIGGER)
t = ((struct char_data *)item)->proto_script;
t = ((char_data *)item)->proto_script;
else if (type==OBJ_TRIGGER)
t = ((struct obj_data *)item)->proto_script;
t = ((obj_data *)item)->proto_script;
else if (type==WLD_TRIGGER)
t = ((struct room_data *)item)->proto_script;
else {
@@ -132,7 +132,7 @@ void script_save_to_disk(FILE *fp, void *item, int type)
}
}
static void trigedit_setup_new(struct descriptor_data *d)
static void trigedit_setup_new(descriptor_data *d)
{
struct trig_data *trig;
@@ -155,7 +155,7 @@ static void trigedit_setup_new(struct descriptor_data *d)
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
}
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
void trigedit_setup_existing(descriptor_data *d, int rtrg_num)
{
struct trig_data *trig;
struct cmdlist_element *c;
@@ -182,7 +182,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
}
static void trigedit_disp_menu(struct descriptor_data *d)
static void trigedit_disp_menu(descriptor_data *d)
{
struct trig_data *trig = OLC_TRIG(d);
char *attach_type;
@@ -227,7 +227,7 @@ static void trigedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
}
static void trigedit_disp_types(struct descriptor_data *d)
static void trigedit_disp_types(descriptor_data *d)
{
int i, columns = 0;
const char **types;
@@ -420,7 +420,7 @@ static const char *command_color_replacement[COMMAND_TERMS][2] =
};
static void script_syntax_highlighting(struct descriptor_data *d, char *string)
static void script_syntax_highlighting(descriptor_data *d, char *string)
{
ACMD(do_action);
char buffer[MAX_STRING_LENGTH] = "";
@@ -484,7 +484,7 @@ static void script_syntax_highlighting(struct descriptor_data *d, char *string)
}
/****************************************************************************************/
void trigedit_parse(struct descriptor_data *d, char *arg)
void trigedit_parse(descriptor_data *d, char *arg)
{
int i = 0;
@@ -602,7 +602,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
return;
case TRIGEDIT_COPY:
if ((i = real_trigger(atoi(arg))) != NOWHERE) {
if ((i = real_trigger(atoidx(arg))) != NOWHERE) {
trigedit_setup_existing(d, i);
} else
write_to_output(d, "That trigger does not exist.\r\n");
@@ -618,7 +618,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
}
/* save the zone's triggers to internal memory and to disk */
void trigedit_save(struct descriptor_data *d)
void trigedit_save(descriptor_data *d)
{
int i;
trig_rnum rnum;
@@ -629,7 +629,7 @@ void trigedit_save(struct descriptor_data *d)
trig_data *live_trig;
struct cmdlist_element *cmd, *next_cmd;
struct index_data **new_index;
struct descriptor_data *dsc;
descriptor_data *dsc;
FILE *trig_file;
int zone, top;
char buf[MAX_CMD_LENGTH];
@@ -911,7 +911,7 @@ static void trigedit_create_index(int znum, char *type)
rename(new_name, old_name);
}
void dg_olc_script_copy(struct descriptor_data *d)
void dg_olc_script_copy(descriptor_data *d)
{
struct trig_proto_list *origscript, *editscript;
@@ -936,7 +936,7 @@ void dg_olc_script_copy(struct descriptor_data *d)
OLC_SCRIPT(d) = NULL;
}
void dg_script_menu(struct descriptor_data *d)
void dg_script_menu(descriptor_data *d)
{
struct trig_proto_list *editscript;
int i = 0;
@@ -972,7 +972,7 @@ void dg_script_menu(struct descriptor_data *d)
grn, nrm, grn, nrm, grn, nrm);
}
int dg_script_edit_parse(struct descriptor_data *d, char *arg)
int dg_script_edit_parse(descriptor_data *d, char *arg)
{
struct trig_proto_list *trig, *currtrig;
int count, pos, vnum;
@@ -1077,7 +1077,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
return 1;
}
void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
void trigedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case TRIGEDIT_COMMANDS:
@@ -1086,7 +1086,7 @@ void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
}
}
int format_script(struct descriptor_data *d)
int format_script(descriptor_data *d)
{
char nsc[MAX_CMD_LENGTH], *t, line[READ_SIZE];
char *sc;
+27 -27
View File
@@ -1,49 +1,49 @@
/**
* @file dg_olc.h
* This source file is used in extending Oasis OLC for trigedit.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* was created by the following people:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
* was created by the following people:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
*/
#ifndef _DG_OLC_H_
#define _DG_OLC_H_
#include "dg_scripts.h"
#define NUM_TRIG_TYPE_FLAGS 21
#define NUM_TRIG_TYPE_FLAGS 21
/* Submodes of TRIGEDIT connectedness. */
#define TRIGEDIT_MAIN_MENU 0
#define TRIGEDIT_TRIGTYPE 1
#define TRIGEDIT_CONFIRM_SAVESTRING 2
#define TRIGEDIT_NAME 3
#define TRIGEDIT_INTENDED 4
#define TRIGEDIT_TYPES 5
#define TRIGEDIT_COMMANDS 6
#define TRIGEDIT_NARG 7
#define TRIGEDIT_ARGUMENT 8
#define TRIGEDIT_COPY 9
#define TRIGEDIT_MAIN_MENU 0
#define TRIGEDIT_TRIGTYPE 1
#define TRIGEDIT_CONFIRM_SAVESTRING 2
#define TRIGEDIT_NAME 3
#define TRIGEDIT_INTENDED 4
#define TRIGEDIT_TYPES 5
#define TRIGEDIT_COMMANDS 6
#define TRIGEDIT_NARG 7
#define TRIGEDIT_ARGUMENT 8
#define TRIGEDIT_COPY 9
#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */
#define SCRIPT_MAIN_MENU 0
#define SCRIPT_NEW_TRIGGER 1
#define SCRIPT_DEL_TRIGGER 2
#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */
#define SCRIPT_MAIN_MENU 0
#define SCRIPT_NEW_TRIGGER 1
#define SCRIPT_DEL_TRIGGER 2
#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */
#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */
#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */
#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */
#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */
#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */
/* prototype exported functions from dg_olc.c */
void script_save_to_disk(FILE *fp, void *item, int type);
void dg_olc_script_copy(struct descriptor_data *d);
void dg_script_menu(struct descriptor_data *d);
int dg_script_edit_parse(struct descriptor_data *d, char *arg);
void dg_olc_script_copy(descriptor_data *d);
void dg_script_menu(descriptor_data *d);
int dg_script_edit_parse(descriptor_data *d, char *arg);
#endif /* _DG_OLC_H_ */
+52 -46
View File
@@ -35,7 +35,7 @@
/* Local functions not used elsewhere */
static obj_data *find_obj(long n);
static room_data *find_room(long n);
static void do_stat_trigger(struct char_data *ch, trig_data *trig);
static void do_stat_trigger(char_data *ch, trig_data *trig);
static void script_stat(char_data *ch, struct script_data *sc);
static int remove_trigger(struct script_data *sc, char *name);
static int is_num(char *arg);
@@ -71,8 +71,8 @@ static void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd);
static struct cmdlist_element * find_case(struct trig_data *trig, struct cmdlist_element *cl,
void *go, struct script_data *sc, int type, char *cond);
static struct cmdlist_element *find_done(struct cmdlist_element *cl);
static struct char_data *find_char_by_uid_in_lookup_table(long uid);
static struct obj_data *find_obj_by_uid_in_lookup_table(long uid);
static char_data *find_char_by_uid_in_lookup_table(long uid);
static obj_data *find_obj_by_uid_in_lookup_table(long uid);
static EVENTFUNC(trig_wait_event);
@@ -186,7 +186,7 @@ obj_data *get_object_in_equip(char_data * ch, char *name)
if (id == obj->script_id)
return (obj);
} else if (is_number(name)) {
obj_vnum ovnum = atoi(name);
obj_vnum ovnum = atoidx(name);
for (j = 0; j < NUM_WEARS; j++)
if ((obj = GET_EQ(ch, j)))
if (GET_OBJ_VNUM(obj) == ovnum)
@@ -258,7 +258,7 @@ int find_eq_pos_script(char *arg)
* @param pos The defined wear location to check.
* @retval int TRUE if obj can be worn on pos, FALSE if not.
*/
int can_wear_on_pos(struct obj_data *obj, int pos)
int can_wear_on_pos(obj_data *obj, int pos)
{
switch (pos) {
case WEAR_HOLD:
@@ -288,7 +288,7 @@ int can_wear_on_pos(struct obj_data *obj, int pos)
* @retval char_data * Pointer to the character structure if it exists, or NULL
* if it cannot be found.
*/
struct char_data *find_char(long n)
char_data *find_char(long n)
{
if (n>=ROOM_ID_BASE) /* See note in dg_scripts.h */
return NULL;
@@ -486,7 +486,7 @@ room_data *get_room(char *name)
if (*name == UID_CHAR)
return find_room(atoi(name + 1));
else if ((nr = real_room(atoi(name))) == NOWHERE)
else if ((nr = real_room(atoidx(name))) == NOWHERE)
return NULL;
else
return &world[nr];
@@ -722,14 +722,14 @@ static EVENTFUNC(trig_wait_event)
{
int found = FALSE;
if (type == MOB_TRIGGER) {
struct char_data *tch;
char_data *tch;
for (tch = character_list;tch && !found;tch = tch->next)
if (tch == (struct char_data *)go)
if (tch == (char_data *)go)
found = TRUE;
} else if (type == OBJ_TRIGGER) {
struct obj_data *obj;
obj_data *obj;
for (obj = object_list;obj && !found;obj = obj->next)
if (obj == (struct obj_data *)go)
if (obj == (obj_data *)go)
found = TRUE;
} else {
room_rnum i;
@@ -753,7 +753,7 @@ static EVENTFUNC(trig_wait_event)
return 0;
}
static void do_stat_trigger(struct char_data *ch, trig_data *trig)
static void do_stat_trigger(char_data *ch, trig_data *trig)
{
struct cmdlist_element *cmd_list;
char sb[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
@@ -878,7 +878,7 @@ static void script_stat (char_data *ch, struct script_data *sc)
}
}
void do_sstat_room(struct char_data * ch, struct room_data *rm)
void do_sstat_room(char_data * ch, struct room_data *rm)
{
send_to_char(ch, "Triggers:\r\n");
if (!SCRIPT(rm)) {
@@ -944,8 +944,11 @@ ACMD(do_attach)
trig_data *trig;
char targ_name[MAX_INPUT_LENGTH], trig_name[MAX_INPUT_LENGTH];
char loc_name[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
int loc, tn, rn, num_arg;
int loc;
trig_rnum rn;
room_rnum rnum;
IDXTYPE num_arg;
trig_vnum tn;
argument = two_arguments(argument, arg, trig_name);
two_arguments(argument, targ_name, loc_name);
@@ -955,8 +958,8 @@ ACMD(do_attach)
return;
}
num_arg = atoi(targ_name);
tn = atoi(trig_name);
num_arg = atoidx(targ_name);
tn = atoidx(trig_name);
loc = (*loc_name) ? atoi(loc_name) : -1;
if (is_abbrev(arg, "mobile") || is_abbrev(arg, "mtr")) {
@@ -1147,13 +1150,15 @@ ACMD(do_detach)
struct room_data *room;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], arg3[MAX_INPUT_LENGTH], *snum;
char *trigger = 0;
int num_arg, tn, rn;
IDXTYPE num_arg;
trig_vnum tn;
trig_rnum rn;
room_rnum rnum;
trig_data *trig;
argument = two_arguments(argument, arg1, arg2);
one_argument(argument, arg3);
tn = atoi(arg3);
tn = atoidx(arg3);
rn = real_trigger(tn);
trig = read_trigger(rn);
@@ -1164,7 +1169,7 @@ ACMD(do_detach)
}
/* vnum of mob/obj, if given */
num_arg = atoi(arg2);
num_arg = atoidx(arg2);
if (!str_cmp(arg1, "room") || !str_cmp(arg1, "wtr")) {
if (!*arg3 || (strchr(arg2, '.')))
@@ -1321,7 +1326,7 @@ ACMD(do_detach)
void script_vlog(const char *format, va_list args)
{
char output[MAX_STRING_LENGTH];
struct descriptor_data *i;
descriptor_data *i;
/* parse the args, making the error message */
vsnprintf(output, sizeof(output) - 2, format, args);
@@ -1793,7 +1798,8 @@ static void process_attach(void *go, struct script_data *sc, trig_data *trig,
char_data *c=NULL;
obj_data *o=NULL;
room_data *r=NULL;
long trignum, id;
long id;
trig_rnum trignum;
id_p = two_arguments(cmd, arg, trignum_s);
skip_spaces(&id_p);
@@ -1831,7 +1837,7 @@ static void process_attach(void *go, struct script_data *sc, trig_data *trig,
}
/* locate and load the trigger specified */
trignum = real_trigger(atoi(trignum_s));
trignum = real_trigger(atoidx(trignum_s));
if (trignum == NOTHING || !(newtrig=read_trigger(trignum))) {
script_log("Trigger: %s, VNum %d. attach invalid trigger: '%s'",
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), trignum_s);
@@ -1953,7 +1959,7 @@ static void process_detach(void *go, struct script_data *sc, trig_data *trig,
}
struct room_data *dg_room_of_obj(struct obj_data *obj)
struct room_data *dg_room_of_obj(obj_data *obj)
{
if (IN_ROOM(obj) != NOWHERE) return &world[IN_ROOM(obj)];
if (obj->carried_by) return &world[IN_ROOM(obj->carried_by)];
@@ -2002,34 +2008,34 @@ static void makeuid_var(void *go, struct script_data *sc, trig_data *trig,
}
if (is_abbrev(arg, "mob")) {
struct char_data *c = NULL;
char_data *c = NULL;
switch (type) {
case WLD_TRIGGER:
c = get_char_in_room((struct room_data *)go, name);
break;
case OBJ_TRIGGER:
c = get_char_near_obj((struct obj_data *)go, name);
c = get_char_near_obj((obj_data *)go, name);
break;
case MOB_TRIGGER:
c = get_char_room_vis((struct char_data *)go, name, NULL);
c = get_char_room_vis((char_data *)go, name, NULL);
break;
}
if (c)
snprintf(uid, sizeof(uid), "%c%ld", UID_CHAR, char_script_id(c));
} else if (is_abbrev(arg, "obj")) {
struct obj_data *o = NULL;
obj_data *o = NULL;
switch (type) {
case WLD_TRIGGER:
o = get_obj_in_room((struct room_data *)go, name);
break;
case OBJ_TRIGGER:
o = get_obj_near_obj((struct obj_data *)go, name);
o = get_obj_near_obj((obj_data *)go, name);
break;
case MOB_TRIGGER:
if ((o = get_obj_in_list_vis((struct char_data *)go, name, NULL,
((struct char_data *)go)->carrying)) == NULL)
o = get_obj_in_list_vis((struct char_data *)go, name, NULL,
world[IN_ROOM((struct char_data *)go)].contents);
if ((o = get_obj_in_list_vis((char_data *)go, name, NULL,
((char_data *)go)->carrying)) == NULL)
o = get_obj_in_list_vis((char_data *)go, name, NULL,
world[IN_ROOM((char_data *)go)].contents);
break;
}
if (o)
@@ -2041,10 +2047,10 @@ static void makeuid_var(void *go, struct script_data *sc, trig_data *trig,
r = real_room(((struct room_data *) go)->number);
break;
case OBJ_TRIGGER:
r = obj_room((struct obj_data *)go);
r = obj_room((obj_data *)go);
break;
case MOB_TRIGGER:
r = IN_ROOM((struct char_data *)go);
r = IN_ROOM((char_data *)go);
break;
}
if (r != NOWHERE)
@@ -2261,7 +2267,7 @@ ACMD(do_vdelete)
/* Called from do_set - return 0 for failure, 1 for success. ch and vict are
* verified. */
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg)
int perform_set_dg_var(char_data *ch, char_data *vict, char *val_arg)
{
char var_name[MAX_INPUT_LENGTH], *var_value;
@@ -2725,7 +2731,7 @@ trig_rnum real_trigger(trig_vnum vnum)
bot = 0;
top = top_of_trigt - 1;
if (!top_of_trigt || trig_index[bot]->vnum > vnum || trig_index[top]->vnum < vnum)
if (vnum == NOTHING || !top_of_trigt || trig_index[bot]->vnum > vnum || trig_index[top]->vnum < vnum)
return (NOTHING);
/* perform binary search on trigger-table */
@@ -2749,7 +2755,7 @@ ACMD(do_tstat)
half_chop(argument, str, argument);
if (*str) {
rnum = real_trigger(atoi(str));
rnum = real_trigger(atoidx(str));
if (rnum == NOTHING) {
send_to_char(ch, "That vnum does not exist.\r\n");
return;
@@ -2821,7 +2827,7 @@ static struct cmdlist_element *find_done(struct cmdlist_element *cl)
/* load in a character's saved variables */
void read_saved_vars(struct char_data *ch)
void read_saved_vars(char_data *ch)
{
FILE *file;
long context;
@@ -2868,7 +2874,7 @@ void read_saved_vars(struct char_data *ch)
}
/* save a characters variables out to disk */
void save_char_vars(struct char_data *ch)
void save_char_vars(char_data *ch)
{
FILE *file;
char fn[127];
@@ -2907,7 +2913,7 @@ void save_char_vars(struct char_data *ch)
}
/* load in a character's saved variables from an ASCII pfile*/
void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count)
void read_saved_vars_ascii(FILE *file, char_data *ch, int count)
{
long context;
char input_line[1024], *temp, *p;
@@ -2942,7 +2948,7 @@ void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count)
}
/* save a characters variables out to an ASCII pfile */
void save_char_vars_ascii(FILE *file, struct char_data *ch)
void save_char_vars_ascii(FILE *file, char_data *ch)
{
struct trig_var_data *vars;
int count = 0;
@@ -3008,23 +3014,23 @@ static inline struct lookup_table_t *find_element_by_uid_in_lookup_table(long ui
return lt;
}
static struct char_data *find_char_by_uid_in_lookup_table(long uid)
static char_data *find_char_by_uid_in_lookup_table(long uid)
{
struct lookup_table_t *lt = find_element_by_uid_in_lookup_table(uid);
if (lt)
return (struct char_data *)(lt->c);
return (char_data *)(lt->c);
log("find_char_by_uid_in_lookup_table : No entity with number %ld in lookup table", uid);
return NULL;
}
static struct obj_data *find_obj_by_uid_in_lookup_table(long uid)
static obj_data *find_obj_by_uid_in_lookup_table(long uid)
{
struct lookup_table_t *lt = find_element_by_uid_in_lookup_table(uid);
if (lt)
return (struct obj_data *)(lt->c);
return (obj_data *)(lt->c);
log("find_obj_by_uid_in_lookup_table : No entity with number %ld in lookup table", uid);
return NULL;
@@ -3096,7 +3102,7 @@ bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *
return FALSE;
}
int trig_is_attached(struct script_data *sc, int trig_num)
int trig_is_attached(struct script_data *sc, trig_vnum trig_num)
{
trig_data *t;
+84 -103
View File
@@ -16,6 +16,7 @@
#define _DG_SCRIPTS_H_
#include "utils.h" /* To make sure ACMD is defined */
#include "structs.h" /* To make sure we have access to typedefs */
#define MOB_TRIGGER 0
#define OBJ_TRIGGER 1
@@ -53,8 +54,8 @@
/* mob trigger types */
#define MTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define MTRIG_RANDOM (1 << 1) /* checked randomly */
#define MTRIG_COMMAND (1 << 2) /* character types a command */
#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */
#define MTRIG_COMMAND (1 << 2) /* character types a command */
#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */
#define MTRIG_ACT (1 << 4) /* word or phrase sent to act */
#define MTRIG_DEATH (1 << 5) /* character dies */
#define MTRIG_GREET (1 << 6) /* something enters room seen */
@@ -63,7 +64,7 @@
#define MTRIG_RECEIVE (1 << 9) /* character is given obj */
#define MTRIG_FIGHT (1 << 10) /* each pulse while fighting */
#define MTRIG_HITPRCNT (1 << 11) /* fighting and below some hp */
#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */
#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */
#define MTRIG_LOAD (1 << 13) /* the mob is loaded */
#define MTRIG_MEMORY (1 << 14) /* mob see's someone remembered */
#define MTRIG_CAST (1 << 15) /* mob targetted by spell */
@@ -74,8 +75,8 @@
#define MTRIG_DAMAGE (1 << 20) /* trigger whenever mob is damaged */
/* obj trigger types */
#define OTRIG_GLOBAL (1 << 0) /* unused */
#define OTRIG_RANDOM (1 << 1) /* checked randomly */
#define OTRIG_GLOBAL (1 << 0) /* unused */
#define OTRIG_RANDOM (1 << 1) /* checked randomly */
#define OTRIG_COMMAND (1 << 2) /* character types a command */
#define OTRIG_TIMER (1 << 5) /* item's timer expires */
@@ -95,12 +96,12 @@
/* wld trigger types */
#define WTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define WTRIG_RANDOM (1 << 1) /* checked randomly */
#define WTRIG_COMMAND (1 << 2) /* character types a command */
#define WTRIG_RANDOM (1 << 1) /* checked randomly */
#define WTRIG_COMMAND (1 << 2) /* character types a command */
#define WTRIG_SPEECH (1 << 3) /* a char says word/phrase */
#define WTRIG_RESET (1 << 5) /* zone has been reset */
#define WTRIG_ENTER (1 << 6) /* character enters room */
#define WTRIG_ENTER (1 << 6) /* character enters room */
#define WTRIG_DROP (1 << 7) /* something dropped in room */
#define WTRIG_CAST (1 << 15) /* spell cast in room */
@@ -110,41 +111,40 @@
#define WTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj command trigger types */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
#define OCMD_ROOM (1 << 2) /* obj must be in char's room */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
#define OCMD_ROOM (1 << 2) /* obj must be in char's room */
/* obj consume trigger commands */
#define OCMD_EAT 1
#define OCMD_DRINK 2
#define OCMD_QUAFF 3
#define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */
#define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
* same time. */
#define PULSE_DG_SCRIPT (13 RL_SEC)
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
recurse into each other */
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can recurse into each other */
#define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */
/* one line of the trigger */
struct cmdlist_element {
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
int loops; /* for counting number of runs in a while loop */
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
int loops; /* for counting number of runs in a while loop */
};
struct trig_var_data {
char *name; /* name of variable */
char *value; /* value of variable */
long context; /* 0: global context */
char *name; /* name of variable */
char *value; /* value of variable */
long context; /* 0: global context */
struct trig_var_data *next;
struct trig_var_data *next;
};
/** structure for triggers */
@@ -155,14 +155,14 @@ struct trig_data {
char *name; /**< name of trigger */
long trigger_type; /**< type of trigger (for bitvector) */
struct cmdlist_element *cmdlist; /**< top of command list */
struct cmdlist_element *curr_state; /**< ptr to current line of trigger */
struct cmdlist_element *curr_state; /**< ptr to current line of trigger */
int narg; /**< numerical argument */
char *arglist; /**< argument list */
int depth; /**< depth into nest ifs/whiles/etc */
int loops; /**< loop iteration counter */
struct event *wait_event; /**< event to pause the trigger */
ubyte purged; /**< trigger is set to be purged */
struct trig_var_data *var_list; /**< list of local vars for trigger */
struct trig_var_data *var_list; /**< list of local vars for trigger */
struct trig_data *next;
struct trig_data *next_in_world; /**< next in the global trigger list */
@@ -170,44 +170,36 @@ struct trig_data {
/** a complete script (composed of several triggers) */
struct script_data {
long types; /**< bitvector of trigger types */
struct trig_data *trig_list; /**< list of triggers */
struct trig_var_data *global_vars; /**< list of global variables */
ubyte purged; /**< script is set to be purged */
long context; /**< current context for statics */
long types; /**< bitvector of trigger types */
struct trig_data *trig_list; /**< list of triggers */
struct trig_var_data *global_vars; /**< list of global variables */
ubyte purged; /**< script is set to be purged */
long context; /**< current context for statics */
struct script_data *next; /**< used for purged_scripts */
struct script_data *next; /**< used for purged_scripts */
};
/* The event data for the wait command */
struct wait_event_data {
struct trig_data *trigger;
void *go;
int type;
struct trig_data *trigger;
void *go;
int type;
};
/* used for actor memory triggers */
struct script_memory {
long id; /* id of who to remember */
char *cmd; /* command, or NULL for generic */
struct script_memory *next;
long id; /* id of who to remember */
char *cmd; /* command, or NULL for generic */
struct script_memory *next;
};
/* typedefs that the dg functions rely on */
typedef struct index_data index_data;
typedef struct room_data room_data;
typedef struct obj_data obj_data;
typedef struct trig_data trig_data;
typedef struct char_data char_data;
/* function prototypes from dg_triggers.c */
char *one_phrase(char *arg, char *first_arg);
int is_substring(char *sub, char *string);
int word_check(char *str, char *wordlist);
void act_mtrigger(const char_data *ch, char *str,
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
void act_mtrigger(const char_data *ch, char *str, char_data *actor, char_data *victim, obj_data *object,
obj_data *target, char *arg);
void speech_mtrigger(char_data *actor, char *str);
void speech_wtrigger(char_data *actor, char *str);
void greet_memory_mtrigger(char_data *ch);
@@ -219,17 +211,13 @@ int drop_otrigger(obj_data *obj, char_data *actor);
void timer_otrigger(obj_data *obj);
int get_otrigger(obj_data *obj, char_data *actor);
int drop_wtrigger(obj_data *obj, char_data *actor);
int give_otrigger(obj_data *obj, char_data *actor,
char_data *victim);
int receive_mtrigger(char_data *ch, char_data *actor,
obj_data *obj);
void bribe_mtrigger(char_data *ch, char_data *actor,
int amount);
int give_otrigger(obj_data *obj, char_data *actor, char_data *victim);
int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj);
void bribe_mtrigger(char_data *ch, char_data *actor, int amount);
int wear_otrigger(obj_data *obj, char_data *actor, int where);
int remove_otrigger(obj_data *obj, char_data *actor);
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
char *argument, int type);
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, char *argument, int type);
int command_mtrigger(char_data *actor, char *cmd, char *argument);
int command_otrigger(char_data *actor, char *cmd, char *argument);
int command_wtrigger(char_data *actor, char *cmd, char *argument);
@@ -273,8 +261,8 @@ ACMD(do_vdelete);
ACMD(do_tstat);
char *str_str(char *cs, char *ct);
int find_eq_pos_script(char *arg);
int can_wear_on_pos(struct obj_data *obj, int pos);
struct char_data *find_char(long n);
int can_wear_on_pos(obj_data *obj, int pos);
char_data *find_char(long n);
char_data *get_char(char *name);
char_data *get_char_near_obj(obj_data *obj, char *name);
char_data *get_char_in_room(room_data *room, char *name);
@@ -292,28 +280,27 @@ obj_data *get_object_in_equip(char_data * ch, char *name);
void script_trigger_check(void);
void check_time_triggers(void);
void find_uid_name(char *uid, char *name, size_t nlen);
void do_sstat_room(struct char_data * ch, room_data *r);
void do_sstat_room(char_data * ch, room_data *r);
void do_sstat_object(char_data *ch, obj_data *j);
void do_sstat_character(char_data *ch, char_data *k);
void add_trigger(struct script_data *sc, trig_data *t, int loc);
void script_vlog(const char *format, va_list args);
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
char *matching_quote(char *p);
struct room_data *dg_room_of_obj(struct obj_data *obj);
struct room_data *dg_room_of_obj(obj_data *obj);
bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]);
void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count);
void save_char_vars_ascii(FILE *file, struct char_data *ch);
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg);
int trig_is_attached(struct script_data *sc, int trig_num);
void read_saved_vars_ascii(FILE *file, char_data *ch, int count);
void save_char_vars_ascii(FILE *file, char_data *ch);
int perform_set_dg_var(char_data *ch, char_data *vict, char *val_arg);
int trig_is_attached(struct script_data *sc, trig_vnum trig_num);
/* To maintain strict-aliasing we'll have to do this trick with a union */
/* Thanks to Chris Gilbert for reminding me that there are other options. */
int script_driver(void *go_adress, trig_data *trig, int type, int mode);
trig_rnum real_trigger(trig_vnum vnum);
void process_eval(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void read_saved_vars(struct char_data *ch);
void save_char_vars(struct char_data *ch);
void process_eval(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void read_saved_vars(char_data *ch);
void save_char_vars(char_data *ch);
void init_lookup_table(void);
void add_to_lookup_table(long uid, void *c);
void remove_from_lookup_table(long uid);
@@ -323,20 +310,18 @@ void parse_trigger(FILE *trig_f, int nr);
trig_data *read_trigger(int nr);
void trig_data_copy(trig_data *this_data, const trig_data *trg);
void dg_read_trigger(FILE *fp, void *proto, int type);
void dg_obj_trigger(char *line, struct obj_data *obj);
void dg_obj_trigger(char *line, obj_data *obj);
void assign_triggers(void *i, int type);
/* From dg_variables.c */
void add_var(struct trig_var_data **var_list, const char *name, const char *value, long id);
int item_in_list(char *item, obj_data *list);
char *skill_percent(struct char_data *ch, char *skill);
int char_has_item(char *item, struct char_data *ch);
void var_subst(void *go, struct script_data *sc, trig_data *trig,
int type, char *line, char *buf);
int text_processed(char *field, char *subfield, struct trig_var_data *vd,
char *str, size_t slen);
void find_replacement(void *go, struct script_data *sc, trig_data *trig,
int type, char *var, char *field, char *subfield, char *str, size_t slen);
char *skill_percent(char_data *ch, char *skill);
int char_has_item(char *item, char_data *ch);
void var_subst(void *go, struct script_data *sc, trig_data *trig, int type, char *line, char *buf);
int text_processed(char *field, char *subfield, struct trig_var_data *vd, char *str, size_t slen);
void find_replacement(void *go, struct script_data *sc, trig_data *trig, int type, char *var, char *field,
char *subfield, char *str, size_t slen);
/* From dg_handler.c */
void free_var_el(struct trig_var_data *var);
@@ -357,11 +342,9 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets);
void send_to_zone(char *messg, zone_rnum zone);
/* from dg_misc.c */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void send_char_pos(struct char_data *ch, int dam);
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void send_char_pos(char_data *ch, int dam);
int valid_dg_target(char_data *ch, int bitvector);
void script_damage(char_data *vict, int dam);
@@ -390,10 +373,10 @@ ACMD(do_mzoneecho);
ACMD(do_mlog);
/* from dg_olc.c... thinking these should be moved to oasis.h */
void trigedit_save(struct descriptor_data *d);
void trigedit_string_cleanup(struct descriptor_data *d, int terminator);
int format_script(struct descriptor_data *d);
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
void trigedit_save(descriptor_data *d);
void trigedit_string_cleanup(descriptor_data *d, int terminator);
int format_script(descriptor_data *d);
void trigedit_setup_existing(descriptor_data *d, int rtrg_num);
/* from dg_objcmd.c */
room_rnum obj_room(obj_data *obj);
@@ -409,13 +392,13 @@ void wld_command_interpreter(room_data *room, char *argument);
#define UID_CHAR '}'
#define GET_TRIG_NAME(t) ((t)->name)
#define GET_TRIG_RNUM(t) ((t)->nr)
#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum)
#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum)
#define GET_TRIG_TYPE(t) ((t)->trigger_type)
#define GET_TRIG_DATA_TYPE(t) ((t)->data_type)
#define GET_TRIG_DATA_TYPE(t) ((t)->data_type)
#define GET_TRIG_NARG(t) ((t)->narg)
#define GET_TRIG_ARG(t) ((t)->arglist)
#define GET_TRIG_VARS(t) ((t)->var_list)
#define GET_TRIG_WAIT(t) ((t)->wait_event)
#define GET_TRIG_VARS(t) ((t)->var_list)
#define GET_TRIG_WAIT(t) ((t)->wait_event)
#define GET_TRIG_DEPTH(t) ((t)->depth)
#define GET_TRIG_LOOPS(t) ((t)->loops)
@@ -423,22 +406,20 @@ void wld_command_interpreter(room_data *room, char *argument);
* mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1
* room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1
* object id's: OBJ_ID_BASE and higher */
#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */
#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */
#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */
#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */
#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */
#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */
#define SCRIPT(o) ((o)->script)
#define SCRIPT_MEM(c) ((c)->memory)
#define SCRIPT(o) ((o)->script)
#define SCRIPT_MEM(c) ((c)->memory)
#define SCRIPT_TYPES(s) ((s)->types)
#define TRIGGERS(s) ((s)->trig_list)
#define SCRIPT_TYPES(s) ((s)->types)
#define TRIGGERS(s) ((s)->trig_list)
#define GET_SHORT(ch) ((ch)->player.short_descr)
#define GET_SHORT(ch) ((ch)->player.short_descr)
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \
IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \
!GET_TRIG_DEPTH(t))
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && !GET_TRIG_DEPTH(t))
/* This formerly used 'go' instead of 'id' and referenced 'go->id' but this is
@@ -446,8 +427,8 @@ void wld_command_interpreter(room_data *room, char *argument);
* and obj_script_id().
*/
#define ADD_UID_VAR(buf, trig, id, name, context) do { \
sprintf(buf, "%c%ld", UID_CHAR, id); \
add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0)
sprintf(buf, "%c%ld", UID_CHAR, id); \
add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0)
// id helpers
extern long char_script_id(char_data *ch);
+3 -3
View File
@@ -412,7 +412,7 @@ void act_mtrigger(const char_data *ch, char *str, char_data *actor,
void fight_mtrigger(char_data *ch)
{
struct char_data *actor;
char_data *actor;
trig_data *t;
char buf[MAX_INPUT_LENGTH];
@@ -437,7 +437,7 @@ void fight_mtrigger(char_data *ch)
void hitprcnt_mtrigger(char_data *ch)
{
struct char_data *actor;
char_data *actor;
trig_data *t;
char buf[MAX_INPUT_LENGTH];
@@ -676,7 +676,7 @@ void random_otrigger(obj_data *obj)
}
}
void timer_otrigger(struct obj_data *obj)
void timer_otrigger(obj_data *obj)
{
trig_data *t;
+21 -20
View File
@@ -65,7 +65,7 @@ void add_var(struct trig_var_data **var_list, const char *name, const char *valu
}
/* perhaps not the best place for this, but I didn't want a new file */
char *skill_percent(struct char_data *ch, char *skill)
char *skill_percent(char_data *ch, char *skill)
{
static char retval[16];
int skillnum;
@@ -98,7 +98,7 @@ int item_in_list(char *item, obj_data *list)
count += item_in_list(item, i->contains);
}
} else if (is_number(item)) { /* check for vnum */
obj_vnum ovnum = atoi(item);
obj_vnum ovnum = atoidx(item);
for (i = list; i; i = i->next_content) {
if (GET_OBJ_VNUM(i) == ovnum)
@@ -120,7 +120,7 @@ int item_in_list(char *item, obj_data *list)
/* BOOLEAN return, just check if a player or mob has an item of any sort,
* searched for by name or id. Searching equipment as well as inventory, and
* containers. Jamie Nelson */
int char_has_item(char *item, struct char_data *ch)
int char_has_item(char *item, char_data *ch)
{
/* If this works, no more searching needed */
@@ -133,7 +133,7 @@ int char_has_item(char *item, struct char_data *ch)
return 1;
}
static int handle_oset(struct obj_data * obj, char * argument)
static int handle_oset(obj_data * obj, char * argument)
{
int i = 0;
bool found = FALSE;
@@ -141,7 +141,7 @@ static int handle_oset(struct obj_data * obj, char * argument)
struct oset_handler {
const char * type;
bool (* name)(struct obj_data *, char *);
bool (* name)(obj_data *, char *);
} handler[] = {
{ "alias", oset_alias },
{ "apply", oset_apply },
@@ -256,6 +256,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
struct room_data *room, *r = NULL;
char *name;
int num, count, i, j, doors;
IDXTYPE idx;
char *log_cmd[] = {"mlog ", "olog ", "wlog " };
char *send_cmd[] = {"msend ", "osend ", "wsend " };
@@ -429,7 +430,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
return;
}
else if (!str_cmp(var, "people")) {
snprintf(str, slen, "%d",((num = atoi(field)) > 0) ? trgvar_in_room(num) : 0);
snprintf(str, slen, "%d",((num = atoidx(field)) > 0) ? trgvar_in_room(num) : 0);
return;
}
else if (!str_cmp(var, "happyhour")) {
@@ -469,8 +470,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
script_log("findmob.vnum(mvnum) - illegal syntax");
strcpy(str, "0");
} else {
room_rnum rrnum = real_room(atoi(field));
mob_vnum mvnum = atoi(subfield);
room_rnum rrnum = real_room(atoidx(field));
mob_vnum mvnum = atoidx(subfield);
if (rrnum == NOWHERE) {
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
@@ -490,7 +491,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
script_log("findobj.vnum(ovnum) - illegal syntax");
strcpy(str, "0");
} else {
room_rnum rrnum = real_room(atoi(field));
room_rnum rrnum = real_room(atoidx(field));
if (rrnum == NOWHERE) {
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
@@ -552,10 +553,10 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
in_room = real_room(((struct room_data *) go)->number);
break;
case OBJ_TRIGGER:
in_room = obj_room((struct obj_data *) go);
in_room = obj_room((obj_data *) go);
break;
case MOB_TRIGGER:
in_room = IN_ROOM((struct char_data *)go);
in_room = IN_ROOM((char_data *)go);
break;
}
if (in_room == NOWHERE) {
@@ -978,7 +979,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
else if (!str_cmp(field, "questdone"))
{
if (!IS_NPC(c) && subfield && *subfield) {
int q_num = atoi(subfield);
qst_vnum q_num = atoidx(subfield);
if (is_complete(c, q_num))
strcpy(str, "1");
else
@@ -1111,7 +1112,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
* something like if %actor.vnum(500)%. It should return false for PC's instead
* -- Fizban 02/18
*/
snprintf(str, slen, "%d", IS_NPC(c) ? (int)(GET_MOB_VNUM(c) == atoi(subfield)) : 0 );
snprintf(str, slen, "%d", IS_NPC(c) ? GET_MOB_VNUM(c) == atoidx(subfield) : 0 );
} else {
if (IS_NPC(c))
snprintf(str, slen, "%d", GET_MOB_VNUM(c));
@@ -1249,8 +1250,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
if (!(subfield && *subfield))
*str = '\0';
else {
i = atoi(subfield);
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(o), i));
idx = atoidx(subfield);
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(o), idx));
}
}
break;
@@ -1311,7 +1312,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
case 'v':
if (!str_cmp(field, "vnum"))
if (subfield && *subfield) {
snprintf(str, slen, "%d", (int)(GET_OBJ_VNUM(o) == atoi(subfield)));
snprintf(str, slen, "%d", GET_OBJ_VNUM(o) == atoidx(subfield));
} else {
snprintf(str, slen, "%d", GET_OBJ_VNUM(o));
}
@@ -1403,14 +1404,14 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
else if (!str_cmp(field, "vnum")) {
if (subfield && *subfield) {
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
snprintf(str, slen, "%d", r->number == atoidx(subfield));
} else {
snprintf(str, slen,"%d",r->number);
}
} else if (!str_cmp(field, "contents")) {
if (subfield && *subfield) {
for (obj = r->contents; obj; obj = obj->next_content) {
if (GET_OBJ_VNUM(obj) == atoi(subfield)) {
if (GET_OBJ_VNUM(obj) == atoidx(subfield)) {
/* arg given, found */
snprintf(str, slen, "%c%ld", UID_CHAR, obj_script_id(obj));
return;
@@ -1457,8 +1458,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
if (!(subfield && *subfield))
*str = '\0';
else {
i = atoi(subfield);
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(r), i));
idx = atoidx(subfield);
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(r), idx));
}
}
else if (!str_cmp(field, "zonenumber"))
+15 -13
View File
@@ -169,7 +169,7 @@ WCMD(do_wzoneecho)
if (!*room_num || !*msg)
wld_log(room, "wzoneecho called with too few args");
else if ((zone = real_zone_by_thing(atoi(room_num))) == NOWHERE)
else if ((zone = real_zone_by_thing(atoidx(room_num))) == NOWHERE)
wld_log(room, "wzoneecho called for nonexistant zone");
else {
@@ -191,7 +191,7 @@ WCMD(do_wrecho)
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
wld_log(room, "wrecho: too few args");
else
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
send_to_range(atoidx(start), atoidx(finish), "%s\r\n", msg);
}
@@ -270,7 +270,7 @@ WCMD(do_wdoor)
newexit->exit_info = (sh_int)asciiflag_conv(value);
break;
case 3: /* key */
newexit->key = atoi(value);
newexit->key = atoidx(value);
break;
case 4: /* name */
if (newexit->keyword)
@@ -279,7 +279,7 @@ WCMD(do_wdoor)
strcpy(newexit->keyword, value);
break;
case 5: /* room */
if ((to_room = real_room(atoi(value))) != NOWHERE)
if ((to_room = real_room(atoidx(value))) != NOWHERE)
newexit->to_room = to_room;
else
wld_log(room, "wdoor: invalid door target");
@@ -291,7 +291,8 @@ WCMD(do_wdoor)
WCMD(do_wteleport)
{
char_data *ch, *next_ch;
room_rnum target, nr;
room_rnum target;
room_vnum nr;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
two_arguments(argument, arg1, arg2);
@@ -301,7 +302,7 @@ WCMD(do_wteleport)
return;
}
nr = atoi(arg2);
nr = atoidx(arg2);
target = real_room(nr);
if (target == NOWHERE)
@@ -435,7 +436,7 @@ WCMD(do_wpurge)
WCMD(do_wload)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
int number = 0;
IDXTYPE number = NOTHING;
char_data *mob;
obj_data *object;
char *target;
@@ -445,7 +446,7 @@ WCMD(do_wload)
target = two_arguments(argument, arg1, arg2);
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
if (!*arg1 || !*arg2 || !is_number(arg2) || (number = atoidx(arg2)) == NOTHING) {
wld_log(room, "wload: bad syntax");
return;
}
@@ -456,7 +457,7 @@ WCMD(do_wload)
if (!target || !*target) {
rnum = real_room(room->number);
} else {
if (!isdigit(*target) || (rnum = real_room(atoi(target))) == NOWHERE) {
if (!isdigit(*target) || (rnum = real_room(atoidx(target))) == NOWHERE) {
wld_log(room, "wload: room target vnum doesn't exist (loading mob vnum %d to room %s)", number, target);
return;
}
@@ -547,7 +548,7 @@ WCMD(do_wdamage) {
WCMD(do_wat)
{
room_rnum loc = NOWHERE;
struct char_data *ch;
char_data *ch;
char arg[MAX_INPUT_LENGTH], *command;
command = any_one_arg(argument, arg);
@@ -564,7 +565,7 @@ WCMD(do_wat)
return;
}
if (isdigit(*arg)) loc = real_room(atoi(arg));
if (isdigit(*arg)) loc = real_room(atoidx(arg));
else if ((ch = get_char_by_room(room, arg))) loc = IN_ROOM(ch);
if (loc == NOWHERE) {
@@ -577,7 +578,8 @@ WCMD(do_wat)
WCMD(do_wmove)
{
obj_data *obj, *next_obj;
room_rnum target, nr;
room_rnum target;
room_vnum nr;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
two_arguments(argument, arg1, arg2);
@@ -587,7 +589,7 @@ WCMD(do_wmove)
return;
}
nr = atoi(arg2);
nr = atoidx(arg2);
target = real_room(nr);
if (target == NOWHERE) {
+1 -1
View File
@@ -1054,7 +1054,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = "ACMD(name)=void name (struct char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(struct char_data *ch, void *me, int cmd, char *argument)"
PREDEFINED = "ACMD(name)=void name (char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(char_data *ch, void *me, int cmd, char *argument)"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
+1 -1
View File
@@ -1054,7 +1054,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = "ACMD(name)=void name (struct char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(struct char_data *ch, void *me, int cmd, char *argument)"
PREDEFINED = "ACMD(name)=void name (char_data *ch, char *argument, int cmd, int subcmd)" "WCMD(name)=void name (room_data *room, char *argument, int cmd, int subcmd)" "OCMD(name)=void name(obj_data *obj, char *argument, int cmd, int subcmd)" "SPECIAL(name)=int name(char_data *ch, void *me, int cmd, char *argument)"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
+43 -43
View File
@@ -29,7 +29,7 @@
/* locally defined global variables, used externally */
/* head of l-list of fighting chars */
struct char_data *combat_list = NULL;
char_data *combat_list = NULL;
/* Weapon attack texts */
struct attack_hit_type attack_hit_text[] =
{
@@ -51,23 +51,23 @@ struct attack_hit_type attack_hit_text[] =
};
/* local (file scope only) variables */
static struct char_data *next_combat_list = NULL;
static char_data *next_combat_list = NULL;
/* local file scope utility functions */
static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim);
static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type);
static void make_corpse(struct char_data *ch);
static void change_alignment(struct char_data *ch, struct char_data *victim);
static void group_gain(struct char_data *ch, struct char_data *victim);
static void solo_gain(struct char_data *ch, struct char_data *victim);
static void perform_group_gain(char_data *ch, int base, char_data *victim);
static void dam_message(int dam, char_data *ch, char_data *victim, int w_type);
static void make_corpse(char_data *ch);
static void change_alignment(char_data *ch, char_data *victim);
static void group_gain(char_data *ch, char_data *victim);
static void solo_gain(char_data *ch, char_data *victim);
/** @todo refactor this function name */
static char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural);
static int compute_thaco(struct char_data *ch, struct char_data *vict);
static int compute_thaco(char_data *ch, char_data *vict);
#define IS_WEAPON(type) (((type) >= TYPE_HIT) && ((type) < TYPE_SUFFERING))
/* The Fight related routines */
void appear(struct char_data *ch)
void appear(char_data *ch)
{
if (affected_by_spell(ch, SPELL_INVISIBLE))
affect_from_char(ch, SPELL_INVISIBLE);
@@ -82,7 +82,7 @@ void appear(struct char_data *ch)
FALSE, ch, 0, 0, TO_ROOM);
}
int compute_armor_class(struct char_data *ch)
int compute_armor_class(char_data *ch)
{
int armorclass = GET_AC(ch);
@@ -92,7 +92,7 @@ int compute_armor_class(struct char_data *ch)
return (MAX(-100, armorclass)); /* -100 is lowest */
}
void update_pos(struct char_data *victim)
void update_pos(char_data *victim)
{
if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))
return;
@@ -108,7 +108,7 @@ void update_pos(struct char_data *victim)
GET_POS(victim) = POS_STUNNED;
}
void check_killer(struct char_data *ch, struct char_data *vict)
void check_killer(char_data *ch, char_data *vict)
{
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF))
return;
@@ -123,7 +123,7 @@ void check_killer(struct char_data *ch, struct char_data *vict)
}
/* start one char fighting another (yes, it is horrible, I know... ) */
void set_fighting(struct char_data *ch, struct char_data *vict)
void set_fighting(char_data *ch, char_data *vict)
{
if (ch == vict)
return;
@@ -147,9 +147,9 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
}
/* remove a char from the list of fighting chars */
void stop_fighting(struct char_data *ch)
void stop_fighting(char_data *ch)
{
struct char_data *temp;
char_data *temp;
if (ch == next_combat_list)
next_combat_list = ch->next_fighting;
@@ -161,11 +161,11 @@ void stop_fighting(struct char_data *ch)
update_pos(ch);
}
static void make_corpse(struct char_data *ch)
static void make_corpse(char_data *ch)
{
char buf2[MAX_NAME_LENGTH + 64];
struct obj_data *corpse, *o;
struct obj_data *money;
obj_data *corpse, *o;
obj_data *money;
int i, x, y;
corpse = create_obj();
@@ -232,14 +232,14 @@ static void make_corpse(struct char_data *ch)
}
/* When ch kills victim */
static void change_alignment(struct char_data *ch, struct char_data *victim)
static void change_alignment(char_data *ch, char_data *victim)
{
/* new alignment change algorithm: if you kill a monster with alignment A,
* you move 1/16th of the way to having alignment -A. Simple and fast. */
GET_ALIGNMENT(ch) += (-GET_ALIGNMENT(victim) - GET_ALIGNMENT(ch)) / 16;
}
void death_cry(struct char_data *ch)
void death_cry(char_data *ch)
{
int door;
@@ -250,9 +250,9 @@ void death_cry(struct char_data *ch)
send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n");
}
void raw_kill(struct char_data * ch, struct char_data * killer)
void raw_kill(char_data * ch, char_data * killer)
{
struct char_data *i;
char_data *i;
if (FIGHTING(ch))
stop_fighting(ch);
@@ -271,7 +271,7 @@ struct char_data *i;
if (killer) {
if (killer->group) {
while ((i = (struct char_data *) simple_list(killer->group->members)) != NULL)
while ((i = (char_data *) simple_list(killer->group->members)) != NULL)
if(IN_ROOM(i) == IN_ROOM(ch) || (world[IN_ROOM(i)].zone == world[IN_ROOM(ch)].zone))
autoquest_trigger_check(i, ch, NULL, AQ_MOB_KILL);
} else
@@ -293,7 +293,7 @@ struct char_data *i;
}
}
void die(struct char_data * ch, struct char_data * killer)
void die(char_data * ch, char_data * killer)
{
gain_exp(ch, -(GET_EXP(ch) / 2));
if (!IS_NPC(ch)) {
@@ -303,8 +303,8 @@ void die(struct char_data * ch, struct char_data * killer)
raw_kill(ch, killer);
}
static void perform_group_gain(struct char_data *ch, int base,
struct char_data *victim)
static void perform_group_gain(char_data *ch, int base,
char_data *victim)
{
int share, hap_share;
@@ -325,12 +325,12 @@ static void perform_group_gain(struct char_data *ch, int base,
change_alignment(ch, victim);
}
static void group_gain(struct char_data *ch, struct char_data *victim)
static void group_gain(char_data *ch, char_data *victim)
{
int tot_members = 0, base, tot_gain;
struct char_data *k;
char_data *k;
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL)
while ((k = (char_data *) simple_list(GROUP(ch)->members)) != NULL)
if (IN_ROOM(ch) == IN_ROOM(k))
tot_members++;
@@ -346,12 +346,12 @@ static void group_gain(struct char_data *ch, struct char_data *victim)
else
base = 0;
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL)
while ((k = (char_data *) simple_list(GROUP(ch)->members)) != NULL)
if (IN_ROOM(k) == IN_ROOM(ch))
perform_group_gain(k, base, victim);
}
static void solo_gain(struct char_data *ch, struct char_data *victim)
static void solo_gain(char_data *ch, char_data *victim)
{
int exp, happy_exp;
@@ -407,7 +407,7 @@ static char *replace_string(const char *str, const char *weapon_singular, const
}
/* message for doing damage with a weapon */
static void dam_message(int dam, struct char_data *ch, struct char_data *victim,
static void dam_message(int dam, char_data *ch, char_data *victim,
int w_type)
{
char *buf;
@@ -512,13 +512,13 @@ static void dam_message(int dam, struct char_data *ch, struct char_data *victim,
/* message for doing damage with a spell or skill. Also used for weapon
* damage on miss and death blows. */
int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int skill_message(int dam, char_data *ch, char_data *vict,
int attacktype)
{
int i, j, nr;
struct message_type *msg;
struct obj_data *weap = GET_EQ(ch, WEAR_WIELD);
obj_data *weap = GET_EQ(ch, WEAR_WIELD);
/* @todo restructure the messages library to a pointer based system as
* opposed to the current cyclic location system. */
@@ -585,12 +585,12 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
* < 0 Victim died.
* = 0 No damage.
* > 0 How much damage done. */
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
int damage(char_data *ch, char_data *victim, int dam, int attacktype)
{
long local_gold = 0, happy_gold = 0;
char local_buf[256];
struct char_data *tmp_char;
struct obj_data *corpse_obj;
char_data *tmp_char;
obj_data *corpse_obj;
if (GET_POS(victim) <= POS_DEAD) {
/* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */
@@ -791,7 +791,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
/* Calculate the THAC0 of the attacker. 'victim' currently isn't used but you
* could use it for special cases like weapons that hit evil creatures easier
* or a weapon that always misses attacking an animal. */
static int compute_thaco(struct char_data *ch, struct char_data *victim)
static int compute_thaco(char_data *ch, char_data *victim)
{
int calc_thaco;
@@ -807,9 +807,9 @@ static int compute_thaco(struct char_data *ch, struct char_data *victim)
return calc_thaco;
}
void hit(struct char_data *ch, struct char_data *victim, int type)
void hit(char_data *ch, char_data *victim, int type)
{
struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
int w_type, victim_ac, calc_thaco, dam, diceroll;
/* Check that the attacker and victim exist */
@@ -910,7 +910,7 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
/* control the fights going on. Called every 2 seconds from comm.c. */
void perform_violence(void)
{
struct char_data *ch, *tch;
char_data *ch, *tch;
for (ch = combat_list; ch; ch = next_combat_list) {
next_combat_list = ch->next_fighting;
@@ -940,7 +940,7 @@ void perform_violence(void)
if (GROUP(ch) && GROUP(ch)->members && GROUP(ch)->members->iSize) {
struct iterator_data Iterator;
tch = (struct char_data *) merge_iterator(&Iterator, GROUP(ch)->members);
tch = (char_data *) merge_iterator(&Iterator, GROUP(ch)->members);
for (; tch ; tch = next_in_list(&Iterator)) {
if (tch == ch)
continue;
+18 -19
View File
@@ -1,12 +1,12 @@
/**
* @file fight.h
* Fighting and violence functions and variables.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
@@ -16,28 +16,27 @@
/* Structures and defines */
/* Attacktypes with grammar */
struct attack_hit_type {
const char *singular;
const char *plural;
const char *singular;
const char *plural;
};
/* Functions available in fight.c */
void appear(struct char_data *ch);
void check_killer(struct char_data *ch, struct char_data *vict);
int compute_armor_class(struct char_data *ch);
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype);
void death_cry(struct char_data *ch);
void die(struct char_data * ch, struct char_data * killer);
void hit(struct char_data *ch, struct char_data *victim, int type);
void appear(char_data *ch);
void check_killer(char_data *ch, char_data *vict);
int compute_armor_class(char_data *ch);
int damage(char_data *ch, char_data *victim, int dam, int attacktype);
void death_cry(char_data *ch);
void die(char_data * ch, char_data * killer);
void hit(char_data *ch, char_data *victim, int type);
void perform_violence(void);
void raw_kill(struct char_data * ch, struct char_data * killer);
void set_fighting(struct char_data *ch, struct char_data *victim);
int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int attacktype);
void stop_fighting(struct char_data *ch);
void raw_kill(char_data * ch, char_data * killer);
void set_fighting(char_data *ch, char_data *victim);
int skill_message(int dam, char_data *ch, char_data *vict, int attacktype);
void stop_fighting(char_data *ch);
/* Global variables */
extern struct attack_hit_type attack_hit_text[];
extern struct char_data *combat_list;
extern char_data *combat_list;
#endif /* _FIGHT_H_*/
+15 -15
View File
@@ -21,11 +21,11 @@
/* local functions */
static void extract_mobile_all(mob_vnum vnum);
int add_mobile(struct char_data *mob, mob_vnum vnum)
int add_mobile(char_data *mob, mob_vnum vnum)
{
int rnum, i, found = FALSE, shop, cmd_no;
zone_rnum zone;
struct char_data *live_mob;
char_data *live_mob;
if ((rnum = real_mobile(vnum)) != NOBODY) {
/* Copy over the mobile and free() the old strings. */
@@ -41,7 +41,7 @@ int add_mobile(struct char_data *mob, mob_vnum vnum)
return rnum;
}
RECREATE(mob_proto, struct char_data, top_of_mobt + 2);
RECREATE(mob_proto, char_data, top_of_mobt + 2);
RECREATE(mob_index, struct index_data, top_of_mobt + 2);
top_of_mobt++;
@@ -90,7 +90,7 @@ int add_mobile(struct char_data *mob, mob_vnum vnum)
return found;
}
int copy_mobile(struct char_data *to, struct char_data *from)
int copy_mobile(char_data *to, char_data *from)
{
free_mobile_strings(to);
*to = *from;
@@ -101,7 +101,7 @@ int copy_mobile(struct char_data *to, struct char_data *from)
static void extract_mobile_all(mob_vnum vnum)
{
struct char_data *next, *ch;
char_data *next, *ch;
int i;
for (ch = character_list; ch; ch = next) {
@@ -140,8 +140,8 @@ static void extract_mobile_all(mob_vnum vnum)
int delete_mobile(mob_rnum refpt)
{
struct char_data *live_mob;
struct char_data *proto;
char_data *live_mob;
char_data *proto;
int counter, cmd_no;
mob_vnum vnum;
zone_rnum zone;
@@ -169,7 +169,7 @@ int delete_mobile(mob_rnum refpt)
top_of_mobt--;
RECREATE(mob_index, struct index_data, top_of_mobt + 1);
RECREATE(mob_proto, struct char_data, top_of_mobt + 1);
RECREATE(mob_proto, char_data, top_of_mobt + 1);
/* Update live mobile rnums. */
for (live_mob = character_list; live_mob; live_mob = live_mob->next)
@@ -195,7 +195,7 @@ int delete_mobile(mob_rnum refpt)
return refpt;
}
int copy_mobile_strings(struct char_data *t, struct char_data *f)
int copy_mobile_strings(char_data *t, char_data *f)
{
if (f->player.name)
t->player.name = strdup(f->player.name);
@@ -210,7 +210,7 @@ int copy_mobile_strings(struct char_data *t, struct char_data *f)
return TRUE;
}
int update_mobile_strings(struct char_data *t, struct char_data *f)
int update_mobile_strings(char_data *t, char_data *f)
{
if (f->player.name)
t->player.name = f->player.name;
@@ -225,7 +225,7 @@ int update_mobile_strings(struct char_data *t, struct char_data *f)
return TRUE;
}
int free_mobile_strings(struct char_data *mob)
int free_mobile_strings(char_data *mob)
{
if (mob->player.name)
free(mob->player.name);
@@ -242,7 +242,7 @@ int free_mobile_strings(struct char_data *mob)
/* Free a mobile structure that has been edited. Take care of existing mobiles
* and their mob_proto! */
int free_mobile(struct char_data *mob)
int free_mobile(char_data *mob)
{
mob_rnum i;
@@ -325,7 +325,7 @@ int save_mobiles(zone_rnum rznum)
return written;
}
int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
int write_mobile_espec(mob_vnum mvnum, char_data *mob, FILE *fd)
{
if (GET_ATTACK(mob) != 0)
fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob));
@@ -357,7 +357,7 @@ int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
return TRUE;
}
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
int write_mobile_record(mob_vnum mvnum, char_data *mob, FILE *fd)
{
char ldesc[MAX_STRING_LENGTH];
char ddesc[MAX_STRING_LENGTH];
@@ -419,7 +419,7 @@ int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
return TRUE;
}
void check_mobile_strings(struct char_data *mob)
void check_mobile_strings(char_data *mob)
{
mob_vnum mvnum = mob_index[mob->nr].vnum;
check_mobile_string(mvnum, &GET_LDESC(mob), "long description");
+22 -22
View File
@@ -1,42 +1,42 @@
/**
* @file genmob.h
* Generic OLC Library - Mobiles.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENMOB_H_
#define _GENMOB_H_
int delete_mobile(mob_rnum);
int copy_mobile(struct char_data *to, struct char_data *from);
int add_mobile(struct char_data *, mob_vnum);
int copy_mob_strings(struct char_data *to, struct char_data *from);
int free_mob_strings(struct char_data *);
int free_mobile(struct char_data *mob);
int copy_mobile(char_data *to, char_data *from);
int add_mobile(char_data *, mob_vnum);
int copy_mob_strings(char_data *to, char_data *from);
int free_mob_strings(char_data *);
int free_mobile(char_data *mob);
int save_mobiles(zone_rnum rznum);
int update_mobile_strings(struct char_data *t, struct char_data *f);
void check_mobile_strings(struct char_data *mob);
int update_mobile_strings(char_data *t, char_data *f);
void check_mobile_strings(char_data *mob);
void check_mobile_string(mob_vnum i, char **string, const char *desc);
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd);
int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd);
int free_mobile_strings(struct char_data *mob);
int copy_mobile_strings(struct char_data *t, struct char_data *f);
int write_mobile_record(mob_vnum mvnum, char_data *mob, FILE *fd);
int write_mobile_espec(mob_vnum mvnum, char_data *mob, FILE *fd);
int free_mobile_strings(char_data *mob);
int copy_mobile_strings(char_data *t, char_data *f);
#if CONFIG_GENOLC_MOBPROG
int write_mobile_mobprog(mob_vnum mvnum, struct char_data *mob, FILE *fd);
int write_mobile_mobprog(mob_vnum mvnum, char_data *mob, FILE *fd);
#endif
/* Handy macros. */
#define GET_NDD(mob) ((mob)->mob_specials.damnodice)
#define GET_SDD(mob) ((mob)->mob_specials.damsizedice)
#define GET_ALIAS(mob) ((mob)->player.name)
#define GET_SDESC(mob) ((mob)->player.short_descr)
#define GET_LDESC(mob) ((mob)->player.long_descr)
#define GET_DDESC(mob) ((mob)->player.description)
#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type)
#define GET_NDD(mob) ((mob)->mob_specials.damnodice)
#define GET_SDD(mob) ((mob)->mob_specials.damsizedice)
#define GET_ALIAS(mob) ((mob)->player.name)
#define GET_SDESC(mob) ((mob)->player.short_descr)
#define GET_LDESC(mob) ((mob)->player.long_descr)
#define GET_DDESC(mob) ((mob)->player.description)
#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type)
#endif /* _GENMOB_H_ */
+23 -23
View File
@@ -22,10 +22,10 @@
/* local functions */
static int update_all_objects(struct obj_data *obj);
static void copy_object_strings(struct obj_data *to, struct obj_data *from);
static int update_all_objects(obj_data *obj);
static void copy_object_strings(obj_data *to, obj_data *from);
obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum)
obj_rnum add_object(obj_data *newobj, obj_vnum ovnum)
{
int found = NOTHING;
zone_rnum rznum = real_zone_by_thing(ovnum);
@@ -48,9 +48,9 @@ obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum)
* and every object currently in the game to see which ones are pointing to
* this prototype. If object is pointing to this prototype, then we need to
* replace it with the new one. */
static int update_all_objects(struct obj_data *refobj)
static int update_all_objects(obj_data *refobj)
{
struct obj_data *obj, swap;
obj_data *obj, swap;
int count = 0;
for (obj = object_list; obj; obj = obj->next) {
@@ -85,7 +85,7 @@ static int update_all_objects(struct obj_data *refobj)
obj_rnum adjust_objects(obj_rnum refpt)
{
int shop, i, zone, cmd_no;
struct obj_data *obj;
obj_data *obj;
#if CIRCLE_UNSIGNED_INDEX
if (refpt == NOTHING || refpt > top_of_objt)
@@ -132,13 +132,13 @@ obj_rnum adjust_objects(obj_rnum refpt)
/* Function handle the insertion of an object within the prototype framework.
* Note that this does not adjust internal values of other objects, use
* add_object() for that. */
obj_rnum insert_object(struct obj_data *obj, obj_vnum ovnum)
obj_rnum insert_object(obj_data *obj, obj_vnum ovnum)
{
obj_rnum i;
top_of_objt++;
RECREATE(obj_index, struct index_data, top_of_objt + 1);
RECREATE(obj_proto, struct obj_data, top_of_objt + 1);
RECREATE(obj_proto, obj_data, top_of_objt + 1);
/* Start counting through both tables. */
for (i = top_of_objt; i > 0; i--) {
@@ -156,7 +156,7 @@ obj_rnum insert_object(struct obj_data *obj, obj_vnum ovnum)
return index_object(obj, ovnum, 0);
}
obj_rnum index_object(struct obj_data *obj, obj_vnum ovnum, obj_rnum ornum)
obj_rnum index_object(obj_data *obj, obj_vnum ovnum, obj_rnum ornum)
{
#if CIRCLE_UNSIGNED_INDEX
if (obj == NULL || ornum == NOTHING || ornum > top_of_objt)
@@ -184,7 +184,7 @@ int save_objects(zone_rnum zone_num)
char pbuf1[MAX_STRING_LENGTH], pbuf2[MAX_STRING_LENGTH], pbuf3[MAX_STRING_LENGTH], pbuf4[MAX_STRING_LENGTH];
int counter, counter2, realcounter;
FILE *fp;
struct obj_data *obj;
obj_data *obj;
struct extra_descr_data *ex_desc;
#if CIRCLE_UNSIGNED_INDEX
@@ -299,7 +299,7 @@ int save_objects(zone_rnum zone_num)
}
/* Free all, unconditionally. */
void free_object_strings(struct obj_data *obj)
void free_object_strings(obj_data *obj)
{
if (obj->name)
free(obj->name);
@@ -314,7 +314,7 @@ void free_object_strings(struct obj_data *obj)
}
/* For object instances that are not the prototype. */
void free_object_strings_proto(struct obj_data *obj)
void free_object_strings_proto(obj_data *obj)
{
int robj_num = GET_OBJ_RNUM(obj);
@@ -349,7 +349,7 @@ void free_object_strings_proto(struct obj_data *obj)
}
}
static void copy_object_strings(struct obj_data *to, struct obj_data *from)
static void copy_object_strings(obj_data *to, obj_data *from)
{
to->name = from->name ? strdup(from->name) : NULL;
to->description = from->description ? strdup(from->description) : NULL;
@@ -362,18 +362,18 @@ static void copy_object_strings(struct obj_data *to, struct obj_data *from)
to->ex_description = NULL;
}
int copy_object(struct obj_data *to, struct obj_data *from)
int copy_object(obj_data *to, obj_data *from)
{
free_object_strings(to);
return copy_object_main(to, from, TRUE);
}
int copy_object_preserve(struct obj_data *to, struct obj_data *from)
int copy_object_preserve(obj_data *to, obj_data *from)
{
return copy_object_main(to, from, FALSE);
}
int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object)
int copy_object_main(obj_data *to, obj_data *from, int free_object)
{
*to = *from;
copy_object_strings(to, from);
@@ -384,7 +384,7 @@ int delete_object(obj_rnum rnum)
{
obj_rnum i;
zone_rnum zrnum;
struct obj_data *obj, *tmp, *next_obj;
obj_data *obj, *tmp, *next_obj;
int shop, j, zone, cmd_no;
if (rnum == NOTHING || rnum > top_of_objt)
@@ -404,7 +404,7 @@ int delete_object(obj_rnum rnum)
/* extract_obj() will just axe contents. */
if (tmp->contains) {
struct obj_data *this_content, *next_content;
obj_data *this_content, *next_content;
for (this_content = tmp->contains; this_content; this_content = next_content) {
next_content = this_content->next_content;
if (IN_ROOM(tmp)) {
@@ -442,7 +442,7 @@ int delete_object(obj_rnum rnum)
top_of_objt--;
RECREATE(obj_index, struct index_data, top_of_objt + 1);
RECREATE(obj_proto, struct obj_data, top_of_objt + 1);
RECREATE(obj_proto, obj_data, top_of_objt + 1);
/* Renumber notice boards. */
for (j = 0; j < NUM_OF_BOARDS; j++)
@@ -487,7 +487,7 @@ int delete_object(obj_rnum rnum)
}
/* oset handling, this location should be temporary */
bool oset_alias(struct obj_data *obj, char * argument)
bool oset_alias(obj_data *obj, char * argument)
{
static size_t max_len = 64;
int i = GET_OBJ_RNUM(obj);
@@ -505,7 +505,7 @@ bool oset_alias(struct obj_data *obj, char * argument)
return TRUE;
}
bool oset_apply(struct obj_data *obj, char * argument)
bool oset_apply(obj_data *obj, char * argument)
{
int i = 0, apply = -1, location = -1, mod = 0, empty = -1, value;
char arg[MAX_INPUT_LENGTH];
@@ -558,7 +558,7 @@ bool oset_apply(struct obj_data *obj, char * argument)
return TRUE;
}
bool oset_short_description(struct obj_data *obj, char * argument)
bool oset_short_description(obj_data *obj, char * argument)
{
static size_t max_len = 64;
int i = GET_OBJ_RNUM(obj);
@@ -576,7 +576,7 @@ bool oset_short_description(struct obj_data *obj, char * argument)
return TRUE;
}
bool oset_long_description(struct obj_data *obj, char * argument)
bool oset_long_description(obj_data *obj, char * argument)
{
static size_t max_len = 128;
int i = GET_OBJ_RNUM(obj);
+15 -15
View File
@@ -1,31 +1,31 @@
/**
* @file genobj.h
* Generic OLC Library - Objects.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENOBJ_H_
#define _GENOBJ_H_
void free_object_strings_proto(struct obj_data *obj);
void free_object_strings(struct obj_data *obj);
int copy_object(struct obj_data *to, struct obj_data *from);
int copy_object_preserve(struct obj_data *to, struct obj_data *from);
void free_object_strings_proto(obj_data *obj);
void free_object_strings(obj_data *obj);
int copy_object(obj_data *to, obj_data *from);
int copy_object_preserve(obj_data *to, obj_data *from);
int save_objects(zone_rnum vznum);
obj_rnum insert_object(struct obj_data *obj, obj_vnum ovnum);
obj_rnum insert_object(obj_data *obj, obj_vnum ovnum);
obj_rnum adjust_objects(obj_rnum refpt);
obj_rnum index_object(struct obj_data *obj, obj_vnum ovnum, obj_rnum ornum);
obj_rnum add_object(struct obj_data *, obj_vnum ovnum);
int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object);
obj_rnum index_object(obj_data *obj, obj_vnum ovnum, obj_rnum ornum);
obj_rnum add_object(obj_data *, obj_vnum ovnum);
int copy_object_main(obj_data *to, obj_data *from, int free_object);
int delete_object(obj_rnum);
bool oset_alias(struct obj_data *obj, char * argument);
bool oset_apply(struct obj_data *obj, char * argument);
bool oset_short_description(struct obj_data *obj, char * argument);
bool oset_long_description(struct obj_data *obj, char * argument);
bool oset_alias(obj_data *obj, char * argument);
bool oset_apply(obj_data *obj, char * argument);
bool oset_short_description(obj_data *obj, char * argument);
bool oset_long_description(obj_data *obj, char * argument);
#endif /* _GENOBJ_H_ */
+7 -7
View File
@@ -60,11 +60,11 @@ static int export_save_zone(zone_rnum zrnum);
static int export_save_objects(zone_rnum zrnum);
static int export_save_rooms(zone_rnum zrnum);
static int export_save_triggers(zone_rnum zrnum);
static int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd);
static int export_mobile_record(mob_vnum mvnum, char_data *mob, FILE *fd);
static void export_script_save_to_disk(FILE *fp, void *item, int type);
static int export_info_file(zone_rnum zrnum);
int genolc_checkstring(struct descriptor_data *d, char *arg)
int genolc_checkstring(descriptor_data *d, char *arg)
{
smash_tilde(arg);
parse_at(arg);
@@ -330,7 +330,7 @@ ACMD(do_export_zone)
return;
}
zvnum = atoi(argument);
zvnum = atoidx(argument);
zrnum = real_zone(zvnum);
if (zrnum == NOWHERE) {
@@ -589,7 +589,7 @@ static int export_save_mobiles(zone_rnum rznum)
return TRUE;
}
static int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
static int export_mobile_record(mob_vnum mvnum, char_data *mob, FILE *fd)
{
char ldesc[MAX_STRING_LENGTH];
@@ -774,7 +774,7 @@ static int export_save_objects(zone_rnum zrnum)
obj_vnum ovnum;
int i;
FILE *obj_file;
struct obj_data *obj;
obj_data *obj;
struct extra_descr_data *ex_desc;
if (!(obj_file = fopen("world/export/qq.obj", "w"))) {
@@ -996,9 +996,9 @@ static void export_script_save_to_disk(FILE *fp, void *item, int type)
struct trig_proto_list *t;
if (type==MOB_TRIGGER)
t = ((struct char_data *)item)->proto_script;
t = ((char_data *)item)->proto_script;
else if (type==OBJ_TRIGGER)
t = ((struct obj_data *)item)->proto_script;
t = ((obj_data *)item)->proto_script;
else if (type==WLD_TRIGGER)
t = ((struct room_data *)item)->proto_script;
else {
+18 -18
View File
@@ -1,21 +1,21 @@
/**
* @file genolc.h
* Generic OLC Library - General.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENOLC_H_
#define _GENOLC_H_
#define STRING_TERMINATOR '~'
#define CONFIG_GENOLC_MOBPROG 0
#define CONFIG_GENOLC_MOBPROG 0
int genolc_checkstring(struct descriptor_data *d, char *arg);
int genolc_checkstring(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);
@@ -30,28 +30,28 @@ ACMD(do_export_zone);
ACMD(do_show_save_list);
struct save_list_data {
int zone;
int type;
struct save_list_data *next;
int zone;
int type;
struct save_list_data *next;
};
extern struct save_list_data *save_list;
/* save_list_data.type */
#define SL_MOB 0
#define SL_OBJ 1
#define SL_SHP 2
#define SL_WLD 3
#define SL_ZON 4
#define SL_CFG 5
#define SL_MOB 0
#define SL_OBJ 1
#define SL_SHP 2
#define SL_WLD 3
#define SL_ZON 4
#define SL_CFG 5
#define SL_QST 6
#define SL_MAX 6
#define SL_ACT SL_MAX + 1 /* must be above MAX */
#define SL_MAX 6
#define SL_ACT SL_MAX + 1 /* must be above MAX */
#define SL_HLP SL_MAX + 2
#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)]
#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)]
#define LIMIT(var, low, high) MIN(high, MAX(var, low))
#define LIMIT(var, low, high) MIN(high, MAX(var, low))
room_vnum genolc_zone_bottom(zone_rnum rznum);
room_vnum genolc_zonep_bottom(struct zone_data *zone);
+31 -31
View File
@@ -1,13 +1,13 @@
/**
* @file genshp.h
* Generic OLC Library - Shops.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENSHP_H_
#define _GENSHP_H_
@@ -25,35 +25,35 @@ int save_shops(zone_rnum zone_num);
shop_rnum real_shop(shop_vnum vnum);
/* Handy macros. */
#define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1)
#define S_CLOSE1(i) ((i)->close1)
#define S_OPEN2(i) ((i)->open2)
#define S_CLOSE2(i) ((i)->close2)
#define S_BANK(i) ((i)->bankAccount)
#define S_BROKE_TEMPER(i) ((i)->temper1)
#define S_BITVECTOR(i) ((i)->bitvector)
#define S_NOTRADE(i) ((i)->with_who)
#define S_SORT(i) ((i)->lastsort)
#define S_BUYPROFIT(i) ((i)->profit_buy)
#define S_SELLPROFIT(i) ((i)->profit_sell)
#define S_FUNC(i) ((i)->func)
#define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1)
#define S_CLOSE1(i) ((i)->close1)
#define S_OPEN2(i) ((i)->open2)
#define S_CLOSE2(i) ((i)->close2)
#define S_BANK(i) ((i)->bankAccount)
#define S_BROKE_TEMPER(i) ((i)->temper1)
#define S_BITVECTOR(i) ((i)->bitvector)
#define S_NOTRADE(i) ((i)->with_who)
#define S_SORT(i) ((i)->lastsort)
#define S_BUYPROFIT(i) ((i)->profit_buy)
#define S_SELLPROFIT(i) ((i)->profit_sell)
#define S_FUNC(i) ((i)->func)
#define S_ROOMS(i) ((i)->in_room)
#define S_PRODUCTS(i) ((i)->producing)
#define S_NAMELISTS(i) ((i)->type)
#define S_ROOM(i, num) ((i)->in_room[(num)])
#define S_PRODUCT(i, num) ((i)->producing[(num)])
#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)]))
#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)]))
#define S_ROOMS(i) ((i)->in_room)
#define S_PRODUCTS(i) ((i)->producing)
#define S_NAMELISTS(i) ((i)->type)
#define S_ROOM(i, num) ((i)->in_room[(num)])
#define S_PRODUCT(i, num) ((i)->producing[(num)])
#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)]))
#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)]))
#define S_NOITEM1(i) ((i)->no_such_item1)
#define S_NOITEM2(i) ((i)->no_such_item2)
#define S_NOCASH1(i) ((i)->missing_cash1)
#define S_NOCASH2(i) ((i)->missing_cash2)
#define S_NOBUY(i) ((i)->do_not_buy)
#define S_BUY(i) ((i)->message_buy)
#define S_SELL(i) ((i)->message_sell)
#define S_NOITEM1(i) ((i)->no_such_item1)
#define S_NOITEM2(i) ((i)->no_such_item2)
#define S_NOCASH1(i) ((i)->missing_cash1)
#define S_NOCASH2(i) ((i)->missing_cash2)
#define S_NOBUY(i) ((i)->do_not_buy)
#define S_BUY(i) ((i)->message_buy)
#define S_SELL(i) ((i)->message_sell)
#endif /* _GENSHP_H_ */
+4 -4
View File
@@ -24,8 +24,8 @@
* the description, title, and such. */
room_rnum add_room(struct room_data *room)
{
struct char_data *tch;
struct obj_data *tobj;
char_data *tch;
obj_data *tobj;
int j, found = FALSE;
room_rnum i;
@@ -123,8 +123,8 @@ int delete_room(room_rnum rnum)
{
room_rnum i;
int j;
struct char_data *ppl, *next_ppl;
struct obj_data *obj, *next_obj;
char_data *ppl, *next_ppl;
obj_data *obj, *next_obj;
struct room_data *room;
if (rnum <= 0 || rnum > top_of_world) /* Can't delete void yet. */
+3 -3
View File
@@ -1,13 +1,13 @@
/**
* @file genwld.h
* Generic OLC Library - Rooms.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENWLD_H_
#define _GENWLD_H_
+3 -3
View File
@@ -1,13 +1,13 @@
/**
* @file genzon.h
* Generic OLC Library - Zones.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENZON_H_
#define _GENZON_H_
+3 -3
View File
@@ -141,7 +141,7 @@ static int find_first_step(room_rnum src, room_rnum target)
ACMD(do_track)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
char_data *vict;
int dir;
/* The character must have the track skill. */
@@ -195,11 +195,11 @@ ACMD(do_track)
}
}
void hunt_victim(struct char_data *ch)
void hunt_victim(char_data *ch)
{
int dir;
byte found;
struct char_data *tmp;
char_data *tmp;
if (!ch || !HUNTING(ch) || FIGHTING(ch))
return;
+6 -6
View File
@@ -1,13 +1,13 @@
/**
* @file graph.h
* Header file for Various graph algorithms.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* @todo the functions here should perhaps be a part of another module?
*/
@@ -15,6 +15,6 @@
#define _GRAPH_H_
ACMD(do_track);
void hunt_victim(struct char_data *ch);
void hunt_victim(char_data *ch);
#endif /* _GRAPH_H_*/
+76 -76
View File
@@ -29,9 +29,9 @@
static int extractions_pending = 0;
/* local file scope functions */
static int apply_ac(struct char_data *ch, int eq_pos);
static void update_object(struct obj_data *obj, int use);
static void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bitv[], bool add);
static int apply_ac(char_data *ch, int eq_pos);
static void update_object(obj_data *obj, int use);
static void affect_modify_ar(char_data * ch, byte loc, sbyte mod, int bitv[], bool add);
char *fname(const char *namelist)
{
@@ -105,7 +105,7 @@ int isname(const char *str, const char *namelist)
return 0;
}
static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
static void aff_apply_modify(char_data *ch, byte loc, sbyte mod, char *msg)
{
switch (loc) {
case APPLY_NONE:
@@ -205,7 +205,7 @@ static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *ms
} /* switch */
}
static void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bitv[], bool add)
static void affect_modify_ar(char_data * ch, byte loc, sbyte mod, int bitv[], bool add)
{
int i , j;
@@ -227,7 +227,7 @@ static void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bit
/* This updates a character by subtracting everything he is affected by
* restoring original abilities, and then affecting all again. */
void affect_total(struct char_data *ch)
void affect_total(char_data *ch)
{
struct affected_type *af;
int i, j;
@@ -279,7 +279,7 @@ void affect_total(struct char_data *ch)
/* Insert an affect_type in a char_data structure. Automatically sets
* apropriate bits and apply's */
void affect_to_char(struct char_data *ch, struct affected_type *af)
void affect_to_char(char_data *ch, struct affected_type *af)
{
struct affected_type *affected_alloc;
@@ -296,7 +296,7 @@ void affect_to_char(struct char_data *ch, struct affected_type *af)
/* Remove an affected_type structure from a char (called when duration reaches
* zero). Pointer *af must never be NIL! Frees mem and calls
* affect_location_apply */
void affect_remove(struct char_data *ch, struct affected_type *af)
void affect_remove(char_data *ch, struct affected_type *af)
{
struct affected_type *temp;
@@ -312,7 +312,7 @@ void affect_remove(struct char_data *ch, struct affected_type *af)
}
/* Call affect_remove with every affect from the spell "type" */
void affect_from_char(struct char_data *ch, int type)
void affect_from_char(char_data *ch, int type)
{
struct affected_type *hjp, *next;
@@ -325,7 +325,7 @@ void affect_from_char(struct char_data *ch, int type)
/* Return TRUE if a char is affected by a spell (SPELL_XXX), FALSE indicates
* not affected. */
bool affected_by_spell(struct char_data *ch, int type)
bool affected_by_spell(char_data *ch, int type)
{
struct affected_type *hjp;
@@ -336,7 +336,7 @@ bool affected_by_spell(struct char_data *ch, int type)
return (FALSE);
}
void affect_join(struct char_data *ch, struct affected_type *af,
void affect_join(char_data *ch, struct affected_type *af,
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod)
{
struct affected_type *hjp, *next;
@@ -365,9 +365,9 @@ void affect_join(struct char_data *ch, struct affected_type *af,
}
/* move a player out of a room */
void char_from_room(struct char_data *ch)
void char_from_room(char_data *ch)
{
struct char_data *temp;
char_data *temp;
if (ch == NULL || IN_ROOM(ch) == NOWHERE) {
log("SYSERR: NULL character or NOWHERE in %s, char_from_room", __FILE__);
@@ -390,7 +390,7 @@ void char_from_room(struct char_data *ch)
}
/* place a character in a room */
void char_to_room(struct char_data *ch, room_rnum room)
void char_to_room(char_data *ch, room_rnum room)
{
if (ch == NULL || room == NOWHERE || room > top_of_world)
log("SYSERR: Illegal value(s) passed to char_to_room. (Room: %d/%d Ch: %p",
@@ -417,7 +417,7 @@ void char_to_room(struct char_data *ch, room_rnum room)
}
/* Give an object to a char. */
void obj_to_char(struct obj_data *object, struct char_data *ch)
void obj_to_char(obj_data *object, char_data *ch)
{
if (object && ch) {
object->next_content = ch->carrying;
@@ -437,9 +437,9 @@ void obj_to_char(struct obj_data *object, struct char_data *ch)
}
/* take an object from a char */
void obj_from_char(struct obj_data *object)
void obj_from_char(obj_data *object)
{
struct obj_data *temp;
obj_data *temp;
if (object == NULL) {
log("SYSERR: NULL object passed to obj_from_char.");
@@ -458,7 +458,7 @@ void obj_from_char(struct obj_data *object)
}
/* Return the effect of a piece of armor in position eq_pos */
static int apply_ac(struct char_data *ch, int eq_pos)
static int apply_ac(char_data *ch, int eq_pos)
{
int factor;
@@ -489,7 +489,7 @@ static int apply_ac(struct char_data *ch, int eq_pos)
return (factor * GET_OBJ_VAL(GET_EQ(ch, eq_pos), 0));
}
int invalid_align(struct char_data *ch, struct obj_data *obj)
int invalid_align(char_data *ch, obj_data *obj)
{
if (OBJ_FLAGGED(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch))
return TRUE;
@@ -500,7 +500,7 @@ int invalid_align(struct char_data *ch, struct obj_data *obj)
return FALSE;
}
void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
void equip_char(char_data *ch, obj_data *obj, int pos)
{
int j;
@@ -552,10 +552,10 @@ void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
affect_total(ch);
}
struct obj_data *unequip_char(struct char_data *ch, int pos)
obj_data *unequip_char(char_data *ch, int pos)
{
int j;
struct obj_data *obj;
obj_data *obj;
if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) {
core_dump();
@@ -611,9 +611,9 @@ int get_number(char **name)
}
/* Search a given list for an object number, and return a ptr to that obj */
struct obj_data *get_obj_in_list_num(int num, struct obj_data *list)
obj_data *get_obj_in_list_num(int num, obj_data *list)
{
struct obj_data *i;
obj_data *i;
for (i = list; i; i = i->next_content)
if (GET_OBJ_RNUM(i) == num)
@@ -623,9 +623,9 @@ struct obj_data *get_obj_in_list_num(int num, struct obj_data *list)
}
/* search the entire world for an object number, and return a pointer */
struct obj_data *get_obj_num(obj_rnum nr)
obj_data *get_obj_num(obj_rnum nr)
{
struct obj_data *i;
obj_data *i;
for (i = object_list; i; i = i->next)
if (GET_OBJ_RNUM(i) == nr)
@@ -635,9 +635,9 @@ struct obj_data *get_obj_num(obj_rnum nr)
}
/* search a room for a char, and return a pointer if found.. */
struct char_data *get_char_room(char *name, int *number, room_rnum room)
char_data *get_char_room(char *name, int *number, room_rnum room)
{
struct char_data *i;
char_data *i;
int num;
if (!number) {
@@ -657,9 +657,9 @@ struct char_data *get_char_room(char *name, int *number, room_rnum room)
}
/* search all over the world for a char num, and return a pointer if found */
struct char_data *get_char_num(mob_rnum nr)
char_data *get_char_num(mob_rnum nr)
{
struct char_data *i;
char_data *i;
for (i = character_list; i; i = i->next)
if (GET_MOB_RNUM(i) == nr)
@@ -669,7 +669,7 @@ struct char_data *get_char_num(mob_rnum nr)
}
/* put an object in a room */
void obj_to_room(struct obj_data *object, room_rnum room)
void obj_to_room(obj_data *object, room_rnum room)
{
if (!object || room == NOWHERE || room > top_of_world){
log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)",
@@ -680,7 +680,7 @@ void obj_to_room(struct obj_data *object, room_rnum room)
world[room].contents = object; // add object to list
}
else {
struct obj_data *i = world[room].contents; // define a temporary pointer
obj_data *i = world[room].contents; // define a temporary pointer
while (i->next_content != NULL) i = i->next_content; // find the first without a next_content
i->next_content = object; // add object at the end
}
@@ -693,10 +693,10 @@ void obj_to_room(struct obj_data *object, room_rnum room)
}
/* Take an object from a room */
void obj_from_room(struct obj_data *object)
void obj_from_room(obj_data *object)
{
struct obj_data *temp;
struct char_data *t, *tempch;
obj_data *temp;
char_data *t, *tempch;
if (!object || IN_ROOM(object) == NOWHERE) {
log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room",
@@ -722,9 +722,9 @@ void obj_from_room(struct obj_data *object)
}
/* put an object in an object (quaint) */
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
void obj_to_obj(obj_data *obj, obj_data *obj_to)
{
struct obj_data *tmp_obj;
obj_data *tmp_obj;
if (!obj || !obj_to || obj == obj_to) {
log("SYSERR: NULL object (%p) or same source (%p) and target (%p) obj passed to obj_to_obj.",
@@ -749,9 +749,9 @@ void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
}
/* remove an object from an object */
void obj_from_obj(struct obj_data *obj)
void obj_from_obj(obj_data *obj)
{
struct obj_data *temp, *obj_from;
obj_data *temp, *obj_from;
if (obj->in_obj == NULL) {
log("SYSERR: (%s): trying to illegally extract obj from obj.", __FILE__);
@@ -775,7 +775,7 @@ void obj_from_obj(struct obj_data *obj)
}
/* Set all carried_by to point to new owner */
void object_list_new_owner(struct obj_data *list, struct char_data *ch)
void object_list_new_owner(obj_data *list, char_data *ch)
{
if (list) {
object_list_new_owner(list->contains, ch);
@@ -785,10 +785,10 @@ void object_list_new_owner(struct obj_data *list, struct char_data *ch)
}
/* Extract an object from the world */
void extract_obj(struct obj_data *obj)
void extract_obj(obj_data *obj)
{
struct char_data *ch, *next = NULL;
struct obj_data *temp;
char_data *ch, *next = NULL;
obj_data *temp;
if (obj->worn_by != NULL)
if (unequip_char(obj->worn_by, obj->worn_on) != obj)
@@ -840,7 +840,7 @@ void extract_obj(struct obj_data *obj)
free_obj(obj);
}
static void update_object(struct obj_data *obj, int use)
static void update_object(obj_data *obj, int use)
{
/* dont update objects with a timer trigger */
if (!SCRIPT_CHECK(obj, OTRIG_TIMER) && (GET_OBJ_TIMER(obj) > 0))
@@ -851,7 +851,7 @@ static void update_object(struct obj_data *obj, int use)
update_object(obj->next_content, use);
}
void update_char_objects(struct char_data *ch)
void update_char_objects(char_data *ch)
{
int i;
@@ -878,11 +878,11 @@ void update_char_objects(struct char_data *ch)
}
/* Extract a ch completely from the world, and leave his stuff behind */
void extract_char_final(struct char_data *ch)
void extract_char_final(char_data *ch)
{
struct char_data *k, *temp;
struct descriptor_data *d;
struct obj_data *obj;
char_data *k, *temp;
descriptor_data *d;
obj_data *obj;
int i;
if (IN_ROOM(ch) == NOWHERE) {
@@ -1001,7 +1001,7 @@ void extract_char_final(struct char_data *ch)
* Fixed a bug where it would over-count extractions if you try to extract the
* same character twice (e.g. double-purging in a script) -khufu / EmpireMUD
*/
void extract_char(struct char_data *ch)
void extract_char(char_data *ch)
{
char_from_furniture(ch);
clear_char_event_list(ch);
@@ -1022,7 +1022,7 @@ void extract_char(struct char_data *ch)
* confusing some code. -gg This doesn't handle recursive extractions. */
void extract_pending_chars(void)
{
struct char_data *vict, *next_vict, *prev_vict;
char_data *vict, *next_vict, *prev_vict;
if (extractions_pending < 0)
log("SYSERR: Negative (%d) extractions pending.", extractions_pending);
@@ -1057,9 +1057,9 @@ void extract_pending_chars(void)
/* Here follows high-level versions of some earlier routines, ie functions
* which incorporate the actual player-data */
struct char_data *get_player_vis(struct char_data *ch, char *name, int *number, int inroom)
char_data *get_player_vis(char_data *ch, char *name, int *number, int inroom)
{
struct char_data *i;
char_data *i;
int num;
if (!number) {
@@ -1084,9 +1084,9 @@ struct char_data *get_player_vis(struct char_data *ch, char *name, int *number,
return (NULL);
}
struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *number)
char_data *get_char_room_vis(char_data *ch, char *name, int *number)
{
struct char_data *i;
char_data *i;
int num;
if (!number) {
@@ -1111,9 +1111,9 @@ struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *numbe
return (NULL);
}
struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *number)
char_data *get_char_world_vis(char_data *ch, char *name, int *number)
{
struct char_data *i;
char_data *i;
int num;
if (!number) {
@@ -1142,7 +1142,7 @@ struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *numb
return (NULL);
}
struct char_data *get_char_vis(struct char_data *ch, char *name, int *number, int where)
char_data *get_char_vis(char_data *ch, char *name, int *number, int where)
{
if (where == FIND_CHAR_ROOM)
return get_char_room_vis(ch, name, number);
@@ -1152,9 +1152,9 @@ struct char_data *get_char_vis(struct char_data *ch, char *name, int *number, in
return (NULL);
}
struct obj_data *get_obj_in_list_vis(struct char_data *ch, char *name, int *number, struct obj_data *list)
obj_data *get_obj_in_list_vis(char_data *ch, char *name, int *number, obj_data *list)
{
struct obj_data *i;
obj_data *i;
int num;
if (!number) {
@@ -1175,9 +1175,9 @@ struct obj_data *get_obj_in_list_vis(struct char_data *ch, char *name, int *numb
}
/* search the entire world for an object, and return a pointer */
struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *number)
obj_data *get_obj_vis(char_data *ch, char *name, int *number)
{
struct obj_data *i;
obj_data *i;
int num;
if (!number) {
@@ -1206,7 +1206,7 @@ struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *number)
return (NULL);
}
struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *number, struct obj_data *equipment[])
obj_data *get_obj_in_equip_vis(char_data *ch, char *arg, int *number, obj_data *equipment[])
{
int j, num;
@@ -1226,7 +1226,7 @@ struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *numb
return (NULL);
}
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *number, struct obj_data *equipment[])
int get_obj_pos_in_equip_vis(char_data *ch, char *arg, int *number, obj_data *equipment[])
{
int j, num;
@@ -1282,9 +1282,9 @@ const char *money_desc(int amount)
return ("an absolutely colossal mountain of gold coins");
}
struct obj_data *create_money(int amount)
obj_data *create_money(int amount)
{
struct obj_data *obj;
obj_data *obj;
struct extra_descr_data *new_descr;
char buf[200];
int y;
@@ -1350,8 +1350,8 @@ struct obj_data *create_money(int amount)
* The routine used to return a pointer to the next word in *arg (just
* like the one_argument routine), but now it returns an integer that
* describes what it filled in. */
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
struct char_data **tar_ch, struct obj_data **tar_obj)
int generic_find(char *arg, bitvector_t bitvector, char_data *ch,
char_data **tar_ch, obj_data **tar_obj)
{
int i, found, number;
char name_val[MAX_INPUT_LENGTH];
@@ -1418,7 +1418,7 @@ int find_all_dots(char *arg)
}
/* Group Handlers */
struct group_data * create_group(struct char_data * leader)
struct group_data * create_group(char_data * leader)
{
struct group_data * new_group;
@@ -1445,11 +1445,11 @@ struct group_data * create_group(struct char_data * leader)
void free_group(struct group_data * group)
{
struct char_data *tch;
char_data *tch;
struct iterator_data Iterator;
if (group->members->iSize) {
for (tch = (struct char_data *) merge_iterator(&Iterator, group->members);
for (tch = (char_data *) merge_iterator(&Iterator, group->members);
tch;
tch = next_in_list(&Iterator))
leave_group(tch);
@@ -1462,10 +1462,10 @@ void free_group(struct group_data * group)
free(group);
}
void leave_group(struct char_data *ch)
void leave_group(char_data *ch)
{
struct group_data *group;
struct char_data *tch;
char_data *tch;
struct iterator_data Iterator;
bool found_pc = FALSE;
@@ -1478,7 +1478,7 @@ void leave_group(struct char_data *ch)
ch->group = NULL;
if (group->members->iSize) {
for (tch = (struct char_data *) merge_iterator(&Iterator, group->members);
for (tch = (char_data *) merge_iterator(&Iterator, group->members);
tch; tch = next_in_list(&Iterator))
if (!IS_NPC(tch))
found_pc = TRUE;
@@ -1490,13 +1490,13 @@ void leave_group(struct char_data *ch)
SET_BIT(GROUP_FLAGS(group), GROUP_NPC);
if (GROUP_LEADER(group) == ch && group->members->iSize) {
group->leader = (struct char_data *) random_from_list(group->members);
group->leader = (char_data *) random_from_list(group->members);
send_to_group(NULL, group, "%s has assumed leadership of the group.\r\n", GET_NAME(GROUP_LEADER(group)));
} else if (group->members->iSize == 0)
free_group(group);
}
void join_group(struct char_data *ch, struct group_data *group)
void join_group(char_data *ch, struct group_data *group)
{
add_to_list(ch, group->members);
+64 -66
View File
@@ -1,91 +1,89 @@
/**
* @file handler.h
* Prototypes of handling and utility functions.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _HANDLER_H_
#define _HANDLER_H_
/* handling the affected-structures */
void affect_total(struct char_data *ch);
void affect_to_char(struct char_data *ch, struct affected_type *af);
void affect_remove(struct char_data *ch, struct affected_type *af);
void affect_from_char(struct char_data *ch, int type);
bool affected_by_spell(struct char_data *ch, int type);
void affect_join(struct char_data *ch, struct affected_type *af,
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod);
void affect_total(char_data *ch);
void affect_to_char(char_data *ch, struct affected_type *af);
void affect_remove(char_data *ch, struct affected_type *af);
void affect_from_char(char_data *ch, int type);
bool affected_by_spell(char_data *ch, int type);
void affect_join(char_data *ch, struct affected_type *af, bool add_dur, bool avg_dur, bool add_mod, bool avg_mod);
/* utility */
const char *money_desc(int amount);
struct obj_data *create_money(int amount);
int isname(const char *str, const char *namelist);
int is_name(const char *str, const char *namelist);
char *fname(const char *namelist);
int get_number(char **name);
obj_data *create_money(int amount);
int isname(const char *str, const char *namelist);
int is_name(const char *str, const char *namelist);
char *fname(const char *namelist);
int get_number(char **name);
/* objects */
void obj_to_char(struct obj_data *object, struct char_data *ch);
void obj_from_char(struct obj_data *object);
void obj_to_char(obj_data *object, char_data *ch);
void obj_from_char(obj_data *object);
void equip_char(struct char_data *ch, struct obj_data *obj, int pos);
struct obj_data *unequip_char(struct char_data *ch, int pos);
int invalid_align(struct char_data *ch, struct obj_data *obj);
void equip_char(char_data *ch, obj_data *obj, int pos);
obj_data *unequip_char(char_data *ch, int pos);
int invalid_align(char_data *ch, obj_data *obj);
void obj_to_room(struct obj_data *object, room_rnum room);
void obj_from_room(struct obj_data *object);
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to);
void obj_from_obj(struct obj_data *obj);
void object_list_new_owner(struct obj_data *list, struct char_data *ch);
void obj_to_room(obj_data *object, room_rnum room);
void obj_from_room(obj_data *object);
void obj_to_obj(obj_data *obj, obj_data *obj_to);
void obj_from_obj(obj_data *obj);
void object_list_new_owner(obj_data *list, char_data *ch);
void extract_obj(struct obj_data *obj);
void extract_obj(obj_data *obj);
void update_char_objects(struct char_data *ch);
void update_char_objects(char_data *ch);
/* characters*/
struct char_data *get_char_room(char *name, int *num, room_rnum room);
struct char_data *get_char_num(mob_rnum nr);
char_data *get_char_room(char *name, int *num, room_rnum room);
char_data *get_char_num(mob_rnum nr);
void char_from_room(struct char_data *ch);
void char_to_room(struct char_data *ch, room_rnum room);
void extract_char(struct char_data *ch);
void extract_char_final(struct char_data *ch);
void extract_pending_chars(void);
void char_from_room(char_data *ch);
void char_to_room(char_data *ch, room_rnum room);
void extract_char(char_data *ch);
void extract_char_final(char_data *ch);
void extract_pending_chars(void);
/* find if character can see */
struct char_data *get_player_vis(struct char_data *ch, char *name, int *number, int inroom);
struct char_data *get_char_vis(struct char_data *ch, char *name, int *number, int where);
struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *number);
struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *number);
char_data *get_player_vis(char_data *ch, char *name, int *number, int inroom);
char_data *get_char_vis(char_data *ch, char *name, int *number, int where);
char_data *get_char_room_vis(char_data *ch, char *name, int *number);
char_data *get_char_world_vis(char_data *ch, char *name, int *number);
struct obj_data *get_obj_in_list_num(int num, struct obj_data *list);
struct obj_data *get_obj_num(obj_rnum nr);
struct obj_data *get_obj_in_list_vis(struct char_data *ch, char *name, int *number, struct obj_data *list);
struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *num);
struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *number, struct obj_data *equipment[]);
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]);
obj_data *get_obj_in_list_num(int num, obj_data *list);
obj_data *get_obj_num(obj_rnum nr);
obj_data *get_obj_in_list_vis(char_data *ch, char *name, int *number, obj_data *list);
obj_data *get_obj_vis(char_data *ch, char *name, int *num);
obj_data *get_obj_in_equip_vis(char_data *ch, char *arg, int *number, obj_data *equipment[]);
int get_obj_pos_in_equip_vis(char_data *ch, char *arg, int *num, obj_data *equipment[]);
/* find all dots */
int find_all_dots(char *arg);
int find_all_dots(char *arg);
#define FIND_INDIV 0
#define FIND_ALL 1
#define FIND_ALLDOT 2
#define FIND_INDIV 0
#define FIND_ALL 1
#define FIND_ALLDOT 2
/* group */
struct group_data * create_group(struct char_data * leader);
struct group_data * create_group(char_data * leader);
void free_group(struct group_data * group);
void leave_group(struct char_data *ch);
void join_group(struct char_data *ch, struct group_data *group);
void leave_group(char_data *ch);
void join_group(char_data *ch, struct group_data *group);
/* Generic Find */
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
struct char_data **tar_ch, struct obj_data **tar_obj);
int generic_find(char *arg, bitvector_t bitvector, char_data *ch, char_data **tar_ch, obj_data **tar_obj);
#define FIND_CHAR_ROOM (1 << 0)
#define FIND_CHAR_WORLD (1 << 1)
@@ -96,10 +94,10 @@ int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
/* prototypes from mobact.c */
void forget(struct char_data *ch, struct char_data *victim);
void remember(struct char_data *ch, struct char_data *victim);
void forget(char_data *ch, char_data *victim);
void remember(char_data *ch, char_data *victim);
void mobile_activity(void);
void clearMemory(struct char_data *ch);
void clearMemory(char_data *ch);
/* For new last command: */
@@ -118,16 +116,16 @@ void clearMemory(struct char_data *ch);
#define LAST_PLAYING 10
struct last_entry {
int close_type;
char hostname[256];
char username[16];
time_t time;
time_t close_time;
int idnum;
int punique;
int close_type;
char hostname[256];
char username[16];
time_t time;
time_t close_time;
int idnum;
int punique;
};
void add_llog_entry(struct char_data *ch, int type);
void add_llog_entry(char_data *ch, int type);
struct last_entry *find_llog_entry(int punique, long idnum);
#endif /* _HANDLER_H_ */
+13 -13
View File
@@ -26,17 +26,17 @@
#include "modify.h"
/* local functions */
static void hedit_disp_menu(struct descriptor_data *);
static void hedit_setup_new(struct descriptor_data *);
static void hedit_setup_existing(struct descriptor_data *, int);
static void hedit_save_to_disk(struct descriptor_data *);
static void hedit_save_internally(struct descriptor_data *);
static void hedit_disp_menu(descriptor_data *);
static void hedit_setup_new(descriptor_data *);
static void hedit_setup_existing(descriptor_data *, int);
static void hedit_save_to_disk(descriptor_data *);
static void hedit_save_internally(descriptor_data *);
ACMD(do_oasis_hedit)
{
char arg[MAX_INPUT_LENGTH];
struct descriptor_data *d;
descriptor_data *d;
int i;
/* No building as a mob or while being forced. */
@@ -107,7 +107,7 @@ ACMD(do_oasis_hedit)
TRUE, "OLC: %s starts editing help files.", GET_NAME(d->character));
}
static void hedit_setup_new(struct descriptor_data *d)
static void hedit_setup_new(descriptor_data *d)
{
CREATE(OLC_HELP(d), struct help_index_element, 1);
@@ -120,7 +120,7 @@ static void hedit_setup_new(struct descriptor_data *d)
hedit_disp_menu(d);
}
static void hedit_setup_existing(struct descriptor_data *d, int rnum)
static void hedit_setup_existing(descriptor_data *d, int rnum)
{
CREATE(OLC_HELP(d), struct help_index_element, 1);
@@ -133,7 +133,7 @@ static void hedit_setup_existing(struct descriptor_data *d, int rnum)
hedit_disp_menu(d);
}
static void hedit_save_internally(struct descriptor_data *d)
static void hedit_save_internally(descriptor_data *d)
{
struct help_index_element *new_help_table = NULL;
@@ -154,7 +154,7 @@ static void hedit_save_internally(struct descriptor_data *d)
hedit_save_to_disk(d);
}
static void hedit_save_to_disk(struct descriptor_data *d)
static void hedit_save_to_disk(descriptor_data *d)
{
FILE *fp;
char buf1[MAX_STRING_LENGTH], index_name[READ_SIZE];
@@ -187,7 +187,7 @@ static void hedit_save_to_disk(struct descriptor_data *d)
}
/* The main menu. */
static void hedit_disp_menu(struct descriptor_data *d)
static void hedit_disp_menu(descriptor_data *d)
{
get_char_colors(d->character);
@@ -205,7 +205,7 @@ static void hedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = HEDIT_MAIN_MENU;
}
void hedit_parse(struct descriptor_data *d, char *arg)
void hedit_parse(descriptor_data *d, char *arg)
{
char buf[MAX_STRING_LENGTH];
char *oldtext = "";
@@ -357,7 +357,7 @@ void hedit_parse(struct descriptor_data *d, char *arg)
hedit_disp_menu(d);
}
void hedit_string_cleanup(struct descriptor_data *d, int terminator)
void hedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case HEDIT_ENTRY:
+5 -5
View File
@@ -1,13 +1,13 @@
/**
* @file hedit.h
* Oasis OLC Help Editor.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* Author: Steve Wolfe, Scott Meisenholder, Rhade
* All rights reserved. See license.doc for complete information.
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _HEDIT_H_
@@ -19,8 +19,8 @@
/* Utility functions */
/*
* All the following functions are declared in oasis.h
void hedit_parse(struct descriptor_data *, char *);
void hedit_string_cleanup(struct descriptor_data *, int);
void hedit_parse(descriptor_data *, char *);
void hedit_string_cleanup(descriptor_data *, int);
ACMD(do_oasis_hedit);
*/
/* Action fuctions */
+29 -29
View File
@@ -27,18 +27,18 @@ static int num_of_houses = 0;
/* local functions */
static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen);
static int House_load(room_vnum vnum);
static void House_restore_weight(struct obj_data *obj);
static void House_restore_weight(obj_data *obj);
static void House_delete_file(room_vnum vnum);
static int find_house(room_vnum vnum);
static void House_save_control(void);
static void hcontrol_build_house(struct char_data *ch, char *arg);
static void hcontrol_destroy_house(struct char_data *ch, char *arg);
static void hcontrol_pay_house(struct char_data *ch, char *arg);
static void House_listrent(struct char_data *ch, room_vnum vnum);
static void hcontrol_build_house(char_data *ch, char *arg);
static void hcontrol_destroy_house(char_data *ch, char *arg);
static void hcontrol_pay_house(char_data *ch, char *arg);
static void House_listrent(char_data *ch, room_vnum vnum);
/* CONVERSION code starts here -- see comment below. */
static int ascii_convert_house(struct char_data *ch, obj_vnum vnum);
static void hcontrol_convert_houses(struct char_data *ch);
static struct obj_data *Obj_from_store(struct obj_file_elem object, int *location);
static int ascii_convert_house(char_data *ch, obj_vnum vnum);
static void hcontrol_convert_houses(char_data *ch);
static obj_data *Obj_from_store(struct obj_file_elem object, int *location);
/* CONVERSION code ends here -- see comment below. */
/* First, the basics: finding the filename; loading/saving objects */
@@ -88,9 +88,9 @@ static int House_load(room_vnum vnum)
/* Save all objects for a house (recursive; initial call must be followed by a
* call to House_restore_weight) Assumes file is open already. */
int House_save(struct obj_data *obj, FILE *fp)
int House_save(obj_data *obj, FILE *fp)
{
struct obj_data *tmp;
obj_data *tmp;
int result;
if (obj) {
@@ -107,7 +107,7 @@ int House_save(struct obj_data *obj, FILE *fp)
}
/* restore weight of containers after House_save has changed them for saving */
static void House_restore_weight(struct obj_data *obj)
static void House_restore_weight(obj_data *obj)
{
if (obj) {
House_restore_weight(obj->contains);
@@ -160,7 +160,7 @@ static void House_delete_file(room_vnum vnum)
}
/* List all objects in a house file */
static void House_listrent(struct char_data *ch, room_vnum vnum)
static void House_listrent(char_data *ch, room_vnum vnum)
{
FILE *fl;
char filename[MAX_STRING_LENGTH];
@@ -288,7 +288,7 @@ static const char *HCONTROL_FORMAT =
" hcontrol pay <house vnum>\r\n"
" hcontrol show [house vnum | .]\r\n";
void hcontrol_list_houses(struct char_data *ch, char *arg)
void hcontrol_list_houses(char_data *ch, char *arg)
{
int i;
char *temp;
@@ -300,7 +300,7 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
if (*arg == '.')
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
else
toshow = atoi(arg);
toshow = atoidx(arg);
if ((i = find_house(toshow)) == NOWHERE) {
send_to_char(ch, "Unknown house, \"%s\".\r\n", arg);
@@ -343,7 +343,7 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
}
}
static void hcontrol_build_house(struct char_data *ch, char *arg)
static void hcontrol_build_house(char_data *ch, char *arg)
{
char arg1[MAX_INPUT_LENGTH];
struct house_control_rec temp_house;
@@ -363,7 +363,7 @@ static void hcontrol_build_house(struct char_data *ch, char *arg)
send_to_char(ch, "%s", HCONTROL_FORMAT);
return;
}
virt_house = atoi(arg1);
virt_house = atoidx(arg1);
if ((real_house = real_room(virt_house)) == NOWHERE) {
send_to_char(ch, "No such room exists.\r\n");
return;
@@ -427,7 +427,7 @@ static void hcontrol_build_house(struct char_data *ch, char *arg)
House_save_control();
}
static void hcontrol_destroy_house(struct char_data *ch, char *arg)
static void hcontrol_destroy_house(char_data *ch, char *arg)
{
int i, j;
room_rnum real_atrium, real_house;
@@ -436,17 +436,17 @@ static void hcontrol_destroy_house(struct char_data *ch, char *arg)
send_to_char(ch, "%s", HCONTROL_FORMAT);
return;
}
if ((i = find_house(atoi(arg))) == NOWHERE) {
if ((i = find_house(atoidx(arg))) == NOWHERE) {
send_to_char(ch, "Unknown house.\r\n");
return;
}
if ((real_atrium = real_room(house_control[i].atrium)) == NOWHERE)
log("SYSERR: House %d had invalid atrium %d!", atoi(arg), house_control[i].atrium);
log("SYSERR: House %s had invalid atrium %d!", arg, house_control[i].atrium);
else
REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
if ((real_house = real_room(house_control[i].vnum)) == NOWHERE)
log("SYSERR: House %d had invalid vnum %d!", atoi(arg), house_control[i].vnum);
log("SYSERR: House %s had invalid vnum %d!", arg, house_control[i].vnum);
else {
REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);
@@ -469,13 +469,13 @@ static void hcontrol_destroy_house(struct char_data *ch, char *arg)
SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
}
static void hcontrol_pay_house(struct char_data *ch, char *arg)
static void hcontrol_pay_house(char_data *ch, char *arg)
{
int i;
if (!*arg)
send_to_char(ch, "%s", HCONTROL_FORMAT);
else if ((i = find_house(atoi(arg))) == NOWHERE)
else if ((i = find_house(atoidx(arg))) == NOWHERE)
send_to_char(ch, "Unknown house.\r\n");
else {
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "Payment for house %s collected by %s.", arg, GET_NAME(ch));
@@ -564,7 +564,7 @@ void House_save_all(void)
}
/* note: arg passed must be house vnum, so there. */
int House_can_enter(struct char_data *ch, room_vnum house)
int House_can_enter(char_data *ch, room_vnum house)
{
int i, j;
@@ -583,7 +583,7 @@ int House_can_enter(struct char_data *ch, room_vnum house)
return (0);
}
void House_list_guests(struct char_data *ch, int i, int quiet)
void House_list_guests(char_data *ch, int i, int quiet)
{
int j, num_printed;
char *temp;
@@ -622,7 +622,7 @@ void House_list_guests(struct char_data *ch, int i, int quiet)
* will let your house files load on the next bootup. -Welcor *
************************************************************************/
/* Code for conversion to ascii house rent files. */
static void hcontrol_convert_houses(struct char_data *ch)
static void hcontrol_convert_houses(char_data *ch)
{
int i;
@@ -656,11 +656,11 @@ static void hcontrol_convert_houses(struct char_data *ch)
send_to_char(ch, "All done.\r\n");
}
static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
static int ascii_convert_house(char_data *ch, obj_vnum vnum)
{
FILE *in, *out;
char infile[MAX_INPUT_LENGTH], *outfile;
struct obj_data *tmp;
obj_data *tmp;
int i, j=0;
House_get_filename(vnum, infile, sizeof(infile));
@@ -722,9 +722,9 @@ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
}
/* The circle 3.1 function for reading rent files. No longer used by the rent system. */
static struct obj_data *Obj_from_store(struct obj_file_elem object, int *location)
static obj_data *Obj_from_store(struct obj_file_elem object, int *location)
{
struct obj_data *obj;
obj_data *obj;
obj_rnum itemnum;
int j, taeller;
+33 -34
View File
@@ -1,54 +1,53 @@
/**
* @file house.h
* Player house structures, prototypes and defines.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _HOUSE_H_
#define _HOUSE_H_
#define MAX_HOUSES 100
#define MAX_GUESTS 10
#define MAX_HOUSES 100
#define MAX_GUESTS 10
#define HOUSE_PRIVATE 0
#define HOUSE_PRIVATE 0
struct house_control_rec {
room_vnum vnum; /* vnum of this house */
room_vnum atrium; /* vnum of atrium */
sh_int exit_num; /* direction of house's exit */
time_t built_on; /* date this house was built */
int mode; /* mode of ownership */
long owner; /* idnum of house's owner */
int num_of_guests; /* how many guests for house */
long guests[MAX_GUESTS]; /* idnums of house's guests */
time_t last_payment; /* date of last house payment */
long spare0;
long spare1;
long spare2;
long spare3;
long spare4;
long spare5;
long spare6;
long spare7;
room_vnum vnum; /* vnum of this house */
room_vnum atrium; /* vnum of atrium */
sh_int exit_num; /* direction of house's exit */
time_t built_on; /* date this house was built */
int mode; /* mode of ownership */
long owner; /* idnum of house's owner */
int num_of_guests; /* how many guests for house */
long guests[MAX_GUESTS]; /* idnums of house's guests */
time_t last_payment; /* date of last house payment */
long spare0;
long spare1;
long spare2;
long spare3;
long spare4;
long spare5;
long spare6;
long spare7;
};
#define TOROOM(room, dir) (world[room].dir_option[dir] ? \
world[room].dir_option[dir]->to_room : NOWHERE)
#define TOROOM(room, dir) (world[room].dir_option[dir] ? world[room].dir_option[dir]->to_room : NOWHERE)
/* Functions in house.c made externally available */
/* Utility Functions */
void House_boot(void);
void House_save_all(void);
int House_can_enter(struct char_data *ch, room_vnum house);
void House_crashsave(room_vnum vnum);
void House_list_guests(struct char_data *ch, int i, int quiet);
int House_save(struct obj_data *obj, FILE *fp);
void hcontrol_list_houses(struct char_data *ch, char *arg);
void House_boot(void);
void House_save_all(void);
int House_can_enter(char_data *ch, room_vnum house);
void House_crashsave(room_vnum vnum);
void House_list_guests(char_data *ch, int i, int quiet);
int House_save(obj_data *obj, FILE *fp);
void hcontrol_list_houses(char_data *ch, char *arg);
/* In game Commands */
ACMD(do_hcontrol);
ACMD(do_house);
+14 -14
View File
@@ -56,12 +56,12 @@ static void free_ibt_list(IBT_DATA *first_ibt, IBT_DATA *last_ibt);
static IBT_DATA *read_ibt(char *filename, FILE *fp);
static IBT_DATA *get_first_ibt(int mode);
static IBT_DATA *get_last_ibt(int mode);
static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch);
static bool is_ibt_logger(IBT_DATA *ibtData, char_data *ch);
/* Internal (static) OLC functions */
static void ibtedit_setup(struct descriptor_data *d);
static void ibtedit_save(struct descriptor_data *d);
static void ibtedit_disp_main_menu(struct descriptor_data *d);
static void ibtedit_disp_flags(struct descriptor_data *d);
static void ibtedit_setup(descriptor_data *d);
static void ibtedit_save(descriptor_data *d);
static void ibtedit_disp_main_menu(descriptor_data *d);
static void ibtedit_disp_flags(descriptor_data *d);
static IBT_DATA *new_ibt(void)
{
@@ -436,7 +436,7 @@ static bool free_ibt(int mode, IBT_DATA *ibtData)
}
/* Return TRUE if 'ch' is the person who logged the IBT */
static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch)
static bool is_ibt_logger(IBT_DATA *ibtData, char_data *ch)
{
if ( ch && !IS_NPC(ch) && ibtData ) {
@@ -773,7 +773,7 @@ ACMD(do_ibt)
ACMD(do_oasis_ibtedit)
{
int number = NOTHING;
struct descriptor_data *d;
descriptor_data *d;
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
/* No editing as a mob or while being forced. */
@@ -845,7 +845,7 @@ ACMD(do_oasis_ibtedit)
/*-------------------------------------------------------------------*/
/* Copy IBT data into the OLC structure */
static void ibtedit_setup(struct descriptor_data *d)
static void ibtedit_setup(descriptor_data *d)
{
IBT_DATA *ibtData;
int i;
@@ -877,7 +877,7 @@ static void ibtedit_setup(struct descriptor_data *d)
/*-------------------------------------------------------------------*/
/* Copy IBT data back to the correct list */
static void ibtedit_save(struct descriptor_data *d)
static void ibtedit_save(descriptor_data *d)
{
IBT_DATA *ibtData;
int i;
@@ -944,9 +944,9 @@ void free_olc_ibt(IBT_DATA *toFree) {
/*-------------------------------------------------------------------*/
/* main ibtedit menu function... */
static void ibtedit_disp_main_menu(struct descriptor_data *d)
static void ibtedit_disp_main_menu(descriptor_data *d)
{
struct char_data *ch = d->character;
char_data *ch = d->character;
char flg_text[MAX_STRING_LENGTH];
room_rnum rr;
@@ -978,7 +978,7 @@ static void ibtedit_disp_main_menu(struct descriptor_data *d)
}
/*-------------------------------------------------------------------*/
/* Display IBT-flags menu. */
static void ibtedit_disp_flags(struct descriptor_data *d)
static void ibtedit_disp_flags(descriptor_data *d)
{
char buf[MAX_STRING_LENGTH];
@@ -995,7 +995,7 @@ static void ibtedit_disp_flags(struct descriptor_data *d)
}
/*-------------------------------------------------------------------*/
/* main clanedit parser function... interpreter throws all input to here. */
void ibtedit_parse(struct descriptor_data *d, char *arg)
void ibtedit_parse(descriptor_data *d, char *arg)
{
int i;
char *oldtext = NULL;
@@ -1145,7 +1145,7 @@ void ibtedit_parse(struct descriptor_data *d, char *arg)
}
/*-------------------------------------------------------------------*/
void ibtedit_string_cleanup(struct descriptor_data *d, int terminator)
void ibtedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
Executable → Regular
+14 -15
View File
@@ -69,19 +69,18 @@ typedef struct ibt_data IBT_DATA;
break; \
}
struct ibt_data
{
IBT_DATA *next; /**< Pointer to next IBT in the list */
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
char *text; /**< Header Text for this IBT */
char *body; /**< Body Text for this IBT */
char *name; /**< Name of the person who reported this IBT */
char *notes; /**< Resolution Notes added by Administrators */
int level; /**< Level of the person who reported this IBT */
room_vnum room; /**< Room in which this IBT was reported */
long id_num; /**< The ID number of the player who logged it */
int flags[IBT_ARRAY_MAX]; /**< IBT flags */
long dated; /**< When the IBT what reported */
struct ibt_data {
IBT_DATA *next; /**< Pointer to next IBT in the list */
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
char *text; /**< Header Text for this IBT */
char *body; /**< Body Text for this IBT */
char *name; /**< Name of the person who reported this IBT */
char *notes; /**< Resolution Notes added by Administrators */
int level; /**< Level of the person who reported this IBT */
room_vnum room; /**< Room in which this IBT was reported */
long id_num; /**< The ID number of the player who logged it */
int flags[IBT_ARRAY_MAX]; /**< IBT flags */
long dated; /**< When the IBT what reported */
};
extern IBT_DATA *first_bug;
@@ -96,8 +95,8 @@ ACMD(do_ibt);
ACMD(do_oasis_ibtedit);
void save_ibt_file(int mode);
void load_ibt_file(int mode);
void ibtedit_parse(struct descriptor_data *d, char *arg);
void ibtedit_string_cleanup(struct descriptor_data *d, int terminator);
void ibtedit_parse(descriptor_data *d, char *arg);
void ibtedit_string_cleanup(descriptor_data *d, int terminator);
void free_ibt_lists(void);
void free_olc_ibt(IBT_DATA *toFree);
void clean_ibt_list(int mode);
+4 -4
View File
@@ -15,7 +15,7 @@
#include "modify.h"
void send_editor_help(struct descriptor_data *d)
void send_editor_help(descriptor_data *d)
{
if (using_improved_editor)
write_to_output(d, "Instructions: /s to save, /h for more options.\r\n");
@@ -25,7 +25,7 @@ void send_editor_help(struct descriptor_data *d)
#if CONFIG_IMPROVED_EDITOR
int improved_editor_execute(struct descriptor_data *d, char *str)
int improved_editor_execute(descriptor_data *d, char *str)
{
char actions[MAX_INPUT_LENGTH];
@@ -96,7 +96,7 @@ int improved_editor_execute(struct descriptor_data *d, char *str)
}
/* Handle some editor commands. */
void parse_edit_action(int command, char *string, struct descriptor_data *d)
void parse_edit_action(int command, char *string, descriptor_data *d)
{
int indent = 0, rep_all = 0, flags = 0, replaced, i, line_low, line_high, j = 0;
unsigned int total_len;
@@ -503,7 +503,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
/* Re-formats message type formatted char *. (for strings edited with d->str)
* (mostly olc and mail). */
int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high)
int format_text(char **ptr_string, int mode, descriptor_data *d, unsigned int maxlen, int low, int high)
{
int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
char *flow, *start = NULL, temp;
+17 -17
View File
@@ -1,27 +1,27 @@
/**
* @file improved-edit.h
* The basic and improved editor.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* This set of code was not originally part of the circlemud distribution.
*
* This set of code was not originally part of the circlemud distribution.
*/
#ifndef _IMPROVED_EDIT_H_
#define _IMPROVED_EDIT_H_
/* This is here to allow different code for the basic and improved editor. If
* you do not wish to use the improved editor, put #if 0 below, otherwise you
/* This is here to allow different code for the basic and improved editor. If
* you do not wish to use the improved editor, put #if 0 below, otherwise you
* should leave the setting at #if 1. */
#define CONFIG_IMPROVED_EDITOR 1
#define CONFIG_IMPROVED_EDITOR 1
#define using_improved_editor CONFIG_IMPROVED_EDITOR
#define using_improved_editor CONFIG_IMPROVED_EDITOR
void parse_edit_action(int command, char *string, struct descriptor_data *d);
int improved_editor_execute(struct descriptor_data *d, char *string);
int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high);
void parse_edit_action(int command, char *string, descriptor_data *d);
int improved_editor_execute(descriptor_data *d, char *string);
int format_text(char **ptr_string, int mode, descriptor_data *d, unsigned int maxlen, int low, int high);
int replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size);
void send_editor_help(struct descriptor_data *d);
void send_editor_help(descriptor_data *d);
/* Action modes for parse_edit_action(). */
#define PARSE_FORMAT 0
@@ -29,18 +29,18 @@ void send_editor_help(struct descriptor_data *d);
#define PARSE_HELP 2
#define PARSE_DELETE 3
#define PARSE_INSERT 4
#define PARSE_LIST_NORM 5
#define PARSE_LIST_NORM 5
#define PARSE_LIST_NUM 6
#define PARSE_EDIT 7
#define PARSE_TOGGLE 8
/* Defines for the action variable. */
#define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */
#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */
#define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */
#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */
/* Settings for formatter. */
#define FORMAT_INDENT (1 << 0)
#define FORMAT_INDENT (1 << 0)
#endif /* _IMPROVED_EDIT_H_ */
+1410 -1409
View File
File diff suppressed because it is too large Load Diff
+37 -37
View File
@@ -21,25 +21,25 @@
#define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move)
void sort_commands(void);
void command_interpreter(struct char_data *ch, char *argument);
int search_block(char *arg, const char **list, int exact);
char *one_argument(char *argument, char *first_arg);
char *one_word(char *argument, char *first_arg);
char *any_one_arg(char *argument, char *first_arg);
char *two_arguments(char *argument, char *first_arg, char *second_arg);
int fill_word(char *argument);
void command_interpreter(char_data *ch, char *argument);
int search_block(char *arg, const char **list, int exact);
char *one_argument(char *argument, char *first_arg);
char *one_word(char *argument, char *first_arg);
char *any_one_arg(char *argument, char *first_arg);
char *two_arguments(char *argument, char *first_arg, char *second_arg);
int fill_word(char *argument);
int reserved_word(char *argument);
void half_chop(char *string, char *arg1, char *arg2);
void nanny(struct descriptor_data *d, char *arg);
int is_abbrev(const char *arg1, const char *arg2);
int is_number(const char *str);
int find_command(const char *command);
void skip_spaces(char **string);
char *delete_doubledollar(char *string);
int special(struct char_data *ch, int cmd, char *arg);
void half_chop(char *string, char *arg1, char *arg2);
void nanny(descriptor_data *d, char *arg);
int is_abbrev(const char *arg1, const char *arg2);
int is_number(const char *str);
int find_command(const char *command);
void skip_spaces(char **string);
char *delete_doubledollar(char *string);
int special(char_data *ch, int cmd, char *arg);
void free_alias(struct alias_data *a);
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
int enter_player_game (struct descriptor_data *d);
int perform_alias(descriptor_data *d, char *orig, size_t maxlen);
int enter_player_game (descriptor_data *d);
/* ACMDs available through interpreter.c */
ACMD(do_alias);
@@ -54,35 +54,35 @@ ACMD(do_alias);
#define RESERVE_CMDS 7
struct command_info {
const char *command;
const char *sort_as;
byte minimum_position;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
sh_int minimum_level;
int subcmd;
const char *command;
const char *sort_as;
byte minimum_position;
void (*command_pointer)
(char_data *ch, char *argument, int cmd, int subcmd);
sh_int minimum_level;
int subcmd;
};
struct mob_script_command_t {
const char *command_name;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
int subcmd;
const char *command_name;
void (*command_pointer)
(char_data *ch, char *argument, int cmd, int subcmd);
int subcmd;
};
struct alias_data {
char *alias;
char *replacement;
int type;
struct alias_data *next;
char *alias;
char *replacement;
int type;
struct alias_data *next;
};
#define ALIAS_SIMPLE 0
#define ALIAS_COMPLEX 1
#define ALIAS_SIMPLE 0
#define ALIAS_COMPLEX 1
#define ALIAS_SEP_CHAR ';'
#define ALIAS_VAR_CHAR '$'
#define ALIAS_GLOB_CHAR '*'
#define ALIAS_SEP_CHAR ';'
#define ALIAS_VAR_CHAR '$'
#define ALIAS_GLOB_CHAR '*'
/* SUBCOMMANDS: You can define these however you want to, and the definitions
* of the subcommands are independent from function to function.*/
+15 -15
View File
@@ -25,7 +25,7 @@
/* local file scope function prototypes */
static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int p6);
static void check_idling(struct char_data *ch);
static void check_idling(char_data *ch);
/* When age < 15 return the value p0
@@ -58,7 +58,7 @@ static int graf(int grafage, int p0, int p1, int p2, int p3, int p4, int p5, int
* that a character's age will now only affect the HMV gain per tick, and _not_
* the HMV maximums. */
/* manapoint gain pr. game hour */
int mana_gain(struct char_data *ch)
int mana_gain(char_data *ch)
{
int gain;
@@ -99,7 +99,7 @@ int mana_gain(struct char_data *ch)
}
/* Hitpoint gain pr. game hour */
int hit_gain(struct char_data *ch)
int hit_gain(char_data *ch)
{
int gain;
@@ -140,7 +140,7 @@ int hit_gain(struct char_data *ch)
}
/* move gain pr. game hour */
int move_gain(struct char_data *ch)
int move_gain(char_data *ch)
{
int gain;
@@ -175,7 +175,7 @@ int move_gain(struct char_data *ch)
return (gain);
}
void set_title(struct char_data *ch, char *title)
void set_title(char_data *ch, char *title)
{
if (GET_TITLE(ch) != NULL)
free(GET_TITLE(ch));
@@ -220,7 +220,7 @@ void run_autowiz(void)
#endif /* CIRCLE_UNIX || CIRCLE_WINDOWS */
}
void gain_exp(struct char_data *ch, int gain)
void gain_exp(char_data *ch, int gain)
{
int is_altered = FALSE;
int num_levels = 0;
@@ -267,7 +267,7 @@ void gain_exp(struct char_data *ch, int gain)
run_autowiz();
}
void gain_exp_regardless(struct char_data *ch, int gain)
void gain_exp_regardless(char_data *ch, int gain)
{
int is_altered = FALSE;
int num_levels = 0;
@@ -302,7 +302,7 @@ void gain_exp_regardless(struct char_data *ch, int gain)
run_autowiz();
}
void gain_condition(struct char_data *ch, int condition, int value)
void gain_condition(char_data *ch, int condition, int value)
{
bool intoxicated;
@@ -336,7 +336,7 @@ void gain_condition(struct char_data *ch, int condition, int value)
}
static void check_idling(struct char_data *ch)
static void check_idling(char_data *ch)
{
if (ch->char_specials.timer > CONFIG_IDLE_VOID) {
if (GET_WAS_IN(ch) == NOWHERE && IN_ROOM(ch) != NOWHERE) {
@@ -378,8 +378,8 @@ static void check_idling(struct char_data *ch)
/* Update PCs, NPCs, and objects */
void point_update(void)
{
struct char_data *i, *next_char;
struct obj_data *j, *next_thing, *jj, *next_thing2;
char_data *i, *next_char;
obj_data *j, *next_thing, *jj, *next_thing2;
/* characters */
for (i = character_list; i; i = next_char) {
@@ -471,7 +471,7 @@ void point_update(void)
}
/* Note: amt may be negative */
int increase_gold(struct char_data *ch, int amt)
int increase_gold(char_data *ch, int amt)
{
int curr_gold;
@@ -492,7 +492,7 @@ int increase_gold(struct char_data *ch, int amt)
return (GET_GOLD(ch));
}
int decrease_gold(struct char_data *ch, int deduction)
int decrease_gold(char_data *ch, int deduction)
{
int amt;
amt = (deduction * -1);
@@ -500,7 +500,7 @@ int decrease_gold(struct char_data *ch, int deduction)
return (GET_GOLD(ch));
}
int increase_bank(struct char_data *ch, int amt)
int increase_bank(char_data *ch, int amt)
{
int curr_bank;
@@ -522,7 +522,7 @@ int increase_bank(struct char_data *ch, int amt)
return (GET_BANK_GOLD(ch));
}
int decrease_bank(struct char_data *ch, int deduction)
int decrease_bank(char_data *ch, int deduction)
{
int amt;
amt = (deduction * -1);
+12 -12
View File
@@ -1,34 +1,34 @@
/**
* @file lists.h
* Lists Header file.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 2012 by Joseph Arnusch.
* Copyright 2012 by Joseph Arnusch.
*/
#ifndef _LISTS_HEADER
#define _LISTS_HEADER
struct item_data {
struct item_data * pPrevItem;
struct item_data * pNextItem;
void * pContent;
struct item_data * pPrevItem;
struct item_data * pNextItem;
void * pContent;
};
struct list_data {
struct item_data * pFirstItem;
struct item_data * pLastItem;
unsigned short int iIterators;
unsigned short int iSize;
struct item_data * pFirstItem;
struct item_data * pLastItem;
unsigned short int iIterators;
unsigned short int iSize;
};
struct iterator_data {
struct list_data * pList;
struct item_data * pItem;
struct list_data * pList;
struct item_data * pItem;
};
/* Externals */
+27 -27
View File
@@ -25,15 +25,15 @@
/* local file scope function prototypes */
static int mag_materials(struct char_data *ch, IDXTYPE item0, IDXTYPE item1, IDXTYPE item2, int extract, int verbose);
static void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype);
static int mag_materials(char_data *ch, IDXTYPE item0, IDXTYPE item1, IDXTYPE item2, int extract, int verbose);
static void perform_mag_groups(int level, char_data *ch, char_data *tch, int spellnum, int savetype);
/* Negative apply_saving_throw[] values make saving throws better! So do
* negative modifiers. Though people may be used to the reverse of that.
* It's due to the code modifying the target saving throw instead of the
* random number of the character as in some other systems. */
int mag_savingthrow(struct char_data *ch, int type, int modifier)
int mag_savingthrow(char_data *ch, int type, int modifier)
{
/* NPCs use warrior tables according to some book */
int class_sav = CLASS_WARRIOR;
@@ -58,7 +58,7 @@ int mag_savingthrow(struct char_data *ch, int type, int modifier)
void affect_update(void)
{
struct affected_type *af, *next;
struct char_data *i;
char_data *i;
for (i = character_list; i; i = i->next)
for (af = i->affected; af; af = next) {
@@ -92,15 +92,15 @@ void affect_update(void)
* FALSE to send no in game messages from this function.
* @retval int TRUE if ch has all materials to cast the spell, FALSE if not.
*/
static int mag_materials(struct char_data *ch, IDXTYPE item0,
static int mag_materials(char_data *ch, IDXTYPE item0,
IDXTYPE item1, IDXTYPE item2, int extract, int verbose)
{
/* Begin Local variable definitions. */
/*------------------------------------------------------------------------*/
/* Used for object searches. */
struct obj_data *tobj = NULL;
obj_data *tobj = NULL;
/* Points to found reagents. */
struct obj_data *obj0 = NULL, *obj1 = NULL, *obj2 = NULL;
obj_data *obj0 = NULL, *obj1 = NULL, *obj2 = NULL;
/*------------------------------------------------------------------------*/
/* End Local variable definitions. */
@@ -192,7 +192,7 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0,
/* Every spell that does damage comes through here. This calculates the amount
* of damage, adds in any modifiers, determines what the saves are, tests for
* save and calls damage(). -1 = dead, otherwise the amount of damage done. */
int mag_damage(int level, struct char_data *ch, struct char_data *victim,
int mag_damage(int level, char_data *ch, char_data *victim,
int spellnum, int savetype)
{
int dam = 0;
@@ -300,7 +300,7 @@ int mag_damage(int level, struct char_data *ch, struct char_data *victim,
* affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod) */
#define MAX_SPELL_AFFECTS 5 /* change if more needed */
void mag_affects(int level, struct char_data *ch, struct char_data *victim,
void mag_affects(int level, char_data *ch, char_data *victim,
int spellnum, int savetype)
{
struct affected_type af[MAX_SPELL_AFFECTS];
@@ -552,8 +552,8 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
/* This function is used to provide services to mag_groups. This function is
* the one you should change to add new group spells. */
static void perform_mag_groups(int level, struct char_data *ch,
struct char_data *tch, int spellnum, int savetype)
static void perform_mag_groups(int level, char_data *ch,
char_data *tch, int spellnum, int savetype)
{
switch (spellnum) {
case SPELL_GROUP_HEAL:
@@ -573,9 +573,9 @@ static void perform_mag_groups(int level, struct char_data *ch,
* affect everyone grouped with the caster who is in the room, caster last. To
* add new group spells, you shouldn't have to change anything in mag_groups.
* Just add a new case to perform_mag_groups. */
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
void mag_groups(int level, char_data *ch, int spellnum, int savetype)
{
struct char_data *tch;
char_data *tch;
if (ch == NULL)
return;
@@ -583,7 +583,7 @@ void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
if (!GROUP(ch))
return;
while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) {
while ((tch = (char_data *) simple_list(GROUP(ch)->members)) != NULL) {
if (IN_ROOM(tch) != IN_ROOM(ch))
continue;
if (tch == ch)
@@ -596,9 +596,9 @@ void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
/* Mass spells affect every creature in the room except the caster. No spells
* of this class currently implemented. */
void mag_masses(int level, struct char_data *ch, int spellnum, int savetype)
void mag_masses(int level, char_data *ch, int spellnum, int savetype)
{
struct char_data *tch, *tch_next;
char_data *tch, *tch_next;
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch_next) {
tch_next = tch->next_in_room;
@@ -614,9 +614,9 @@ void mag_masses(int level, struct char_data *ch, int spellnum, int savetype)
* generally offensive spells. This calls mag_damage to do the actual damage.
* All spells listed here must also have a case in mag_damage() in order for
* them to work. Area spells have limited targets within the room. */
void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
void mag_areas(int level, char_data *ch, int spellnum, int savetype)
{
struct char_data *tch, *next_tch;
char_data *tch, *next_tch;
const char *to_char = NULL, *to_room = NULL;
if (ch == NULL)
@@ -702,11 +702,11 @@ static const char *mag_summon_fail_msgs[] = {
#define OBJ_CLONE 161 /**< vnum for clone material. */
#define MOB_ZOMBIE 11 /**< vnum for the zombie mob. */
void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
void mag_summons(int level, char_data *ch, obj_data *obj,
int spellnum, int savetype)
{
struct char_data *mob = NULL;
struct obj_data *tobj, *next_obj;
char_data *mob = NULL;
obj_data *tobj, *next_obj;
int pfail = 0, msg = 0, fmsg = 0, num = 1, handle_corpse = FALSE, i;
mob_vnum mob_num;
@@ -798,7 +798,7 @@ void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
/*----------------------------------------------------------------------------*/
void mag_points(int level, struct char_data *ch, struct char_data *victim,
void mag_points(int level, char_data *ch, char_data *victim,
int spellnum, int savetype)
{
int healing = 0, move = 0;
@@ -825,7 +825,7 @@ void mag_points(int level, struct char_data *ch, struct char_data *victim,
update_pos(victim);
}
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
void mag_unaffects(int level, char_data *ch, char_data *victim,
int spellnum, int type)
{
int spell = 0, msg_not_affected = TRUE;
@@ -872,7 +872,7 @@ void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
act(to_room, TRUE, victim, 0, ch, TO_ROOM);
}
void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
void mag_alter_objs(int level, char_data *ch, obj_data *obj,
int spellnum, int savetype)
{
const char *to_char = NULL, *to_room = NULL;
@@ -939,9 +939,9 @@ void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
act(to_char, TRUE, ch, obj, 0, TO_ROOM);
}
void mag_creations(int level, struct char_data *ch, int spellnum)
void mag_creations(int level, char_data *ch, int spellnum)
{
struct obj_data *tobj;
obj_data *tobj;
obj_vnum z;
if (ch == NULL)
@@ -969,7 +969,7 @@ void mag_creations(int level, struct char_data *ch, int spellnum)
load_otrigger(tobj);
}
void mag_rooms(int level, struct char_data *ch, int spellnum)
void mag_rooms(int level, char_data *ch, int spellnum)
{
room_rnum rnum;
int duration = 0;
+12 -12
View File
@@ -21,9 +21,9 @@
#include "modify.h"
/* local (file scope) function prototypes */
static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg);
static void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg);
static void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, int cmd, char *arg);
static void postmaster_send_mail(char_data *ch, char_data *mailman, int cmd, char *arg);
static void postmaster_check_mail(char_data *ch, char_data *mailman, int cmd, char *arg);
static void postmaster_receive_mail(char_data *ch, char_data *mailman, int cmd, char *arg);
static int mail_recip_ok(const char *name);
static void write_mail_record(FILE *mail_file, struct mail_t *record);
static void free_mail_record(struct mail_t *record);
@@ -257,19 +257,19 @@ SPECIAL(postmaster)
}
if (CMD_IS("mail")) {
postmaster_send_mail(ch, (struct char_data *)me, cmd, argument);
postmaster_send_mail(ch, (char_data *)me, cmd, argument);
return (1);
} else if (CMD_IS("check")) {
postmaster_check_mail(ch, (struct char_data *)me, cmd, argument);
postmaster_check_mail(ch, (char_data *)me, cmd, argument);
return (1);
} else if (CMD_IS("receive")) {
postmaster_receive_mail(ch, (struct char_data *)me, cmd, argument);
postmaster_receive_mail(ch, (char_data *)me, cmd, argument);
return (1);
} else
return (0);
}
static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
static void postmaster_send_mail(char_data *ch, char_data *mailman,
int cmd, char *arg)
{
long recipient;
@@ -316,7 +316,7 @@ static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman
string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL);
}
static void postmaster_check_mail(struct char_data *ch, struct char_data *mailman,
static void postmaster_check_mail(char_data *ch, char_data *mailman,
int cmd, char *arg)
{
if (has_mail(GET_IDNUM(ch)))
@@ -325,11 +325,11 @@ static void postmaster_check_mail(struct char_data *ch, struct char_data *mailma
act("$n tells you, 'Sorry, you don't have any mail waiting.'", FALSE, mailman, 0, ch, TO_VICT);
}
static void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
static void postmaster_receive_mail(char_data *ch, char_data *mailman,
int cmd, char *arg)
{
char buf[256];
struct obj_data *obj;
obj_data *obj;
int y;
if (!has_mail(GET_IDNUM(ch))) {
@@ -364,9 +364,9 @@ static void postmaster_receive_mail(struct char_data *ch, struct char_data *mail
}
}
void notify_if_playing(struct char_data *from, int recipient_id)
void notify_if_playing(char_data *from, int recipient_id)
{
struct descriptor_data *d;
descriptor_data *d;
for (d = descriptor_list; d; d = d->next)
if ((IS_PLAYING(d)) && (GET_IDNUM(d->character) == recipient_id) && (has_mail(GET_IDNUM(d->character))))
+36 -37
View File
@@ -1,12 +1,12 @@
/**
* @file mail.h
* Public procs, macro defs, subcommand defines mudmail system.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
* By Jeremy Elson.
*/
@@ -15,39 +15,39 @@
/* You can modify the following constants to fit your own MUD. */
/* minimum level a player must be to send mail */
/* minimum level a player must be to send mail */
#define MIN_MAIL_LEVEL 1
/* # of gold coins required to send mail */
/* # of gold coins required to send mail */
#define STAMP_PRICE 150
/* Maximum size of mail in bytes (arbitrary) */
/* Maximum size of mail in bytes (arbitrary) */
#define MAX_MAIL_SIZE 8192
/* size of mail file allocation blocks */
/* size of mail file allocation blocks */
#define BLOCK_SIZE 100
/* General, publicly available functions */
SPECIAL(postmaster);
/* NOTE: Make sure that your block size is big enough. If not, HEADER_BLOCK_
* DATASIZE will end up negative. This is a bad thing. Check the define below
* to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE.
* DATASIZE will end up negative. This is a bad thing. Check the define below
* to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE.
* 100 is a nice round number for BLOCK_SIZE and is the default. The mail system
* will always allocate disk space in chunks of size BLOCK_SIZE. */
/* DON'T TOUCH DEFINES BELOW. */
int scan_file(void);
int has_mail(long recipient);
void store_mail(long to, long from, char *message_pointer);
char *read_delete(long recipient);
void notify_if_playing(struct char_data *from, int recipient_id);
int scan_file(void);
int has_mail(long recipient);
void store_mail(long to, long from, char *message_pointer);
char *read_delete(long recipient);
void notify_if_playing(char_data *from, int recipient_id);
struct mail_t {
long recipient;
long sender;
time_t sent_time;
char *body;
long recipient;
long sender;
time_t sent_time;
char *body;
};
/* old stuff below */
@@ -56,18 +56,17 @@ struct mail_t {
#define DELETED_BLOCK (-3)
/* Note: next_block is part of header_blk in a data block; we can't combine them
* here because we have to be able to differentiate a data block from a header
* here because we have to be able to differentiate a data block from a header
* block when booting mail system. */
struct header_data_type {
long next_block; /* if header block, link to next block */
long from; /* idnum of the mail's sender */
long to; /* idnum of mail's recipient */
time_t mail_time; /* when was the letter mailed? */
long next_block; /* if header block, link to next block */
long from; /* idnum of the mail's sender */
long to; /* idnum of mail's recipient */
time_t mail_time; /* when was the letter mailed? */
};
/* size of the data part of a header block */
#define HEADER_BLOCK_DATASIZE \
(BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
#define HEADER_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
/* size of the data part of a data block */
#define DATA_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(char))
@@ -76,31 +75,31 @@ struct header_data_type {
terminating null character. */
struct header_block_type_d {
long block_type; /* is this a header or data block? */
struct header_data_type header_data; /* other header data */
char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
long block_type; /* is this a header or data block? */
struct header_data_type header_data; /* other header data */
char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
};
struct data_block_type_d {
long block_type; /* -1 if header block, -2 if last data block
in mail, otherwise a link to the next */
char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
long block_type; /* -1 if header block, -2 if last data block
in mail, otherwise a link to the next */
char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
};
typedef struct header_block_type_d header_block_type;
typedef struct data_block_type_d data_block_type;
struct position_list_type_d {
long position;
struct position_list_type_d *next;
long position;
struct position_list_type_d *next;
};
typedef struct position_list_type_d position_list_type;
struct mail_index_type_d {
long recipient; /* who is this mail for? */
position_list_type *list_start; /* list of mail positions */
struct mail_index_type_d *next; /* link to next one */
long recipient; /* who is this mail for? */
position_list_type *list_start; /* list of mail positions */
struct mail_index_type_d *next; /* link to next one */
};
typedef struct mail_index_type_d mail_index_type;
+31 -31
View File
@@ -28,23 +28,23 @@
#include "modify.h" /* for smash_tilde */
/* local functions */
static void medit_setup_new(struct descriptor_data *d);
static void init_mobile(struct char_data *mob);
static void medit_setup_new(descriptor_data *d);
static void init_mobile(char_data *mob);
static void medit_save_to_disk(zone_vnum zone_num);
static void medit_disp_positions(struct descriptor_data *d);
static void medit_disp_sex(struct descriptor_data *d);
static void medit_disp_attack_types(struct descriptor_data *d);
static void medit_disp_positions(descriptor_data *d);
static void medit_disp_sex(descriptor_data *d);
static void medit_disp_attack_types(descriptor_data *d);
static bool medit_illegal_mob_flag(int fl);
static int medit_get_mob_flag_by_number(int num);
static void medit_disp_mob_flags(struct descriptor_data *d);
static void medit_disp_aff_flags(struct descriptor_data *d);
static void medit_disp_menu(struct descriptor_data *d);
static void medit_disp_mob_flags(descriptor_data *d);
static void medit_disp_aff_flags(descriptor_data *d);
static void medit_disp_menu(descriptor_data *d);
/* utility functions */
ACMD(do_oasis_medit)
{
int number = NOBODY, save = 0, real_num;
struct descriptor_data *d;
descriptor_data *d;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@@ -175,12 +175,12 @@ static void medit_save_to_disk(zone_vnum foo)
save_mobiles(real_zone(foo));
}
static void medit_setup_new(struct descriptor_data *d)
static void medit_setup_new(descriptor_data *d)
{
struct char_data *mob;
char_data *mob;
/* Allocate a scratch mobile structure. */
CREATE(mob, struct char_data, 1);
CREATE(mob, char_data, 1);
init_mobile(mob);
@@ -199,12 +199,12 @@ static void medit_setup_new(struct descriptor_data *d)
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
}
void medit_setup_existing(struct descriptor_data *d, int rmob_num)
void medit_setup_existing(descriptor_data *d, int rmob_num)
{
struct char_data *mob;
char_data *mob;
/* Allocate a scratch mobile structure. */
CREATE(mob, struct char_data, 1);
CREATE(mob, char_data, 1);
copy_mobile(mob, mob_proto + rmob_num);
@@ -220,7 +220,7 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num)
}
/* Ideally, this function should be in db.c, but I'll put it here for portability. */
static void init_mobile(struct char_data *mob)
static void init_mobile(char_data *mob)
{
clear_char(mob);
@@ -245,12 +245,12 @@ static void init_mobile(struct char_data *mob)
}
/* Save new/edited mob to memory. */
void medit_save_internally(struct descriptor_data *d)
void medit_save_internally(descriptor_data *d)
{
int i;
mob_rnum new_rnum;
struct descriptor_data *dsc;
struct char_data *mob;
descriptor_data *dsc;
char_data *mob;
i = (real_mobile(OLC_NUM(d)) == NOBODY);
@@ -303,7 +303,7 @@ void medit_save_internally(struct descriptor_data *d)
/* Menu functions
Display positions. (sitting, standing, etc) */
static void medit_disp_positions(struct descriptor_data *d)
static void medit_disp_positions(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -312,7 +312,7 @@ static void medit_disp_positions(struct descriptor_data *d)
}
/* Display the gender of the mobile. */
static void medit_disp_sex(struct descriptor_data *d)
static void medit_disp_sex(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -321,7 +321,7 @@ static void medit_disp_sex(struct descriptor_data *d)
}
/* Display attack types menu. */
static void medit_disp_attack_types(struct descriptor_data *d)
static void medit_disp_attack_types(descriptor_data *d)
{
int i;
@@ -370,7 +370,7 @@ static int medit_get_mob_flag_by_number(int num)
}
/* Display mob-flags menu. */
static void medit_disp_mob_flags(struct descriptor_data *d)
static void medit_disp_mob_flags(descriptor_data *d)
{
int i, count = 0, columns = 0;
char flags[MAX_STRING_LENGTH];
@@ -390,7 +390,7 @@ static void medit_disp_mob_flags(struct descriptor_data *d)
}
/* Display affection flags menu. */
static void medit_disp_aff_flags(struct descriptor_data *d)
static void medit_disp_aff_flags(descriptor_data *d)
{
char flags[MAX_STRING_LENGTH];
@@ -404,9 +404,9 @@ static void medit_disp_aff_flags(struct descriptor_data *d)
}
/* Display main menu. */
static void medit_disp_menu(struct descriptor_data *d)
static void medit_disp_menu(descriptor_data *d)
{
struct char_data *mob;
char_data *mob;
char flags[MAX_STRING_LENGTH], flag2[MAX_STRING_LENGTH];
mob = OLC_MOB(d);
@@ -459,9 +459,9 @@ static void medit_disp_menu(struct descriptor_data *d)
}
/* Display main menu. */
static void medit_disp_stats_menu(struct descriptor_data *d)
static void medit_disp_stats_menu(descriptor_data *d)
{
struct char_data *mob;
char_data *mob;
char buf[MAX_STRING_LENGTH];
mob = OLC_MOB(d);
@@ -525,7 +525,7 @@ static void medit_disp_stats_menu(struct descriptor_data *d)
OLC_MODE(d) = MEDIT_STATS_MENU;
}
void medit_parse(struct descriptor_data *d, char *arg)
void medit_parse(descriptor_data *d, char *arg)
{
int i = -1, j;
char *oldtext = NULL;
@@ -1103,7 +1103,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
medit_disp_menu(d);
}
void medit_string_cleanup(struct descriptor_data *d, int terminator)
void medit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
@@ -1114,7 +1114,7 @@ void medit_string_cleanup(struct descriptor_data *d, int terminator)
}
}
void medit_autoroll_stats(struct descriptor_data *d)
void medit_autoroll_stats(descriptor_data *d)
{
int mob_lev;
+7 -7
View File
@@ -24,12 +24,12 @@
/* local file scope only function prototypes */
static bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack);
static bool aggressive_mob_on_a_leash(char_data *slave, char_data *master, char_data *attack);
void mobile_activity(void)
{
struct char_data *ch, *next_ch, *vict;
struct obj_data *obj, *best_obj;
char_data *ch, *next_ch, *vict;
obj_data *obj, *best_obj;
int door, found, max;
memory_rec *names;
@@ -174,7 +174,7 @@ void mobile_activity(void)
/* Mob Memory Routines */
/* make ch remember victim */
void remember(struct char_data *ch, struct char_data *victim)
void remember(char_data *ch, char_data *victim)
{
memory_rec *tmp;
bool present = FALSE;
@@ -195,7 +195,7 @@ void remember(struct char_data *ch, struct char_data *victim)
}
/* make ch forget victim */
void forget(struct char_data *ch, struct char_data *victim)
void forget(char_data *ch, char_data *victim)
{
memory_rec *curr, *prev = NULL;
@@ -219,7 +219,7 @@ void forget(struct char_data *ch, struct char_data *victim)
}
/* erase ch's memory */
void clearMemory(struct char_data *ch)
void clearMemory(char_data *ch)
{
memory_rec *curr, *next;
@@ -237,7 +237,7 @@ void clearMemory(struct char_data *ch)
/* An aggressive mobile wants to attack something. If they're under the
* influence of mind altering PC, then see if their master can talk them out
* of it, eye them down, or otherwise intimidate the slave. */
static bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack)
static bool aggressive_mob_on_a_leash(char_data *slave, char_data *master, char_data *attack)
{
static int snarl_cmd;
int dieroll;
+15 -15
View File
@@ -28,10 +28,10 @@
#include "ibt.h"
/* local (file scope) function prototpyes */
static char *next_page(char *str, struct char_data *ch);
static int count_pages(char *str, struct char_data *ch);
static void playing_string_cleanup(struct descriptor_data *d, int action);
static void exdesc_string_cleanup(struct descriptor_data *d, int action);
static char *next_page(char *str, char_data *ch);
static int count_pages(char *str, char_data *ch);
static void playing_string_cleanup(descriptor_data *d, int action);
static void exdesc_string_cleanup(descriptor_data *d, int action);
/* Local (file scope) global variables */
/* @deprecated string_fields appears to be no longer be used.
@@ -105,7 +105,7 @@ void parse_tab(char *str)
* can use it to pass whatever else you may want through it. The improved
* editor patch when updated could use it to pass the old text buffer, for
* instance. */
void string_write(struct descriptor_data *d, char **writeto, size_t len, long mailto, void *data)
void string_write(descriptor_data *d, char **writeto, size_t len, long mailto, void *data)
{
if (d->character && !IS_NPC(d->character))
SET_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
@@ -122,7 +122,7 @@ void string_write(struct descriptor_data *d, char **writeto, size_t len, long ma
/* Add user input to the 'current' string (as defined by d->str). This is still
* overly complex. */
void string_add(struct descriptor_data *d, char *str)
void string_add(descriptor_data *d, char *str)
{
int action;
@@ -209,7 +209,7 @@ void string_add(struct descriptor_data *d, char *str)
int i;
struct {
int mode;
void (*func)(struct descriptor_data *d, int action);
void (*func)(descriptor_data *d, int action);
} cleanup_modes[] = {
{ CON_CEDIT , cedit_string_cleanup },
{ CON_MEDIT , medit_string_cleanup },
@@ -244,7 +244,7 @@ void string_add(struct descriptor_data *d, char *str)
strcat(*d->str, "\r\n");
}
static void playing_string_cleanup(struct descriptor_data *d, int action)
static void playing_string_cleanup(descriptor_data *d, int action)
{
if (PLR_FLAGGED(d->character, PLR_MAILING)) {
if (action == STRINGADD_SAVE && *d->str) {
@@ -294,7 +294,7 @@ static void playing_string_cleanup(struct descriptor_data *d, int action)
}
}
static void exdesc_string_cleanup(struct descriptor_data *d, int action)
static void exdesc_string_cleanup(descriptor_data *d, int action)
{
if (action == STRINGADD_ABORT)
write_to_output(d, "Description aborted.\r\n");
@@ -306,7 +306,7 @@ static void exdesc_string_cleanup(struct descriptor_data *d, int action)
/* Modification of character skills. */
ACMD(do_skillset)
{
struct char_data *vict;
char_data *vict;
char name[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH], helpbuf[MAX_STRING_LENGTH];
int skill, value, i, qend, pc, pl;
@@ -397,7 +397,7 @@ ACMD(do_skillset)
/* By Michael Buselli. Traverse down the string until the begining of the next
* page has been reached. Return NULL if this is the last page of the string. */
static char *next_page(char *str, struct char_data *ch)
static char *next_page(char *str, char_data *ch)
{
int col = 1, line = 1, count, pw;
@@ -442,7 +442,7 @@ static char *next_page(char *str, struct char_data *ch)
}
/* Function that returns the number of pages in the string. */
static int count_pages(char *str, struct char_data *ch)
static int count_pages(char *str, char_data *ch)
{
int pages;
@@ -454,7 +454,7 @@ static int count_pages(char *str, struct char_data *ch)
/* This function assigns all the pointers for showstr_vector for the
* page_string function, after showstr_vector has been allocated and
* showstr_count set. */
void paginate_string(char *str, struct descriptor_data *d)
void paginate_string(char *str, descriptor_data *d)
{
int i;
@@ -468,7 +468,7 @@ void paginate_string(char *str, struct descriptor_data *d)
}
/* The call that gets the paging ball rolling... */
void page_string(struct descriptor_data *d, char *str, int keep_internal)
void page_string(descriptor_data *d, char *str, int keep_internal)
{
char actbuf[MAX_INPUT_LENGTH] = "";
@@ -493,7 +493,7 @@ void page_string(struct descriptor_data *d, char *str, int keep_internal)
}
/* The call that displays the next page. */
void show_string(struct descriptor_data *d, char *input)
void show_string(descriptor_data *d, char *input)
{
char buffer[MAX_STRING_LENGTH], buf[MAX_INPUT_LENGTH];
int diff;
+12 -12
View File
@@ -1,36 +1,36 @@
/**
* @file modify.h
* Header file for the modify module.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* @todo This module is originally defined as 'Run-time modification of game
*
* @todo This module is originally defined as 'Run-time modification of game
* variables.' I believe it has digressed from the original intent. This
* header file is created to help redefine (over time) what the heck modify.h
* is. For example, publicly functions declared in comm.h but defined in modify.c
* should have their declarations moved here.
* should have their declarations moved here.
*
*/
#ifndef _MODIFY_H_
#define _MODIFY_H_
/* Public functions */
void show_string(struct descriptor_data *d, char *input);
void show_string(descriptor_data *d, char *input);
void smash_tilde(char *str);
void parse_at(char *str);
void parse_tab(char *str);
void paginate_string(char *str, struct descriptor_data *d);
void paginate_string(char *str, descriptor_data *d);
/** @todo should this really be in modify.c? */
ACMD(do_skillset);
/* Following function prototypes moved here from comm.h */
void string_write(struct descriptor_data *d, char **txt, size_t len, long mailto, void *data);
void string_add(struct descriptor_data *d, char *str);
void page_string(struct descriptor_data *d, char *str, int keep_internal);
void string_write(descriptor_data *d, char **txt, size_t len, long mailto, void *data);
void string_add(descriptor_data *d, char *str);
void page_string(descriptor_data *d, char *str, int keep_internal);
/* page string function & defines */
#define PAGE_LENGTH 22
#define PAGE_WIDTH 80
+6 -6
View File
@@ -21,7 +21,7 @@
/* Statics */
static void free_messages_type(struct msg_type *msg);
static void msgedit_main_menu(struct descriptor_data * d);
static void msgedit_main_menu(descriptor_data * d);
static void copy_message_strings(struct message_type *tmsg, struct message_type * fmsg);
static void copy_message_list(struct message_list *to, struct message_list *from);
@@ -149,7 +149,7 @@ void load_messages(void)
log("Loaded %d Combat Messages...", i);
}
static void show_messages(struct char_data *ch)
static void show_messages(char_data *ch)
{
int i, half = MAX_MESSAGES / 2, count = 0;
char buf[MAX_STRING_LENGTH];
@@ -227,7 +227,7 @@ void save_messages_to_disk(void)
fclose(fp);
}
static void msgedit_setup(struct descriptor_data *d)
static void msgedit_setup(descriptor_data *d)
{
CREATE(OLC_MSG_LIST(d), struct message_list, 1);
OLC_MSG_LIST(d)->msg = NULL;
@@ -301,7 +301,7 @@ static void copy_message_strings(struct message_type *tmsg, struct message_type
ACMD(do_msgedit)
{
int num;
struct descriptor_data *d;
descriptor_data *d;
if (!*argument) {
show_messages(ch);
@@ -352,7 +352,7 @@ ACMD(do_msgedit)
GET_NAME(ch), OLC_NUM(d));
}
static void msgedit_main_menu(struct descriptor_data * d)
static void msgedit_main_menu(descriptor_data * d)
{
get_char_colors(d->character);
@@ -405,7 +405,7 @@ static void msgedit_main_menu(struct descriptor_data * d)
OLC_MODE(d) = MSGEDIT_MAIN_MENU;
}
void msgedit_parse(struct descriptor_data *d, char *arg)
void msgedit_parse(descriptor_data *d, char *arg)
{
struct message_type * temp;
static bool quit = FALSE;
+4 -4
View File
@@ -1,21 +1,21 @@
/**
* Copyright 2012 Joseph Arnusch
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
**/
/* Externals */
+10 -10
View File
@@ -93,8 +93,8 @@ EVENTFUNC(event_countdown)
void attach_mud_event(struct mud_event_data *pMudEvent, long time)
{
struct event * pEvent;
struct descriptor_data * d;
struct char_data * ch;
descriptor_data * d;
char_data * ch;
struct room_data * room;
pEvent = event_create(mud_event_index[pMudEvent->iId].func, pMudEvent, time);
@@ -106,11 +106,11 @@ void attach_mud_event(struct mud_event_data *pMudEvent, long time)
add_to_list(pEvent, world_events);
break;
case EVENT_DESC:
d = (struct descriptor_data *) pMudEvent->pStruct;
d = (descriptor_data *) pMudEvent->pStruct;
add_to_list(pEvent, d->events);
break;
case EVENT_CHAR:
ch = (struct char_data *) pMudEvent->pStruct;
ch = (char_data *) pMudEvent->pStruct;
if (ch->events == NULL)
ch->events = create_list();
@@ -146,8 +146,8 @@ struct mud_event_data *new_mud_event(event_id iId, void *pStruct, char *sVariabl
void free_mud_event(struct mud_event_data *pMudEvent)
{
struct descriptor_data * d;
struct char_data * ch;
descriptor_data * d;
char_data * ch;
struct room_data * room;
switch (mud_event_index[pMudEvent->iId].iEvent_Type) {
@@ -155,11 +155,11 @@ void free_mud_event(struct mud_event_data *pMudEvent)
remove_from_list(pMudEvent->pEvent, world_events);
break;
case EVENT_DESC:
d = (struct descriptor_data *) pMudEvent->pStruct;
d = (descriptor_data *) pMudEvent->pStruct;
remove_from_list(pMudEvent->pEvent, d->events);
break;
case EVENT_CHAR:
ch = (struct char_data *) pMudEvent->pStruct;
ch = (char_data *) pMudEvent->pStruct;
remove_from_list(pMudEvent->pEvent, ch->events);
if (ch->events->iSize == 0) {
@@ -185,7 +185,7 @@ void free_mud_event(struct mud_event_data *pMudEvent)
free(pMudEvent);
}
struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId)
struct mud_event_data * char_has_mud_event(char_data * ch, event_id iId)
{
struct event * pEvent;
struct mud_event_data * pMudEvent = NULL;
@@ -215,7 +215,7 @@ struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId)
return NULL;
}
void clear_char_event_list(struct char_data * ch)
void clear_char_event_list(char_data * ch)
{
struct event * pEvent;
+13 -13
View File
@@ -1,13 +1,13 @@
/**
* @file mud_event.h
* Mud_Event Header file.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 2012 by Joseph Arnusch.
* Copyright 2012 by Joseph Arnusch.
*/
#ifndef _MUD_EVENT_H_
@@ -30,17 +30,17 @@ typedef enum {
} event_id;
struct mud_event_list {
const char * event_name;
EVENTFUNC(*func);
int iEvent_Type;
const char * event_name;
EVENTFUNC(*func);
int iEvent_Type;
};
struct mud_event_data {
struct event * pEvent; /***< Pointer reference to the event */
event_id iId; /***< General ID reference */
void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */
char * sVariables; /***< String variable */
};
struct event * pEvent; /***< Pointer reference to the event */
event_id iId; /***< General ID reference */
void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */
char * sVariables; /***< String variable */
};
/* Externals */
extern struct list_data * world_events;
@@ -50,8 +50,8 @@ void init_events(void);
struct mud_event_data *new_mud_event(event_id iId, void *pStruct, char *sVariables);
void attach_mud_event(struct mud_event_data *pMudEvent, long time);
void free_mud_event(struct mud_event_data *pMudEvent);
struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId);
void clear_char_event_list(struct char_data * ch);
struct mud_event_data * char_has_mud_event(char_data * ch, event_id iId);
void clear_char_event_list(char_data * ch);
/* Events */
EVENTFUNC(event_countdown);
+5 -5
View File
@@ -35,7 +35,7 @@ const char *nrm, *grn, *cyn, *yel;
static void free_config(struct config_data *data);
/* Only player characters should be using OLC anyway. */
void clear_screen(struct descriptor_data *d)
void clear_screen(descriptor_data *d)
{
if (PRF_FLAGGED(d->character, PRF_CLS))
write_to_output(d, "");
@@ -45,7 +45,7 @@ void clear_screen(struct descriptor_data *d)
/* 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)
void get_char_colors(char_data *ch)
{
nrm = CCNRM(ch, C_NRM);
grn = CCGRN(ch, C_NRM);
@@ -55,7 +55,7 @@ void get_char_colors(struct char_data *ch)
/* 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)
void cleanup_olc(descriptor_data *d, byte cleanup_type)
{
/* Clean up WHAT? */
if (d->olc == NULL)
@@ -253,7 +253,7 @@ static void free_config(struct config_data *data)
* 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)
int can_edit_zone(char_data *ch, zone_rnum rnum)
{
/* no access if called with bad arguments */
if (!ch->desc || IS_NPC(ch) || rnum == NOWHERE)
@@ -297,7 +297,7 @@ int can_edit_zone(struct char_data *ch, zone_rnum rnum)
return (FALSE);
}
void send_cannot_edit(struct char_data *ch, zone_vnum zone)
void send_cannot_edit(char_data *ch, zone_vnum zone)
{
char buf[MAX_STRING_LENGTH];
+274 -274
View File
@@ -14,11 +14,11 @@
#include "utils.h" /* for ACMD macro */
#define _OASISOLC 0x206 /* 2.0.6 */
#define _OASISOLC 0x206 /* 2.0.6 */
/* Used to determine what version of OasisOLC is installed.
Ex: #if _OASISOLC >= OASIS_VERSION(2,0,0) */
#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z))
#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z))
#define AEDIT_PERMISSION 999 /* arbitrary number higher than max zone vnum*/
#define HEDIT_PERMISSION 888 /* arbitrary number higher then max zone vnum*/
@@ -28,22 +28,22 @@
to adjust these numbers if you ever add more. Note: Most of the NUM_ and
MAX_ limits have been moved to more appropriate locations. */
#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; }
#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; }
#define CHECK_VAR(var) ((var == YES) ? "Yes" : "No")
#define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */
/* Limit information. */
/* Name size increased due to larger colour/mxp codes. -Vatiken */
#define MAX_ROOM_NAME 150
#define MAX_MOB_NAME 100
#define MAX_OBJ_NAME 100
#define MAX_ROOM_DESC 2048
#define MAX_EXIT_DESC 256
#define MAX_EXTRA_DESC 512
#define MAX_MOB_DESC 1024
#define MAX_OBJ_DESC 512
#define MAX_DUPLICATES 100 /* when loading in zedit */
#define MAX_ROOM_NAME 150
#define MAX_MOB_NAME 100
#define MAX_OBJ_NAME 100
#define MAX_ROOM_DESC 2048
#define MAX_EXIT_DESC 256
#define MAX_EXTRA_DESC 512
#define MAX_MOB_DESC 1024
#define MAX_OBJ_DESC 512
#define MAX_DUPLICATES 100 /* when loading in zedit */
/* arbitrary limits - roll your own */
/* max weapon is 50d50 .. avg. 625 dam... */
@@ -67,47 +67,47 @@
#define BIT_STRING_LENGTH 33
/* The data types for miscellaneous functions. */
#define OASIS_WLD 0
#define OASIS_MOB 1
#define OASIS_OBJ 2
#define OASIS_ZON 3
#define OASIS_EXI 4
#define OASIS_CFG 5
#define OASIS_WLD 0
#define OASIS_MOB 1
#define OASIS_OBJ 2
#define OASIS_ZON 3
#define OASIS_EXI 4
#define OASIS_CFG 5
/* Utilities exported from oasis.c. */
void cleanup_olc(struct descriptor_data *d, byte cleanup_type);
void get_char_colors(struct char_data *ch);
void cleanup_olc(descriptor_data *d, byte cleanup_type);
void get_char_colors(char_data *ch);
void split_argument(char *argument, char *tag);
void send_cannot_edit(struct char_data *ch, zone_vnum zone);
void send_cannot_edit(char_data *ch, zone_vnum zone);
/* OLC structures. */
/* NO and YES are defined in utils.h. Removed from here. */
struct oasis_olc_data {
int mode; /* how to parse input */
zone_rnum zone_num; /* current zone */
room_vnum number; /* vnum of subject */
int value; /* mostly 'has changed' flag*/
char *storage; /* used for 'tedit' */
struct char_data *mob; /* used for 'medit' */
struct room_data *room; /* used for 'redit' */
struct obj_data *obj; /* used for 'oedit' */
struct zone_data *zone; /* used for 'zedit' */
struct shop_data *shop; /* used for 'sedit' */
struct config_data *config; /* used for 'cedit' */
struct aq_data *quest; /* used for 'qedit' */
struct extra_descr_data *desc; /* used in '[r|o|m]edit' */
struct social_messg *action; /* Aedit uses this one */
struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */
struct message_list *msg;
struct message_type *m_type;
int script_mode;
int trigger_position;
int item_type;
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
struct help_index_element*help; /* Hedit uses this */
int mode; /* how to parse input */
zone_rnum zone_num; /* current zone */
room_vnum number; /* vnum of subject */
int value; /* mostly 'has changed' flag*/
char *storage; /* used for 'tedit' */
char_data *mob; /* used for 'medit' */
struct room_data *room; /* used for 'redit' */
obj_data *obj; /* used for 'oedit' */
struct zone_data *zone; /* used for 'zedit' */
struct shop_data *shop; /* used for 'sedit' */
struct config_data *config; /* used for 'cedit' */
struct aq_data *quest; /* used for 'qedit' */
struct extra_descr_data *desc; /* used in '[r|o|m]edit' */
struct social_messg *action; /* Aedit uses this one */
struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */
struct message_list *msg;
struct message_type *m_type;
int script_mode;
int trigger_position;
int item_type;
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
struct help_index_element *help; /* Hedit uses this */
};
/* Exported globals. */
@@ -115,22 +115,22 @@ extern const char *nrm, *grn, *cyn, *yel;
/* Descriptor access macros. */
#define OLC(d) ((d)->olc)
#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */
#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */
#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */
#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */
#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */
#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */
#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */
#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */
#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */
#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */
#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */
#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */
#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */
#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */
#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */
#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */
#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */
#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */
#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */
#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */
#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
#define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */
#define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */
#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */
#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */
#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
@@ -141,9 +141,9 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OLC_MSG(d) (OLC(d)->m_type)
/* Cleanup types. */
#define CLEANUP_ALL 1 /* Free the whole lot. */
#define CLEANUP_STRUCTS 2 /* Don't free strings. */
#define CLEANUP_CONFIG 3 /* Used just to send proper message. */
#define CLEANUP_ALL 1 /* Free the whole lot. */
#define CLEANUP_STRUCTS 2 /* Don't free strings. */
#define CLEANUP_CONFIG 3 /* Used just to send proper message. */
/* Submodes of AEDIT connectedness */
#define AEDIT_CONFIRM_SAVESTRING 0
@@ -171,82 +171,82 @@ extern const char *nrm, *grn, *cyn, *yel;
#define AEDIT_OBJ_OTHERS_FOUND 22
/* Submodes of OEDIT connectedness. */
#define OEDIT_MAIN_MENU 1
#define OEDIT_KEYWORD 2
#define OEDIT_SHORTDESC 3
#define OEDIT_LONGDESC 4
#define OEDIT_ACTDESC 5
#define OEDIT_TYPE 6
#define OEDIT_EXTRAS 7
#define OEDIT_WEAR 8
#define OEDIT_WEIGHT 9
#define OEDIT_COST 10
#define OEDIT_COSTPERDAY 11
#define OEDIT_TIMER 12
#define OEDIT_VALUE_1 13
#define OEDIT_VALUE_2 14
#define OEDIT_VALUE_3 15
#define OEDIT_VALUE_4 16
#define OEDIT_APPLY 17
#define OEDIT_APPLYMOD 18
#define OEDIT_EXTRADESC_KEY 19
#define OEDIT_CONFIRM_SAVEDB 20
#define OEDIT_CONFIRM_SAVESTRING 21
#define OEDIT_PROMPT_APPLY 22
#define OEDIT_EXTRADESC_DESCRIPTION 23
#define OEDIT_EXTRADESC_MENU 24
#define OEDIT_LEVEL 25
#define OEDIT_PERM 26
#define OEDIT_MAIN_MENU 1
#define OEDIT_KEYWORD 2
#define OEDIT_SHORTDESC 3
#define OEDIT_LONGDESC 4
#define OEDIT_ACTDESC 5
#define OEDIT_TYPE 6
#define OEDIT_EXTRAS 7
#define OEDIT_WEAR 8
#define OEDIT_WEIGHT 9
#define OEDIT_COST 10
#define OEDIT_COSTPERDAY 11
#define OEDIT_TIMER 12
#define OEDIT_VALUE_1 13
#define OEDIT_VALUE_2 14
#define OEDIT_VALUE_3 15
#define OEDIT_VALUE_4 16
#define OEDIT_APPLY 17
#define OEDIT_APPLYMOD 18
#define OEDIT_EXTRADESC_KEY 19
#define OEDIT_CONFIRM_SAVEDB 20
#define OEDIT_CONFIRM_SAVESTRING 21
#define OEDIT_PROMPT_APPLY 22
#define OEDIT_EXTRADESC_DESCRIPTION 23
#define OEDIT_EXTRADESC_MENU 24
#define OEDIT_LEVEL 25
#define OEDIT_PERM 26
#define OEDIT_DELETE 27
#define OEDIT_COPY 28
/* Submodes of REDIT connectedness. */
#define REDIT_MAIN_MENU 1
#define REDIT_NAME 2
#define REDIT_DESC 3
#define REDIT_FLAGS 4
#define REDIT_SECTOR 5
#define REDIT_EXIT_MENU 6
#define REDIT_CONFIRM_SAVEDB 7
#define REDIT_CONFIRM_SAVESTRING 8
#define REDIT_EXIT_NUMBER 9
#define REDIT_EXIT_DESCRIPTION 10
#define REDIT_EXIT_KEYWORD 11
#define REDIT_EXIT_KEY 12
#define REDIT_EXIT_DOORFLAGS 13
#define REDIT_EXTRADESC_MENU 14
#define REDIT_EXTRADESC_KEY 15
#define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17
#define REDIT_COPY 18
#define REDIT_MAIN_MENU 1
#define REDIT_NAME 2
#define REDIT_DESC 3
#define REDIT_FLAGS 4
#define REDIT_SECTOR 5
#define REDIT_EXIT_MENU 6
#define REDIT_CONFIRM_SAVEDB 7
#define REDIT_CONFIRM_SAVESTRING 8
#define REDIT_EXIT_NUMBER 9
#define REDIT_EXIT_DESCRIPTION 10
#define REDIT_EXIT_KEYWORD 11
#define REDIT_EXIT_KEY 12
#define REDIT_EXIT_DOORFLAGS 13
#define REDIT_EXTRADESC_MENU 14
#define REDIT_EXTRADESC_KEY 15
#define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17
#define REDIT_COPY 18
/* Submodes of ZEDIT connectedness. */
#define ZEDIT_MAIN_MENU 0
#define ZEDIT_DELETE_ENTRY 1
#define ZEDIT_NEW_ENTRY 2
#define ZEDIT_CHANGE_ENTRY 3
#define ZEDIT_COMMAND_TYPE 4
#define ZEDIT_IF_FLAG 5
#define ZEDIT_ARG1 6
#define ZEDIT_ARG2 7
#define ZEDIT_ARG3 8
#define ZEDIT_ZONE_NAME 9
#define ZEDIT_ZONE_LIFE 10
#define ZEDIT_ZONE_BOT 11
#define ZEDIT_ZONE_TOP 12
#define ZEDIT_ZONE_RESET 13
#define ZEDIT_CONFIRM_SAVESTRING 14
#define ZEDIT_ZONE_BUILDERS 15
#define ZEDIT_SARG1 20
#define ZEDIT_SARG2 21
#define ZEDIT_ZONE_FLAGS 22
#define ZEDIT_LEVELS 23
#define ZEDIT_LEV_MIN 24
#define ZEDIT_LEV_MAX 25
#define ZEDIT_ZONE_CLAIM 26
#define ZEDIT_MAIN_MENU 0
#define ZEDIT_DELETE_ENTRY 1
#define ZEDIT_NEW_ENTRY 2
#define ZEDIT_CHANGE_ENTRY 3
#define ZEDIT_COMMAND_TYPE 4
#define ZEDIT_IF_FLAG 5
#define ZEDIT_ARG1 6
#define ZEDIT_ARG2 7
#define ZEDIT_ARG3 8
#define ZEDIT_ZONE_NAME 9
#define ZEDIT_ZONE_LIFE 10
#define ZEDIT_ZONE_BOT 11
#define ZEDIT_ZONE_TOP 12
#define ZEDIT_ZONE_RESET 13
#define ZEDIT_CONFIRM_SAVESTRING 14
#define ZEDIT_ZONE_BUILDERS 15
#define ZEDIT_SARG1 20
#define ZEDIT_SARG2 21
#define ZEDIT_ZONE_FLAGS 22
#define ZEDIT_LEVELS 23
#define ZEDIT_LEV_MIN 24
#define ZEDIT_LEV_MAX 25
#define ZEDIT_ZONE_CLAIM 26
/* Submodes of MEDIT connectedness. */
#define MEDIT_MAIN_MENU 0
#define MEDIT_MAIN_MENU 0
#define MEDIT_KEYWORD 1
#define MEDIT_S_DESC 2
#define MEDIT_L_DESC 3
@@ -257,129 +257,129 @@ extern const char *nrm, *grn, *cyn, *yel;
#define MEDIT_STATS_MENU 8
/* Numerical responses. */
#define MEDIT_NUMERICAL_RESPONSE 10
#define MEDIT_SEX 11
#define MEDIT_HITROLL 12
#define MEDIT_DAMROLL 13
#define MEDIT_NDD 14
#define MEDIT_SDD 15
#define MEDIT_NUM_HP_DICE 16
#define MEDIT_SIZE_HP_DICE 17
#define MEDIT_ADD_HP 18
#define MEDIT_AC 19
#define MEDIT_EXP 20
#define MEDIT_GOLD 21
#define MEDIT_POS 22
#define MEDIT_DEFAULT_POS 23
#define MEDIT_ATTACK 24
#define MEDIT_LEVEL 25
#define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27
#define MEDIT_COPY 28
#define MEDIT_STR 29
#define MEDIT_INT 30
#define MEDIT_WIS 31
#define MEDIT_DEX 32
#define MEDIT_CON 33
#define MEDIT_CHA 34
#define MEDIT_PARA 35
#define MEDIT_ROD 36
#define MEDIT_PETRI 37
#define MEDIT_BREATH 38
#define MEDIT_SPELL 39
#define MEDIT_NUMERICAL_RESPONSE 10
#define MEDIT_SEX 11
#define MEDIT_HITROLL 12
#define MEDIT_DAMROLL 13
#define MEDIT_NDD 14
#define MEDIT_SDD 15
#define MEDIT_NUM_HP_DICE 16
#define MEDIT_SIZE_HP_DICE 17
#define MEDIT_ADD_HP 18
#define MEDIT_AC 19
#define MEDIT_EXP 20
#define MEDIT_GOLD 21
#define MEDIT_POS 22
#define MEDIT_DEFAULT_POS 23
#define MEDIT_ATTACK 24
#define MEDIT_LEVEL 25
#define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27
#define MEDIT_COPY 28
#define MEDIT_STR 29
#define MEDIT_INT 30
#define MEDIT_WIS 31
#define MEDIT_DEX 32
#define MEDIT_CON 33
#define MEDIT_CHA 34
#define MEDIT_PARA 35
#define MEDIT_ROD 36
#define MEDIT_PETRI 37
#define MEDIT_BREATH 38
#define MEDIT_SPELL 39
/* Submodes of SEDIT connectedness. */
#define SEDIT_MAIN_MENU 0
#define SEDIT_CONFIRM_SAVESTRING 1
#define SEDIT_NOITEM1 2
#define SEDIT_NOITEM2 3
#define SEDIT_NOCASH1 4
#define SEDIT_NOCASH2 5
#define SEDIT_NOBUY 6
#define SEDIT_BUY 7
#define SEDIT_SELL 8
#define SEDIT_PRODUCTS_MENU 11
#define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14
#define SEDIT_COPY 15
#define SEDIT_MAIN_MENU 0
#define SEDIT_CONFIRM_SAVESTRING 1
#define SEDIT_NOITEM1 2
#define SEDIT_NOITEM2 3
#define SEDIT_NOCASH1 4
#define SEDIT_NOCASH2 5
#define SEDIT_NOBUY 6
#define SEDIT_BUY 7
#define SEDIT_SELL 8
#define SEDIT_PRODUCTS_MENU 11
#define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14
#define SEDIT_COPY 15
#define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22
#define SEDIT_CLOSE1 23
#define SEDIT_CLOSE2 24
#define SEDIT_KEEPER 25
#define SEDIT_BUY_PROFIT 26
#define SEDIT_SELL_PROFIT 27
#define SEDIT_TYPE_MENU 29
#define SEDIT_DELETE_TYPE 30
#define SEDIT_DELETE_PRODUCT 31
#define SEDIT_NEW_PRODUCT 32
#define SEDIT_DELETE_ROOM 33
#define SEDIT_NEW_ROOM 34
#define SEDIT_SHOP_FLAGS 35
#define SEDIT_NOTRADE 36
#define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22
#define SEDIT_CLOSE1 23
#define SEDIT_CLOSE2 24
#define SEDIT_KEEPER 25
#define SEDIT_BUY_PROFIT 26
#define SEDIT_SELL_PROFIT 27
#define SEDIT_TYPE_MENU 29
#define SEDIT_DELETE_TYPE 30
#define SEDIT_DELETE_PRODUCT 31
#define SEDIT_NEW_PRODUCT 32
#define SEDIT_DELETE_ROOM 33
#define SEDIT_NEW_ROOM 34
#define SEDIT_SHOP_FLAGS 35
#define SEDIT_NOTRADE 36
/* Submodes of CEDIT connectedness. */
#define CEDIT_MAIN_MENU 0
#define CEDIT_CONFIRM_SAVESTRING 1
#define CEDIT_GAME_OPTIONS_MENU 2
#define CEDIT_CRASHSAVE_OPTIONS_MENU 3
#define CEDIT_OPERATION_OPTIONS_MENU 4
#define CEDIT_DISP_EXPERIENCE_MENU 5
#define CEDIT_ROOM_NUMBERS_MENU 6
#define CEDIT_AUTOWIZ_OPTIONS_MENU 7
#define CEDIT_OK 8
#define CEDIT_HUH 9
#define CEDIT_NOPERSON 10
#define CEDIT_NOEFFECT 11
#define CEDIT_DFLT_IP 12
#define CEDIT_DFLT_DIR 13
#define CEDIT_LOGNAME 14
#define CEDIT_MENU 15
#define CEDIT_WELC_MESSG 16
#define CEDIT_START_MESSG 17
#define CEDIT_MAIN_MENU 0
#define CEDIT_CONFIRM_SAVESTRING 1
#define CEDIT_GAME_OPTIONS_MENU 2
#define CEDIT_CRASHSAVE_OPTIONS_MENU 3
#define CEDIT_OPERATION_OPTIONS_MENU 4
#define CEDIT_DISP_EXPERIENCE_MENU 5
#define CEDIT_ROOM_NUMBERS_MENU 6
#define CEDIT_AUTOWIZ_OPTIONS_MENU 7
#define CEDIT_OK 8
#define CEDIT_HUH 9
#define CEDIT_NOPERSON 10
#define CEDIT_NOEFFECT 11
#define CEDIT_DFLT_IP 12
#define CEDIT_DFLT_DIR 13
#define CEDIT_LOGNAME 14
#define CEDIT_MENU 15
#define CEDIT_WELC_MESSG 16
#define CEDIT_START_MESSG 17
/* Numerical responses. */
#define CEDIT_NUMERICAL_RESPONSE 20
#define CEDIT_LEVEL_CAN_SHOUT 21
#define CEDIT_HOLLER_MOVE_COST 22
#define CEDIT_TUNNEL_SIZE 23
#define CEDIT_MAX_EXP_GAIN 24
#define CEDIT_MAX_EXP_LOSS 25
#define CEDIT_MAX_NPC_CORPSE_TIME 26
#define CEDIT_MAX_PC_CORPSE_TIME 27
#define CEDIT_IDLE_VOID 28
#define CEDIT_IDLE_RENT_TIME 29
#define CEDIT_IDLE_MAX_LEVEL 30
#define CEDIT_DTS_ARE_DUMPS 31
#define CEDIT_LOAD_INTO_INVENTORY 32
#define CEDIT_TRACK_THROUGH_DOORS 33
#define CEDIT_NO_MORT_TO_IMMORT 34
#define CEDIT_MAX_OBJ_SAVE 35
#define CEDIT_MIN_RENT_COST 36
#define CEDIT_AUTOSAVE_TIME 37
#define CEDIT_CRASH_FILE_TIMEOUT 38
#define CEDIT_RENT_FILE_TIMEOUT 39
#define CEDIT_MORTAL_START_ROOM 40
#define CEDIT_IMMORT_START_ROOM 41
#define CEDIT_FROZEN_START_ROOM 42
#define CEDIT_DONATION_ROOM_1 43
#define CEDIT_DONATION_ROOM_2 44
#define CEDIT_DONATION_ROOM_3 45
#define CEDIT_DFLT_PORT 46
#define CEDIT_MAX_PLAYING 47
#define CEDIT_MAX_FILESIZE 48
#define CEDIT_MAX_BAD_PWS 49
#define CEDIT_SITEOK_EVERYONE 50
#define CEDIT_NAMESERVER_IS_SLOW 51
#define CEDIT_USE_AUTOWIZ 52
#define CEDIT_MIN_WIZLIST_LEV 53
#define CEDIT_MAP_OPTION 54
#define CEDIT_MAP_SIZE 55
#define CEDIT_MINIMAP_SIZE 56
#define CEDIT_DEBUG_MODE 57
#define CEDIT_NUMERICAL_RESPONSE 20
#define CEDIT_LEVEL_CAN_SHOUT 21
#define CEDIT_HOLLER_MOVE_COST 22
#define CEDIT_TUNNEL_SIZE 23
#define CEDIT_MAX_EXP_GAIN 24
#define CEDIT_MAX_EXP_LOSS 25
#define CEDIT_MAX_NPC_CORPSE_TIME 26
#define CEDIT_MAX_PC_CORPSE_TIME 27
#define CEDIT_IDLE_VOID 28
#define CEDIT_IDLE_RENT_TIME 29
#define CEDIT_IDLE_MAX_LEVEL 30
#define CEDIT_DTS_ARE_DUMPS 31
#define CEDIT_LOAD_INTO_INVENTORY 32
#define CEDIT_TRACK_THROUGH_DOORS 33
#define CEDIT_NO_MORT_TO_IMMORT 34
#define CEDIT_MAX_OBJ_SAVE 35
#define CEDIT_MIN_RENT_COST 36
#define CEDIT_AUTOSAVE_TIME 37
#define CEDIT_CRASH_FILE_TIMEOUT 38
#define CEDIT_RENT_FILE_TIMEOUT 39
#define CEDIT_MORTAL_START_ROOM 40
#define CEDIT_IMMORT_START_ROOM 41
#define CEDIT_FROZEN_START_ROOM 42
#define CEDIT_DONATION_ROOM_1 43
#define CEDIT_DONATION_ROOM_2 44
#define CEDIT_DONATION_ROOM_3 45
#define CEDIT_DFLT_PORT 46
#define CEDIT_MAX_PLAYING 47
#define CEDIT_MAX_FILESIZE 48
#define CEDIT_MAX_BAD_PWS 49
#define CEDIT_SITEOK_EVERYONE 50
#define CEDIT_NAMESERVER_IS_SLOW 51
#define CEDIT_USE_AUTOWIZ 52
#define CEDIT_MIN_WIZLIST_LEV 53
#define CEDIT_MAP_OPTION 54
#define CEDIT_MAP_SIZE 55
#define CEDIT_MINIMAP_SIZE 56
#define CEDIT_DEBUG_MODE 57
/* Hedit Submodes of connectedness. */
#define HEDIT_CONFIRM_SAVESTRING 0
@@ -393,67 +393,67 @@ extern const char *nrm, *grn, *cyn, *yel;
int save_config( IDXTYPE nowhere );
/* Prototypes to keep. */
void clear_screen(struct descriptor_data *);
int can_edit_zone(struct char_data *ch, zone_rnum rnum);
void clear_screen(descriptor_data *);
int can_edit_zone(char_data *ch, zone_rnum rnum);
ACMD(do_oasis);
/* public functions from medit.c */
void medit_setup_existing(struct descriptor_data *d, int rnum);
void medit_save_internally(struct descriptor_data *d);
void medit_parse(struct descriptor_data *d, char *arg);
void medit_string_cleanup(struct descriptor_data *d, int terminator);
void medit_setup_existing(descriptor_data *d, int rnum);
void medit_save_internally(descriptor_data *d);
void medit_parse(descriptor_data *d, char *arg);
void medit_string_cleanup(descriptor_data *d, int terminator);
ACMD(do_oasis_medit);
void medit_autoroll_stats(struct descriptor_data *d);
void medit_autoroll_stats(descriptor_data *d);
/* public functions from oedit.c */
void oedit_setup_existing(struct descriptor_data *d, int rnum);
void oedit_save_internally(struct descriptor_data *d);
void oedit_parse(struct descriptor_data *d, char *arg);
void oedit_string_cleanup(struct descriptor_data *d, int terminator);
void oedit_setup_existing(descriptor_data *d, int rnum);
void oedit_save_internally(descriptor_data *d);
void oedit_parse(descriptor_data *d, char *arg);
void oedit_string_cleanup(descriptor_data *d, int terminator);
ACMD(do_oasis_oedit);
/* public functions from redit.c */
void redit_setup_existing(struct descriptor_data *d, int rnum);
void redit_string_cleanup(struct descriptor_data *d, int terminator);
void redit_save_internally(struct descriptor_data *d);
void redit_setup_existing(descriptor_data *d, int rnum);
void redit_string_cleanup(descriptor_data *d, int terminator);
void redit_save_internally(descriptor_data *d);
void redit_save_to_disk(zone_vnum zone_num);
void redit_parse(struct descriptor_data *d, char *arg);
void redit_parse(descriptor_data *d, char *arg);
void free_room(struct room_data *room);
ACMD(do_oasis_redit);
/* public functions from sedit.c */
void sedit_setup_existing(struct descriptor_data *d, int rnum);
void sedit_save_internally(struct descriptor_data *d);
void sedit_parse(struct descriptor_data *d, char *arg);
void sedit_setup_existing(descriptor_data *d, int rnum);
void sedit_save_internally(descriptor_data *d);
void sedit_parse(descriptor_data *d, char *arg);
ACMD(do_oasis_sedit);
/* public functions from zedit.c */
void zedit_parse(struct descriptor_data *d, char *arg);
void zedit_parse(descriptor_data *d, char *arg);
ACMD(do_oasis_zedit);
/* public functions from cedit.c */
void cedit_save_to_disk( void );
void cedit_parse(struct descriptor_data *d, char *arg);
void cedit_string_cleanup(struct descriptor_data *d, int terminator);
void cedit_parse(descriptor_data *d, char *arg);
void cedit_string_cleanup(descriptor_data *d, int terminator);
ACMD(do_oasis_cedit);
/* public functions from dg_olc.c */
void trigedit_parse(struct descriptor_data *d, char *arg);
void trigedit_parse(descriptor_data *d, char *arg);
ACMD(do_oasis_trigedit);
/* public functions from from aedit.c */
void aedit_parse(struct descriptor_data * d, char *arg);
void aedit_parse(descriptor_data * d, char *arg);
ACMD(do_oasis_aedit);
ACMD(do_astat);
/* public functions from hedit.c */
void hedit_parse(struct descriptor_data *d, char *arg);
void hedit_string_cleanup(struct descriptor_data *d, int terminator);
void hedit_parse(descriptor_data *d, char *arg);
void hedit_string_cleanup(descriptor_data *d, int terminator);
void free_help(struct help_index_element *help);
ACMD(do_oasis_hedit);
/* public functions from tedit.c */
void tedit_string_cleanup(struct descriptor_data *d, int terminator);
void tedit_string_cleanup(descriptor_data *d, int terminator);
ACMD(do_tedit);
/* public functions from qedit.c */
@@ -461,10 +461,10 @@ ACMD(do_oasis_qedit);
/* public functions from msgedit.c */
ACMD(do_msgedit);
void msgedit_parse(struct descriptor_data *d, char *arg);
void msgedit_parse(descriptor_data *d, char *arg);
/* public functions from oasis_copy.c */
int buildwalk(struct char_data *ch, int dir);
int buildwalk(char_data *ch, int dir);
ACMD(do_dig);
ACMD(do_oasis_copy);
@@ -472,7 +472,7 @@ ACMD(do_oasis_copy);
int free_strings(void *data, int type);
/* public functions from oasis_list.c */
void print_zone(struct char_data *ch, zone_rnum rnum);
void print_zone(char_data *ch, zone_rnum rnum);
/** @deprecated is do_oasis_links intentionally dead code? */
ACMD(do_oasis_links);
ACMD(do_oasis_list);
+11 -9
View File
@@ -37,16 +37,18 @@ static room_vnum redit_find_new_vnum(zone_rnum zone);
***********************************************************/
ACMD(do_oasis_copy)
{
int i, src_vnum, src_rnum, dst_vnum, dst_rnum;
int i;
room_vnum src_vnum, dst_vnum;
room_rnum src_rnum, dst_rnum;
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
struct descriptor_data *d;
descriptor_data *d;
struct {
int con_type;
IDXTYPE (*binary_search)(IDXTYPE vnum);
void (*save_func)(struct descriptor_data *d);
void (*setup_existing)(struct descriptor_data *d, int rnum);
void (*save_func)(descriptor_data *d);
void (*setup_existing)(descriptor_data *d, int rnum);
const char *command;
const char *text;
} oasis_copy_info[] = {
@@ -82,7 +84,7 @@ ACMD(do_oasis_copy)
/* We can't copy non-existing data. */
/* Note: the source data can be in any zone. It's not restricted */
/* to the builder's designated OLC zone. */
src_vnum = atoi(buf1);
src_vnum = atoidx(buf1);
src_rnum = (*oasis_copy_info[i].binary_search)(src_vnum);
if (src_rnum == NOWHERE) {
send_to_char(ch, "The source %s (#%d) does not exist.\r\n", oasis_copy_info[i].text, src_vnum);
@@ -90,7 +92,7 @@ ACMD(do_oasis_copy)
}
/* Don't copy if the target already exists. */
dst_vnum = atoi(buf2);
dst_vnum = atoidx(buf2);
dst_rnum = (*oasis_copy_info[i].binary_search)(dst_vnum);
if (dst_rnum != NOWHERE) {
send_to_char(ch, "The target %s (#%d) already exists.\r\n", oasis_copy_info[i].text, dst_vnum);
@@ -156,7 +158,7 @@ ACMD(do_dig)
room_rnum rrnum = NOWHERE;
zone_rnum zone;
int dir = 0, rawvnum;
struct descriptor_data *d = ch->desc; /* will save us some typing */
descriptor_data *d = ch->desc; /* will save us some typing */
/* Grab the room's name (if available). */
new_room_name = two_arguments(argument, sdir, sroom);
@@ -308,7 +310,7 @@ static room_vnum redit_find_new_vnum(zone_rnum zone)
return(vnum);
}
int buildwalk(struct char_data *ch, int dir)
int buildwalk(char_data *ch, int dir)
{
char buf[MAX_INPUT_LENGTH];
room_vnum vnum;
@@ -324,7 +326,7 @@ int buildwalk(struct char_data *ch, int dir)
} else if ((vnum = redit_find_new_vnum(world[IN_ROOM(ch)].zone)) == NOWHERE) {
send_to_char(ch, "No free vnums are available in this zone!\r\n");
} else {
struct descriptor_data *d = ch->desc;
descriptor_data *d = ch->desc;
/* Give the descriptor an olc struct. This way we can let
* redit_save_internally handle the room adding. */
if (d->olc) {
+22 -22
View File
@@ -32,18 +32,18 @@ struct obj_list_item {
int val;
};
/* local functions */
static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax);
static void list_rooms(struct char_data *ch , zone_rnum rnum, room_vnum vmin, room_vnum vmax);
static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax );
static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax );
static void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax);
static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name);
static void list_triggers(char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax);
static void list_rooms(char_data *ch , zone_rnum rnum, room_vnum vmin, room_vnum vmax);
static void list_mobiles(char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax );
static void list_objects(char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax );
static void list_shops(char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax);
static void list_zones(char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name);
static void perform_mob_flag_list(struct char_data * ch, char *arg)
static void perform_mob_flag_list(char_data * ch, char *arg)
{
int num, mob_flag, found = 0;
size_t len;
struct char_data *mob;
char_data *mob;
char buf[MAX_STRING_LENGTH];
mob_flag = atoi(arg);
@@ -76,11 +76,11 @@ static void perform_mob_flag_list(struct char_data * ch, char *arg)
return;
}
static void perform_mob_level_list(struct char_data * ch, char *arg)
static void perform_mob_level_list(char_data * ch, char *arg)
{
int num, mob_level, found = 0;
size_t len;
struct char_data *mob;
char_data *mob;
char buf[MAX_STRING_LENGTH];
mob_level = atoi(arg);
@@ -131,7 +131,7 @@ static void add_to_obj_list(struct obj_list_item *lst, int num_items, obj_vnum n
}
}
static void perform_obj_type_list(struct char_data * ch, char *arg)
static void perform_obj_type_list(char_data * ch, char *arg)
{
int num, itemtype, v1, v2, found = 0;
size_t len = 0, tmp_len = 0;
@@ -246,7 +246,7 @@ static void perform_obj_type_list(struct char_data * ch, char *arg)
page_string(ch->desc, buf, TRUE);
}
static void perform_obj_aff_list(struct char_data * ch, char *arg)
static void perform_obj_aff_list(char_data * ch, char *arg)
{
int num, i, apply, v1 = 0, found = 0;
size_t len = 0, tmp_len = 0;
@@ -331,7 +331,7 @@ static void perform_obj_aff_list(struct char_data * ch, char *arg)
page_string(ch->desc, buf, TRUE);
}
static void perform_obj_name_list(struct char_data * ch, char *arg)
static void perform_obj_name_list(char_data * ch, char *arg)
{
int num, found = 0;
size_t len = 0, tmp_len = 0;
@@ -375,7 +375,7 @@ ACMD(do_oasis_list)
if (!*smin || *smin == '.') {
rzone = world[IN_ROOM(ch)].zone;
} else if (!*smax) {
rzone = real_zone(atoi(smin));
rzone = real_zone(atoidx(smin));
if ((rzone == NOWHERE || rzone == 0) && subcmd == SCMD_OASIS_ZLIST && !isdigit(*smin)) {
/* Must be zlist, with builder name as arg */
@@ -521,7 +521,7 @@ ACMD(do_oasis_links)
zrnum = world[IN_ROOM(ch)].zone;
zvnum = zone_table[zrnum].number;
} else {
zvnum = atoi(arg);
zvnum = atoidx(arg);
zrnum = real_zone(zvnum);
}
@@ -552,7 +552,7 @@ ACMD(do_oasis_links)
/* Helper Functions */
/* List all rooms in a zone. */
static void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
static void list_rooms(char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
{
room_rnum i;
room_vnum bottom, top;
@@ -614,7 +614,7 @@ static void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, roo
}
/* List all mobiles in a zone. */
static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax)
static void list_mobiles(char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax)
{
mob_rnum i;
mob_vnum bottom, top;
@@ -660,7 +660,7 @@ static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mo
}
/* List all objects in a zone. */
static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin, obj_vnum vmax)
static void list_objects(char_data *ch, zone_rnum rnum, obj_vnum vmin, obj_vnum vmax)
{
obj_rnum i;
obj_vnum bottom, top;
@@ -707,7 +707,7 @@ static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin, ob
}
/* List all shops in a zone. */
static void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax)
static void list_shops(char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax)
{
shop_rnum i;
shop_vnum bottom, top;
@@ -751,7 +751,7 @@ static void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, sho
}
/* List all zones in the world (sort of like 'show zones'). */
static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name)
static void list_zones(char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name)
{
int counter = 0;
size_t len = 0, tmp_len = 0;
@@ -804,7 +804,7 @@ static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zon
}
/* Prints all of the zone information for the selected zone. */
void print_zone(struct char_data *ch, zone_vnum vnum)
void print_zone(char_data *ch, zone_vnum vnum)
{
zone_rnum rnum;
int size_rooms, size_objects, size_mobiles, size_quests, size_shops, size_trigs, i, largest_table;
@@ -899,7 +899,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
}
/* List code by Ronald Evers. */
static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax)
static void list_triggers(char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax)
{
int i, bottom, top, counter = 0;
char trgtypes[256];
+53 -53
View File
@@ -31,32 +31,32 @@
#define MAX_BAG_ROWS 5
/* local functions */
static int Crash_save(struct obj_data *obj, FILE *fp, int location);
static void Crash_extract_norent_eq(struct char_data *ch);
static void auto_equip(struct char_data *ch, struct obj_data *obj, int location);
static int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor);
static int Crash_report_unrentables(struct char_data *ch, struct char_data *recep, struct obj_data *obj);
static void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct obj_data *obj, long *cost, long *nitems, int display, int factor);
static int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd, char *arg, int mode);
static void Crash_rent_deadline(struct char_data *ch, struct char_data *recep, long cost);
static void Crash_restore_weight(struct obj_data *obj);
static void Crash_extract_objs(struct obj_data *obj);
static int Crash_is_unrentable(struct obj_data *obj);
static void Crash_extract_norents(struct obj_data *obj);
static void Crash_extract_expensive(struct obj_data *obj);
static void Crash_calculate_rent(struct obj_data *obj, int *cost);
static void Crash_cryosave(struct char_data *ch, int cost);
static int Crash_load_objs(struct char_data *ch);
static int handle_obj(struct obj_data *obj, struct char_data *ch, int locate, struct obj_data **cont_rows);
static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch);
static int Crash_save(obj_data *obj, FILE *fp, int location);
static void Crash_extract_norent_eq(char_data *ch);
static void auto_equip(char_data *ch, obj_data *obj, int location);
static int Crash_offer_rent(char_data *ch, char_data *receptionist, int display, int factor);
static int Crash_report_unrentables(char_data *ch, char_data *recep, obj_data *obj);
static void Crash_report_rent(char_data *ch, char_data *recep, obj_data *obj, long *cost, long *nitems, int display, int factor);
static int gen_receptionist(char_data *ch, char_data *recep, int cmd, char *arg, int mode);
static void Crash_rent_deadline(char_data *ch, char_data *recep, long cost);
static void Crash_restore_weight(obj_data *obj);
static void Crash_extract_objs(obj_data *obj);
static int Crash_is_unrentable(obj_data *obj);
static void Crash_extract_norents(obj_data *obj);
static void Crash_extract_expensive(obj_data *obj);
static void Crash_calculate_rent(obj_data *obj, int *cost);
static void Crash_cryosave(char_data *ch, int cost);
static int Crash_load_objs(char_data *ch);
static int handle_obj(obj_data *obj, char_data *ch, int locate, obj_data **cont_rows);
static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, char_data *ch);
/* Writes one object record to FILE. Old name: Obj_to_store() */
int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
int objsave_save_obj_record(obj_data *obj, FILE *fp, int locate)
{
int counter2;
struct extra_descr_data *ex_desc;
char buf1[MAX_STRING_LENGTH +1];
struct obj_data *temp = NULL;
obj_data *temp = NULL;
if (GET_OBJ_VNUM(obj) != NOTHING)
temp=read_object(GET_OBJ_VNUM(obj), VIRTUAL);
@@ -164,7 +164,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
#undef TEST_OBJN
/* AutoEQ by Burkhard Knopf. */
static void auto_equip(struct char_data *ch, struct obj_data *obj, int location)
static void auto_equip(char_data *ch, obj_data *obj, int location)
{
int j;
@@ -280,7 +280,7 @@ int Crash_delete_file(char *name)
return TRUE;
}
int Crash_delete_crashfile(struct char_data *ch)
int Crash_delete_crashfile(char_data *ch)
{
char filename[MAX_INPUT_LENGTH];
int numread;
@@ -376,7 +376,7 @@ void update_obj_file(void)
Crash_clean_file(player_table[i].name);
}
void Crash_listrent(struct char_data *ch, char *name)
void Crash_listrent(char_data *ch, char *name)
{
FILE *fl;
char filename[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], line[READ_SIZE];
@@ -447,14 +447,14 @@ void Crash_listrent(struct char_data *ch, char *name)
* 0 - successful load, keep char in rent room.
* 1 - load failure or load of crash items -- put char in temple.
* 2 - rented equipment lost (no $) */
int Crash_load(struct char_data *ch)
int Crash_load(char_data *ch)
{
return (Crash_load_objs(ch));
}
static int Crash_save(struct obj_data *obj, FILE *fp, int location)
static int Crash_save(obj_data *obj, FILE *fp, int location)
{
struct obj_data *tmp;
obj_data *tmp;
int result;
if (obj) {
@@ -472,7 +472,7 @@ static int Crash_save(struct obj_data *obj, FILE *fp, int location)
return (TRUE);
}
static void Crash_restore_weight(struct obj_data *obj)
static void Crash_restore_weight(obj_data *obj)
{
if (obj) {
Crash_restore_weight(obj->contains);
@@ -484,7 +484,7 @@ static void Crash_restore_weight(struct obj_data *obj)
/* Get !RENT items from equipment to inventory and extract !RENT out of worn
* containers. */
static void Crash_extract_norent_eq(struct char_data *ch)
static void Crash_extract_norent_eq(char_data *ch)
{
int j;
@@ -499,7 +499,7 @@ static void Crash_extract_norent_eq(struct char_data *ch)
}
}
static void Crash_extract_objs(struct obj_data *obj)
static void Crash_extract_objs(obj_data *obj)
{
if (obj) {
Crash_extract_objs(obj->contains);
@@ -508,7 +508,7 @@ static void Crash_extract_objs(struct obj_data *obj)
}
}
static int Crash_is_unrentable(struct obj_data *obj)
static int Crash_is_unrentable(obj_data *obj)
{
if (!obj)
return FALSE;
@@ -524,7 +524,7 @@ static int Crash_is_unrentable(struct obj_data *obj)
return FALSE;
}
static void Crash_extract_norents(struct obj_data *obj)
static void Crash_extract_norents(obj_data *obj)
{
if (obj) {
Crash_extract_norents(obj->contains);
@@ -534,9 +534,9 @@ static void Crash_extract_norents(struct obj_data *obj)
}
}
static void Crash_extract_expensive(struct obj_data *obj)
static void Crash_extract_expensive(obj_data *obj)
{
struct obj_data *tobj, *max;
obj_data *tobj, *max;
max = obj;
for (tobj = obj; tobj; tobj = tobj->next_content)
@@ -545,7 +545,7 @@ static void Crash_extract_expensive(struct obj_data *obj)
extract_obj(max);
}
static void Crash_calculate_rent(struct obj_data *obj, int *cost)
static void Crash_calculate_rent(obj_data *obj, int *cost)
{
if (obj) {
*cost += MAX(0, GET_OBJ_RENT(obj));
@@ -554,7 +554,7 @@ static void Crash_calculate_rent(struct obj_data *obj, int *cost)
}
}
void Crash_crashsave(struct char_data *ch)
void Crash_crashsave(char_data *ch)
{
char buf[MAX_INPUT_LENGTH];
int j;
@@ -592,7 +592,7 @@ void Crash_crashsave(struct char_data *ch)
REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_CRASH);
}
void Crash_idlesave(struct char_data *ch)
void Crash_idlesave(char_data *ch)
{
char buf[MAX_INPUT_LENGTH];
int j;
@@ -666,7 +666,7 @@ void Crash_idlesave(struct char_data *ch)
Crash_extract_objs(ch->carrying);
}
void Crash_rentsave(struct char_data *ch, int cost)
void Crash_rentsave(char_data *ch, int cost)
{
char buf[MAX_INPUT_LENGTH];
int j;
@@ -707,7 +707,7 @@ void Crash_rentsave(struct char_data *ch, int cost)
Crash_extract_objs(ch->carrying);
}
static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch)
static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, char_data *ch)
{
if (fprintf(fl, "%d %ld %d %d %d %d\r\n",
rentcode,
@@ -725,7 +725,7 @@ static int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, stru
}
static void Crash_cryosave(struct char_data *ch, int cost)
static void Crash_cryosave(char_data *ch, int cost)
{
char buf[MAX_INPUT_LENGTH];
int j;
@@ -769,7 +769,7 @@ static void Crash_cryosave(struct char_data *ch, int cost)
}
/* Routines used for the receptionist. */
static void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
static void Crash_rent_deadline(char_data *ch, char_data *recep,
long cost)
{
long rent_deadline;
@@ -784,8 +784,8 @@ static void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
act(buf, FALSE, recep, 0, ch, TO_VICT);
}
static int Crash_report_unrentables(struct char_data *ch, struct char_data *recep,
struct obj_data *obj)
static int Crash_report_unrentables(char_data *ch, char_data *recep,
obj_data *obj)
{
char buf[128];
int has_norents = 0;
@@ -802,7 +802,7 @@ static int Crash_report_unrentables(struct char_data *ch, struct char_data *rece
return (has_norents);
}
static void Crash_report_rent(struct char_data *ch, struct char_data *recep, struct
static void Crash_report_rent(char_data *ch, char_data *recep, struct
obj_data *obj, long *cost, long *nitems, int display, int factor)
{
static char buf[256];
@@ -822,7 +822,7 @@ static void Crash_report_rent(struct char_data *ch, struct char_data *recep, str
}
}
static int Crash_offer_rent(struct char_data *ch, struct char_data *recep,
static int Crash_offer_rent(char_data *ch, char_data *recep,
int display, int factor)
{
char buf[MAX_INPUT_LENGTH];
@@ -871,7 +871,7 @@ static int Crash_offer_rent(struct char_data *ch, struct char_data *recep,
return (totalcost);
}
static int gen_receptionist(struct char_data *ch, struct char_data *recep, int cmd,
static int gen_receptionist(char_data *ch, char_data *recep, int cmd,
char *arg, int mode)
{
int cost;
@@ -952,17 +952,17 @@ static int gen_receptionist(struct char_data *ch, struct char_data *recep, int c
SPECIAL(receptionist)
{
return (gen_receptionist(ch, (struct char_data *)me, cmd, argument, RENT_FACTOR));
return (gen_receptionist(ch, (char_data *)me, cmd, argument, RENT_FACTOR));
}
SPECIAL(cryogenicist)
{
return (gen_receptionist(ch, (struct char_data *)me, cmd, argument, CRYO_FACTOR));
return (gen_receptionist(ch, (char_data *)me, cmd, argument, CRYO_FACTOR));
}
void Crash_save_all(void)
{
struct descriptor_data *d;
descriptor_data *d;
for (d = descriptor_list; d; d = d->next) {
if ((STATE(d) == CON_PLAYING) && !IS_NPC(d->character)) {
if (PLR_FLAGGED(d->character, PLR_CRASH)) {
@@ -982,7 +982,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
obj_save_data *head, *current, *tempsave;
char f1[128], f2[128], f3[128], f4[128], line[READ_SIZE];
int t[4],i, nr;
struct obj_data *temp;
obj_data *temp;
CREATE(current, obj_save_data, 1);
head = current;
@@ -1175,7 +1175,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
return head;
}
static int Crash_load_objs(struct char_data *ch) {
static int Crash_load_objs(char_data *ch) {
FILE *fl;
char filename[PATH_MAX];
char line[READ_SIZE];
@@ -1183,7 +1183,7 @@ static int Crash_load_objs(struct char_data *ch) {
char str[64];
int i, num_of_days, orig_rent_code, num_objs=0;
unsigned long cost;
struct obj_data *cont_row[MAX_BAG_ROWS];
obj_data *cont_row[MAX_BAG_ROWS];
int rentcode = RENT_UNDEF;
int timed=0,netcost=0,gold,account,nitems;
obj_save_data *loaded, *current;
@@ -1276,10 +1276,10 @@ static int Crash_load_objs(struct char_data *ch) {
return 1;
}
static int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct obj_data **cont_row)
static int handle_obj(obj_data *temp, char_data *ch, int locate, obj_data **cont_row)
{
int j;
struct obj_data *obj1;
obj_data *obj1;
if (!temp) /* this should never happen, but.... */
return FALSE;
+49 -47
View File
@@ -26,23 +26,23 @@
#include "modify.h"
/* local functions */
static void oedit_setup_new(struct descriptor_data *d);
static void oedit_disp_container_flags_menu(struct descriptor_data *d);
static void oedit_disp_extradesc_menu(struct descriptor_data *d);
static void oedit_disp_prompt_apply_menu(struct descriptor_data *d);
static void oedit_liquid_type(struct descriptor_data *d);
static void oedit_disp_apply_menu(struct descriptor_data *d);
static void oedit_disp_weapon_menu(struct descriptor_data *d);
static void oedit_disp_spells_menu(struct descriptor_data *d);
static void oedit_disp_val1_menu(struct descriptor_data *d);
static void oedit_disp_val2_menu(struct descriptor_data *d);
static void oedit_disp_val3_menu(struct descriptor_data *d);
static void oedit_disp_val4_menu(struct descriptor_data *d);
static void oedit_disp_type_menu(struct descriptor_data *d);
static void oedit_disp_extra_menu(struct descriptor_data *d);
static void oedit_disp_wear_menu(struct descriptor_data *d);
static void oedit_disp_menu(struct descriptor_data *d);
static void oedit_disp_perm_menu(struct descriptor_data *d);
static void oedit_setup_new(descriptor_data *d);
static void oedit_disp_container_flags_menu(descriptor_data *d);
static void oedit_disp_extradesc_menu(descriptor_data *d);
static void oedit_disp_prompt_apply_menu(descriptor_data *d);
static void oedit_liquid_type(descriptor_data *d);
static void oedit_disp_apply_menu(descriptor_data *d);
static void oedit_disp_weapon_menu(descriptor_data *d);
static void oedit_disp_spells_menu(descriptor_data *d);
static void oedit_disp_val1_menu(descriptor_data *d);
static void oedit_disp_val2_menu(descriptor_data *d);
static void oedit_disp_val3_menu(descriptor_data *d);
static void oedit_disp_val4_menu(descriptor_data *d);
static void oedit_disp_type_menu(descriptor_data *d);
static void oedit_disp_extra_menu(descriptor_data *d);
static void oedit_disp_wear_menu(descriptor_data *d);
static void oedit_disp_menu(descriptor_data *d);
static void oedit_disp_perm_menu(descriptor_data *d);
static void oedit_save_to_disk(int zone_num);
/* handy macro */
@@ -51,8 +51,10 @@ static void oedit_save_to_disk(int zone_num);
/* Utility and exported functions */
ACMD(do_oasis_oedit)
{
int number = NOWHERE, save = 0, real_num;
struct descriptor_data *d;
int save = 0;
zone_vnum number = NOWHERE;
zone_rnum real_num;
descriptor_data *d;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@@ -76,7 +78,7 @@ ACMD(do_oasis_oedit)
save = TRUE;
if (is_number(buf2))
number = atoi(buf2);
number = atoidx(buf2);
else if (GET_OLC_ZONE(ch) > 0) {
zone_rnum zlok;
@@ -94,7 +96,7 @@ ACMD(do_oasis_oedit)
/* If a numeric argument was given, get it. */
if (number == NOWHERE)
number = atoi(buf1);
number = atoidx(buf1);
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
send_to_char(ch, "That object VNUM can't exist.\r\n");
@@ -181,7 +183,7 @@ ACMD(do_oasis_oedit)
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
}
static void oedit_setup_new(struct descriptor_data *d)
static void oedit_setup_new(descriptor_data *d)
{
CREATE(OLC_OBJ(d), struct obj_data, 1);
@@ -197,9 +199,9 @@ static void oedit_setup_new(struct descriptor_data *d)
OLC_OBJ(d)->proto_script = OLC_SCRIPT(d) = NULL;
}
void oedit_setup_existing(struct descriptor_data *d, int real_num)
void oedit_setup_existing(descriptor_data *d, int real_num)
{
struct obj_data *obj;
obj_data *obj;
/* Allocate object in memory. */
CREATE(obj, struct obj_data, 1);
@@ -216,12 +218,12 @@ void oedit_setup_existing(struct descriptor_data *d, int real_num)
OLC_OBJ(d)->proto_script = NULL;
}
void oedit_save_internally(struct descriptor_data *d)
void oedit_save_internally(descriptor_data *d)
{
int i;
obj_rnum robj_num;
struct descriptor_data *dsc;
struct obj_data *obj;
descriptor_data *dsc;
obj_data *obj;
i = (real_object(OLC_NUM(d)) == NOTHING);
@@ -290,7 +292,7 @@ static void oedit_save_to_disk(int zone_num)
/* Menu functions */
/* For container flags. */
static void oedit_disp_container_flags_menu(struct descriptor_data *d)
static void oedit_disp_container_flags_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
get_char_colors(d->character);
@@ -308,7 +310,7 @@ static void oedit_disp_container_flags_menu(struct descriptor_data *d)
}
/* For extra descriptions. */
static void oedit_disp_extradesc_menu(struct descriptor_data *d)
static void oedit_disp_extradesc_menu(descriptor_data *d)
{
struct extra_descr_data *extra_desc = OLC_DESC(d);
@@ -329,7 +331,7 @@ static void oedit_disp_extradesc_menu(struct descriptor_data *d)
}
/* Ask for *which* apply to edit. */
static void oedit_disp_prompt_apply_menu(struct descriptor_data *d)
static void oedit_disp_prompt_apply_menu(descriptor_data *d)
{
char apply_buf[MAX_STRING_LENGTH];
int counter;
@@ -351,7 +353,7 @@ static void oedit_disp_prompt_apply_menu(struct descriptor_data *d)
}
/* Ask for liquid type. */
static void oedit_liquid_type(struct descriptor_data *d)
static void oedit_liquid_type(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -361,7 +363,7 @@ static void oedit_liquid_type(struct descriptor_data *d)
}
/* The actual apply to set. */
static void oedit_disp_apply_menu(struct descriptor_data *d)
static void oedit_disp_apply_menu(descriptor_data *d)
{
get_char_colors(d->character);
clear_screen(d);
@@ -371,7 +373,7 @@ static void oedit_disp_apply_menu(struct descriptor_data *d)
}
/* Weapon type. */
static void oedit_disp_weapon_menu(struct descriptor_data *d)
static void oedit_disp_weapon_menu(descriptor_data *d)
{
int counter, columns = 0;
@@ -387,7 +389,7 @@ static void oedit_disp_weapon_menu(struct descriptor_data *d)
}
/* Spell type. */
static void oedit_disp_spells_menu(struct descriptor_data *d)
static void oedit_disp_spells_menu(descriptor_data *d)
{
int counter, columns = 0;
@@ -402,7 +404,7 @@ static void oedit_disp_spells_menu(struct descriptor_data *d)
}
/* Object value #1 */
static void oedit_disp_val1_menu(struct descriptor_data *d)
static void oedit_disp_val1_menu(descriptor_data *d)
{
OLC_MODE(d) = OEDIT_VALUE_1;
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
@@ -458,7 +460,7 @@ static void oedit_disp_val1_menu(struct descriptor_data *d)
}
/* Object value #2 */
static void oedit_disp_val2_menu(struct descriptor_data *d)
static void oedit_disp_val2_menu(descriptor_data *d)
{
OLC_MODE(d) = OEDIT_VALUE_2;
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
@@ -491,7 +493,7 @@ static void oedit_disp_val2_menu(struct descriptor_data *d)
}
/* Object value #3 */
static void oedit_disp_val3_menu(struct descriptor_data *d)
static void oedit_disp_val3_menu(descriptor_data *d)
{
OLC_MODE(d) = OEDIT_VALUE_3;
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
@@ -522,7 +524,7 @@ static void oedit_disp_val3_menu(struct descriptor_data *d)
}
/* Object value #4 */
static void oedit_disp_val4_menu(struct descriptor_data *d)
static void oedit_disp_val4_menu(descriptor_data *d)
{
OLC_MODE(d) = OEDIT_VALUE_4;
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
@@ -546,7 +548,7 @@ static void oedit_disp_val4_menu(struct descriptor_data *d)
}
/* Object type. */
static void oedit_disp_type_menu(struct descriptor_data *d)
static void oedit_disp_type_menu(descriptor_data *d)
{
int counter, columns = 0;
@@ -561,7 +563,7 @@ static void oedit_disp_type_menu(struct descriptor_data *d)
}
/* Object extra flags. */
static void oedit_disp_extra_menu(struct descriptor_data *d)
static void oedit_disp_extra_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
int counter, columns = 0;
@@ -580,7 +582,7 @@ static void oedit_disp_extra_menu(struct descriptor_data *d)
}
/* Object perm flags. */
static void oedit_disp_perm_menu(struct descriptor_data *d)
static void oedit_disp_perm_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
int counter, columns = 0;
@@ -597,7 +599,7 @@ static void oedit_disp_perm_menu(struct descriptor_data *d)
}
/* Object wear flags. */
static void oedit_disp_wear_menu(struct descriptor_data *d)
static void oedit_disp_wear_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
int counter, columns = 0;
@@ -615,11 +617,11 @@ static void oedit_disp_wear_menu(struct descriptor_data *d)
}
/* Display main menu. */
static void oedit_disp_menu(struct descriptor_data *d)
static void oedit_disp_menu(descriptor_data *d)
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
struct obj_data *obj;
obj_data *obj;
obj = OLC_OBJ(d);
get_char_colors(d->character);
@@ -689,7 +691,7 @@ static void oedit_disp_menu(struct descriptor_data *d)
}
/* main loop (of sorts).. basically interpreter throws all input to here. */
void oedit_parse(struct descriptor_data *d, char *arg)
void oedit_parse(descriptor_data *d, char *arg)
{
int number, max_val, min_val;
char *oldtext = NULL;
@@ -1182,7 +1184,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
break;
case OEDIT_COPY:
if ((number = real_object(atoi(arg))) != NOTHING) {
if ((number = real_object(atoidx(arg))) != NOTHING) {
oedit_setup_existing(d, number);
} else
write_to_output(d, "That object does not exist.\r\n");
@@ -1213,7 +1215,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
oedit_disp_menu(d);
}
void oedit_string_cleanup(struct descriptor_data *d, int terminator)
void oedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case OEDIT_ACTDESC:
+50 -50
View File
@@ -1,7 +1,7 @@
/**
* @file pfdefaults.h
* ASCII player file defaults.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
@@ -10,56 +10,56 @@
#ifndef _PFDEFAULTS_H_
#define _PFDEFAULTS_H_
/* WARNING: Do not change the values below if you have existing ascii player
/* WARNING: Do not change the values below if you have existing ascii player
* files you don't want to screw up. */
#define PFDEF_SEX 0
#define PFDEF_CLASS 0
#define PFDEF_LEVEL 0
#define PFDEF_HEIGHT 0
#define PFDEF_WEIGHT 0
#define PFDEF_ALIGNMENT 0
#define PFDEF_PLRFLAGS 0
#define PFDEF_AFFFLAGS 0
#define PFDEF_SAVETHROW 0
#define PFDEF_LOADROOM 0
#define PFDEF_INVISLEV 0
#define PFDEF_FREEZELEV 0
#define PFDEF_WIMPLEV 0
#define PFDEF_CONDITION 0
#define PFDEF_BADPWS 0
#define PFDEF_PREFFLAGS 0
#define PFDEF_PRACTICES 0
#define PFDEF_GOLD 0
#define PFDEF_BANK 0
#define PFDEF_EXP 0
#define PFDEF_HITROLL 0
#define PFDEF_DAMROLL 0
#define PFDEF_AC 0
#define PFDEF_STR 0
#define PFDEF_STRADD 0
#define PFDEF_DEX 0
#define PFDEF_INT 0
#define PFDEF_WIS 0
#define PFDEF_CON 0
#define PFDEF_CHA 0
#define PFDEF_HIT 0
#define PFDEF_MAXHIT 0
#define PFDEF_MANA 0
#define PFDEF_MAXMANA 0
#define PFDEF_MOVE 0
#define PFDEF_MAXMOVE 0
#define PFDEF_HUNGER 0
#define PFDEF_THIRST 0
#define PFDEF_DRUNK 0
#define PFDEF_OLC NOWHERE
#define PFDEF_PAGELENGTH 22
#define PFDEF_SCREENWIDTH 80
#define PFDEF_QUESTPOINTS 0
#define PFDEF_QUESTCOUNT 0
#define PFDEF_COMPQUESTS 0
#define PFDEF_CURRQUEST NOTHING
#define PFDEF_LASTMOTD 0
#define PFDEF_LASTNEWS 0
#define PFDEF_SEX 0
#define PFDEF_CLASS 0
#define PFDEF_LEVEL 0
#define PFDEF_HEIGHT 0
#define PFDEF_WEIGHT 0
#define PFDEF_ALIGNMENT 0
#define PFDEF_PLRFLAGS 0
#define PFDEF_AFFFLAGS 0
#define PFDEF_SAVETHROW 0
#define PFDEF_LOADROOM 0
#define PFDEF_INVISLEV 0
#define PFDEF_FREEZELEV 0
#define PFDEF_WIMPLEV 0
#define PFDEF_CONDITION 0
#define PFDEF_BADPWS 0
#define PFDEF_PREFFLAGS 0
#define PFDEF_PRACTICES 0
#define PFDEF_GOLD 0
#define PFDEF_BANK 0
#define PFDEF_EXP 0
#define PFDEF_HITROLL 0
#define PFDEF_DAMROLL 0
#define PFDEF_AC 0
#define PFDEF_STR 0
#define PFDEF_STRADD 0
#define PFDEF_DEX 0
#define PFDEF_INT 0
#define PFDEF_WIS 0
#define PFDEF_CON 0
#define PFDEF_CHA 0
#define PFDEF_HIT 0
#define PFDEF_MAXHIT 0
#define PFDEF_MANA 0
#define PFDEF_MAXMANA 0
#define PFDEF_MOVE 0
#define PFDEF_MAXMOVE 0
#define PFDEF_HUNGER 0
#define PFDEF_THIRST 0
#define PFDEF_DRUNK 0
#define PFDEF_OLC NOWHERE
#define PFDEF_PAGELENGTH 22
#define PFDEF_SCREENWIDTH 80
#define PFDEF_QUESTPOINTS 0
#define PFDEF_QUESTCOUNT 0
#define PFDEF_COMPQUESTS 0
#define PFDEF_CURRQUEST NOTHING
#define PFDEF_LASTMOTD 0
#define PFDEF_LASTNEWS 0
#endif /* _PFDEFAULTS_H_ */
+18 -18
View File
@@ -35,12 +35,12 @@
#define PT_LLAST(i) (player_table[(i)].last)
/* local functions */
static void load_affects(FILE *fl, struct char_data *ch);
static void load_skills(FILE *fl, struct char_data *ch);
static void load_quests(FILE *fl, struct char_data *ch);
static void load_HMVS(struct char_data *ch, const char *line, int mode);
static void write_aliases_ascii(FILE *file, struct char_data *ch);
static void read_aliases_ascii(FILE *file, struct char_data *ch, int count);
static void load_affects(FILE *fl, char_data *ch);
static void load_skills(FILE *fl, char_data *ch);
static void load_quests(FILE *fl, char_data *ch);
static void load_HMVS(char_data *ch, const char *line, int mode);
static void write_aliases_ascii(FILE *file, char_data *ch);
static void read_aliases_ascii(FILE *file, char_data *ch, int count);
/* New version to build player index for ASCII Player Files. Generate index
* table for the player file. */
@@ -225,7 +225,7 @@ char *get_name_by_id(long id)
/* Stuff related to the save/load player system. */
/* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE
* if not. */
int load_char(const char *name, struct char_data *ch)
int load_char(const char *name, char_data *ch)
{
int id, i;
FILE *fl;
@@ -400,7 +400,7 @@ int load_char(const char *name, struct char_data *ch)
break;
case 'O':
if (!strcmp(tag, "Olc ")) GET_OLC_ZONE(ch) = atoi(line);
if (!strcmp(tag, "Olc ")) GET_OLC_ZONE(ch) = atoidx(line);
break;
case 'P':
@@ -429,7 +429,7 @@ int load_char(const char *name, struct char_data *ch)
break;
case 'R':
if (!strcmp(tag, "Room")) GET_LOADROOM(ch) = atoi(line);
if (!strcmp(tag, "Room")) GET_LOADROOM(ch) = atoidx(line);
break;
case 'S':
@@ -448,7 +448,7 @@ int load_char(const char *name, struct char_data *ch)
else if (!strcmp(tag, "Thr5")) GET_SAVE(ch, 4) = atoi(line);
else if (!strcmp(tag, "Titl")) GET_TITLE(ch) = strdup(line);
else if (!strcmp(tag, "Trig") && CONFIG_SCRIPT_PLAYERS) {
if ((t_rnum = real_trigger(atoi(line))) != NOTHING) {
if ((t_rnum = real_trigger(atoidx(line))) != NOTHING) {
t = read_trigger(t_rnum);
if (!SCRIPT(ch))
CREATE(SCRIPT(ch), struct script_data, 1);
@@ -489,13 +489,13 @@ int load_char(const char *name, struct char_data *ch)
/* Write the vital data of a player to the player file. */
/* This is the ASCII Player Files save routine. */
void save_char(struct char_data * ch)
void save_char(char_data * ch)
{
FILE *fl;
char filename[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127];
int i, j, id, save_index = FALSE;
struct affected_type *aff, tmp_aff[MAX_AFFECT];
struct obj_data *char_eq[NUM_WEARS];
obj_data *char_eq[NUM_WEARS];
trig_data *t;
if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0)
@@ -825,7 +825,7 @@ void clean_pfiles(void)
/* load_affects function now handles both 32-bit and
128-bit affect bitvectors for backward compatibility */
static void load_affects(FILE *fl, struct char_data *ch)
static void load_affects(FILE *fl, char_data *ch)
{
int num = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, num6 = 0, num7 = 0, num8 = 0, i, n_vars;
char line[MAX_INPUT_LENGTH + 1];
@@ -858,7 +858,7 @@ static void load_affects(FILE *fl, struct char_data *ch)
} while (num != 0);
}
static void load_skills(FILE *fl, struct char_data *ch)
static void load_skills(FILE *fl, char_data *ch)
{
int num = 0, num2 = 0;
char line[MAX_INPUT_LENGTH + 1];
@@ -871,7 +871,7 @@ static void load_skills(FILE *fl, struct char_data *ch)
} while (num != 0);
}
void load_quests(FILE *fl, struct char_data *ch)
void load_quests(FILE *fl, char_data *ch)
{
int num = NOTHING;
char line[MAX_INPUT_LENGTH + 1];
@@ -884,7 +884,7 @@ void load_quests(FILE *fl, struct char_data *ch)
} while (num != NOTHING);
}
static void load_HMVS(struct char_data *ch, const char *line, int mode)
static void load_HMVS(char_data *ch, const char *line, int mode)
{
int num = 0, num2 = 0;
@@ -913,7 +913,7 @@ static void load_HMVS(struct char_data *ch, const char *line, int mode)
}
}
static void write_aliases_ascii(FILE *file, struct char_data *ch)
static void write_aliases_ascii(FILE *file, char_data *ch)
{
struct alias_data *temp;
int count = 0;
@@ -936,7 +936,7 @@ static void write_aliases_ascii(FILE *file, struct char_data *ch)
temp->type);
}
static void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
static void read_aliases_ascii(FILE *file, char_data *ch, int count)
{
int i;
+21 -21
View File
@@ -22,17 +22,17 @@
#include "screen.h"
/* Internal (static) functions */
static void prefedit_setup(struct descriptor_data *d, struct char_data *vict);
static void prefedit_save_to_char(struct descriptor_data *d);
static void prefedit_disp_main_menu(struct descriptor_data *d);
static void prefedit_disp_toggles_menu(struct descriptor_data *d);
static void prefedit_disp_prompt_menu(struct descriptor_data *d);
static void prefedit_disp_color_menu(struct descriptor_data *d);
static void prefedit_disp_syslog_menu(struct descriptor_data *d);
static void prefedit_setup(descriptor_data *d, char_data *vict);
static void prefedit_save_to_char(descriptor_data *d);
static void prefedit_disp_main_menu(descriptor_data *d);
static void prefedit_disp_toggles_menu(descriptor_data *d);
static void prefedit_disp_prompt_menu(descriptor_data *d);
static void prefedit_disp_color_menu(descriptor_data *d);
static void prefedit_disp_syslog_menu(descriptor_data *d);
/* Note: there is no setup_new, as you can ONLY edit an existing player */
/* vict is normally = d->character, except when imps edit players */
static void prefedit_setup(struct descriptor_data *d, struct char_data *vict)
static void prefedit_setup(descriptor_data *d, char_data *vict)
{
int i;
struct prefs_data *toggles;
@@ -58,10 +58,10 @@ static void prefedit_setup(struct descriptor_data *d, struct char_data *vict)
prefedit_disp_main_menu(d);
}
static void prefedit_save_to_char(struct descriptor_data *d)
static void prefedit_save_to_char(descriptor_data *d)
{
int i;
struct char_data *vict;
char_data *vict;
vict = PREFEDIT_GET_CHAR;
@@ -94,9 +94,9 @@ static void prefedit_save_to_char(struct descriptor_data *d)
}
}
static void prefedit_disp_main_menu(struct descriptor_data *d)
static void prefedit_disp_main_menu(descriptor_data *d)
{
struct char_data *vict;
char_data *vict;
char prompt_string[10], color_string[10], syslog_string[10];
const char *multi_types[] = { "Off", "Brief", "Normal", "Complete", "\n" };
@@ -188,9 +188,9 @@ static void prefedit_disp_main_menu(struct descriptor_data *d)
OLC_MODE(d) = PREFEDIT_MAIN_MENU;
}
static void prefedit_disp_toggles_menu(struct descriptor_data *d)
static void prefedit_disp_toggles_menu(descriptor_data *d)
{
struct char_data *vict;
char_data *vict;
/* Set up the required variables and strings */
vict = OLC_PREFS(d)->ch;
@@ -298,7 +298,7 @@ static void prefedit_disp_toggles_menu(struct descriptor_data *d)
OLC_MODE(d) = PREFEDIT_TOGGLE_MENU;
}
static void prefedit_disp_prompt_menu(struct descriptor_data *d)
static void prefedit_disp_prompt_menu(descriptor_data *d)
{
char prompt_string[7];
@@ -326,7 +326,7 @@ static void prefedit_disp_prompt_menu(struct descriptor_data *d)
OLC_MODE(d) = PREFEDIT_PROMPT;
}
static void prefedit_disp_color_menu(struct descriptor_data *d)
static void prefedit_disp_color_menu(descriptor_data *d)
{
send_to_char(d->character, "%sColor level\r\n"
"%s1%s) Off %s(do not display any color - monochrome)%s\r\n"
@@ -343,7 +343,7 @@ static void prefedit_disp_color_menu(struct descriptor_data *d)
OLC_MODE(d) = PREFEDIT_COLOR;
}
static void prefedit_disp_syslog_menu(struct descriptor_data *d)
static void prefedit_disp_syslog_menu(descriptor_data *d)
{
send_to_char(d->character, "%sSyslog level\r\n"
"%s1%s) Off %s(do not display any logs or error messages)%s\r\n"
@@ -360,7 +360,7 @@ static void prefedit_disp_syslog_menu(struct descriptor_data *d)
OLC_MODE(d) = PREFEDIT_SYSLOG;
}
void prefedit_parse(struct descriptor_data * d, char *arg)
void prefedit_parse(descriptor_data * d, char *arg)
{
int number;
@@ -780,7 +780,7 @@ void prefedit_parse(struct descriptor_data * d, char *arg)
prefedit_disp_main_menu(d);
}
void prefedit_Restore_Defaults(struct descriptor_data *d)
void prefedit_Restore_Defaults(descriptor_data *d)
{
/* Let's do toggles one at a time */
/* PRF_BRIEF - Off */
@@ -931,8 +931,8 @@ void prefedit_Restore_Defaults(struct descriptor_data *d)
ACMD(do_oasis_prefedit)
{
struct descriptor_data *d;
struct char_data *vict;
descriptor_data *d;
char_data *vict;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
Executable → Regular
+8 -9
View File
@@ -10,13 +10,12 @@
**************************************************************************/
/* Toggle structure held for OLC purposes */
struct prefs_data
{
struct char_data *ch; /* Pointer to char being edited */
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
int wimp_level; /* Copy of player's wimp level */
int page_length; /* Copy of player's pagelength */
int screen_width; /* Copy of player's screenwidth */
struct prefs_data {
char_data *ch; /* Pointer to char being edited */
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
int wimp_level; /* Copy of player's wimp level */
int page_length; /* Copy of player's pagelength */
int screen_width; /* Copy of player's screenwidth */
};
/* Prefedit utility macros */
@@ -54,7 +53,7 @@ struct prefs_data
#define PREFEDIT_TOGGLE_MENU 8
/* External Functions in prefedit.c */
void prefedit_Restore_Defaults(struct descriptor_data *d);
void prefedit_parse(struct descriptor_data * d, char *arg);
void prefedit_Restore_Defaults(descriptor_data *d);
void prefedit_parse(descriptor_data * d, char *arg);
ACMD(do_oasis_prefedit);
+30 -36
View File
@@ -22,19 +22,12 @@
The following section is for Diku/Merc derivatives. Replace as needed.
******************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "screen.h"
#include "improved-edit.h"
#include "dg_scripts.h"
#include "act.h"
#include "modify.h"
/* Globals */
const char * RGBone = "F022";
@@ -214,7 +207,7 @@ static time_t s_Uptime = 0;
static void Negotiate ( descriptor_t *apDescriptor );
static void PerformHandshake ( descriptor_t *apDescriptor, char aCmd, char aProtocol );
static void PerformSubnegotiation( descriptor_t *apDescriptor, char aCmd, char *apData, int aSize );
static void PerformSubnegotiation(descriptor_t *apDescriptor, char aCmd, char *apData);
static void ParseMSDP ( descriptor_t *apDescriptor, const char *apData );
static void ExecuteMSDPPair ( descriptor_t *apDescriptor, const char *apVariable, const char *apValue );
@@ -358,7 +351,7 @@ void ProtocolDestroy( protocol_t *apProtocol )
free(apProtocol);
}
ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut )
ssize_t ProtocolInput( descriptor_t *apDescriptor, const char *apData, size_t aSize, char *apOut )
{
static char CmdBuf[MAX_PROTOCOL_BUFFER+1];
static char IacBuf[MAX_PROTOCOL_BUFFER+1];
@@ -395,7 +388,7 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
pProtocol->bIACMode = false;
IacBuf[IacIndex] = '\0';
if ( IacIndex >= 2 )
PerformSubnegotiation( apDescriptor, IacBuf[0], &IacBuf[1], IacIndex-1 );
PerformSubnegotiation( apDescriptor, IacBuf[0], &IacBuf[1]);
IacIndex = 0;
}
else
@@ -405,7 +398,7 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
isdigit(apData[Index+2]) && apData[Index+3] == 'z' )
{
char MXPBuffer [1024];
char *pMXPTag = NULL;
const char *pMXPTag = NULL;
int i = 0; /* Loop counter */
Index += 4; /* Skip to the start of the MXP sequence. */
@@ -525,7 +518,7 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
return (CmdIndex);
}
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int *apLength )
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, size_t *apLength )
{
static char Result[MAX_OUTPUT_BUFFER+1];
const char Tab[] = "\t";
@@ -1068,13 +1061,13 @@ void MSDPSend( descriptor_t *apDescriptor, variable_t aMSDP )
if ( VariableNameTable[aMSDP].bString )
{
/* Should really be replaced with a dynamic buffer */
int RequiredBuffer = strlen(VariableNameTable[aMSDP].pName) +
size_t RequiredBuffer = strlen(VariableNameTable[aMSDP].pName) +
strlen(pProtocol->pVariables[aMSDP]->pValueString) + 12;
if ( RequiredBuffer >= MAX_VARIABLE_LENGTH )
{
sprintf( MSDPBuffer,
"MSDPSend: %s %d bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
"MSDPSend: %s %ld bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
VariableNameTable[aMSDP].pName, RequiredBuffer,
MAX_VARIABLE_LENGTH );
ReportBug( MSDPBuffer );
@@ -1128,20 +1121,20 @@ void MSDPSendPair( descriptor_t *apDescriptor, const char *apVariable, const cha
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
/* Should really be replaced with a dynamic buffer */
int RequiredBuffer = strlen(apVariable) + strlen(apValue) + 12;
size_t RequiredBuffer = strlen(apVariable) + strlen(apValue) + 12;
if ( RequiredBuffer >= MAX_VARIABLE_LENGTH )
{
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
{
sprintf( MSDPBuffer,
"MSDPSendPair: %s %d bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
"MSDPSendPair: %s %ld bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
apVariable, RequiredBuffer, MAX_VARIABLE_LENGTH );
}
else /* The variable name itself is too long */
{
sprintf( MSDPBuffer,
"MSDPSendPair: Variable name has a length of %d bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
"MSDPSendPair: Variable name has a length of %ld bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
RequiredBuffer, MAX_VARIABLE_LENGTH );
}
@@ -1175,20 +1168,20 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
/* Should really be replaced with a dynamic buffer */
int RequiredBuffer = strlen(apVariable) + strlen(apValue) + 12;
size_t RequiredBuffer = strlen(apVariable) + strlen(apValue) + 12;
if ( RequiredBuffer >= MAX_VARIABLE_LENGTH )
{
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
{
sprintf( MSDPBuffer,
"MSDPSendList: %s %d bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
"MSDPSendList: %s %ld bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
apVariable, RequiredBuffer, MAX_VARIABLE_LENGTH );
}
else /* The variable name itself is too long */
{
sprintf( MSDPBuffer,
"MSDPSendList: Variable name has a length of %d bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
"MSDPSendList: Variable name has a length of %ld bytes (exceeds MAX_VARIABLE_LENGTH of %d).\n",
RequiredBuffer, MAX_VARIABLE_LENGTH );
}
@@ -1221,7 +1214,7 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha
}
}
void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue )
void MSDPSetNumber(const descriptor_t *apDescriptor, variable_t aMSDP, int aValue )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
@@ -1238,7 +1231,7 @@ void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue )
}
}
void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
void MSDPSetString(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
@@ -1246,7 +1239,7 @@ void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *ap
{
if ( VariableNameTable[aMSDP].bString )
{
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, apValue) )
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, apValue) != 0 )
{
free(pProtocol->pVariables[aMSDP]->pValueString);
pProtocol->pVariables[aMSDP]->pValueString = AllocString(apValue);
@@ -1256,7 +1249,7 @@ void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *ap
}
}
void MSDPSetTable( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
void MSDPSetTable(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
@@ -1278,7 +1271,7 @@ void MSDPSetTable( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
strcat(pTable, apValue);
strcat(pTable, MsdpTableStop);
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pTable) )
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pTable) != 0 )
{
free(pProtocol->pVariables[aMSDP]->pValueString);
pProtocol->pVariables[aMSDP]->pValueString = pTable;
@@ -1292,7 +1285,7 @@ void MSDPSetTable( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
}
}
void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
void MSDPSetArray(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
@@ -1314,7 +1307,7 @@ void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
strcat(pArray, apValue);
strcat(pArray, MsdpArrayStop);
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pArray) )
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pArray) != 0 )
{
free(pProtocol->pVariables[aMSDP]->pValueString);
pProtocol->pVariables[aMSDP]->pValueString = pArray;
@@ -1344,7 +1337,7 @@ void MSSPSetPlayers( int aPlayers )
MXP global functions.
******************************************************************************/
const char *MXPCreateTag( descriptor_t *apDescriptor, const char *apTag )
const char *MXPCreateTag(const descriptor_t *apDescriptor, const char *apTag )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
@@ -1408,7 +1401,7 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger )
Colour global functions.
******************************************************************************/
const char *ColourRGB( descriptor_t *apDescriptor, const char *apRGB )
const char *ColourRGB(const descriptor_t *apDescriptor, const char *apRGB )
{
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
bool charHasColor = TRUE;
@@ -1599,6 +1592,7 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
if ( aCmd == (char)DO )
SendMSSP( apDescriptor );
else if ( aCmd == (char)DONT )
//NOLINTNEXTLINE(*-suspicious-semicolon)
; /* Do nothing. */
break;
@@ -1687,7 +1681,7 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
}
}
static void PerformSubnegotiation( descriptor_t *apDescriptor, char aCmd, char *apData, int aSize )
static void PerformSubnegotiation(descriptor_t *apDescriptor, char aCmd, char *apData)
{
protocol_t *pProtocol = apDescriptor->pProtocol;
@@ -1742,8 +1736,8 @@ static void PerformSubnegotiation( descriptor_t *apDescriptor, char aCmd, char *
* free to remove the second strcmp ;)
*/
if ( pProtocol->pLastTTYPE == NULL ||
(strcmp(pProtocol->pLastTTYPE, pClientName) &&
strcmp(pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString, pClientName)) )
(strcmp(pProtocol->pLastTTYPE, pClientName) != 0 &&
strcmp(pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString, pClientName) != 0) )
{
char RequestTTYPE [] = { (char)IAC, (char)SB, TELOPT_TTYPE, SEND, (char)IAC, (char)SE, '\0' };
const char *pStartPos = strstr( pClientName, "-" );
@@ -2127,7 +2121,7 @@ static void ExecuteMSDPPair( descriptor_t *apDescriptor, const char *apVariable,
if ( *apValue != '\0' && IsNumber(apValue) )
{
int Value = atoi(apValue);
const int Value = atoi(apValue);
if ( Value >= VariableNameTable[i].Min &&
Value <= VariableNameTable[i].Max )
{
@@ -2247,7 +2241,7 @@ static void SendMSSP( descriptor_t *apDescriptor )
{
char MSSPBuffer[MAX_MSSP_BUFFER];
char MSSPPair[128];
int SizeBuffer = 3; /* IAC SB MSSP */
size_t SizeBuffer = 3; /* IAC SB MSSP */
int i; /* Loop counter */
/* Before updating the following table, please read the MSSP specification:
@@ -2371,7 +2365,7 @@ static void SendMSSP( descriptor_t *apDescriptor )
for ( i = 0; MSSPTable[i].pName != NULL; ++i )
{
int SizePair;
size_t SizePair;
/* Retrieve the next MSSP variable/value pair */
sprintf( MSSPPair, "%c%s%c%s", MSSP_VAR, MSSPTable[i].pName, MSSP_VAL,
@@ -2532,7 +2526,7 @@ static char *AllocString( const char *apString )
if ( apString != NULL )
{
int Size = strlen(apString);
const size_t Size = strlen(apString);
pResult = (char *) malloc(Size+1);
if ( pResult != NULL )
strcpy( pResult, apString );
+209 -216
View File
@@ -71,149 +71,142 @@ typedef struct descriptor_data descriptor_t;
Types.
******************************************************************************/
typedef enum
{
false,
true
typedef enum {
false,
true
} bool_t;
typedef enum
{
eUNKNOWN,
eNO,
eSOMETIMES,
eYES
typedef enum {
eUNKNOWN,
eNO,
eSOMETIMES,
eYES
} support_t;
typedef enum
{
eMSDP_NONE = -1, /* This must always be first. */
typedef enum {
eMSDP_NONE = -1, /* This must always be first. */
/* General */
eMSDP_CHARACTER_NAME,
eMSDP_SERVER_ID,
eMSDP_SERVER_TIME,
eMSDP_SNIPPET_VERSION,
/* General */
eMSDP_CHARACTER_NAME,
eMSDP_SERVER_ID,
eMSDP_SERVER_TIME,
eMSDP_SNIPPET_VERSION,
/* Character */
eMSDP_AFFECTS,
eMSDP_ALIGNMENT,
eMSDP_EXPERIENCE,
eMSDP_EXPERIENCE_MAX,
eMSDP_EXPERIENCE_TNL,
eMSDP_HEALTH,
eMSDP_HEALTH_MAX,
eMSDP_LEVEL,
eMSDP_RACE,
eMSDP_CLASS,
eMSDP_MANA,
eMSDP_MANA_MAX,
eMSDP_WIMPY,
eMSDP_PRACTICE,
eMSDP_MONEY,
eMSDP_MOVEMENT,
eMSDP_MOVEMENT_MAX,
eMSDP_HITROLL,
eMSDP_DAMROLL,
eMSDP_AC,
eMSDP_STR,
eMSDP_INT,
eMSDP_WIS,
eMSDP_DEX,
eMSDP_CON,
eMSDP_STR_PERM,
eMSDP_INT_PERM,
eMSDP_WIS_PERM,
eMSDP_DEX_PERM,
eMSDP_CON_PERM,
/* Character */
eMSDP_AFFECTS,
eMSDP_ALIGNMENT,
eMSDP_EXPERIENCE,
eMSDP_EXPERIENCE_MAX,
eMSDP_EXPERIENCE_TNL,
eMSDP_HEALTH,
eMSDP_HEALTH_MAX,
eMSDP_LEVEL,
eMSDP_RACE,
eMSDP_CLASS,
eMSDP_MANA,
eMSDP_MANA_MAX,
eMSDP_WIMPY,
eMSDP_PRACTICE,
eMSDP_MONEY,
eMSDP_MOVEMENT,
eMSDP_MOVEMENT_MAX,
eMSDP_HITROLL,
eMSDP_DAMROLL,
eMSDP_AC,
eMSDP_STR,
eMSDP_INT,
eMSDP_WIS,
eMSDP_DEX,
eMSDP_CON,
eMSDP_STR_PERM,
eMSDP_INT_PERM,
eMSDP_WIS_PERM,
eMSDP_DEX_PERM,
eMSDP_CON_PERM,
/* Combat */
eMSDP_OPPONENT_HEALTH,
eMSDP_OPPONENT_HEALTH_MAX,
eMSDP_OPPONENT_LEVEL,
eMSDP_OPPONENT_NAME,
/* Combat */
eMSDP_OPPONENT_HEALTH,
eMSDP_OPPONENT_HEALTH_MAX,
eMSDP_OPPONENT_LEVEL,
eMSDP_OPPONENT_NAME,
/* World */
eMSDP_AREA_NAME,
eMSDP_ROOM_EXITS,
eMSDP_ROOM_NAME,
eMSDP_ROOM_VNUM,
eMSDP_WORLD_TIME,
/* World */
eMSDP_AREA_NAME,
eMSDP_ROOM_EXITS,
eMSDP_ROOM_NAME,
eMSDP_ROOM_VNUM,
eMSDP_WORLD_TIME,
/* Configuration */
eMSDP_CLIENT_ID,
eMSDP_CLIENT_VERSION,
eMSDP_PLUGIN_ID,
eMSDP_ANSI_COLORS,
eMSDP_XTERM_256_COLORS,
eMSDP_UTF_8,
eMSDP_SOUND,
eMSDP_MXP,
/* Configuration */
eMSDP_CLIENT_ID,
eMSDP_CLIENT_VERSION,
eMSDP_PLUGIN_ID,
eMSDP_ANSI_COLORS,
eMSDP_XTERM_256_COLORS,
eMSDP_UTF_8,
eMSDP_SOUND,
eMSDP_MXP,
/* GUI variables */
eMSDP_BUTTON_1,
eMSDP_BUTTON_2,
eMSDP_BUTTON_3,
eMSDP_BUTTON_4,
eMSDP_BUTTON_5,
eMSDP_GAUGE_1,
eMSDP_GAUGE_2,
eMSDP_GAUGE_3,
eMSDP_GAUGE_4,
eMSDP_GAUGE_5,
/* GUI variables */
eMSDP_BUTTON_1,
eMSDP_BUTTON_2,
eMSDP_BUTTON_3,
eMSDP_BUTTON_4,
eMSDP_BUTTON_5,
eMSDP_GAUGE_1,
eMSDP_GAUGE_2,
eMSDP_GAUGE_3,
eMSDP_GAUGE_4,
eMSDP_GAUGE_5,
eMSDP_MAX /* This must always be last */
eMSDP_MAX /* This must always be last */
} variable_t;
typedef struct
{
variable_t Variable; /* The enum type of this variable */
const char *pName; /* The string name of this variable */
bool_t bString; /* Is this variable a string or a number? */
bool_t bConfigurable; /* Can it be configured by the client? */
bool_t bWriteOnce; /* Can only set this variable once */
bool_t bGUI; /* It's a special GUI configuration variable */
int Min; /* The minimum valid value or string length */
int Max; /* The maximum valid value or string length */
int Default; /* The default value for a number */
const char *pDefault; /* The default value for a string */
typedef struct {
variable_t Variable; /* The enum type of this variable */
const char *pName; /* The string name of this variable */
bool_t bString; /* Is this variable a string or a number? */
bool_t bConfigurable; /* Can it be configured by the client? */
bool_t bWriteOnce; /* Can only set this variable once */
bool_t bGUI; /* It's a special GUI configuration variable */
int Min; /* The minimum valid value or string length */
int Max; /* The maximum valid value or string length */
int Default; /* The default value for a number */
const char *pDefault; /* The default value for a string */
} variable_name_t;
typedef struct
{
bool_t bReport; /* Is this variable being reported? */
bool_t bDirty; /* Does this variable need to be sent again? */
int ValueInt; /* The numeric value of the variable */
char *pValueString; /* The string value of the variable */
typedef struct {
bool_t bReport; /* Is this variable being reported? */
bool_t bDirty; /* Does this variable need to be sent again? */
int ValueInt; /* The numeric value of the variable */
char *pValueString; /* The string value of the variable */
} MSDP_t;
typedef struct
{
const char *pName; /* The name of the MSSP variable */
const char *pValue; /* The value of the MSSP variable */
const char *(*pFunction)(void); /* Optional function to return the value */
typedef struct {
const char *pName; /* The name of the MSSP variable */
const char *pValue; /* The value of the MSSP variable */
const char *(*pFunction)(void); /* Optional function to return the value */
} MSSP_t;
typedef struct
{
int WriteOOB; /* Used internally to indicate OOB data */
bool_t bIACMode; /* Current mode - deals with broken packets */
bool_t bNegotiated; /* Indicates client successfully negotiated */
bool_t bBlockMXP; /* Used internally based on MXP version */
bool_t bTTYPE; /* The client supports TTYPE */
bool_t bNAWS; /* The client supports NAWS */
bool_t bCHARSET; /* The client supports CHARSET */
bool_t bMSDP; /* The client supports MSDP */
bool_t bATCP; /* The client supports ATCP */
bool_t bMSP; /* The client supports MSP */
bool_t bMXP; /* The client supports MXP */
bool_t bMCCP; /* The client supports MCCP */
support_t b256Support; /* The client supports XTerm 256 colors */
int ScreenWidth; /* The client's screen width */
int ScreenHeight; /* The client's screen height */
char *pMXPVersion; /* The version of MXP supported */
char *pLastTTYPE; /* Used for the cyclic TTYPE check */
MSDP_t **pVariables; /* The MSDP variables */
typedef struct {
int WriteOOB; /* Used internally to indicate OOB data */
bool_t bIACMode; /* Current mode - deals with broken packets */
bool_t bNegotiated; /* Indicates client successfully negotiated */
bool_t bBlockMXP; /* Used internally based on MXP version */
bool_t bTTYPE; /* The client supports TTYPE */
bool_t bNAWS; /* The client supports NAWS */
bool_t bCHARSET; /* The client supports CHARSET */
bool_t bMSDP; /* The client supports MSDP */
bool_t bATCP; /* The client supports ATCP */
bool_t bMSP; /* The client supports MSP */
bool_t bMXP; /* The client supports MXP */
bool_t bMCCP; /* The client supports MCCP */
support_t b256Support; /* The client supports XTerm 256 colors */
int ScreenWidth; /* The client's screen width */
int ScreenHeight; /* The client's screen height */
char *pMXPVersion; /* The version of MXP supported */
char *pLastTTYPE; /* Used for the cyclic TTYPE check */
MSDP_t **pVariables; /* The MSDP variables */
} protocol_t;
/******************************************************************************
@@ -222,55 +215,55 @@ typedef struct
/* Function: ProtocolCreate
*
* Creates, initialises and returns a structure containing protocol data for a
* Creates, initialises and returns a structure containing protocol data for a
* single user. This should be called when the descriptor is initialised.
*/
protocol_t *ProtocolCreate( void );
/* Function: ProtocolDestroy
*
* Frees the memory allocated by the specified structure. This should be
* Frees the memory allocated by the specified structure. This should be
* called just before a descriptor is freed.
*/
void ProtocolDestroy( protocol_t *apProtocol );
/* Function: ProtocolNegotiate
*
* Negatiates with the client to see which protocols the user supports, and
* stores the results in the user's protocol structure. Call this when you
* wish to perform negotiation (but only call it once). It is usually called
* either immediately after the user has connected, or just after they have
* Negatiates with the client to see which protocols the user supports, and
* stores the results in the user's protocol structure. Call this when you
* wish to perform negotiation (but only call it once). It is usually called
* either immediately after the user has connected, or just after they have
* entered the game.
*/
void ProtocolNegotiate( descriptor_t *apDescriptor );
/* Function: ProtocolInput
*
* Extracts any negotiation sequences from the input buffer, and passes back
* whatever is left for the mud to parse normally. Call this after data has
* Extracts any negotiation sequences from the input buffer, and passes back
* whatever is left for the mud to parse normally. Call this after data has
* been read into the input buffer, before it is used for anything else.
*/
/* MUD Primary Colours */
extern const char * RGBone;
extern const char * RGBtwo;
extern const char * RGBthree;
ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut );
extern const char * RGBthree;
ssize_t ProtocolInput( descriptor_t *apDescriptor, const char *apData, size_t aSize, char *apOut );
/* Function: ProtocolOutput
*
* This function takes a string, applies colour codes to it, and returns the
* This function takes a string, applies colour codes to it, and returns the
* result. It should be called just before writing to the output buffer.
*
* The special character used to indicate the start of a colour sequence is
* '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include
* in help files (as you can literally press the tab key) as well as strings
* (where you can use \t instead). However players can't send tabs (on most
*
* The special character used to indicate the start of a colour sequence is
* '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include
* in help files (as you can literally press the tab key) as well as strings
* (where you can use \t instead). However players can't send tabs (on most
* muds at least), so this stops them from sending colour codes to each other.
*
*
* The predefined colours are:
*
*
* n: no colour (switches colour off)
* r: dark red R: bright red
* g: dark green G: bright green
@@ -280,44 +273,44 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
* c: dark cyan C: bright cyan
* w: dark white W: bright white
* o: dark orange O: bright orange
*
* So for example "This is \tOorange\tn." will colour the word "orange". You
*
* So for example "This is \tOorange\tn." will colour the word "orange". You
* can add more colours yourself just by updating the switch statement.
*
* It's also possible to explicitly specify an RGB value, by including the four
*
* It's also possible to explicitly specify an RGB value, by including the four
* character colour sequence (as used by ColourRGB) within square brackets, eg:
*
*
* This is a \t[F010]very dark green foreground\tn.
*
*
* The square brackets can also be used to send unicode characters, like this:
*
*
* Boat: \t[U9973/B]
* Rook: \t[U9814/C]
*
* For example you might use 'B' to represent a boat on your ASCII map, or a 'C'
* to represent a castle - but players with UTF-8 support would actually see the
*
* For example you might use 'B' to represent a boat on your ASCII map, or a 'C'
* to represent a castle - but players with UTF-8 support would actually see the
* appropriate unicode characters for a boat or a rook (the chess playing piece).
*
* The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal
* number of the unicode character (see http://www.unicode.org/charts), then '/'
* followed by the ASCII character/s that should be used if the client doesn't
* support UTF-8. The ASCII sequence can be up to 7 characters in length, but in
* most cases you'll only want it to be one or two characters (so that it has the
*
* The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal
* number of the unicode character (see http://www.unicode.org/charts), then '/'
* followed by the ASCII character/s that should be used if the client doesn't
* support UTF-8. The ASCII sequence can be up to 7 characters in length, but in
* most cases you'll only want it to be one or two characters (so that it has the
* same alignment as the unicode character).
*
* Finally, this function also allows you to embed MXP tags. The easiest and
*
* Finally, this function also allows you to embed MXP tags. The easiest and
* safest way to do this is via the ( and ) bracket options:
*
*
* From here, you can walk \t(north\t).
*
*
* However it's also possible to include more explicit MSP tags, like this:
*
*
* The baker offers to sell you a \t<send href="buy pie">pie\t</send>.
*
* Note that the MXP tags will automatically be removed if the user doesn't
*
* Note that the MXP tags will automatically be removed if the user doesn't
* support MXP, but it's very important you remember to close the tags.
*/
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int *apLength );
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, size_t *apLength );
/******************************************************************************
Copyover save/load functions.
@@ -325,24 +318,24 @@ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int
/* Function: CopyoverGet
*
* Returns the protocol values stored as a short string. If your mud uses
* copyover, you should call this for each player and insert it after their
* Returns the protocol values stored as a short string. If your mud uses
* copyover, you should call this for each player and insert it after their
* name in the temporary text file.
*/
const char *CopyoverGet( descriptor_t *apDescriptor );
/* Function: CopyoverSet
*
* Call this function for each player after a copyover, passing in the string
* you added to the temporary text file. This will restore their protocol
* Call this function for each player after a copyover, passing in the string
* you added to the temporary text file. This will restore their protocol
* settings, and automatically renegotiate MSDP/ATCP.
*
* Note that the client doesn't recognise a copyover, and therefore refuses to
* renegotiate certain telnet options (to avoid loops), so they really need to
* be saved. However MSDP/ATCP is handled through scripts, and we don't want
*
* Note that the client doesn't recognise a copyover, and therefore refuses to
* renegotiate certain telnet options (to avoid loops), so they really need to
* be saved. However MSDP/ATCP is handled through scripts, and we don't want
* to have to save all of the REPORT variables, so it's easier to renegotiate.
*
* Client name and version are not saved. It is recommended you save these in
*
* Client name and version are not saved. It is recommended you save these in
* the player file, as then you can grep to collect client usage stats.
*/
void CopyoverSet( descriptor_t *apDescriptor, const char *apData );
@@ -353,33 +346,33 @@ void CopyoverSet( descriptor_t *apDescriptor, const char *apData );
/* Function: MSDPUpdate
*
* Call this regularly (I'd suggest at least once per second) to flush every
* dirty MSDP variable that has been requested by the client via REPORT. This
* Call this regularly (I'd suggest at least once per second) to flush every
* dirty MSDP variable that has been requested by the client via REPORT. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPUpdate( descriptor_t *apDescriptor );
/* Function: MSDPFlush
*
* Works like MSDPUpdate(), except only flushes a specific variable. The
* Works like MSDPUpdate(), except only flushes a specific variable. The
* variable will only actually be sent if it's both reported and dirty.
*
* Call this function after setting a variable if you want it to be reported
*
* Call this function after setting a variable if you want it to be reported
* immediately, instead of on the next update.
*/
void MSDPFlush( descriptor_t *apDescriptor, variable_t aMSDP );
/* Function: MSDPSend
*
* Send the specified MSDP variable to the player. You shouldn't ever really
* need to do this manually, except perhaps when debugging something. This
* Send the specified MSDP variable to the player. You shouldn't ever really
* need to do this manually, except perhaps when debugging something. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPSend( descriptor_t *apDescriptor, variable_t aMSDP );
/* Function: MSDPSendPair
*
* Send the specified strings to the user as an MSDP variable/value pair. This
* Send the specified strings to the user as an MSDP variable/value pair. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPSendPair( descriptor_t *apDescriptor, const char *apVariable, const char *apValue );
@@ -394,23 +387,23 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha
/* Function: MSDPSetNumber
*
* Call this whenever an MSDP integer variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* Call this whenever an MSDP integer variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* set in one place you can just move its MDSPSend() call to there.
*
*
* You can also this function for bools, chars, enums, short ints, etc.
*/
void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue );
void MSDPSetNumber(const descriptor_t *apDescriptor, variable_t aMSDP, int aValue );
/* Function: MSDPSetString
*
* Call this whenever an MSDP string variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* Call this whenever an MSDP string variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* set in one place you can just move its MDSPSend() call to there.
*/
void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
void MSDPSetString(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
/* Function: MSDPSetTable
*
@@ -421,7 +414,7 @@ void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *ap
* sprintf( Buffer, "%c%s%c%s", (char)MSDP_VAR, Name, (char)MSDP_VAL, Value );
* MSDPSetTable( d, eMSDP_TEST, Buffer );
*/
void MSDPSetTable( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
void MSDPSetTable(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
/* Function: MSDPSetArray
*
@@ -432,7 +425,7 @@ void MSDPSetTable( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
* sprintf( Buffer, "%c%s%c%s", (char)MSDP_VAL, Val1, (char)MSDP_VAL, Val2 );
* MSDPSetArray( d, eMSDP_TEST, Buffer );
*/
void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
void MSDPSetArray(const descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
/******************************************************************************
MSSP functions.
@@ -440,7 +433,7 @@ void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
/* Function: MSSPSetPlayers
*
* Stores the current number of players. The first time it's called, it also
* Stores the current number of players. The first time it's called, it also
* stores the uptime.
*/
void MSSPSetPlayers( int aPlayers );
@@ -451,17 +444,17 @@ void MSSPSetPlayers( int aPlayers );
/* Function: MXPCreateTag
*
* Puts the specified tag into a secure line, if MXP is supported. If the user
* doesn't support MXP they will see the string unchanged, meaning they will
* see the <send> tags or whatever. You should therefore check for support and
* provide a different sequence for other users, or better yet just embed MXP
* Puts the specified tag into a secure line, if MXP is supported. If the user
* doesn't support MXP they will see the string unchanged, meaning they will
* see the <send> tags or whatever. You should therefore check for support and
* provide a different sequence for other users, or better yet just embed MXP
* tags for the ProtocolOutput() function.
*/
const char *MXPCreateTag( descriptor_t *apDescriptor, const char *apTag );
const char *MXPCreateTag(const descriptor_t *apDescriptor, const char *apTag );
/* Function: MXPSendTag
*
* This works like MXPCreateTag, but instead of returning the string it sends
* This works like MXPCreateTag, but instead of returning the string it sends
* it directly to the user. This is mainly useful for the <VERSION> tag.
*/
void MXPSendTag( descriptor_t *apDescriptor, const char *apTag );
@@ -472,8 +465,8 @@ void MXPSendTag( descriptor_t *apDescriptor, const char *apTag );
/* Function: SoundSend
*
* Sends the specified sound trigger to the player, using MSDP or ATCP if
* supported, MSP if not. The trigger string itself is a relative path and
* Sends the specified sound trigger to the player, using MSDP or ATCP if
* supported, MSP if not. The trigger string itself is a relative path and
* filename, eg: SoundSend( pDesc, "monster/growl.wav" );
*/
void SoundSend( descriptor_t *apDescriptor, const char *apTrigger );
@@ -484,20 +477,20 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger );
/* Function: ColourRGB
*
* Returns a colour as an escape code, based on the RGB value provided. The
* string must be four characters, where the first is either 'f' for foreground
* or 'b' for background (case insensitive), and the other three characters are
* Returns a colour as an escape code, based on the RGB value provided. The
* string must be four characters, where the first is either 'f' for foreground
* or 'b' for background (case insensitive), and the other three characters are
* numeric digits in the range 0 to 5, representing red, green and blue.
*
* For example "F500" returns a red foreground, "B530" an orange background,
*
* For example "F500" returns a red foreground, "B530" an orange background,
* and so on. An invalid colour will clear whatever you've set previously.
*
* If the user doesn't support XTerm 256 colours, this function will return the
*
* If the user doesn't support XTerm 256 colours, this function will return the
* best-fit ANSI colour instead.
*
*
* If you wish to embed colours in strings, use ProtocolOutput().
*/
const char *ColourRGB( descriptor_t *apDescriptor, const char *apRGB );
const char *ColourRGB(const descriptor_t *apDescriptor, const char *apRGB );
/******************************************************************************
Unicode (UTF-8 conversion) functions.
@@ -511,7 +504,7 @@ char *UnicodeGet( int aValue );
/* Function: UnicodeAdd
*
* Adds the UTF-8 sequence for the specified unicode value onto the end of the
* Adds the UTF-8 sequence for the specified unicode value onto the end of the
* string, without adding a NUL character at the end.
*/
void UnicodeAdd( char **apString, int aValue );
+15 -15
View File
@@ -28,15 +28,15 @@
/*-------------------------------------------------------------------*/
/*. Function prototypes . */
static void qedit_setup_new(struct descriptor_data *d);
static void qedit_setup_existing(struct descriptor_data *d, qst_rnum rnum);
static void qedit_disp_menu(struct descriptor_data *d);
static void qedit_save_internally(struct descriptor_data *d);
static void qedit_setup_new(descriptor_data *d);
static void qedit_setup_existing(descriptor_data *d, qst_rnum rnum);
static void qedit_disp_menu(descriptor_data *d);
static void qedit_save_internally(descriptor_data *d);
static void qedit_save_to_disk(int num);
/*-------------------------------------------------------------------*/
static void qedit_save_internally(struct descriptor_data *d)
static void qedit_save_internally(descriptor_data *d)
{
add_quest(OLC_QUEST(d));
}
@@ -54,7 +54,7 @@ ACMD(do_oasis_qedit)
{
int number = NOWHERE, save = 0;
qst_rnum real_num;
struct descriptor_data *d;
descriptor_data *d;
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
@@ -192,7 +192,7 @@ ACMD(do_oasis_qedit)
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
}
static void qedit_setup_new(struct descriptor_data *d)
static void qedit_setup_new(descriptor_data *d)
{
struct aq_data *quest;
@@ -231,7 +231,7 @@ static void qedit_setup_new(struct descriptor_data *d)
/*-------------------------------------------------------------------*/
static void qedit_setup_existing(struct descriptor_data *d, qst_rnum r_num)
static void qedit_setup_existing(descriptor_data *d, qst_rnum r_num)
{
/*. Alloc some quest shaped space . */
CREATE(OLC_QUEST(d), struct aq_data, 1);
@@ -248,7 +248,7 @@ static void qedit_setup_existing(struct descriptor_data *d, qst_rnum r_num)
/*-------------------------------------------------------------------*/
/*. Display main menu . */
static void qedit_disp_menu(struct descriptor_data *d)
static void qedit_disp_menu(descriptor_data *d)
{
struct aq_data *quest;
char quest_flags[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
@@ -351,7 +351,7 @@ static void qedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = QEDIT_MAIN_MENU;
}
/* For quest type. */
static void qedit_disp_type_menu(struct descriptor_data *d)
static void qedit_disp_type_menu(descriptor_data *d)
{
clear_screen(d);
column_list(d->character, 0, quest_types, NUM_AQ_TYPES, TRUE);
@@ -359,7 +359,7 @@ static void qedit_disp_type_menu(struct descriptor_data *d)
OLC_MODE(d) = QEDIT_TYPES;
}
/* For quest flags. */
static void qedit_disp_flag_menu(struct descriptor_data *d)
static void qedit_disp_flag_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
@@ -375,7 +375,7 @@ static void qedit_disp_flag_menu(struct descriptor_data *d)
The GARGANTUAN event handler
**************************************************************************/
void qedit_parse(struct descriptor_data *d, char *arg)
void qedit_parse(descriptor_data *d, char *arg)
{
int number = atoi(arg);
char *oldtext = NULL;
@@ -692,7 +692,7 @@ void qedit_parse(struct descriptor_data *d, char *arg)
return;
}
}
OLC_QUEST(d)->next_quest = (number == -1 ? NOTHING : atoi(arg));
OLC_QUEST(d)->next_quest = (number == -1 ? NOTHING : atoidx(arg));
break;
case QEDIT_PREVQUEST:
if ((number = atoi(arg)) != -1) {
@@ -701,7 +701,7 @@ void qedit_parse(struct descriptor_data *d, char *arg)
return;
}
}
OLC_QUEST(d)->prev_quest = (number == -1 ? NOTHING : atoi(arg));
OLC_QUEST(d)->prev_quest = (number == -1 ? NOTHING : atoidx(arg));
break;
case QEDIT_GOLD:
OLC_QUEST(d)->gold_reward = LIMIT(number, 0, 99999);
@@ -734,7 +734,7 @@ void qedit_parse(struct descriptor_data *d, char *arg)
qedit_disp_menu(d);
}
void qedit_string_cleanup(struct descriptor_data *d, int terminator)
void qedit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case QEDIT_INFO:
+664 -670
View File
File diff suppressed because it is too large Load Diff
+37 -34
View File
@@ -34,27 +34,30 @@
/* AQ Flags (much room for expansion) ********************************* */
#define AQ_REPEATABLE (1 << 0) /* Quest can be repeated */
#define NUM_AQ_FLAGS 1
/* Main quest struct ************************************************** */
struct aq_data {
qst_vnum vnum; /* Virtual nr of the quest */
char *name; /* For qlist and the sort */
char *desc; /* Description of the quest */
char *info; /* Message displayed when accepted */
char *done; /* Message displayed when completed */
char *quit; /* Message displayed when quit quest */
long flags; /* Flags (repeatable, etc */
int type; /* Quest type */
mob_vnum qm; /* questmaster offering quest */
int target; /* Target value */
obj_vnum prereq; /* Object required to undertake quest */
int value[7]; /* Quest values */
int gold_reward; /* Number of gold coins given as reward */
int exp_reward; /* Experience points given as a reward */
obj_vnum obj_reward; /* vnum of object given as a reward */
qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
SPECIAL (*func); /* secondary spec_proc for the QM */
struct aq_data
{
qst_vnum vnum; /* Virtual nr of the quest */
char *name; /* For qlist and the sort */
char *desc; /* Description of the quest */
char *info; /* Message displayed when accepted */
char *done; /* Message displayed when completed */
char *quit; /* Message displayed when quit quest */
bitvector_t flags; /* Flags (repeatable, etc */
int type; /* Quest type */
mob_vnum qm; /* questmaster offering quest */
int target; /* Target value */
obj_vnum prereq; /* Object required to undertake quest */
int value[7]; /* Quest values */
int gold_reward; /* Number of gold coins given as reward */
int exp_reward; /* Experience points given as a reward */
obj_vnum obj_reward; /* vnum of object given as a reward */
qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
SPECIAL(*func); /* secondary spec_proc for the QM */
};
#define QST_NUM(i) (aquest_table[i].vnum)
#define QST_NAME(i) (aquest_table[i].name)
#define QST_DESC(i) (aquest_table[i].desc)
@@ -85,24 +88,24 @@ struct aq_data {
void destroy_quests(void);
void assign_the_quests(void);
void parse_quest(FILE *quest_f, int nr);
int count_quests(qst_vnum low, qst_vnum high);
void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax);
void set_quest(struct char_data *ch, qst_rnum rnum);
void clear_quest(struct char_data *ch);
void generic_complete_quest(struct char_data *ch);
void autoquest_trigger_check(struct char_data *ch, struct char_data *vict, struct obj_data *object, int type);
int count_quests(qst_vnum low, qst_vnum high);
void list_quests(char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax);
void set_quest(const char_data *ch, qst_rnum rnum);
void clear_quest(const char_data *ch);
void generic_complete_quest(char_data *ch);
void autoquest_trigger_check(char_data *ch, const char_data *vict, const obj_data *object, int type);
qst_rnum real_quest(qst_vnum vnum);
int is_complete(struct char_data *ch, qst_vnum vnum);
qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_rnum qm, int num);
void add_completed_quest(struct char_data *ch, qst_vnum vnum);
void remove_completed_quest(struct char_data *ch, qst_vnum vnum);
void quest_timeout(struct char_data *ch);
int is_complete(const char_data *ch, qst_vnum vnum);
qst_vnum find_quest_by_qmnum(char_data *ch, mob_rnum qm, int num);
void add_completed_quest(const char_data *ch, qst_vnum vnum);
void remove_completed_quest(const char_data *ch, qst_vnum vnum);
void quest_timeout(char_data *ch);
void check_timed_quests(void);
SPECIAL(questmaster);
ACMD(do_quest);
/* Implemented in qedit.c */
void qedit_parse(struct descriptor_data *d, char *arg);
void qedit_string_cleanup(struct descriptor_data *d, int terminator);
void qedit_parse(descriptor_data *d, char *arg);
void qedit_string_cleanup(descriptor_data *d, int terminator);
/* Implemented in genqst.c */
int copy_quest_strings(struct aq_data *from, struct aq_data *to);
int copy_quest(struct aq_data *from, struct aq_data *to, int free_old_strings);
@@ -141,7 +144,7 @@ int save_quests(zone_rnum zone_num);
/* ******************************************************************** */
/* AQ Global Variables ************************************************ */
extern const char *aq_flags[]; /* names for quest flags (quest.c) */
extern const char *quest_types[]; /* named for quest types (quest.c) */
extern const char *aq_flags[]; /* names for quest flags (quest.c) */
extern const char *quest_types[]; /* named for quest types (quest.c) */
#endif /* _QUEST_H_ */
+25 -28
View File
@@ -23,13 +23,13 @@
#include "modify.h"
/* local functions */
static void redit_setup_new(struct descriptor_data *d);
static void redit_disp_extradesc_menu(struct descriptor_data *d);
static void redit_disp_exit_menu(struct descriptor_data *d);
static void redit_disp_exit_flag_menu(struct descriptor_data *d);
static void redit_disp_flag_menu(struct descriptor_data *d);
static void redit_disp_sector_menu(struct descriptor_data *d);
static void redit_disp_menu(struct descriptor_data *d);
static void redit_setup_new(descriptor_data *d);
static void redit_disp_extradesc_menu(descriptor_data *d);
static void redit_disp_exit_menu(descriptor_data *d);
static void redit_disp_exit_flag_menu(descriptor_data *d);
static void redit_disp_flag_menu(descriptor_data *d);
static void redit_disp_sector_menu(descriptor_data *d);
static void redit_disp_menu(descriptor_data *d);
/* Utils and exported functions. */
ACMD(do_oasis_redit)
@@ -37,7 +37,7 @@ ACMD(do_oasis_redit)
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int number = NOWHERE, save = 0, real_num;
struct descriptor_data *d;
descriptor_data *d;
/* No building as a mob or while being forced. */
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
@@ -57,7 +57,7 @@ ACMD(do_oasis_redit)
save = TRUE;
if (is_number(buf2))
number = atoi(buf2);
number = atoidx(buf2);
else if (GET_OLC_ZONE(ch) != NOWHERE) {
zone_rnum zlok;
@@ -75,7 +75,7 @@ ACMD(do_oasis_redit)
/* If a numeric argument was given (like a room number), get it. */
if (number == NOWHERE)
number = atoi(buf1);
number = atoidx(buf1);
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
send_to_char(ch, "That room VNUM can't exist.\r\n");
@@ -152,7 +152,7 @@ ACMD(do_oasis_redit)
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
}
static void redit_setup_new(struct descriptor_data *d)
static void redit_setup_new(descriptor_data *d)
{
CREATE(OLC_ROOM(d), struct room_data, 1);
@@ -165,7 +165,7 @@ static void redit_setup_new(struct descriptor_data *d)
OLC_VAL(d) = 0;
}
void redit_setup_existing(struct descriptor_data *d, int real_num)
void redit_setup_existing(descriptor_data *d, int real_num)
{
struct room_data *room;
int counter;
@@ -231,10 +231,10 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
SCRIPT(room) = NULL;
}
void redit_save_internally(struct descriptor_data *d)
void redit_save_internally(descriptor_data *d)
{
int j, room_num, new_room = FALSE;
struct descriptor_data *dsc;
descriptor_data *dsc;
if (OLC_ROOM(d)->number == NOWHERE)
new_room = TRUE;
@@ -312,7 +312,7 @@ void free_room(struct room_data *room)
/* Menu functions */
/* For extra descriptions. */
static void redit_disp_extradesc_menu(struct descriptor_data *d)
static void redit_disp_extradesc_menu(descriptor_data *d)
{
struct extra_descr_data *extra_desc = OLC_DESC(d);
@@ -333,7 +333,7 @@ static void redit_disp_extradesc_menu(struct descriptor_data *d)
}
/* For exits. */
static void redit_disp_exit_menu(struct descriptor_data *d)
static void redit_disp_exit_menu(descriptor_data *d)
{
char door_buf[24];
/* if exit doesn't exist, alloc/create it */
@@ -377,7 +377,7 @@ static void redit_disp_exit_menu(struct descriptor_data *d)
}
/* For exit flags. */
static void redit_disp_exit_flag_menu(struct descriptor_data *d)
static void redit_disp_exit_flag_menu(descriptor_data *d)
{
get_char_colors(d->character);
write_to_output(d, "%s0%s) No door\r\n"
@@ -389,7 +389,7 @@ static void redit_disp_exit_flag_menu(struct descriptor_data *d)
}
/* For room flags. */
static void redit_disp_flag_menu(struct descriptor_data *d)
static void redit_disp_flag_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
@@ -404,7 +404,7 @@ static void redit_disp_flag_menu(struct descriptor_data *d)
}
/* For sector type. */
static void redit_disp_sector_menu(struct descriptor_data *d)
static void redit_disp_sector_menu(descriptor_data *d)
{
clear_screen(d);
column_list(d->character, 0, sector_types, NUM_ROOM_SECTORS, TRUE);
@@ -413,7 +413,7 @@ static void redit_disp_sector_menu(struct descriptor_data *d)
}
/* The main menu. */
static void redit_disp_menu(struct descriptor_data *d)
static void redit_disp_menu(descriptor_data *d)
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@@ -515,7 +515,7 @@ static void redit_disp_menu(struct descriptor_data *d)
}
/* The main loop*/
void redit_parse(struct descriptor_data *d, char *arg)
void redit_parse(descriptor_data *d, char *arg)
{
int number;
char *oldtext = NULL;
@@ -799,11 +799,8 @@ void redit_parse(struct descriptor_data *d, char *arg)
return;
case REDIT_EXIT_KEY:
number = atoi(arg);
if (number < 0)
OLC_EXIT(d)->key = NOTHING;
else
OLC_EXIT(d)->key = number;
number = atoidx(arg);
OLC_EXIT(d)->key = number;
redit_disp_exit_menu(d);
return;
@@ -886,7 +883,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
break;
case REDIT_COPY:
if ((number = real_room(atoi(arg))) != NOWHERE) {
if ((number = real_room(atoidx(arg))) != NOWHERE) {
redit_setup_existing(d, number);
} else
write_to_output(d, "That room does not exist.\r\n");
@@ -920,7 +917,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
redit_disp_menu(d);
}
void redit_string_cleanup(struct descriptor_data *d, int terminator)
void redit_string_cleanup(descriptor_data *d, int terminator)
{
switch (OLC_MODE(d)) {
case REDIT_DESC:
+151 -151
View File
@@ -1,183 +1,183 @@
/**
* @file screen.h
* Header file with ANSI color codes for online color.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _SCREEN_H_
#define _SCREEN_H_
#define CNRM "\x1B[0;0m" /* "Normal" */
#define CNUL "" /* No Change */
#define KNRM "\x1B[0m" /* Foreground "Normal" */
#define KBLK "\x1b[0;30m" /* Foreground Black */
#define KRED "\x1B[0;31m" /* Foreground Dark Red */
#define KGRN "\x1B[0;32m" /* Foreground Dark Green */
#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */
#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */
#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */
#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */
#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */
#define KNUL "" /* Foreground No Change */
#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */
#define BRED "\x1B[1;31m" /* Foreground Bright Red */
#define BGRN "\x1B[1;32m" /* Foreground Bright Green */
#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */
#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */
#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */
#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */
#define BWHT "\x1B[1;37m" /* Foreground Bright White */
#define CNRM "\x1B[0;0m" /* "Normal" */
#define CNUL "" /* No Change */
#define KNRM "\x1B[0m" /* Foreground "Normal" */
#define KBLK "\x1b[0;30m" /* Foreground Black */
#define KRED "\x1B[0;31m" /* Foreground Dark Red */
#define KGRN "\x1B[0;32m" /* Foreground Dark Green */
#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */
#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */
#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */
#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */
#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */
#define KNUL "" /* Foreground No Change */
#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */
#define BRED "\x1B[1;31m" /* Foreground Bright Red */
#define BGRN "\x1B[1;32m" /* Foreground Bright Green */
#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */
#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */
#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */
#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */
#define BWHT "\x1B[1;37m" /* Foreground Bright White */
#define BKBLK "\x1B[40m" /* Background Black */
#define BKRED "\x1B[41m" /* Background Dark Red */
#define BKGRN "\x1B[42m" /* Background Dark Green */
#define BKYEL "\x1B[43m" /* Background Dark Yellow */
#define BKBLU "\x1B[44m" /* Background Dark Blue */
#define BKMAG "\x1B[45m" /* Background Dark Magenta */
#define BKCYN "\x1B[46m" /* Background Dark Cyan */
#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */
#define BKBLK "\x1B[40m" /* Background Black */
#define BKRED "\x1B[41m" /* Background Dark Red */
#define BKGRN "\x1B[42m" /* Background Dark Green */
#define BKYEL "\x1B[43m" /* Background Dark Yellow */
#define BKBLU "\x1B[44m" /* Background Dark Blue */
#define BKMAG "\x1B[45m" /* Background Dark Magenta */
#define BKCYN "\x1B[46m" /* Background Dark Cyan */
#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */
#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */
#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */
#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */
#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */
#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */
#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */
#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */
#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */
#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */
#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */
#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */
#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */
#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */
#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */
#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */
#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */
#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */
#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */
#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */
#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */
#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */
#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */
#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */
#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */
#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */
#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */
#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */
#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */
#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */
#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */
#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */
#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */
#define CBEEP "\x07"
#define CBEEP "\x07"
#define CAT "@@"
#define CAMP "&"
#define CSLH "\\"
#define CAMP "&"
#define CSLH "\\"
#define CUDL "\x1B[4m" /* Underline ANSI code */
#define CUDL "\x1B[4m" /* Underline ANSI code */
#define CFSH "\x1B[5m" /* Flashing ANSI code. Change to #define CFSH "" if
* you want to disable flashing colour codes
*/
#define CRVS "\x1B[7m" /* Reverse video ANSI code */
*/
#define CRVS "\x1B[7m" /* Reverse video ANSI code */
/* conditional color. pass it a pointer to a char_data and a color level. */
#define C_OFF 0
#define C_SPR 1
#define C_NRM 2
#define C_CMP 3
/* conditional color. pass it a pointer to a char_data and a color level. */
#define C_OFF 0
#define C_SPR 1
#define C_NRM 2
#define C_CMP 3
#define _clrlevel(ch) (!IS_NPC(ch) ? (PRF_FLAGGED((ch), PRF_COLOR_1) ? 1 : 0) + \
(PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0)
#define clr(ch,lvl) (_clrlevel(ch) >= (lvl))
(PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0)
#define clr(ch,lvl) (_clrlevel(ch) >= (lvl))
/* Player dependant foreground color codes */
#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL)
#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL)
#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL)
#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL)
#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL)
#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL)
#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL)
#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL)
#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL)
/* Player dependant foreground color codes */
#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL)
#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL)
#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL)
#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL)
#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL)
#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL)
#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL)
#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL)
#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL)
/* Bright colors */
#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL)
#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL)
#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL)
#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL)
#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL)
#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL)
#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL)
#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL)
/* Bright colors */
#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL)
#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL)
#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL)
#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL)
#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL)
#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL)
#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL)
#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL)
/* Flashing colors */
#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL)
#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL)
#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL)
#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL)
#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL)
#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL)
#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL)
/* Flashing colors */
#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL)
#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL)
#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL)
#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL)
#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL)
#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL)
#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL)
/* Flashing bright colors */
#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL)
#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL)
#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL)
#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL)
#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL)
#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL)
#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL)
/* Flashing bright colors */
#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL)
#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL)
#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL)
#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL)
#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL)
#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL)
#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL)
/* Background colors */
#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL)
#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL)
#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL)
#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL)
#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL)
#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL)
#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL)
#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL)
/* Background colors */
#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL)
#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL)
#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL)
#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL)
#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL)
#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL)
#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL)
#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL)
#define COLOR_LEV(ch) (_clrlevel(ch))
#define COLOR_LEV(ch) (_clrlevel(ch))
/* Simplified color codes */
#define QNRM CCNRM(ch,C_SPR)
#define QBLK CCBLK(ch,C_SPR)
#define QRED CCRED(ch,C_SPR)
#define QGRN CCGRN(ch,C_SPR)
#define QYEL CCYEL(ch,C_SPR)
#define QBLU CCBLU(ch,C_SPR)
#define QMAG CCMAG(ch,C_SPR)
#define QCYN CCCYN(ch,C_SPR)
#define QWHT CCWHT(ch,C_SPR)
/* Simplified color codes */
#define QNRM CCNRM(ch,C_SPR)
#define QBLK CCBLK(ch,C_SPR)
#define QRED CCRED(ch,C_SPR)
#define QGRN CCGRN(ch,C_SPR)
#define QYEL CCYEL(ch,C_SPR)
#define QBLU CCBLU(ch,C_SPR)
#define QMAG CCMAG(ch,C_SPR)
#define QCYN CCCYN(ch,C_SPR)
#define QWHT CCWHT(ch,C_SPR)
/* simplified brights */
#define QBBLK CBBLK(ch,C_SPR)
#define QBRED CBRED(ch,C_SPR)
#define QBGRN CBGRN(ch,C_SPR)
#define QBYEL CBYEL(ch,C_SPR)
#define QBBLU CBBLU(ch,C_SPR)
#define QBMAG CBMAG(ch,C_SPR)
#define QBCYN CBCYN(ch,C_SPR)
#define QBWHT CBWHT(ch,C_SPR)
/* simplified brights */
#define QBBLK CBBLK(ch,C_SPR)
#define QBRED CBRED(ch,C_SPR)
#define QBGRN CBGRN(ch,C_SPR)
#define QBYEL CBYEL(ch,C_SPR)
#define QBBLU CBBLU(ch,C_SPR)
#define QBMAG CBMAG(ch,C_SPR)
#define QBCYN CBCYN(ch,C_SPR)
#define QBWHT CBWHT(ch,C_SPR)
/* Simplified Flashing */
#define QFRED CCFRED(ch,C_SPR)
#define QFGRN CCFGRN(ch,C_SPR)
#define QFYEL CCFYEL(ch,C_SPR)
#define QFBLU CCFBLU(ch,C_SPR)
#define QFMAG CCFMAG(ch,C_SPR)
#define QFCYN CCFCYN(ch,C_SPR)
#define QFWHT CCFWHT(ch,C_SPR)
/* Simplified Flashing */
#define QFRED CCFRED(ch,C_SPR)
#define QFGRN CCFGRN(ch,C_SPR)
#define QFYEL CCFYEL(ch,C_SPR)
#define QFBLU CCFBLU(ch,C_SPR)
#define QFMAG CCFMAG(ch,C_SPR)
#define QFCYN CCFCYN(ch,C_SPR)
#define QFWHT CCFWHT(ch,C_SPR)
/* Simplified Bright Flashing */
#define QBFRED CBFRED(ch,C_SPR)
#define QBFGRN CBFGRN(ch,C_SPR)
#define QBFYEL CBFYEL(ch,C_SPR)
#define QBFBLU CBFBLU(ch,C_SPR)
#define QBFMAG CBFMAG(ch,C_SPR)
#define QBFCYN CBFCYN(ch,C_SPR)
#define QBFWHT CBFWHT(ch,C_SPR)
/* Simplified Bright Flashing */
#define QBFRED CBFRED(ch,C_SPR)
#define QBFGRN CBFGRN(ch,C_SPR)
#define QBFYEL CBFYEL(ch,C_SPR)
#define QBFBLU CBFBLU(ch,C_SPR)
#define QBFMAG CBFMAG(ch,C_SPR)
#define QBFCYN CBFCYN(ch,C_SPR)
#define QBFWHT CBFWHT(ch,C_SPR)
/* Simplified Backgrounds */
#define QBKBLK CBKBLK(ch,C_SPR)
#define QBKRED CBKRED(ch,C_SPR)
#define QBKGRN CBKGRN(ch,C_SPR)
#define QBKYEL CBKYEL(ch,C_SPR)
#define QBKBLU CBKBLU(ch,C_SPR)
#define QBKMAG CBKMAG(ch,C_SPR)
#define QBKCYN CBKCYN(ch,C_SPR)
#define QBKWHT CBKWHT(ch,C_SPR)
/* Simplified Backgrounds */
#define QBKBLK CBKBLK(ch,C_SPR)
#define QBKRED CBKRED(ch,C_SPR)
#define QBKGRN CBKGRN(ch,C_SPR)
#define QBKYEL CBKYEL(ch,C_SPR)
#define QBKBLU CBKBLU(ch,C_SPR)
#define QBKMAG CBKMAG(ch,C_SPR)
#define QBKCYN CBKCYN(ch,C_SPR)
#define QBKWHT CBKWHT(ch,C_SPR)
#endif /* _SCREEN_H_ */
+24 -24
View File
@@ -21,19 +21,19 @@
#include "shop.h"
/* local functions */
static void sedit_setup_new(struct descriptor_data *d);
static void sedit_setup_new(descriptor_data *d);
static void sedit_save_to_disk(int zone_num);
static void sedit_products_menu(struct descriptor_data *d);
static void sedit_compact_rooms_menu(struct descriptor_data *d);
static void sedit_rooms_menu(struct descriptor_data *d);
static void sedit_namelist_menu(struct descriptor_data *d);
static void sedit_shop_flags_menu(struct descriptor_data *d);
static void sedit_no_trade_menu(struct descriptor_data *d);
static void sedit_types_menu(struct descriptor_data *d);
static void sedit_disp_menu(struct descriptor_data *d);
static void sedit_products_menu(descriptor_data *d);
static void sedit_compact_rooms_menu(descriptor_data *d);
static void sedit_rooms_menu(descriptor_data *d);
static void sedit_namelist_menu(descriptor_data *d);
static void sedit_shop_flags_menu(descriptor_data *d);
static void sedit_no_trade_menu(descriptor_data *d);
static void sedit_types_menu(descriptor_data *d);
static void sedit_disp_menu(descriptor_data *d);
void sedit_save_internally(struct descriptor_data *d)
void sedit_save_internally(descriptor_data *d)
{
OLC_SHOP(d)->vnum = OLC_NUM(d);
add_shop(OLC_SHOP(d));
@@ -49,7 +49,7 @@ ACMD(do_oasis_sedit)
{
int number = NOWHERE, save = 0;
shop_rnum real_num;
struct descriptor_data *d;
descriptor_data *d;
char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH];
@@ -72,7 +72,7 @@ ACMD(do_oasis_sedit)
save = TRUE;
if (is_number(buf2))
number = atoi(buf2);
number = atoidx(buf2);
else if (GET_OLC_ZONE(ch) > 0) {
zone_rnum zlok;
@@ -90,7 +90,7 @@ ACMD(do_oasis_sedit)
/* If a numeric argument was given, get it. */
if (number == NOWHERE)
number = atoi(buf1);
number = atoidx(buf1);
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
send_to_char(ch, "That shop VNUM can't exist.\r\n");
@@ -171,7 +171,7 @@ ACMD(do_oasis_sedit)
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
}
static void sedit_setup_new(struct descriptor_data *d)
static void sedit_setup_new(descriptor_data *d)
{
struct shop_data *shop;
@@ -207,7 +207,7 @@ static void sedit_setup_new(struct descriptor_data *d)
OLC_SHOP(d) = shop;
}
void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
void sedit_setup_existing(descriptor_data *d, int rshop_num)
{
/* Create a scratch shop structure. */
CREATE(OLC_SHOP(d), struct shop_data, 1);
@@ -217,7 +217,7 @@ void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
}
/* Menu functions */
static void sedit_products_menu(struct descriptor_data *d)
static void sedit_products_menu(descriptor_data *d)
{
struct shop_data *shop;
int i;
@@ -241,7 +241,7 @@ static void sedit_products_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_PRODUCTS_MENU;
}
static void sedit_compact_rooms_menu(struct descriptor_data *d)
static void sedit_compact_rooms_menu(descriptor_data *d)
{
struct shop_data *shop;
int i;
@@ -267,7 +267,7 @@ static void sedit_compact_rooms_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_ROOMS_MENU;
}
static void sedit_rooms_menu(struct descriptor_data *d)
static void sedit_rooms_menu(descriptor_data *d)
{
struct shop_data *shop;
int i;
@@ -298,7 +298,7 @@ static void sedit_rooms_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_ROOMS_MENU;
}
static void sedit_namelist_menu(struct descriptor_data *d)
static void sedit_namelist_menu(descriptor_data *d)
{
struct shop_data *shop;
int i;
@@ -322,7 +322,7 @@ static void sedit_namelist_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_NAMELIST_MENU;
}
static void sedit_shop_flags_menu(struct descriptor_data *d)
static void sedit_shop_flags_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
int i, count = 0;
@@ -339,7 +339,7 @@ static void sedit_shop_flags_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_SHOP_FLAGS;
}
static void sedit_no_trade_menu(struct descriptor_data *d)
static void sedit_no_trade_menu(descriptor_data *d)
{
char bits[MAX_STRING_LENGTH];
int i, count = 0;
@@ -356,7 +356,7 @@ static void sedit_no_trade_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_NOTRADE;
}
static void sedit_types_menu(struct descriptor_data *d)
static void sedit_types_menu(descriptor_data *d)
{
int i, count = 0;
@@ -372,7 +372,7 @@ static void sedit_types_menu(struct descriptor_data *d)
}
/* Display main menu. */
static void sedit_disp_menu(struct descriptor_data *d)
static void sedit_disp_menu(descriptor_data *d)
{
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
@@ -431,7 +431,7 @@ static void sedit_disp_menu(struct descriptor_data *d)
}
/* The GARGANTUAN event handler */
void sedit_parse(struct descriptor_data *d, char *arg)
void sedit_parse(descriptor_data *d, char *arg)
{
int i;

Some files were not shown because too many files have changed in this diff Show More