forked from kyonshi/grenzland-mud
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 744286a1f7 | |||
| df3aefe9b8 | |||
| 0e110b93d5 | |||
| b489a72c58 | |||
| 9c5787129b | |||
| fdb6ff3771 | |||
| 5c44f0575e | |||
| e6085172d5 |
@@ -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
|
||||||
|
...
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
select foo.com 1745106858 Welcor
|
||||||
|
|||||||
+41
-31
@@ -45,7 +45,7 @@ ACMD(do_say)
|
|||||||
send_to_char(ch, "Yes, but WHAT do you want to say?\r\n");
|
send_to_char(ch, "Yes, but WHAT do you want to say?\r\n");
|
||||||
else {
|
else {
|
||||||
char buf[MAX_INPUT_LENGTH + 14], *msg;
|
char buf[MAX_INPUT_LENGTH + 14], *msg;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||||
parse_at(argument);
|
parse_at(argument);
|
||||||
@@ -86,7 +86,8 @@ ACMD(do_gsay)
|
|||||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||||
parse_at(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));
|
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))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
|
||||||
send_to_char(ch, "%s", CONFIG_OK);
|
send_to_char(ch, "%s", CONFIG_OK);
|
||||||
@@ -95,7 +96,7 @@ ACMD(do_gsay)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
char buf[MAX_STRING_LENGTH], *msg;
|
||||||
|
|
||||||
@@ -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);
|
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)
|
if (!ch)
|
||||||
log("SYSERR: is_tell_ok called with no characters");
|
log("SYSERR: is_tell_ok called with no characters");
|
||||||
@@ -131,7 +132,8 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
|
|||||||
act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
||||||
else if (PLR_FLAGGED(vict, PLR_WRITING))
|
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);
|
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);
|
act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
||||||
else
|
else
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -143,7 +145,7 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
|
|||||||
* called frequently, and should IMHO be kept as tight as possible. */
|
* called frequently, and should IMHO be kept as tight as possible. */
|
||||||
ACMD(do_tell)
|
ACMD(do_tell)
|
||||||
{
|
{
|
||||||
struct char_data *vict = NULL;
|
char_data *vict = NULL;
|
||||||
char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants
|
char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants
|
||||||
|
|
||||||
half_chop(argument, buf, buf2);
|
half_chop(argument, buf, buf2);
|
||||||
@@ -163,7 +165,7 @@ ACMD(do_tell)
|
|||||||
|
|
||||||
ACMD(do_reply)
|
ACMD(do_reply)
|
||||||
{
|
{
|
||||||
struct char_data *tch = character_list;
|
char_data *tch = character_list;
|
||||||
|
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
return;
|
return;
|
||||||
@@ -197,7 +199,7 @@ ACMD(do_reply)
|
|||||||
ACMD(do_spec_comm)
|
ACMD(do_spec_comm)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
const char *action_sing, *action_plur, *action_others;
|
const char *action_sing, *action_plur, *action_others;
|
||||||
|
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
@@ -247,7 +249,7 @@ ACMD(do_spec_comm)
|
|||||||
|
|
||||||
ACMD(do_write)
|
ACMD(do_write)
|
||||||
{
|
{
|
||||||
struct obj_data *paper, *pen = NULL;
|
obj_data *paper, *pen = NULL;
|
||||||
char *papername, *penname;
|
char *papername, *penname;
|
||||||
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -326,8 +328,8 @@ ACMD(do_write)
|
|||||||
|
|
||||||
ACMD(do_page)
|
ACMD(do_page)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
char buf2[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
char buf2[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
half_chop(argument, arg, buf2);
|
half_chop(argument, arg, buf2);
|
||||||
@@ -363,7 +365,7 @@ ACMD(do_page)
|
|||||||
/* Generalized communication function by Fred C. Merkel (Torg). */
|
/* Generalized communication function by Fred C. Merkel (Torg). */
|
||||||
ACMD(do_gen_comm)
|
ACMD(do_gen_comm)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
char color_on[24];
|
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;
|
bool emoting = FALSE;
|
||||||
@@ -392,35 +394,42 @@ ACMD(do_gen_comm)
|
|||||||
* [2] message if you're not on the channel
|
* [2] message if you're not on the channel
|
||||||
* [3] a color string. */
|
* [3] a color string. */
|
||||||
const char *com_msgs[][4] = {
|
const char *com_msgs[][4] = {
|
||||||
{"You cannot holler!!\r\n",
|
{
|
||||||
|
"You cannot holler!!\r\n",
|
||||||
"holler",
|
"holler",
|
||||||
"",
|
"",
|
||||||
KYEL},
|
KYEL
|
||||||
|
},
|
||||||
{"You cannot shout!!\r\n",
|
{
|
||||||
|
"You cannot shout!!\r\n",
|
||||||
"shout",
|
"shout",
|
||||||
"Turn off your noshout flag first!\r\n",
|
"Turn off your noshout flag first!\r\n",
|
||||||
KYEL},
|
KYEL
|
||||||
|
},
|
||||||
{"You cannot gossip!!\r\n",
|
{
|
||||||
|
"You cannot gossip!!\r\n",
|
||||||
"gossip",
|
"gossip",
|
||||||
"You aren't even on the channel!\r\n",
|
"You aren't even on the channel!\r\n",
|
||||||
KYEL},
|
KYEL
|
||||||
|
},
|
||||||
{"You cannot auction!!\r\n",
|
{
|
||||||
|
"You cannot auction!!\r\n",
|
||||||
"auction",
|
"auction",
|
||||||
"You aren't even on the channel!\r\n",
|
"You aren't even on the channel!\r\n",
|
||||||
KMAG},
|
KMAG
|
||||||
|
},
|
||||||
{"You cannot congratulate!\r\n",
|
{
|
||||||
|
"You cannot congratulate!\r\n",
|
||||||
"congrat",
|
"congrat",
|
||||||
"You aren't even on the channel!\r\n",
|
"You aren't even on the channel!\r\n",
|
||||||
KGRN},
|
KGRN
|
||||||
|
},
|
||||||
{"You cannot gossip your emotions!\r\n",
|
{
|
||||||
|
"You cannot gossip your emotions!\r\n",
|
||||||
"gossip",
|
"gossip",
|
||||||
"You aren't even on the channel!\r\n",
|
"You aren't even on the channel!\r\n",
|
||||||
KYEL}
|
KYEL
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (PLR_FLAGGED(ch, PLR_NOSHOUT)) {
|
if (PLR_FLAGGED(ch, PLR_NOSHOUT)) {
|
||||||
@@ -443,7 +452,8 @@ ACMD(do_gen_comm)
|
|||||||
|
|
||||||
/* Level_can_shout defined in config.c. */
|
/* Level_can_shout defined in config.c. */
|
||||||
if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
/* Make sure the char is on the channel. */
|
/* Make sure the char is on the channel. */
|
||||||
@@ -518,7 +528,7 @@ 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);
|
send_to_char(ch, "%c%s? Yes, fine, %s we must, but WHAT??\r\n", UPPER(*CMD_NAME), CMD_NAME + 1, CMD_NAME);
|
||||||
else {
|
else {
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
|
|
||||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||||
parse_at(argument);
|
parse_at(argument);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ char *find_exdesc(char *word, struct extra_descr_data *list);
|
|||||||
void space_to_minus(char *str);
|
void space_to_minus(char *str);
|
||||||
/** @todo Move to a help module? */
|
/** @todo Move to a help module? */
|
||||||
int search_help(const char *argument, int level);
|
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);
|
void free_recent_players(void);
|
||||||
/* functions with subcommands */
|
/* functions with subcommands */
|
||||||
/* do_commands */
|
/* do_commands */
|
||||||
@@ -109,10 +109,10 @@ ACMD(do_whois);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Utility Functions */
|
/* Utility Functions */
|
||||||
/** @todo Compare with needs of find_eq_pos_script. */
|
/** @todo Compare with needs of find_eq_pos_script. */
|
||||||
int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg);
|
int find_eq_pos(char_data *ch, obj_data *obj, char *arg);
|
||||||
void name_from_drinkcon(struct obj_data *obj);
|
void name_from_drinkcon(obj_data *obj);
|
||||||
void name_to_drinkcon(struct obj_data *obj, int type);
|
void name_to_drinkcon(obj_data *obj, int type);
|
||||||
void weight_change_object(struct obj_data *obj, int weight);
|
void weight_change_object(obj_data *obj, int weight);
|
||||||
/* functions with subcommands */
|
/* functions with subcommands */
|
||||||
/* do_drop */
|
/* do_drop */
|
||||||
ACMD(do_drop);
|
ACMD(do_drop);
|
||||||
@@ -268,7 +268,6 @@ ACMD(do_action);
|
|||||||
ACMD(do_gmote);
|
ACMD(do_gmote);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Begin Functions and defines for act.wizard.c
|
* 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 */
|
/** @todo should probably be moved to a more general file handler module */
|
||||||
void clean_llog_entries(void);
|
void clean_llog_entries(void);
|
||||||
/** @todo This should be moved to a more general utility file */
|
/** @todo This should be moved to a more general utility file */
|
||||||
int script_command_interpreter(struct char_data *ch, char *arg);
|
int script_command_interpreter(char_data *ch, char *arg);
|
||||||
room_rnum find_target_room(struct char_data *ch, char *rawroomstr);
|
room_rnum find_target_room(char_data *ch, char *rawroomstr);
|
||||||
void perform_immort_vis(struct char_data *ch);
|
void perform_immort_vis(char_data *ch);
|
||||||
void snoop_check(struct char_data *ch);
|
void snoop_check(char_data *ch);
|
||||||
bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name);
|
bool change_player_name(char_data *ch, char_data *vict, char *new_name);
|
||||||
bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr);
|
bool AddRecentPlayer(char *chname, char *chhost, bool newplr, bool cpyplr);
|
||||||
/* Functions with subcommands */
|
/* Functions with subcommands */
|
||||||
/* do_date */
|
/* do_date */
|
||||||
@@ -327,7 +326,7 @@ ACMD(do_plist);
|
|||||||
ACMD(do_purge);
|
ACMD(do_purge);
|
||||||
ACMD(do_recent);
|
ACMD(do_recent);
|
||||||
ACMD(do_restore);
|
ACMD(do_restore);
|
||||||
void return_to_char(struct char_data * ch);
|
void return_to_char(char_data *ch);
|
||||||
ACMD(do_return);
|
ACMD(do_return);
|
||||||
ACMD(do_saveall);
|
ACMD(do_saveall);
|
||||||
ACMD(do_send);
|
ACMD(do_send);
|
||||||
|
|||||||
+263
-188
@@ -31,23 +31,23 @@
|
|||||||
|
|
||||||
/* prototypes of local functions */
|
/* prototypes of local functions */
|
||||||
/* do_diagnose utility functions */
|
/* do_diagnose utility functions */
|
||||||
static void diag_char_to_char(struct char_data *i, struct char_data *ch);
|
static void diag_char_to_char(char_data *i, char_data *ch);
|
||||||
/* do_look and do_examine utility functions */
|
/* do_look and do_examine utility functions */
|
||||||
static void do_auto_exits(struct char_data *ch);
|
static void do_auto_exits(char_data *ch);
|
||||||
static void list_char_to_char(struct char_data *list, struct char_data *ch);
|
static void list_char_to_char(char_data *list, char_data *ch);
|
||||||
static void list_one_char(struct char_data *i, struct char_data *ch);
|
static void list_one_char(char_data *i, char_data *ch);
|
||||||
static void look_at_char(struct char_data *i, struct char_data *ch);
|
static void look_at_char(char_data *i, char_data *ch);
|
||||||
static void look_at_target(struct char_data *ch, char *arg);
|
static void look_at_target(char_data *ch, char *arg);
|
||||||
static void look_in_direction(struct char_data *ch, int dir);
|
static void look_in_direction(char_data *ch, int dir);
|
||||||
static void look_in_obj(struct char_data *ch, char *arg);
|
static void look_in_obj(char_data *ch, char *arg);
|
||||||
/* do_look, do_inventory utility functions */
|
/* do_look, do_inventory utility functions */
|
||||||
static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show);
|
static void list_obj_to_char(obj_data *list, char_data *ch, int mode, int show);
|
||||||
/* do_look, do_equipment, do_examine, do_inventory */
|
/* do_look, do_equipment, do_examine, do_inventory */
|
||||||
static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode);
|
static void show_obj_to_char(obj_data *obj, char_data *ch, int mode);
|
||||||
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch);
|
static void show_obj_modifiers(obj_data *obj, char_data *ch);
|
||||||
/* do_where utility functions */
|
/* do_where utility functions */
|
||||||
static void perform_immort_where(char_data *ch, const char *arg);
|
static void perform_immort_where(char_data *ch, const char *arg);
|
||||||
static void perform_mortal_where(struct char_data *ch, char *arg);
|
static void perform_mortal_where(char_data *ch, char *arg);
|
||||||
static size_t print_object_location(int num, const obj_data *obj, const char_data *ch,
|
static size_t print_object_location(int num, const obj_data *obj, const char_data *ch,
|
||||||
char *buf, size_t len, size_t buf_size, int recur);
|
char *buf, size_t len, size_t buf_size, int recur);
|
||||||
/* Subcommands */
|
/* Subcommands */
|
||||||
@@ -56,10 +56,10 @@ static size_t print_object_location(int num, const obj_data *obj, const char_dat
|
|||||||
#define SHOW_OBJ_SHORT 1
|
#define SHOW_OBJ_SHORT 1
|
||||||
#define SHOW_OBJ_ACTION 2
|
#define SHOW_OBJ_ACTION 2
|
||||||
|
|
||||||
static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
|
static void show_obj_to_char(obj_data *obj, char_data *ch, int mode)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
struct char_data *temp;
|
char_data *temp;
|
||||||
|
|
||||||
if (!obj || !ch) {
|
if (!obj || !ch) {
|
||||||
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", (void *)obj, (void *)ch);
|
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", (void *)obj, (void *)ch);
|
||||||
@@ -77,8 +77,8 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod
|
|||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
send_to_char(ch, "You are %s upon %s.", GET_POS(ch) == POS_SITTING ? "sitting" :
|
send_to_char(ch, "You are %s upon %s.", GET_POS(ch) == POS_SITTING ? "sitting" : "resting",
|
||||||
"resting", obj->short_description);
|
obj->short_description);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod
|
|||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch)
|
static void show_obj_modifiers(obj_data *obj, char_data *ch)
|
||||||
{
|
{
|
||||||
if (OBJ_FLAGGED(obj, ITEM_INVISIBLE))
|
if (OBJ_FLAGGED(obj, ITEM_INVISIBLE))
|
||||||
send_to_char(ch, " (invisible)");
|
send_to_char(ch, " (invisible)");
|
||||||
@@ -171,9 +171,9 @@ static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch)
|
|||||||
send_to_char(ch, " ..It emits a faint humming sound!");
|
send_to_char(ch, " ..It emits a faint humming sound!");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show)
|
static void list_obj_to_char(obj_data *list, char_data *ch, int mode, int show)
|
||||||
{
|
{
|
||||||
struct obj_data *i, *j, *display;
|
obj_data *i, *j, *display;
|
||||||
bool found;
|
bool found;
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
@@ -219,9 +219,10 @@ static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mo
|
|||||||
send_to_char(ch, " Nothing.\r\n");
|
send_to_char(ch, " Nothing.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void diag_char_to_char(struct char_data *i, struct char_data *ch)
|
static void diag_char_to_char(char_data *i, char_data *ch)
|
||||||
|
{
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
struct {
|
|
||||||
byte percent;
|
byte percent;
|
||||||
const char *text;
|
const char *text;
|
||||||
} diagnosis[] = {
|
} diagnosis[] = {
|
||||||
@@ -249,7 +250,7 @@ static void diag_char_to_char(struct char_data *i, struct char_data *ch)
|
|||||||
send_to_char(ch, "%c%s %s\r\n", UPPER(*pers), pers + 1, diagnosis[ar_index].text);
|
send_to_char(ch, "%c%s %s\r\n", UPPER(*pers), pers + 1, diagnosis[ar_index].text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void look_at_char(struct char_data *i, struct char_data *ch)
|
static void look_at_char(char_data *i, char_data *ch)
|
||||||
{
|
{
|
||||||
int j, found;
|
int j, found;
|
||||||
|
|
||||||
@@ -283,9 +284,9 @@ static void look_at_char(struct char_data *i, struct char_data *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_one_char(struct char_data *i, struct char_data *ch)
|
static void list_one_char(char_data *i, char_data *ch)
|
||||||
{
|
{
|
||||||
struct obj_data *furniture;
|
obj_data *furniture;
|
||||||
const char *positions[] = {
|
const char *positions[] = {
|
||||||
" is lying here, dead.",
|
" is lying here, dead.",
|
||||||
" is lying here, mortally wounded.",
|
" is lying here, mortally wounded.",
|
||||||
@@ -363,8 +364,8 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||||||
send_to_char(ch, "%s", positions[(int)GET_POS(i)]);
|
send_to_char(ch, "%s", positions[(int)GET_POS(i)]);
|
||||||
else {
|
else {
|
||||||
furniture = SITTING(i);
|
furniture = SITTING(i);
|
||||||
send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ?
|
send_to_char(ch, " is %s upon %s.",
|
||||||
"sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")),
|
(GET_POS(i) == POS_SLEEPING ? "sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")),
|
||||||
OBJS(furniture, ch));
|
OBJS(furniture, ch));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -394,9 +395,9 @@ static void list_one_char(struct char_data *i, struct char_data *ch)
|
|||||||
act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
|
act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_char_to_char(struct char_data *list, struct char_data *ch)
|
static void list_char_to_char(char_data *list, char_data *ch)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
|
|
||||||
for (i = list; i; i = i->next_in_room)
|
for (i = list; i; i = i->next_in_room)
|
||||||
if (ch != i) {
|
if (ch != i) {
|
||||||
@@ -414,7 +415,7 @@ static void list_char_to_char(struct char_data *list, struct char_data *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_auto_exits(struct char_data *ch)
|
static void do_auto_exits(char_data *ch)
|
||||||
{
|
{
|
||||||
int door, slen = 0;
|
int door, slen = 0;
|
||||||
|
|
||||||
@@ -428,7 +429,8 @@ static void do_auto_exits(struct char_data *ch)
|
|||||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
|
if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT))
|
||||||
continue;
|
continue;
|
||||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||||
send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM),
|
||||||
|
autoexits[door], CCCYN(ch, C_NRM));
|
||||||
else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN))
|
else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN))
|
||||||
send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM));
|
||||||
else
|
else
|
||||||
@@ -443,16 +445,14 @@ ACMD(do_exits)
|
|||||||
{
|
{
|
||||||
int door, len = 0;
|
int door, len = 0;
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT)
|
if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
||||||
{
|
|
||||||
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
|
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(ch, "Obvious exits:\r\n");
|
send_to_char(ch, "Obvious exits:\r\n");
|
||||||
|
|
||||||
for (door = 0; door < DIR_COUNT; door++)
|
for (door = 0; door < DIR_COUNT; door++) {
|
||||||
{
|
|
||||||
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
|
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
|
||||||
continue;
|
continue;
|
||||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
||||||
@@ -462,29 +462,26 @@ ACMD(do_exits)
|
|||||||
|
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) {
|
||||||
{
|
|
||||||
send_to_char(ch, "%-5s -[%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
|
send_to_char(ch, "%-5s -[%5d]%s %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
|
||||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name);
|
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? "[HIDDEN]" : "", world[EXIT(ch, door)->to_room].name);
|
||||||
}
|
} else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) {
|
||||||
else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
|
||||||
{
|
|
||||||
/*But we tell them the door is closed */
|
/*But we tell them the door is closed */
|
||||||
send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door],
|
send_to_char(ch, "%-5s - The %s is closed%s\r\n", dirs[door],
|
||||||
(EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening",
|
(EXIT(ch, door)->keyword) ? fname(EXIT(ch, door)->keyword) : "opening",
|
||||||
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : ".");
|
EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? " and hidden." : ".");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) &&
|
send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) &&
|
||||||
!CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name);
|
!CAN_SEE_IN_DARK(ch)
|
||||||
|
? "Too dark to tell."
|
||||||
|
: world[EXIT(ch, door)->to_room].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!len)
|
if (!len)
|
||||||
send_to_char(ch, " None.\r\n");
|
send_to_char(ch, " None.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void look_at_room(struct char_data *ch, int ignore_brief)
|
void look_at_room(char_data *ch, int ignore_brief)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
struct room_data *rm = &world[IN_ROOM(ch)];
|
struct room_data *rm = &world[IN_ROOM(ch)];
|
||||||
@@ -498,8 +495,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
|||||||
if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) {
|
if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) {
|
||||||
send_to_char(ch, "It is pitch black...\r\n");
|
send_to_char(ch, "It is pitch black...\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
} else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
||||||
else if (AFF_FLAGGED(ch, AFF_BLIND) && GET_LEVEL(ch) < LVL_IMMORT) {
|
|
||||||
send_to_char(ch, "You see nothing but infinite darkness...\r\n");
|
send_to_char(ch, "You see nothing but infinite darkness...\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -518,8 +514,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
|||||||
send_to_char(ch, " %d", GET_TRIG_VNUM(t));
|
send_to_char(ch, " %d", GET_TRIG_VNUM(t));
|
||||||
send_to_char(ch, "]");
|
send_to_char(ch, "]");
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
send_to_char(ch, "%s", world[IN_ROOM(ch)].name);
|
send_to_char(ch, "%s", world[IN_ROOM(ch)].name);
|
||||||
|
|
||||||
send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM));
|
send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM));
|
||||||
@@ -542,7 +537,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
|||||||
list_char_to_char(world[IN_ROOM(ch)].people, ch);
|
list_char_to_char(world[IN_ROOM(ch)].people, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void look_in_direction(struct char_data *ch, int dir)
|
static void look_in_direction(char_data *ch, int dir)
|
||||||
{
|
{
|
||||||
if (EXIT(ch, dir)) {
|
if (EXIT(ch, dir)) {
|
||||||
if (EXIT(ch, dir)->general_description)
|
if (EXIT(ch, dir)->general_description)
|
||||||
@@ -558,10 +553,10 @@ static void look_in_direction(struct char_data *ch, int dir)
|
|||||||
send_to_char(ch, "Nothing special there...\r\n");
|
send_to_char(ch, "Nothing special there...\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void look_in_obj(struct char_data *ch, char *arg)
|
static void look_in_obj(char_data *ch, char *arg)
|
||||||
{
|
{
|
||||||
struct obj_data *obj = NULL;
|
obj_data *obj = NULL;
|
||||||
struct char_data *dummy = NULL;
|
char_data *dummy = NULL;
|
||||||
int amt, bits;
|
int amt, bits;
|
||||||
|
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
@@ -597,16 +592,13 @@ static void look_in_obj(struct char_data *ch, char *arg)
|
|||||||
if ((GET_OBJ_VAL(obj, 1) == 0) && (GET_OBJ_VAL(obj, 0) != -1))
|
if ((GET_OBJ_VAL(obj, 1) == 0) && (GET_OBJ_VAL(obj, 0) != -1))
|
||||||
send_to_char(ch, "It is empty.\r\n");
|
send_to_char(ch, "It is empty.\r\n");
|
||||||
else {
|
else {
|
||||||
if (GET_OBJ_VAL(obj, 0) < 0)
|
if (GET_OBJ_VAL(obj, 0) < 0) {
|
||||||
{
|
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
||||||
send_to_char(ch, "It's full of a %s liquid.\r\n", buf2);
|
send_to_char(ch, "It's full of a %s liquid.\r\n", buf2);
|
||||||
}
|
} else if (GET_OBJ_VAL(obj, 1) > GET_OBJ_VAL(obj, 0))
|
||||||
else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0))
|
|
||||||
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
|
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
|
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
|
||||||
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
|
||||||
@@ -632,11 +624,11 @@ char *find_exdesc(char *word, struct extra_descr_data *list)
|
|||||||
* matches the target. First, see if there is another char in the room with
|
* matches the target. First, see if there is another char in the room with
|
||||||
* the name. Then check local objs for exdescs. Thanks to Angus Mezick for
|
* the name. Then check local objs for exdescs. Thanks to Angus Mezick for
|
||||||
* the suggested fix to this problem. */
|
* the suggested fix to this problem. */
|
||||||
static void look_at_target(struct char_data *ch, char *arg)
|
static void look_at_target(char_data *ch, char *arg)
|
||||||
{
|
{
|
||||||
int bits, found = FALSE, j, fnum, i = 0;
|
int bits, found = FALSE, j, fnum, i = 0;
|
||||||
struct char_data *found_char = NULL;
|
char_data *found_char = NULL;
|
||||||
struct obj_data *obj, *found_obj = NULL;
|
obj_data *obj, *found_obj = NULL;
|
||||||
char *desc;
|
char *desc;
|
||||||
|
|
||||||
if (!ch->desc)
|
if (!ch->desc)
|
||||||
@@ -766,8 +758,8 @@ ACMD(do_look)
|
|||||||
|
|
||||||
ACMD(do_examine)
|
ACMD(do_examine)
|
||||||
{
|
{
|
||||||
struct char_data *tmp_char;
|
char_data *tmp_char;
|
||||||
struct obj_data *tmp_object;
|
obj_data *tmp_object;
|
||||||
char tempsave[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
char tempsave[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
@@ -837,8 +829,7 @@ ACMD(do_score)
|
|||||||
GET_NUM_QUESTS(ch) == 1 ? "" : "s");
|
GET_NUM_QUESTS(ch) == 1 ? "" : "s");
|
||||||
if (GET_QUEST(ch) == NOTHING)
|
if (GET_QUEST(ch) == NOTHING)
|
||||||
send_to_char(ch, "and you are not on a quest at the moment.\r\n");
|
send_to_char(ch, "and you are not on a quest at the moment.\r\n");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
send_to_char(ch, "and your current quest is: %s", QST_NAME(real_quest(GET_QUEST(ch))));
|
send_to_char(ch, "and your current quest is: %s", QST_NAME(real_quest(GET_QUEST(ch))));
|
||||||
|
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
||||||
@@ -879,7 +870,7 @@ ACMD(do_score)
|
|||||||
if (!SITTING(ch))
|
if (!SITTING(ch))
|
||||||
send_to_char(ch, "You are sitting.\r\n");
|
send_to_char(ch, "You are sitting.\r\n");
|
||||||
else {
|
else {
|
||||||
struct obj_data *furniture = SITTING(ch);
|
obj_data *furniture = SITTING(ch);
|
||||||
send_to_char(ch, "You are sitting upon %s.\r\n", furniture->short_description);
|
send_to_char(ch, "You are sitting upon %s.\r\n", furniture->short_description);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1020,19 +1011,18 @@ ACMD(do_weather)
|
|||||||
"lit by flashes of lightning"
|
"lit by flashes of lightning"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (OUTSIDE(ch))
|
if (OUTSIDE(ch)) {
|
||||||
{
|
|
||||||
send_to_char(ch, "The sky is %s and %s.\r\n", sky_look[weather_info.sky],
|
send_to_char(ch, "The sky is %s and %s.\r\n", sky_look[weather_info.sky],
|
||||||
weather_info.change >= 0 ? "you feel a warm wind from south" :
|
weather_info.change >= 0
|
||||||
"your foot tells you bad weather is due");
|
? "you feel a warm wind from south"
|
||||||
|
: "your foot tells you bad weather is due");
|
||||||
if (GET_LEVEL(ch) >= LVL_GOD)
|
if (GET_LEVEL(ch) >= LVL_GOD)
|
||||||
send_to_char(ch, "Pressure: %d (change: %d), Sky: %d (%s)\r\n",
|
send_to_char(ch, "Pressure: %d (change: %d), Sky: %d (%s)\r\n",
|
||||||
weather_info.pressure,
|
weather_info.pressure,
|
||||||
weather_info.change,
|
weather_info.change,
|
||||||
weather_info.sky,
|
weather_info.sky,
|
||||||
sky_look[weather_info.sky]);
|
sky_look[weather_info.sky]);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
send_to_char(ch, "You have no feeling about the weather at all.\r\n");
|
send_to_char(ch, "You have no feeling about the weather at all.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,8 +1054,7 @@ int search_help(const char *argument, int level)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
return (mid);
|
return (mid);
|
||||||
}
|
} else if (chk > 0)
|
||||||
else if (chk > 0)
|
|
||||||
bot = mid + 1;
|
bot = mid + 1;
|
||||||
else
|
else
|
||||||
top = mid - 1;
|
top = mid - 1;
|
||||||
@@ -1127,8 +1116,8 @@ ACMD(do_help)
|
|||||||
/* Written by Rhade */
|
/* Written by Rhade */
|
||||||
ACMD(do_who)
|
ACMD(do_who)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
int i, num_can_see = 0;
|
int i, num_can_see = 0;
|
||||||
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||||
char mode;
|
char mode;
|
||||||
@@ -1136,15 +1125,19 @@ ACMD(do_who)
|
|||||||
int showclass = 0, short_list = 0, outlaws = 0;
|
int showclass = 0, short_list = 0, outlaws = 0;
|
||||||
int who_room = 0, showgroup = 0, showleader = 0;
|
int who_room = 0, showgroup = 0, showleader = 0;
|
||||||
|
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
char *disp;
|
char *disp;
|
||||||
int min_level;
|
int min_level;
|
||||||
int max_level;
|
int max_level;
|
||||||
int count; /* must always start as 0 */
|
int count; /* must always start as 0 */
|
||||||
} rank[] = {
|
} rank[] = {
|
||||||
{ "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
{
|
||||||
{ "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 },
|
"Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
||||||
{ "\n", 0, 0, 0 }
|
{
|
||||||
|
"Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0},
|
||||||
|
{
|
||||||
|
"\n", 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
@@ -1374,8 +1367,8 @@ ACMD(do_users)
|
|||||||
char line[200], line2[220], idletime[10], classname[20];
|
char line[200], line2[220], idletime[10], classname[20];
|
||||||
char state[30], timestr[9], mode;
|
char state[30], timestr[9], mode;
|
||||||
char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH];
|
char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH];
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int low = 0, high = LVL_IMPL, num_can_see = 0;
|
int low = 0, high = LVL_IMPL, num_can_see = 0;
|
||||||
int showclass = 0, outlaws = 0, playing = 0, deadweight = 0;
|
int showclass = 0, outlaws = 0, playing = 0, deadweight = 0;
|
||||||
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
||||||
@@ -1486,9 +1479,11 @@ ACMD(do_users)
|
|||||||
strcpy(idletime, " ");
|
strcpy(idletime, " ");
|
||||||
|
|
||||||
sprintf(line, "%3d %-7s %-12s %-14s %-3s %-8s ", d->desc_num, classname,
|
sprintf(line, "%3d %-7s %-12s %-14s %-3s %-8s ", d->desc_num, classname,
|
||||||
d->original && d->original->player.name ? d->original->player.name :
|
d->original && d->original->player.name
|
||||||
d->character && d->character->player.name ? d->character->player.name :
|
? d->original->player.name
|
||||||
"UNDEFINED",
|
: d->character && d->character->player.name
|
||||||
|
? d->character->player.name
|
||||||
|
: "UNDEFINED",
|
||||||
state, idletime, timestr);
|
state, idletime, timestr);
|
||||||
|
|
||||||
if (*d->host)
|
if (*d->host)
|
||||||
@@ -1568,10 +1563,10 @@ ACMD(do_gen_ps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_mortal_where(struct char_data *ch, char *arg)
|
static void perform_mortal_where(char_data *ch, char *arg)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
@@ -1662,7 +1657,7 @@ static void perform_immort_where(char_data *ch, const char *arg)
|
|||||||
{
|
{
|
||||||
char_data *i;
|
char_data *i;
|
||||||
obj_data *k;
|
obj_data *k;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int num = 0, found = FALSE; // "num" here needs to match the lookup in do_stat, so "stat 4.sword" finds the right one
|
int num = 0, found = FALSE; // "num" here needs to match the lookup in do_stat, so "stat 4.sword" finds the right one
|
||||||
const char *error_message = "\r\n***OVERFLOW***\r\n";
|
const char *error_message = "\r\n***OVERFLOW***\r\n";
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -1780,21 +1775,17 @@ ACMD(do_levels)
|
|||||||
/* No valid args found */
|
/* No valid args found */
|
||||||
min_lev = 1;
|
min_lev = 1;
|
||||||
max_lev = LVL_IMMORT;
|
max_lev = LVL_IMMORT;
|
||||||
}
|
} else if (ret == 1) {
|
||||||
else if (ret == 1) {
|
|
||||||
/* One arg = range is (num) either side of current level */
|
/* One arg = range is (num) either side of current level */
|
||||||
val = min_lev;
|
val = min_lev;
|
||||||
max_lev = MIN(GET_LEVEL(ch) + val, LVL_IMMORT);
|
max_lev = MIN(GET_LEVEL(ch) + val, LVL_IMMORT);
|
||||||
min_lev = MAX(GET_LEVEL(ch) - val, 1);
|
min_lev = MAX(GET_LEVEL(ch) - val, 1);
|
||||||
}
|
} else if (ret == 2) {
|
||||||
else if (ret == 2) {
|
|
||||||
/* Two args = min-max range limit - just do sanity checks */
|
/* Two args = min-max range limit - just do sanity checks */
|
||||||
min_lev = MAX(min_lev, 1);
|
min_lev = MAX(min_lev, 1);
|
||||||
max_lev = MIN(max_lev + 1, LVL_IMMORT);
|
max_lev = MIN(max_lev + 1, LVL_IMMORT);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
send_to_char(ch, "Usage: %slevels [<min>-<max> | <range>]%s\r\n\r\n", QYEL, QNRM);
|
send_to_char(ch, "Usage: %slevels [<min>-<max> | <range>]%s\r\n\r\n", QYEL, QNRM);
|
||||||
send_to_char(ch, "Displays exp required for levels.\r\n");
|
send_to_char(ch, "Displays exp required for levels.\r\n");
|
||||||
send_to_char(ch, "%slevels %s- shows all levels (1-%d)\r\n", QCYN, QNRM, (LVL_IMMORT - 1));
|
send_to_char(ch, "%slevels %s- shows all levels (1-%d)\r\n", QCYN, QNRM, (LVL_IMMORT - 1));
|
||||||
@@ -1837,7 +1828,7 @@ ACMD(do_levels)
|
|||||||
ACMD(do_consider)
|
ACMD(do_consider)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct char_data *victim;
|
char_data *victim;
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
one_argument(argument, buf);
|
one_argument(argument, buf);
|
||||||
@@ -1883,7 +1874,7 @@ ACMD(do_consider)
|
|||||||
ACMD(do_diagnose)
|
ACMD(do_diagnose)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
one_argument(argument, buf);
|
one_argument(argument, buf);
|
||||||
|
|
||||||
@@ -1906,109 +1897,180 @@ ACMD(do_toggle)
|
|||||||
int toggle, tp, wimp_lev, result = 0, len = 0, i;
|
int toggle, tp, wimp_lev, result = 0, len = 0, i;
|
||||||
const char *types[] = {"off", "brief", "normal", "on", "\n"};
|
const char *types[] = {"off", "brief", "normal", "on", "\n"};
|
||||||
|
|
||||||
const struct {
|
const struct
|
||||||
|
{
|
||||||
char *command;
|
char *command;
|
||||||
bitvector_t toggle; /* this needs changing once hashmaps are implemented */
|
bitvector_t toggle; /* this needs changing once hashmaps are implemented */
|
||||||
char min_level;
|
char min_level;
|
||||||
char *disable_msg;
|
char *disable_msg;
|
||||||
char *enable_msg;
|
char *enable_msg;
|
||||||
} tog_messages[] = {
|
} tog_messages[] = {
|
||||||
{"summonable", PRF_SUMMONABLE, 0,
|
{
|
||||||
|
"summonable", PRF_SUMMONABLE, 0,
|
||||||
"You are now safe from summoning by other players.\r\n",
|
"You are now safe from summoning by other players.\r\n",
|
||||||
"You may now be summoned by other players.\r\n"},
|
"You may now be summoned by other players.\r\n"
|
||||||
{"nohassle", PRF_NOHASSLE, LVL_IMMORT,
|
},
|
||||||
|
{
|
||||||
|
"nohassle", PRF_NOHASSLE, LVL_IMMORT,
|
||||||
"Nohassle disabled.\r\n",
|
"Nohassle disabled.\r\n",
|
||||||
"Nohassle enabled.\r\n"},
|
"Nohassle enabled.\r\n"
|
||||||
{"brief", PRF_BRIEF, 0,
|
},
|
||||||
|
{
|
||||||
|
"brief", PRF_BRIEF, 0,
|
||||||
"Brief mode off.\r\n",
|
"Brief mode off.\r\n",
|
||||||
"Brief mode on.\r\n"},
|
"Brief mode on.\r\n"
|
||||||
{"compact", PRF_COMPACT, 0,
|
},
|
||||||
|
{
|
||||||
|
"compact", PRF_COMPACT, 0,
|
||||||
"Compact mode off.\r\n",
|
"Compact mode off.\r\n",
|
||||||
"Compact mode on.\r\n"},
|
"Compact mode on.\r\n"
|
||||||
{"notell", PRF_NOTELL, 0,
|
},
|
||||||
|
{
|
||||||
|
"notell", PRF_NOTELL, 0,
|
||||||
"You can now hear tells.\r\n",
|
"You can now hear tells.\r\n",
|
||||||
"You are now deaf to tells.\r\n"},
|
"You are now deaf to tells.\r\n"
|
||||||
{"noauction", PRF_NOAUCT, 0,
|
},
|
||||||
|
{
|
||||||
|
"noauction", PRF_NOAUCT, 0,
|
||||||
"You can now hear auctions.\r\n",
|
"You can now hear auctions.\r\n",
|
||||||
"You are now deaf to auctions.\r\n"},
|
"You are now deaf to auctions.\r\n"
|
||||||
{"noshout", PRF_NOSHOUT, 0,
|
},
|
||||||
|
{
|
||||||
|
"noshout", PRF_NOSHOUT, 0,
|
||||||
"You can now hear shouts.\r\n",
|
"You can now hear shouts.\r\n",
|
||||||
"You are now deaf to shouts.\r\n"},
|
"You are now deaf to shouts.\r\n"
|
||||||
{"nogossip", PRF_NOGOSS, 0,
|
},
|
||||||
|
{
|
||||||
|
"nogossip", PRF_NOGOSS, 0,
|
||||||
"You can now hear gossip.\r\n",
|
"You can now hear gossip.\r\n",
|
||||||
"You are now deaf to gossip.\r\n"},
|
"You are now deaf to gossip.\r\n"
|
||||||
{"nograts", PRF_NOGRATZ, 0,
|
},
|
||||||
|
{
|
||||||
|
"nograts", PRF_NOGRATZ, 0,
|
||||||
"You can now hear gratz.\r\n",
|
"You can now hear gratz.\r\n",
|
||||||
"You are now deaf to gratz.\r\n"},
|
"You are now deaf to gratz.\r\n"
|
||||||
{"nowiz", PRF_NOWIZ, LVL_IMMORT,
|
},
|
||||||
|
{
|
||||||
|
"nowiz", PRF_NOWIZ, LVL_IMMORT,
|
||||||
"You can now hear the Wiz-channel.\r\n",
|
"You can now hear the Wiz-channel.\r\n",
|
||||||
"You are now deaf to the Wiz-channel.\r\n"},
|
"You are now deaf to the Wiz-channel.\r\n"
|
||||||
{"quest", PRF_QUEST, 0,
|
},
|
||||||
|
{
|
||||||
|
"quest", PRF_QUEST, 0,
|
||||||
"You are no longer part of the Quest.\r\n",
|
"You are no longer part of the Quest.\r\n",
|
||||||
"Okay, you are part of the Quest.\r\n"},
|
"Okay, you are part of the Quest.\r\n"
|
||||||
{"showvnums", PRF_SHOWVNUMS, LVL_IMMORT,
|
},
|
||||||
|
{
|
||||||
|
"showvnums", PRF_SHOWVNUMS, LVL_IMMORT,
|
||||||
"You will no longer see the vnums.\r\n",
|
"You will no longer see the vnums.\r\n",
|
||||||
"You will now see the vnums.\r\n"},
|
"You will now see the vnums.\r\n"
|
||||||
{"norepeat", PRF_NOREPEAT, 0,
|
},
|
||||||
|
{
|
||||||
|
"norepeat", PRF_NOREPEAT, 0,
|
||||||
"You will now have your communication repeated.\r\n",
|
"You will now have your communication repeated.\r\n",
|
||||||
"You will no longer have your communication repeated.\r\n"},
|
"You will no longer have your communication repeated.\r\n"
|
||||||
{"holylight", PRF_HOLYLIGHT, LVL_IMMORT,
|
},
|
||||||
|
{
|
||||||
|
"holylight", PRF_HOLYLIGHT, LVL_IMMORT,
|
||||||
"HolyLight mode off.\r\n",
|
"HolyLight mode off.\r\n",
|
||||||
"HolyLight mode on.\r\n"},
|
"HolyLight mode on.\r\n"
|
||||||
{"slownameserver", 0, LVL_IMPL,
|
},
|
||||||
|
{
|
||||||
|
"slownameserver", 0, LVL_IMPL,
|
||||||
"Nameserver_is_slow changed to OFF; IP addresses will now be resolved.\r\n",
|
"Nameserver_is_slow changed to OFF; IP addresses will now be resolved.\r\n",
|
||||||
"Nameserver_is_slow changed to ON; sitenames will no longer be resolved.\r\n"},
|
"Nameserver_is_slow changed to ON; sitenames will no longer be resolved.\r\n"
|
||||||
{"autoexits", PRF_AUTOEXIT, 0,
|
},
|
||||||
|
{
|
||||||
|
"autoexits", PRF_AUTOEXIT, 0,
|
||||||
"Autoexits disabled.\r\n",
|
"Autoexits disabled.\r\n",
|
||||||
"Autoexits enabled.\r\n"},
|
"Autoexits enabled.\r\n"
|
||||||
{"trackthru", 0, LVL_IMPL,
|
},
|
||||||
|
{
|
||||||
|
"trackthru", 0, LVL_IMPL,
|
||||||
"Players can no longer track through doors.\r\n",
|
"Players can no longer track through doors.\r\n",
|
||||||
"Players can now track through doors.\r\n"},
|
"Players can now track through doors.\r\n"
|
||||||
{"clsolc", PRF_CLS, LVL_BUILDER,
|
},
|
||||||
|
{
|
||||||
|
"clsolc", PRF_CLS, LVL_BUILDER,
|
||||||
"You will no longer clear screen in OLC.\r\n",
|
"You will no longer clear screen in OLC.\r\n",
|
||||||
"You will now clear screen in OLC.\r\n"},
|
"You will now clear screen in OLC.\r\n"
|
||||||
{"buildwalk", PRF_BUILDWALK, LVL_BUILDER,
|
},
|
||||||
|
{
|
||||||
|
"buildwalk", PRF_BUILDWALK, LVL_BUILDER,
|
||||||
"Buildwalk is now Off.\r\n",
|
"Buildwalk is now Off.\r\n",
|
||||||
"Buildwalk is now On.\r\n"},
|
"Buildwalk is now On.\r\n"
|
||||||
{"afk", PRF_AFK, 0,
|
},
|
||||||
|
{
|
||||||
|
"afk", PRF_AFK, 0,
|
||||||
"AFK is now Off.\r\n",
|
"AFK is now Off.\r\n",
|
||||||
"AFK is now On.\r\n"},
|
"AFK is now On.\r\n"
|
||||||
{"autoloot", PRF_AUTOLOOT, 0,
|
},
|
||||||
|
{
|
||||||
|
"autoloot", PRF_AUTOLOOT, 0,
|
||||||
"Autoloot disabled.\r\n",
|
"Autoloot disabled.\r\n",
|
||||||
"Autoloot enabled.\r\n"},
|
"Autoloot enabled.\r\n"
|
||||||
{"autogold", PRF_AUTOGOLD, 0,
|
},
|
||||||
|
{
|
||||||
|
"autogold", PRF_AUTOGOLD, 0,
|
||||||
"Autogold disabled.\r\n",
|
"Autogold disabled.\r\n",
|
||||||
"Autogold enabled.\r\n"},
|
"Autogold enabled.\r\n"
|
||||||
{"autosplit", PRF_AUTOSPLIT, 0,
|
},
|
||||||
|
{
|
||||||
|
"autosplit", PRF_AUTOSPLIT, 0,
|
||||||
"Autosplit disabled.\r\n",
|
"Autosplit disabled.\r\n",
|
||||||
"Autosplit enabled.\r\n"},
|
"Autosplit enabled.\r\n"
|
||||||
{"autosac", PRF_AUTOSAC, 0,
|
},
|
||||||
|
{
|
||||||
|
"autosac", PRF_AUTOSAC, 0,
|
||||||
"Autosac disabled.\r\n",
|
"Autosac disabled.\r\n",
|
||||||
"Autosac enabled.\r\n"},
|
"Autosac enabled.\r\n"
|
||||||
{"autoassist", PRF_AUTOASSIST, 0,
|
},
|
||||||
|
{
|
||||||
|
"autoassist", PRF_AUTOASSIST, 0,
|
||||||
"Autoassist disabled.\r\n",
|
"Autoassist disabled.\r\n",
|
||||||
"Autoassist enabled.\r\n"},
|
"Autoassist enabled.\r\n"
|
||||||
{"automap", PRF_AUTOMAP, 1,
|
},
|
||||||
|
{
|
||||||
|
"automap", PRF_AUTOMAP, 1,
|
||||||
"You will no longer see the mini-map.\r\n",
|
"You will no longer see the mini-map.\r\n",
|
||||||
"You will now see a mini-map at the side of room descriptions.\r\n"},
|
"You will now see a mini-map at the side of room descriptions.\r\n"
|
||||||
{"autokey", PRF_AUTOKEY, 0,
|
},
|
||||||
|
{
|
||||||
|
"autokey", PRF_AUTOKEY, 0,
|
||||||
"You will now have to unlock doors manually before opening.\r\n",
|
"You will now have to unlock doors manually before opening.\r\n",
|
||||||
"You will now automatically unlock doors when opening them (if you have the key).\r\n"},
|
"You will now automatically unlock doors when opening them (if you have the key).\r\n"
|
||||||
{"autodoor", PRF_AUTODOOR, 0,
|
},
|
||||||
|
{
|
||||||
|
"autodoor", PRF_AUTODOOR, 0,
|
||||||
"You will now need to specify a door direction when opening, closing and unlocking.\r\n",
|
"You will now need to specify a door direction when opening, closing and unlocking.\r\n",
|
||||||
"You will now find the next available door when opening, closing or unlocking.\r\n"},
|
"You will now find the next available door when opening, closing or unlocking.\r\n"
|
||||||
{"zoneresets", PRF_ZONERESETS, LVL_IMPL,
|
},
|
||||||
|
{
|
||||||
|
"zoneresets", PRF_ZONERESETS, LVL_IMPL,
|
||||||
"You will no longer see zone resets.\r\n",
|
"You will no longer see zone resets.\r\n",
|
||||||
"You will now see zone resets.\r\n"},
|
"You will now see zone resets.\r\n"
|
||||||
{"syslog", 0, LVL_IMMORT, "\n", "\n"},
|
},
|
||||||
{"wimpy", 0, 0, "\n", "\n"},
|
{
|
||||||
{"pagelength", 0, 0, "\n", "\n"},
|
"syslog", 0, LVL_IMMORT, "\n", "\n"
|
||||||
{"screenwidth", 0, 0, "\n", "\n"},
|
},
|
||||||
{"color", 0, 0, "\n", "\n"},
|
{
|
||||||
{"verbose", PRF_VERBOSE, LVL_IMMORT,
|
"wimpy", 0, 0, "\n", "\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagelength", 0, 0, "\n", "\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"screenwidth", 0, 0, "\n", "\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color", 0, 0, "\n", "\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"verbose", PRF_VERBOSE, LVL_IMMORT,
|
||||||
"You will no longer see verbose output in listings.\n",
|
"You will no longer see verbose output in listings.\n",
|
||||||
"You will now see verbose listings.\n"},
|
"You will now see verbose listings.\n"},
|
||||||
{"\n", 0, -1, "\n", "\n"} /* must be last */
|
{"\n", 0, -1, "\n", "\n"
|
||||||
|
} /* must be last */
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
@@ -2159,8 +2221,10 @@ ACMD(do_toggle)
|
|||||||
}
|
}
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
|
||||||
if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
|
if (tp & 1)
|
||||||
if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
|
||||||
|
if (tp & 2)
|
||||||
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
|
||||||
|
|
||||||
send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]);
|
send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]);
|
||||||
return;
|
return;
|
||||||
@@ -2176,8 +2240,10 @@ ACMD(do_toggle)
|
|||||||
}
|
}
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);
|
||||||
if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
|
if (tp & 1)
|
||||||
if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
|
||||||
|
if (tp & 2)
|
||||||
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);
|
||||||
|
|
||||||
send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]);
|
send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]);
|
||||||
return;
|
return;
|
||||||
@@ -2343,7 +2409,7 @@ ACMD(do_commands)
|
|||||||
column_list(ch, 0, commands, no, FALSE);
|
column_list(ch, 0, commands, no, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_history(struct char_data *ch, int type)
|
void free_history(char_data *ch, int type)
|
||||||
{
|
{
|
||||||
struct txt_block *tmp = GET_HISTORY(ch, type), *ftmp;
|
struct txt_block *tmp = GET_HISTORY(ch, type), *ftmp;
|
||||||
|
|
||||||
@@ -2391,7 +2457,8 @@ ACMD(do_history)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define HIST_LENGTH 100
|
#define HIST_LENGTH 100
|
||||||
void add_history(struct char_data *ch, char *str, int type)
|
|
||||||
|
void add_history(char_data *ch, char *str, int type)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
|
char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
|
||||||
@@ -2410,8 +2477,7 @@ void add_history(struct char_data *ch, char *str, int type)
|
|||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
CREATE(GET_HISTORY(ch, type), struct txt_block, 1);
|
CREATE(GET_HISTORY(ch, type), struct txt_block, 1);
|
||||||
GET_HISTORY(ch, type)->text = strdup(buf);
|
GET_HISTORY(ch, type)->text = strdup(buf);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
while (tmp->next)
|
while (tmp->next)
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
CREATE(tmp->next, struct txt_block, 1);
|
CREATE(tmp->next, struct txt_block, 1);
|
||||||
@@ -2434,7 +2500,7 @@ void add_history(struct char_data *ch, char *str, int type)
|
|||||||
|
|
||||||
ACMD(do_whois)
|
ACMD(do_whois)
|
||||||
{
|
{
|
||||||
struct char_data *victim = 0;
|
char_data *victim = 0;
|
||||||
int hours;
|
int hours;
|
||||||
int got_from_file = 0;
|
int got_from_file = 0;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -2446,9 +2512,8 @@ ACMD(do_whois)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(victim=get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
if (!(victim = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) {
|
||||||
{
|
CREATE(victim, char_data, 1);
|
||||||
CREATE(victim, struct char_data, 1);
|
|
||||||
clear_char(victim);
|
clear_char(victim);
|
||||||
|
|
||||||
new_mobile_data(victim);
|
new_mobile_data(victim);
|
||||||
@@ -2489,9 +2554,9 @@ ACMD(do_whois)
|
|||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
|
|
||||||
if (PRF_FLAGGED(victim, PRF_AFK))
|
if (PRF_FLAGGED(victim, PRF_AFK))
|
||||||
send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), HSSH(victim), CCNRM(ch, C_NRM));
|
send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM),
|
||||||
}
|
GET_NAME(victim), HSSH(victim), CCNRM(ch, C_NRM));
|
||||||
else if (hours > 0)
|
} else if (hours > 0)
|
||||||
send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours / 24, hours % 24);
|
send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours / 24, hours % 24);
|
||||||
else
|
else
|
||||||
send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n",
|
send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n",
|
||||||
@@ -2508,8 +2573,13 @@ ACMD(do_whois)
|
|||||||
|
|
||||||
if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) {
|
if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) {
|
||||||
protocol_t *prot = victim->desc->pProtocol;
|
protocol_t *prot = victim->desc->pProtocol;
|
||||||
send_to_char(ch, "Client: %s [%s]\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString, prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString ? prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString : "Unknown");
|
send_to_char(ch, "Client: %s [%s]\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString,
|
||||||
send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt ? "Xterm" : (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None"));
|
prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString
|
||||||
|
? prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString
|
||||||
|
: "Unknown");
|
||||||
|
send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt
|
||||||
|
? "Xterm"
|
||||||
|
: (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None"));
|
||||||
send_to_char(ch, "MXP: %s\r\n", prot->bMXP ? "Yes" : "No");
|
send_to_char(ch, "MXP: %s\r\n", prot->bMXP ? "Yes" : "No");
|
||||||
send_to_char(ch, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No");
|
send_to_char(ch, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No");
|
||||||
send_to_char(ch, "MSP: %s\r\n", prot->bMSP ? "Yes" : "No");
|
send_to_char(ch, "MSP: %s\r\n", prot->bMSP ? "Yes" : "No");
|
||||||
@@ -2600,7 +2670,8 @@ ACMD(do_areas)
|
|||||||
} else if ((hilev != -1) && (lolev >= ZONE_MINLVL(i)) && (hilev <= ZONE_MAXLVL(i))) {
|
} else if ((hilev != -1) && (lolev >= ZONE_MINLVL(i)) && (hilev <= ZONE_MAXLVL(i))) {
|
||||||
/* Range supplied, it's completely within this zone's range (no overlap) */
|
/* Range supplied, it's completely within this zone's range (no overlap) */
|
||||||
show_zone = TRUE;
|
show_zone = TRUE;
|
||||||
} else if ((hilev != -1) && ((lolev >= ZONE_MINLVL(i) && lolev <= ZONE_MAXLVL(i)) || (hilev <= ZONE_MAXLVL(i) && hilev >= ZONE_MINLVL(i)))) {
|
} else if ((hilev != -1) && ((lolev >= ZONE_MINLVL(i) && lolev <= ZONE_MAXLVL(i)) || (
|
||||||
|
hilev <= ZONE_MAXLVL(i) && hilev >= ZONE_MINLVL(i)))) {
|
||||||
/* Range supplied, it overlaps this zone's range */
|
/* Range supplied, it overlaps this zone's range */
|
||||||
show_zone = TRUE;
|
show_zone = TRUE;
|
||||||
overlap = TRUE;
|
overlap = TRUE;
|
||||||
@@ -2615,19 +2686,23 @@ ACMD(do_areas)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (show_zone) {
|
if (show_zone) {
|
||||||
if (overlap) overlap_shown = TRUE;
|
if (overlap)
|
||||||
|
overlap_shown = TRUE;
|
||||||
lev_set = get_zone_levels(i, lev_str);
|
lev_set = get_zone_levels(i, lev_str);
|
||||||
tmp_len = snprintf(buf+len, sizeof(buf)-len, "\tn(%3d) %s%-*s\tn %s%s\tn\r\n", ++zcount, overlap ? QRED : QCYN,
|
tmp_len = snprintf(buf + len, sizeof(buf) - len, "\tn(%3d) %s%-*s\tn %s%s\tn\r\n", ++zcount,
|
||||||
|
overlap ? QRED : QCYN,
|
||||||
count_color_chars(zone_table[i].name) + 30, zone_table[i].name,
|
count_color_chars(zone_table[i].name) + 30, zone_table[i].name,
|
||||||
lev_set ? "\tc" : "\tn", lev_set ? lev_str : "All Levels");
|
lev_set ? "\tc" : "\tn", lev_set ? lev_str : "All Levels");
|
||||||
len += tmp_len;
|
len += tmp_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp_len = snprintf(buf+len, sizeof(buf)-len, "%s%d%s area%s found.\r\n", QYEL, zcount, QNRM, zcount == 1 ? "" : "s");
|
tmp_len = snprintf(buf + len, sizeof(buf) - len, "%s%d%s area%s found.\r\n", QYEL, zcount, QNRM,
|
||||||
|
zcount == 1 ? "" : "s");
|
||||||
len += tmp_len;
|
len += tmp_len;
|
||||||
|
|
||||||
if (overlap_shown) {
|
if (overlap_shown) {
|
||||||
snprintf(buf+len, sizeof(buf)-len, "Areas shown in \trred\tn may have some creatures outside the specified range.\r\n");
|
snprintf(buf + len, sizeof(buf) - len,
|
||||||
|
"Areas shown in \trred\tn may have some creatures outside the specified range.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zcount == 0)
|
if (zcount == 0)
|
||||||
@@ -2636,7 +2711,7 @@ ACMD(do_areas)
|
|||||||
page_string(ch->desc, buf, TRUE);
|
page_string(ch->desc, buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_scanned_chars(struct char_data * list, struct char_data * ch, int
|
static void list_scanned_chars(char_data *list, char_data *ch, int
|
||||||
distance, int door)
|
distance, int door)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH - 1];
|
char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH - 1];
|
||||||
@@ -2647,7 +2722,7 @@ distance, int door)
|
|||||||
"far off to the"
|
"far off to the"
|
||||||
};
|
};
|
||||||
|
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
|
|||||||
+108
-89
@@ -26,31 +26,29 @@
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
/* do_get utility functions */
|
/* do_get utility functions */
|
||||||
static int can_take_obj(struct char_data *ch, struct obj_data *obj);
|
static int can_take_obj(char_data *ch, obj_data *obj);
|
||||||
static void get_check_money(struct char_data *ch, struct obj_data *obj);
|
static void get_check_money(char_data *ch, obj_data *obj);
|
||||||
static void get_from_container(struct char_data *ch, struct obj_data *cont, char *arg, int mode, int amount);
|
static void get_from_container(char_data *ch, obj_data *cont, char *arg, int mode, int amount);
|
||||||
static void get_from_room(struct char_data *ch, char *arg, int amount);
|
static void get_from_room(char_data *ch, char *arg, int amount);
|
||||||
static void perform_get_from_container(struct char_data *ch, struct obj_data *obj, struct obj_data *cont, int mode);
|
static void perform_get_from_container(char_data *ch, obj_data *obj, obj_data *cont, int mode);
|
||||||
static int perform_get_from_room(struct char_data *ch, struct obj_data *obj);
|
static int perform_get_from_room(char_data *ch, obj_data *obj);
|
||||||
/* do_give utility functions */
|
/* do_give utility functions */
|
||||||
static struct char_data *give_find_vict(struct char_data *ch, char *arg);
|
static char_data *give_find_vict(char_data *ch, char *arg);
|
||||||
static void perform_give(struct char_data *ch, struct char_data *vict, struct obj_data *obj);
|
static void perform_give(char_data *ch, char_data *vict, obj_data *obj);
|
||||||
static void perform_give_gold(struct char_data *ch, struct char_data *vict, int amount);
|
static void perform_give_gold(char_data *ch, char_data *vict, int amount);
|
||||||
/* do_drop utility functions */
|
/* do_drop utility functions */
|
||||||
static int perform_drop(struct char_data *ch, struct obj_data *obj, byte mode, const char *sname, room_rnum RDR);
|
static int perform_drop(char_data *ch, obj_data *obj, byte mode, const char *sname, room_rnum RDR);
|
||||||
static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR);
|
static void perform_drop_gold(char_data *ch, int amount, byte mode, room_rnum RDR);
|
||||||
/* do_put utility functions */
|
/* do_put utility functions */
|
||||||
static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont);
|
static void perform_put(char_data *ch, obj_data *obj, obj_data *cont);
|
||||||
/* do_remove utility functions */
|
/* do_remove utility functions */
|
||||||
static void perform_remove(struct char_data *ch, int pos);
|
static void perform_remove(char_data *ch, int pos);
|
||||||
/* do_wear utility functions */
|
/* do_wear utility functions */
|
||||||
static void perform_wear(struct char_data *ch, struct obj_data *obj, int where);
|
static void perform_wear(char_data *ch, obj_data *obj, int where);
|
||||||
static void wear_message(struct char_data *ch, struct obj_data *obj, int where);
|
static void wear_message(char_data *ch, obj_data *obj, int where);
|
||||||
|
|
||||||
|
|
||||||
|
static void perform_put(char_data *ch, obj_data *obj, obj_data *cont)
|
||||||
|
|
||||||
static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont)
|
|
||||||
{
|
{
|
||||||
long object_id = obj_script_id(obj);
|
long object_id = obj_script_id(obj);
|
||||||
|
|
||||||
@@ -92,8 +90,8 @@ ACMD(do_put)
|
|||||||
char arg1[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH];
|
||||||
char arg2[MAX_INPUT_LENGTH];
|
char arg2[MAX_INPUT_LENGTH];
|
||||||
char arg3[MAX_INPUT_LENGTH];
|
char arg3[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj, *next_obj, *cont;
|
obj_data *obj, *next_obj, *cont;
|
||||||
struct char_data *tmp_char;
|
char_data *tmp_char;
|
||||||
int obj_dotmode, cont_dotmode, found = 0, howmany = 1;
|
int obj_dotmode, cont_dotmode, found = 0, howmany = 1;
|
||||||
char *theobj, *thecont;
|
char *theobj, *thecont;
|
||||||
|
|
||||||
@@ -126,7 +124,7 @@ ACMD(do_put)
|
|||||||
send_to_char(ch, "You'd better open it first!\r\n");
|
send_to_char(ch, "You'd better open it first!\r\n");
|
||||||
else {
|
else {
|
||||||
if (obj_dotmode == FIND_INDIV) { /* put <obj> <container> */
|
if (obj_dotmode == FIND_INDIV) { /* put <obj> <container> */
|
||||||
if (!(obj = get_obj_in_list_vis(ch, theobj, NULL, ch->carrying)))
|
if (!((obj = get_obj_in_list_vis(ch, theobj, NULL, ch->carrying))))
|
||||||
send_to_char(ch, "You aren't carrying %s %s.\r\n", AN(theobj), theobj);
|
send_to_char(ch, "You aren't carrying %s %s.\r\n", AN(theobj), theobj);
|
||||||
else if (obj == cont && howmany == 1)
|
else if (obj == cont && howmany == 1)
|
||||||
send_to_char(ch, "You attempt to fold it into itself, but fail.\r\n");
|
send_to_char(ch, "You attempt to fold it into itself, but fail.\r\n");
|
||||||
@@ -160,7 +158,7 @@ ACMD(do_put)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int can_take_obj(struct char_data *ch, struct obj_data *obj)
|
static int can_take_obj(char_data *ch, obj_data *obj)
|
||||||
{
|
{
|
||||||
if (!(CAN_WEAR(obj, ITEM_WEAR_TAKE))) {
|
if (!(CAN_WEAR(obj, ITEM_WEAR_TAKE))) {
|
||||||
act("$p: you can't take that!", FALSE, ch, obj, 0, TO_CHAR);
|
act("$p: you can't take that!", FALSE, ch, obj, 0, TO_CHAR);
|
||||||
@@ -185,7 +183,7 @@ if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_check_money(struct char_data *ch, struct obj_data *obj)
|
static void get_check_money(char_data *ch, obj_data *obj)
|
||||||
{
|
{
|
||||||
int value = GET_OBJ_VAL(obj, 0);
|
int value = GET_OBJ_VAL(obj, 0);
|
||||||
|
|
||||||
@@ -202,8 +200,8 @@ static void get_check_money(struct char_data *ch, struct obj_data *obj)
|
|||||||
send_to_char(ch, "There were %d coins.\r\n", value);
|
send_to_char(ch, "There were %d coins.\r\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_get_from_container(struct char_data *ch, struct obj_data *obj,
|
static void perform_get_from_container(char_data *ch, obj_data *obj,
|
||||||
struct obj_data *cont, int mode)
|
obj_data *cont, int mode)
|
||||||
{
|
{
|
||||||
if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) {
|
if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) {
|
||||||
if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
|
if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
|
||||||
@@ -218,10 +216,10 @@ static void perform_get_from_container(struct char_data *ch, struct obj_data *ob
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_from_container(struct char_data *ch, struct obj_data *cont,
|
void get_from_container(char_data *ch, obj_data *cont,
|
||||||
char *arg, int mode, int howmany)
|
char *arg, int mode, int howmany)
|
||||||
{
|
{
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
int obj_dotmode, found = 0;
|
int obj_dotmode, found = 0;
|
||||||
|
|
||||||
obj_dotmode = find_all_dots(arg);
|
obj_dotmode = find_all_dots(arg);
|
||||||
@@ -235,7 +233,7 @@ void get_from_container(struct char_data *ch, struct obj_data *cont,
|
|||||||
snprintf(buf, sizeof(buf), "There doesn't seem to be %s %s in $p.", AN(arg), arg);
|
snprintf(buf, sizeof(buf), "There doesn't seem to be %s %s in $p.", AN(arg), arg);
|
||||||
act(buf, FALSE, ch, cont, 0, TO_CHAR);
|
act(buf, FALSE, ch, cont, 0, TO_CHAR);
|
||||||
} else {
|
} else {
|
||||||
struct obj_data *obj_next;
|
obj_data *obj_next;
|
||||||
while (obj && howmany--) {
|
while (obj && howmany--) {
|
||||||
obj_next = obj->next_content;
|
obj_next = obj->next_content;
|
||||||
perform_get_from_container(ch, obj, cont, mode);
|
perform_get_from_container(ch, obj, cont, mode);
|
||||||
@@ -268,7 +266,7 @@ void get_from_container(struct char_data *ch, struct obj_data *cont,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
|
static int perform_get_from_room(char_data *ch, obj_data *obj)
|
||||||
{
|
{
|
||||||
if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) {
|
if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) {
|
||||||
obj_from_room(obj);
|
obj_from_room(obj);
|
||||||
@@ -281,9 +279,9 @@ static int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_from_room(struct char_data *ch, char *arg, int howmany)
|
static void get_from_room(char_data *ch, char *arg, int howmany)
|
||||||
{
|
{
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
int dotmode, found = 0;
|
int dotmode, found = 0;
|
||||||
|
|
||||||
dotmode = find_all_dots(arg);
|
dotmode = find_all_dots(arg);
|
||||||
@@ -297,7 +295,7 @@ static void get_from_room(struct char_data *ch, char *arg, int howmany)
|
|||||||
}
|
}
|
||||||
send_to_char(ch, "You don't see %s %s here.\r\n", AN(arg), arg);
|
send_to_char(ch, "You don't see %s %s here.\r\n", AN(arg), arg);
|
||||||
} else {
|
} else {
|
||||||
struct obj_data *obj_next;
|
obj_data *obj_next;
|
||||||
while (obj && howmany--) {
|
while (obj && howmany--) {
|
||||||
obj_next = obj->next_content;
|
obj_next = obj->next_content;
|
||||||
perform_get_from_room(ch, obj);
|
perform_get_from_room(ch, obj);
|
||||||
@@ -333,8 +331,8 @@ ACMD(do_get)
|
|||||||
char arg3[MAX_INPUT_LENGTH];
|
char arg3[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
int cont_dotmode, found = 0, mode;
|
int cont_dotmode, found = 0, mode;
|
||||||
struct obj_data *cont;
|
obj_data *cont;
|
||||||
struct char_data *tmp_char;
|
char_data *tmp_char;
|
||||||
|
|
||||||
one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */
|
one_argument(two_arguments(argument, arg1, arg2), arg3); /* three_arguments */
|
||||||
|
|
||||||
@@ -397,9 +395,9 @@ ACMD(do_get)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR)
|
static void perform_drop_gold(char_data *ch, int amount, byte mode, room_rnum RDR)
|
||||||
{
|
{
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
send_to_char(ch, "Heh heh heh.. we are jolly funny today, eh?\r\n");
|
send_to_char(ch, "Heh heh heh.. we are jolly funny today, eh?\r\n");
|
||||||
@@ -446,7 +444,8 @@ static void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_
|
|||||||
|
|
||||||
#define VANISH(mode) ((mode == SCMD_DONATE || mode == SCMD_JUNK) ? \
|
#define VANISH(mode) ((mode == SCMD_DONATE || mode == SCMD_JUNK) ? \
|
||||||
" It vanishes in a puff of smoke!" : "")
|
" It vanishes in a puff of smoke!" : "")
|
||||||
static int perform_drop(struct char_data *ch, struct obj_data *obj,
|
|
||||||
|
static int perform_drop(char_data *ch, obj_data *obj,
|
||||||
byte mode, const char *sname, room_rnum RDR)
|
byte mode, const char *sname, room_rnum RDR)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -507,7 +506,7 @@ static int perform_drop(struct char_data *ch, struct obj_data *obj,
|
|||||||
ACMD(do_drop)
|
ACMD(do_drop)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
room_rnum RDR = 0;
|
room_rnum RDR = 0;
|
||||||
byte mode = SCMD_DROP;
|
byte mode = SCMD_DROP;
|
||||||
int dotmode, amount = 0, multi, num_don_rooms;
|
int dotmode, amount = 0, multi, num_don_rooms;
|
||||||
@@ -533,8 +532,12 @@ ACMD(do_drop)
|
|||||||
case 2:
|
case 2:
|
||||||
RDR = real_room(CONFIG_DON_ROOM_1);
|
RDR = real_room(CONFIG_DON_ROOM_1);
|
||||||
break;
|
break;
|
||||||
case 3: RDR = real_room(CONFIG_DON_ROOM_2); break;
|
case 3:
|
||||||
case 4: RDR = real_room(CONFIG_DON_ROOM_3); break;
|
RDR = real_room(CONFIG_DON_ROOM_2);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
RDR = real_room(CONFIG_DON_ROOM_3);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (RDR == NOWHERE) {
|
if (RDR == NOWHERE) {
|
||||||
@@ -568,7 +571,8 @@ ACMD(do_drop)
|
|||||||
next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content);
|
next_obj = get_obj_in_list_vis(ch, arg, NULL, obj->next_content);
|
||||||
amount += perform_drop(ch, obj, mode, sname, RDR);
|
amount += perform_drop(ch, obj, mode, sname, RDR);
|
||||||
obj = next_obj;
|
obj = next_obj;
|
||||||
} while (obj && --multi);
|
}
|
||||||
|
while (obj && --multi);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dotmode = find_all_dots(arg);
|
dotmode = find_all_dots(arg);
|
||||||
@@ -617,8 +621,8 @@ ACMD(do_drop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_give(struct char_data *ch, struct char_data *vict,
|
static void perform_give(char_data *ch, char_data *vict,
|
||||||
struct obj_data *obj)
|
obj_data *obj)
|
||||||
{
|
{
|
||||||
if (!give_otrigger(obj, ch, vict))
|
if (!give_otrigger(obj, ch, vict))
|
||||||
return;
|
return;
|
||||||
@@ -633,7 +637,8 @@ static void perform_give(struct char_data *ch, struct char_data *vict,
|
|||||||
act("$N seems to have $S hands full.", FALSE, ch, 0, vict, TO_CHAR);
|
act("$N seems to have $S hands full.", FALSE, ch, 0, vict, TO_CHAR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GET_OBJ_WEIGHT(obj) + IS_CARRYING_W(vict) > CAN_CARRY_W(vict) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT) {
|
if (GET_OBJ_WEIGHT(obj) + IS_CARRYING_W(vict) > CAN_CARRY_W(vict) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) <
|
||||||
|
LVL_IMMORT) {
|
||||||
act("$E can't carry that much weight.", FALSE, ch, 0, vict, TO_CHAR);
|
act("$E can't carry that much weight.", FALSE, ch, 0, vict, TO_CHAR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -647,9 +652,9 @@ static void perform_give(struct char_data *ch, struct char_data *vict,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* utility function for give */
|
/* utility function for give */
|
||||||
static struct char_data *give_find_vict(struct char_data *ch, char *arg)
|
static char_data *give_find_vict(char_data *ch, char *arg)
|
||||||
{
|
{
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
skip_spaces(&arg);
|
skip_spaces(&arg);
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
@@ -664,7 +669,7 @@ static struct char_data *give_find_vict(struct char_data *ch, char *arg)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_give_gold(struct char_data *ch, struct char_data *vict,
|
static void perform_give_gold(char_data *ch, char_data *vict,
|
||||||
int amount)
|
int amount)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -696,8 +701,8 @@ ACMD(do_give)
|
|||||||
{
|
{
|
||||||
char arg[MAX_STRING_LENGTH];
|
char arg[MAX_STRING_LENGTH];
|
||||||
int amount, dotmode;
|
int amount, dotmode;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
|
|
||||||
argument = one_argument(argument, arg);
|
argument = one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -754,10 +759,10 @@ ACMD(do_give)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void weight_change_object(struct obj_data *obj, int weight)
|
void weight_change_object(obj_data *obj, int weight)
|
||||||
{
|
{
|
||||||
struct obj_data *tmp_obj;
|
obj_data *tmp_obj;
|
||||||
struct char_data *tmp_ch;
|
char_data *tmp_ch;
|
||||||
|
|
||||||
if (IN_ROOM(obj) != NOWHERE) {
|
if (IN_ROOM(obj) != NOWHERE) {
|
||||||
GET_OBJ_WEIGHT(obj) += weight;
|
GET_OBJ_WEIGHT(obj) += weight;
|
||||||
@@ -777,7 +782,7 @@ void weight_change_object(struct obj_data *obj, int weight)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void name_from_drinkcon(struct obj_data *obj)
|
void name_from_drinkcon(obj_data *obj)
|
||||||
{
|
{
|
||||||
const char *liqname;
|
const char *liqname;
|
||||||
char *new_name;
|
char *new_name;
|
||||||
@@ -797,7 +802,7 @@ void name_from_drinkcon(struct obj_data *obj)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void name_to_drinkcon(struct obj_data *obj, int type)
|
void name_to_drinkcon(obj_data *obj, int type)
|
||||||
{
|
{
|
||||||
char *new_name;
|
char *new_name;
|
||||||
|
|
||||||
@@ -816,7 +821,7 @@ void name_to_drinkcon(struct obj_data *obj, int type)
|
|||||||
ACMD(do_drink)
|
ACMD(do_drink)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *temp;
|
obj_data *temp;
|
||||||
struct affected_type af;
|
struct affected_type af;
|
||||||
int amount, weight;
|
int amount, weight;
|
||||||
int on_ground = 0;
|
int on_ground = 0;
|
||||||
@@ -946,7 +951,7 @@ ACMD(do_drink)
|
|||||||
ACMD(do_eat)
|
ACMD(do_eat)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *food;
|
obj_data *food;
|
||||||
struct affected_type af;
|
struct affected_type af;
|
||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
@@ -1019,7 +1024,7 @@ ACMD(do_eat)
|
|||||||
ACMD(do_pour)
|
ACMD(do_pour)
|
||||||
{
|
{
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *from_obj = NULL, *to_obj = NULL;
|
obj_data *from_obj = NULL, *to_obj = NULL;
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
@@ -1084,8 +1089,7 @@ ACMD(do_pour)
|
|||||||
GET_OBJ_VAL(from_obj, 1) = 0;
|
GET_OBJ_VAL(from_obj, 1) = 0;
|
||||||
GET_OBJ_VAL(from_obj, 2) = 0;
|
GET_OBJ_VAL(from_obj, 2) = 0;
|
||||||
GET_OBJ_VAL(from_obj, 3) = 0;
|
GET_OBJ_VAL(from_obj, 3) = 0;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
send_to_char(ch, "You can't possibly pour that container out!\r\n");
|
send_to_char(ch, "You can't possibly pour that container out!\r\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1142,14 +1146,12 @@ ACMD(do_pour)
|
|||||||
GET_OBJ_VAL(from_obj, 2) = 0;
|
GET_OBJ_VAL(from_obj, 2) = 0;
|
||||||
GET_OBJ_VAL(from_obj, 3) = 0;
|
GET_OBJ_VAL(from_obj, 3) = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
|
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
|
||||||
amount = GET_OBJ_VAL(to_obj, 0);
|
amount = GET_OBJ_VAL(to_obj, 0);
|
||||||
}
|
}
|
||||||
/* Poisoned? */
|
/* Poisoned? */
|
||||||
GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3))
|
GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3));
|
||||||
;
|
|
||||||
/* Weight change, except for unlimited. */
|
/* Weight change, except for unlimited. */
|
||||||
if (GET_OBJ_VAL(from_obj, 0) > 0) {
|
if (GET_OBJ_VAL(from_obj, 0) > 0) {
|
||||||
weight_change_object(from_obj, -amount);
|
weight_change_object(from_obj, -amount);
|
||||||
@@ -1157,7 +1159,7 @@ ACMD(do_pour)
|
|||||||
weight_change_object(to_obj, amount); /* Add weight */
|
weight_change_object(to_obj, amount); /* Add weight */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wear_message(struct char_data *ch, struct obj_data *obj, int where)
|
static void wear_message(char_data *ch, obj_data *obj, int where)
|
||||||
{
|
{
|
||||||
const char *wear_messages[][2] = {
|
const char *wear_messages[][2] = {
|
||||||
{"$n lights $p and holds it.",
|
{"$n lights $p and holds it.",
|
||||||
@@ -1219,7 +1221,7 @@ static void wear_message(struct char_data *ch, struct obj_data *obj, int where)
|
|||||||
act(wear_messages[where][1], FALSE, ch, obj, 0, TO_CHAR);
|
act(wear_messages[where][1], FALSE, ch, obj, 0, TO_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_wear(struct char_data *ch, struct obj_data *obj, int where)
|
static void perform_wear(char_data *ch, obj_data *obj, int where)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* ITEM_WEAR_TAKE is used for objects that do not require special bits
|
* ITEM_WEAR_TAKE is used for objects that do not require special bits
|
||||||
@@ -1280,7 +1282,7 @@ static void perform_wear(struct char_data *ch, struct obj_data *obj, int where)
|
|||||||
equip_char(ch, obj, where);
|
equip_char(ch, obj, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg)
|
int find_eq_pos(char_data *ch, obj_data *obj, char *arg)
|
||||||
{
|
{
|
||||||
int where = -1;
|
int where = -1;
|
||||||
|
|
||||||
@@ -1307,18 +1309,30 @@ int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!arg || !*arg) {
|
if (!arg || !*arg) {
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_FINGER)) where = WEAR_FINGER_R;
|
if (CAN_WEAR(obj, ITEM_WEAR_FINGER))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_NECK)) where = WEAR_NECK_1;
|
where = WEAR_FINGER_R;
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_BODY)) where = WEAR_BODY;
|
if (CAN_WEAR(obj, ITEM_WEAR_NECK))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_HEAD)) where = WEAR_HEAD;
|
where = WEAR_NECK_1;
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_LEGS)) where = WEAR_LEGS;
|
if (CAN_WEAR(obj, ITEM_WEAR_BODY))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_FEET)) where = WEAR_FEET;
|
where = WEAR_BODY;
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_HANDS)) where = WEAR_HANDS;
|
if (CAN_WEAR(obj, ITEM_WEAR_HEAD))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_ARMS)) where = WEAR_ARMS;
|
where = WEAR_HEAD;
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_SHIELD)) where = WEAR_SHIELD;
|
if (CAN_WEAR(obj, ITEM_WEAR_LEGS))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_ABOUT)) where = WEAR_ABOUT;
|
where = WEAR_LEGS;
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_WAIST)) where = WEAR_WAIST;
|
if (CAN_WEAR(obj, ITEM_WEAR_FEET))
|
||||||
if (CAN_WEAR(obj, ITEM_WEAR_WRIST)) where = WEAR_WRIST_R;
|
where = WEAR_FEET;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_HANDS))
|
||||||
|
where = WEAR_HANDS;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_ARMS))
|
||||||
|
where = WEAR_ARMS;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_SHIELD))
|
||||||
|
where = WEAR_SHIELD;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_ABOUT))
|
||||||
|
where = WEAR_ABOUT;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_WAIST))
|
||||||
|
where = WEAR_WAIST;
|
||||||
|
if (CAN_WEAR(obj, ITEM_WEAR_WRIST))
|
||||||
|
where = WEAR_WRIST_R;
|
||||||
} else if ((where = search_block(arg, keywords, FALSE)) < 0)
|
} else if ((where = search_block(arg, keywords, FALSE)) < 0)
|
||||||
send_to_char(ch, "'%s'? What part of your body is THAT?\r\n", arg);
|
send_to_char(ch, "'%s'? What part of your body is THAT?\r\n", arg);
|
||||||
|
|
||||||
@@ -1329,7 +1343,7 @@ ACMD(do_wear)
|
|||||||
{
|
{
|
||||||
char arg1[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH];
|
||||||
char arg2[MAX_INPUT_LENGTH];
|
char arg2[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
int where, dotmode, items_worn = 0;
|
int where, dotmode, items_worn = 0;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
@@ -1393,7 +1407,7 @@ ACMD(do_wear)
|
|||||||
ACMD(do_wield)
|
ACMD(do_wield)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -1416,7 +1430,7 @@ ACMD(do_wield)
|
|||||||
ACMD(do_grab)
|
ACMD(do_grab)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -1440,9 +1454,9 @@ ACMD(do_grab)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_remove(struct char_data *ch, int pos)
|
static void perform_remove(char_data *ch, int pos)
|
||||||
{
|
{
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
if (!(obj = GET_EQ(ch, pos)))
|
if (!(obj = GET_EQ(ch, pos)))
|
||||||
log("SYSERR: perform_remove: bad pos %d passed.", pos);
|
log("SYSERR: perform_remove: bad pos %d passed.", pos);
|
||||||
@@ -1509,7 +1523,7 @@ ACMD(do_remove)
|
|||||||
ACMD(do_sac)
|
ACMD(do_sac)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *j, *jj, *next_thing2;
|
obj_data *j, *jj, *next_thing2;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -1518,7 +1532,8 @@ ACMD(do_sac)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!(j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) {
|
if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!(
|
||||||
|
j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) {
|
||||||
send_to_char(ch, "It doesn't seem to be here.\n\r");
|
send_to_char(ch, "It doesn't seem to be here.\n\r");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1532,18 +1547,21 @@ ACMD(do_sac)
|
|||||||
|
|
||||||
switch (rand_number(0, 5)) {
|
switch (rand_number(0, 5)) {
|
||||||
case 0:
|
case 0:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n",
|
||||||
|
GET_OBJ_SHORT(j));
|
||||||
increase_gold(ch, 1);
|
increase_gold(ch, 1);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j), 1+2*GET_OBJ_LEVEL(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe gods give you %d experience points.\r\n", GET_OBJ_SHORT(j),
|
||||||
|
1 + 2 * GET_OBJ_LEVEL(j));
|
||||||
GET_EXP(ch) += (1 + 2 * GET_OBJ_LEVEL(j));
|
GET_EXP(ch) += (1 + 2 * GET_OBJ_LEVEL(j));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), 1+GET_OBJ_LEVEL(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j),
|
||||||
|
1 + GET_OBJ_LEVEL(j));
|
||||||
GET_EXP(ch) += (1 + GET_OBJ_LEVEL(j));
|
GET_EXP(ch) += (1 + GET_OBJ_LEVEL(j));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@@ -1555,7 +1573,8 @@ ACMD(do_sac)
|
|||||||
increase_gold(ch, (1 + 2 * GET_OBJ_LEVEL(j)));
|
increase_gold(ch, (1 + 2 * GET_OBJ_LEVEL(j)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n",GET_OBJ_SHORT(j));
|
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n",
|
||||||
|
GET_OBJ_SHORT(j));
|
||||||
increase_gold(ch, 1);
|
increase_gold(ch, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-76
@@ -27,18 +27,18 @@
|
|||||||
|
|
||||||
/* local only functions */
|
/* local only functions */
|
||||||
/* do_simple_move utility 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 */
|
/* do_gen_door utility functions */
|
||||||
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);
|
||||||
static int has_key(struct char_data *ch, obj_vnum key);
|
static int has_key(char_data *ch, obj_vnum key);
|
||||||
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);
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
/* simple function to determine if char can walk on water */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) > LVL_IMMORT)
|
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. */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) > LVL_IMMORT)
|
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. */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) > LVL_IMMORT)
|
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
|
* @param need_specials_check If TRUE will cause
|
||||||
* @retval int 1 for a successful move (ch is now in a new location)
|
* @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). */
|
* 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 */
|
/* Begin Local variable definitions */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
@@ -166,8 +166,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Charm effect: Does it override the movement? */
|
/* 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");
|
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);
|
act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM);
|
||||||
return (0);
|
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? */
|
/* Water, No Swimming Rooms: Does the deep water prevent movement? */
|
||||||
if ((SECT(was_in) == SECT_WATER_NOSWIM) ||
|
if ((SECT(was_in) == SECT_WATER_NOSWIM) ||
|
||||||
(SECT(going_to) == SECT_WATER_NOSWIM))
|
(SECT(going_to) == SECT_WATER_NOSWIM)) {
|
||||||
{
|
if (!has_boat(ch)) {
|
||||||
if (!has_boat(ch))
|
|
||||||
{
|
|
||||||
send_to_char(ch, "You need a boat to go there.\r\n");
|
send_to_char(ch, "You need a boat to go there.\r\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flying Required: Does lack of flying prevent movement? */
|
/* Flying Required: Does lack of flying prevent movement? */
|
||||||
if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING))
|
if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) {
|
||||||
{
|
if (!has_flight(ch)) {
|
||||||
if (!has_flight(ch))
|
|
||||||
{
|
|
||||||
send_to_char(ch, "You need to be flying to go there!\r\n");
|
send_to_char(ch, "You need to be flying to go there!\r\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Underwater Room: Does lack of underwater breathing prevent movement? */
|
/* 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)) {
|
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");
|
send_to_char(ch, "You need to be able to breathe water to go there!\r\n");
|
||||||
return (0);
|
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? */
|
/* Houses: Can the player walk into the house? */
|
||||||
if (ROOM_FLAGGED(was_in, ROOM_ATRIUM))
|
if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) {
|
||||||
{
|
if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) {
|
||||||
if (!House_can_enter(ch, GET_ROOM_VNUM(going_to)))
|
|
||||||
{
|
|
||||||
send_to_char(ch, "That's private property -- no trespassing!\r\n");
|
send_to_char(ch, "That's private property -- no trespassing!\r\n");
|
||||||
return (0);
|
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");
|
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
|
||||||
return (0);
|
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");
|
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Room Size Capacity: Is the room full of people already? */
|
/* Room Size Capacity: Is the room full of people already? */
|
||||||
if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) &&
|
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)
|
if (CONFIG_TUNNEL_SIZE > 1)
|
||||||
send_to_char(ch, "There isn't enough room for you to go there!\r\n");
|
send_to_char(ch, "There isn't enough room for you to go there!\r\n");
|
||||||
else
|
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? */
|
/* 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");
|
send_to_char(ch, "You aren't godly enough to use that room!\r\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -253,8 +244,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
|
|||||||
movement_loss[SECT(going_to)]) / 2;
|
movement_loss[SECT(going_to)]) / 2;
|
||||||
|
|
||||||
/* Move Point Requirement Check */
|
/* 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)
|
if (need_specials_check && ch->master)
|
||||||
send_to_char(ch, "You are too exhausted to follow.\r\n");
|
send_to_char(ch, "You are too exhausted to follow.\r\n");
|
||||||
else
|
else
|
||||||
@@ -274,8 +264,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
|
|||||||
GET_MOVE(ch) -= need_movement;
|
GET_MOVE(ch) -= need_movement;
|
||||||
|
|
||||||
/* Generate the leave message and display to others in the was_in room. */
|
/* 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]);
|
snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]);
|
||||||
act(leave_message, TRUE, ch, 0, 0, TO_ROOM);
|
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);
|
look_at_room(ch, 0);
|
||||||
|
|
||||||
/* ... and Kill the player if the room is a death trap. */
|
/* ... and Kill the player if the room is a death trap. */
|
||||||
if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT)
|
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),
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name);
|
world[going_to].name);
|
||||||
death_cry(ch);
|
death_cry(ch);
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
return (0);
|
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
|
/* 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. */
|
* prevents movement, and if so, move the player back to the previous room. */
|
||||||
entry_memory_mtrigger(ch);
|
entry_memory_mtrigger(ch);
|
||||||
if (!greet_mtrigger(ch, dir))
|
if (!greet_mtrigger(ch, dir)) {
|
||||||
{
|
|
||||||
char_from_room(ch);
|
char_from_room(ch);
|
||||||
char_to_room(ch, was_in);
|
char_to_room(ch, was_in);
|
||||||
look_at_room(ch, 0);
|
look_at_room(ch, 0);
|
||||||
/* Failed move, return a failure */
|
/* Failed move, return a failure */
|
||||||
return (0);
|
return (0);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
greet_memory_mtrigger(ch);
|
greet_memory_mtrigger(ch);
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* End: Post-move operations. */
|
/* End: Post-move operations. */
|
||||||
@@ -337,7 +324,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
|
|||||||
return (1);
|
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;
|
room_rnum was_in;
|
||||||
struct follow_type *k, *next;
|
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");
|
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)
|
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");
|
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)
|
if (EXIT(ch, dir)->keyword)
|
||||||
send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword));
|
send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword));
|
||||||
else
|
else
|
||||||
@@ -380,7 +368,7 @@ ACMD(do_move)
|
|||||||
perform_move(ch, subcmd, 0);
|
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;
|
int door;
|
||||||
|
|
||||||
@@ -410,24 +398,18 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
|
|||||||
send_to_char(ch, "What is it you want to %s?\r\n", cmdname);
|
send_to_char(ch, "What is it you want to %s?\r\n", cmdname);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
for (door = 0; door < DIR_COUNT; door++)
|
for (door = 0; door < DIR_COUNT; door++) {
|
||||||
{
|
if (EXIT(ch, door)) {
|
||||||
if (EXIT(ch, door))
|
if (EXIT(ch, door)->keyword) {
|
||||||
{
|
if (isname(type, EXIT(ch, door)->keyword)) {
|
||||||
if (EXIT(ch, door)->keyword)
|
|
||||||
{
|
|
||||||
if (isname(type, EXIT(ch, door)->keyword))
|
|
||||||
{
|
|
||||||
if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR)))
|
if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR)))
|
||||||
return door;
|
return door;
|
||||||
else if (is_abbrev(cmdname, "open"))
|
else if (is_abbrev(cmdname, "open")) {
|
||||||
{
|
|
||||||
if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
|
if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
|
||||||
return door;
|
return door;
|
||||||
else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))
|
else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))
|
||||||
return door;
|
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;
|
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;
|
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)
|
if (key == NOTHING)
|
||||||
return (0);
|
return (0);
|
||||||
@@ -516,7 +498,7 @@ static const int flags_door[] =
|
|||||||
(TOGGLE_BIT(GET_OBJ_VAL(obj, 1), CONT_LOCKED)) :\
|
(TOGGLE_BIT(GET_OBJ_VAL(obj, 1), CONT_LOCKED)) :\
|
||||||
(TOGGLE_BIT(EXITN(room, door)->exit_info, EX_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];
|
char buf[MAX_STRING_LENGTH];
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -587,7 +569,7 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int
|
|||||||
scmd == SCMD_CLOSE ? "d" : "ed");
|
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;
|
int percent, skill_lvl;
|
||||||
|
|
||||||
@@ -628,8 +610,8 @@ ACMD(do_gen_door)
|
|||||||
int door = -1;
|
int door = -1;
|
||||||
obj_vnum keynum;
|
obj_vnum keynum;
|
||||||
char type[MAX_INPUT_LENGTH], dir[MAX_INPUT_LENGTH];
|
char type[MAX_INPUT_LENGTH], dir[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj = NULL;
|
obj_data *obj = NULL;
|
||||||
struct char_data *victim = NULL;
|
char_data *victim = NULL;
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
@@ -655,17 +637,15 @@ ACMD(do_gen_door)
|
|||||||
send_to_char(ch, "But it's currently open!\r\n");
|
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))
|
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");
|
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");
|
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, SCMD_UNLOCK);
|
||||||
do_doorcmd(ch, obj, door, subcmd);
|
do_doorcmd(ch, obj, door, subcmd);
|
||||||
}
|
} else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((
|
||||||
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)) )
|
!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");
|
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) &&
|
||||||
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))))
|
(GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))))
|
||||||
send_to_char(ch, "It seems to be locked.\r\n");
|
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)))
|
else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK)))
|
||||||
@@ -767,8 +747,8 @@ ACMD(do_stand)
|
|||||||
ACMD(do_sit)
|
ACMD(do_sit)
|
||||||
{
|
{
|
||||||
char arg[MAX_STRING_LENGTH];
|
char arg[MAX_STRING_LENGTH];
|
||||||
struct obj_data *furniture;
|
obj_data *furniture;
|
||||||
struct char_data *tempch;
|
char_data *tempch;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
@@ -893,7 +873,7 @@ ACMD(do_sleep)
|
|||||||
ACMD(do_wake)
|
ACMD(do_wake)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
int self = 0;
|
int self = 0;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
@@ -932,7 +912,7 @@ ACMD(do_wake)
|
|||||||
ACMD(do_follow)
|
ACMD(do_follow)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct char_data *leader;
|
char_data *leader;
|
||||||
|
|
||||||
one_argument(argument, buf);
|
one_argument(argument, buf);
|
||||||
|
|
||||||
|
|||||||
+17
-15
@@ -24,7 +24,7 @@
|
|||||||
ACMD(do_assist)
|
ACMD(do_assist)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *helpee, *opponent;
|
char_data *helpee, *opponent;
|
||||||
|
|
||||||
if (FIGHTING(ch)) {
|
if (FIGHTING(ch)) {
|
||||||
send_to_char(ch, "You're already fighting! How can you assist someone else?\r\n");
|
send_to_char(ch, "You're already fighting! How can you assist someone else?\r\n");
|
||||||
@@ -68,7 +68,7 @@ ACMD(do_assist)
|
|||||||
ACMD(do_hit)
|
ACMD(do_hit)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -88,7 +88,8 @@ ACMD(do_hit)
|
|||||||
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
|
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 */
|
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 */
|
hit(ch, vict, TYPE_UNDEFINED); /* first */
|
||||||
else hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */
|
else
|
||||||
|
hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */
|
||||||
WAIT_STATE(ch, PULSE_VIOLENCE + 2);
|
WAIT_STATE(ch, PULSE_VIOLENCE + 2);
|
||||||
} else
|
} else
|
||||||
send_to_char(ch, "You're fighting the best you can!\r\n");
|
send_to_char(ch, "You're fighting the best you can!\r\n");
|
||||||
@@ -98,7 +99,7 @@ ACMD(do_hit)
|
|||||||
ACMD(do_kill)
|
ACMD(do_kill)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
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)) {
|
if (GET_LEVEL(ch) < LVL_GRGOD || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
|
||||||
do_hit(ch, argument, cmd, subcmd);
|
do_hit(ch, argument, cmd, subcmd);
|
||||||
@@ -125,7 +126,7 @@ ACMD(do_kill)
|
|||||||
ACMD(do_backstab)
|
ACMD(do_backstab)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
int percent, prob;
|
int percent, prob;
|
||||||
|
|
||||||
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_BACKSTAB)) {
|
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_BACKSTAB)) {
|
||||||
@@ -179,7 +180,7 @@ ACMD(do_order)
|
|||||||
{
|
{
|
||||||
char name[MAX_INPUT_LENGTH], message[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH], message[MAX_INPUT_LENGTH];
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
struct follow_type *k;
|
struct follow_type *k;
|
||||||
|
|
||||||
half_chop(argument, name, message);
|
half_chop(argument, name, message);
|
||||||
@@ -232,7 +233,7 @@ ACMD(do_order)
|
|||||||
ACMD(do_flee)
|
ACMD(do_flee)
|
||||||
{
|
{
|
||||||
int i, attempt, loss;
|
int i, attempt, loss;
|
||||||
struct char_data *was_fighting;
|
char_data *was_fighting;
|
||||||
|
|
||||||
if (GET_POS(ch) < POS_FIGHTING) {
|
if (GET_POS(ch) < POS_FIGHTING) {
|
||||||
send_to_char(ch, "You are in pretty bad shape, unable to flee!\r\n");
|
send_to_char(ch, "You are in pretty bad shape, unable to flee!\r\n");
|
||||||
@@ -268,7 +269,7 @@ ACMD(do_flee)
|
|||||||
ACMD(do_bash)
|
ACMD(do_bash)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
int percent, prob;
|
int percent, prob;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
@@ -330,7 +331,7 @@ ACMD(do_bash)
|
|||||||
ACMD(do_rescue)
|
ACMD(do_rescue)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict, *tmp_ch;
|
char_data *vict, *tmp_ch;
|
||||||
int percent, prob;
|
int percent, prob;
|
||||||
|
|
||||||
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_RESCUE)) {
|
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_RESCUE)) {
|
||||||
@@ -393,7 +394,7 @@ ACMD(do_rescue)
|
|||||||
|
|
||||||
EVENTFUNC(event_whirlwind)
|
EVENTFUNC(event_whirlwind)
|
||||||
{
|
{
|
||||||
struct char_data *ch, *tch;
|
char_data *ch, *tch;
|
||||||
struct mud_event_data *pMudEvent;
|
struct mud_event_data *pMudEvent;
|
||||||
struct list_data *room_list;
|
struct list_data *room_list;
|
||||||
int count;
|
int count;
|
||||||
@@ -405,7 +406,7 @@ EVENTFUNC(event_whirlwind)
|
|||||||
/* For the sake of simplicity, we will place the event data in easily
|
/* For the sake of simplicity, we will place the event data in easily
|
||||||
* referenced pointers */
|
* referenced pointers */
|
||||||
pMudEvent = (struct mud_event_data *)event_obj;
|
pMudEvent = (struct mud_event_data *)event_obj;
|
||||||
ch = (struct char_data *) pMudEvent->pStruct;
|
ch = (char_data *)pMudEvent->pStruct;
|
||||||
|
|
||||||
/* When using a list, we have to make sure to allocate the list as it
|
/* When using a list, we have to make sure to allocate the list as it
|
||||||
* uses dynamic memory */
|
* uses dynamic memory */
|
||||||
@@ -491,7 +492,7 @@ ACMD(do_whirlwind)
|
|||||||
ACMD(do_kick)
|
ACMD(do_kick)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
int percent, prob;
|
int percent, prob;
|
||||||
|
|
||||||
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_KICK)) {
|
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_KICK)) {
|
||||||
@@ -509,6 +510,8 @@ ACMD(do_kick)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log("ch class = %d vict class = %d", GET_CLASS(ch), GET_CLASS(vict));
|
||||||
|
|
||||||
if (vict == ch) {
|
if (vict == ch) {
|
||||||
send_to_char(ch, "Aren't we funny today...\r\n");
|
send_to_char(ch, "Aren't we funny today...\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -528,11 +531,10 @@ ACMD(do_kick)
|
|||||||
ACMD(do_bandage)
|
ACMD(do_bandage)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data * vict;
|
char_data *vict;
|
||||||
int percent, prob;
|
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");
|
send_to_char(ch, "You are unskilled in the art of bandaging.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-44
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
/* Local defined utility functions */
|
/* Local defined utility functions */
|
||||||
/* do_group utility functions */
|
/* do_group utility functions */
|
||||||
static void print_group(struct char_data *ch);
|
static void print_group(char_data *ch);
|
||||||
static void display_group_list(struct char_data * ch);
|
static void display_group_list(char_data *ch);
|
||||||
|
|
||||||
ACMD(do_quit)
|
ACMD(do_quit)
|
||||||
{
|
{
|
||||||
@@ -145,8 +145,8 @@ ACMD(do_hide)
|
|||||||
|
|
||||||
ACMD(do_steal)
|
ACMD(do_steal)
|
||||||
{
|
{
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
char vict_name[MAX_INPUT_LENGTH], obj_name[MAX_INPUT_LENGTH];
|
char vict_name[MAX_INPUT_LENGTH], obj_name[MAX_INPUT_LENGTH];
|
||||||
int percent, gold, eq_pos, pcsteal = 0, ohoh = 0;
|
int percent, gold, eq_pos, pcsteal = 0, ohoh = 0;
|
||||||
|
|
||||||
@@ -315,13 +315,13 @@ 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");
|
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",
|
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),
|
count_color_chars(GET_NAME(k)) + 22, GET_NAME(k),
|
||||||
GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM),
|
GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM),
|
||||||
@@ -331,7 +331,7 @@ static void print_group(struct char_data *ch)
|
|||||||
CCNRM(ch, C_NRM));
|
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;
|
int count = 0;
|
||||||
@@ -347,7 +347,8 @@ static void display_group_list(struct char_data * ch)
|
|||||||
send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n",
|
send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n",
|
||||||
++count,
|
++count,
|
||||||
IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM),
|
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,
|
GET_NAME(GROUP_LEADER(group)), group->members->iSize,
|
||||||
|
zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name,
|
||||||
CCNRM(ch, C_NRM));
|
CCNRM(ch, C_NRM));
|
||||||
else
|
else
|
||||||
send_to_char(ch, "%-2d) Hidden\r\n", ++count);
|
send_to_char(ch, "%-2d) Hidden\r\n", ++count);
|
||||||
@@ -369,7 +370,7 @@ static void display_group_list(struct char_data * ch)
|
|||||||
ACMD(do_group)
|
ACMD(do_group)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
argument = one_argument(argument, buf);
|
argument = one_argument(argument, buf);
|
||||||
|
|
||||||
@@ -459,10 +460,12 @@ ACMD(do_group)
|
|||||||
}
|
}
|
||||||
if (is_abbrev(argument, "open")) {
|
if (is_abbrev(argument, "open")) {
|
||||||
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_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")) {
|
} else if (is_abbrev(argument, "anonymous")) {
|
||||||
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_ANON);
|
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");
|
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
|
} else
|
||||||
send_to_char(ch, "The flag options are: Open, Anonymous\r\n");
|
send_to_char(ch, "The flag options are: Open, Anonymous\r\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -492,7 +495,7 @@ ACMD(do_split)
|
|||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int amount, num = 0, share, rest;
|
int amount, num = 0, share, rest;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct char_data *k;
|
char_data *k;
|
||||||
|
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
return;
|
return;
|
||||||
@@ -511,7 +514,7 @@ ACMD(do_split)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GROUP(ch))
|
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))
|
if (IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k))
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
@@ -534,7 +537,7 @@ ACMD(do_split)
|
|||||||
(rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch));
|
(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)) {
|
if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) {
|
||||||
increase_gold(k, share);
|
increase_gold(k, share);
|
||||||
send_to_char(k, "%s", buf);
|
send_to_char(k, "%s", buf);
|
||||||
@@ -556,7 +559,7 @@ ACMD(do_split)
|
|||||||
ACMD(do_use)
|
ACMD(do_use)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *mag_item;
|
obj_data *mag_item;
|
||||||
|
|
||||||
half_chop(argument, arg, buf);
|
half_chop(argument, arg, buf);
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
@@ -857,13 +860,12 @@ ACMD(do_gen_tog)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_happyhour(struct char_data *ch)
|
static void show_happyhour(char_data *ch)
|
||||||
{
|
{
|
||||||
char happyexp[80], happygold[80], happyqp[80];
|
char happyexp[80], happygold[80], happyqp[80];
|
||||||
int secs_left;
|
int secs_left;
|
||||||
|
|
||||||
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD))
|
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) {
|
||||||
{
|
|
||||||
if (HAPPY_TIME)
|
if (HAPPY_TIME)
|
||||||
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
|
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
|
||||||
else
|
else
|
||||||
@@ -882,9 +884,7 @@ static void show_happyhour(struct char_data *ch)
|
|||||||
CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM),
|
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 % 3600) / 60, CCNRM(ch, C_NRM),
|
||||||
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM));
|
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
|
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];
|
char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH];
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < LVL_GOD)
|
if (GET_LEVEL(ch) < LVL_GOD) {
|
||||||
{
|
|
||||||
show_happyhour(ch);
|
show_happyhour(ch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -903,20 +902,15 @@ ACMD(do_happyhour)
|
|||||||
/* Only Imms get here, so check args */
|
/* Only Imms get here, so check args */
|
||||||
two_arguments(argument, arg, val);
|
two_arguments(argument, arg, val);
|
||||||
|
|
||||||
if (is_abbrev(arg, "experience"))
|
if (is_abbrev(arg, "experience")) {
|
||||||
{
|
|
||||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||||
HAPPY_EXP = num;
|
HAPPY_EXP = num;
|
||||||
send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP);
|
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);
|
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||||
HAPPY_GOLD = num;
|
HAPPY_GOLD = num;
|
||||||
send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD);
|
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);
|
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||||
if (HAPPY_TIME && !num)
|
if (HAPPY_TIME && !num)
|
||||||
game_info("Happyhour has been stopped!");
|
game_info("Happyhour has been stopped!");
|
||||||
@@ -929,27 +923,19 @@ ACMD(do_happyhour)
|
|||||||
(HAPPY_TIME * SECS_PER_MUD_HOUR) / 3600,
|
(HAPPY_TIME * SECS_PER_MUD_HOUR) / 3600,
|
||||||
((HAPPY_TIME * SECS_PER_MUD_HOUR) % 3600) / 60,
|
((HAPPY_TIME * SECS_PER_MUD_HOUR) % 3600) / 60,
|
||||||
(HAPPY_TIME * SECS_PER_MUD_HOUR) % 60);
|
(HAPPY_TIME * SECS_PER_MUD_HOUR) % 60);
|
||||||
}
|
} else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints"))) {
|
||||||
else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints")))
|
|
||||||
{
|
|
||||||
num = MIN(MAX((atoi(val)), 0), 1000);
|
num = MIN(MAX((atoi(val)), 0), 1000);
|
||||||
HAPPY_QP = num;
|
HAPPY_QP = num;
|
||||||
send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP);
|
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);
|
show_happyhour(ch);
|
||||||
}
|
} else if (is_abbrev(arg, "default")) {
|
||||||
else if (is_abbrev(arg, "default"))
|
|
||||||
{
|
|
||||||
HAPPY_EXP = 100;
|
HAPPY_EXP = 100;
|
||||||
HAPPY_GOLD = 50;
|
HAPPY_GOLD = 50;
|
||||||
HAPPY_QP = 50;
|
HAPPY_QP = 50;
|
||||||
HAPPY_TIME = 48;
|
HAPPY_TIME = 48;
|
||||||
game_info("A Happyhour has started!");
|
game_info("A Happyhour has started!");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n"
|
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 show %s- display current settings (what mortals see)\r\n"
|
||||||
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
|
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
|
||||||
|
|||||||
+42
-24
@@ -30,8 +30,8 @@ ACMD(do_action)
|
|||||||
char arg[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH], part[MAX_INPUT_LENGTH];
|
||||||
int act_nr;
|
int act_nr;
|
||||||
struct social_messg *action;
|
struct social_messg *action;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
struct obj_data *targ;
|
obj_data *targ;
|
||||||
|
|
||||||
if ((act_nr = find_action(cmd)) < 0) {
|
if ((act_nr = find_action(cmd)) < 0) {
|
||||||
send_to_char(ch, "That action is not supported.\r\n");
|
send_to_char(ch, "That action is not supported.\r\n");
|
||||||
@@ -65,7 +65,8 @@ ACMD(do_action)
|
|||||||
if (!vict) {
|
if (!vict) {
|
||||||
if (action->char_obj_found) {
|
if (action->char_obj_found) {
|
||||||
targ = get_obj_in_list_vis(ch, arg, NULL, ch->carrying);
|
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) {
|
if (targ) {
|
||||||
act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR);
|
act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR);
|
||||||
act(action->others_obj_found, action->hide, ch, targ, 0, TO_ROOM);
|
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);
|
act("$N is not in a proper position for that.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
||||||
else {
|
else {
|
||||||
if (*part) {
|
if (*part) {
|
||||||
act(action->char_body_found, 0, ch, (struct obj_data *)part, vict, TO_CHAR | TO_SLEEP);
|
act(action->char_body_found, 0, ch, (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->others_body_found, action->hide, ch, (obj_data *)part, vict, TO_NOTVICT);
|
||||||
act(action->vict_body_found, action->hide, ch, (struct obj_data *)part, vict, TO_VICT);
|
act(action->vict_body_found, action->hide, ch, (obj_data *)part, vict, TO_VICT);
|
||||||
} else {
|
} else {
|
||||||
act(action->char_found, 0, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
act(action->char_found, 0, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
||||||
act(action->others_found, action->hide, ch, 0, vict, TO_NOTVICT);
|
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 */
|
/* count the commands in the command list */
|
||||||
i = 0;
|
i = 0;
|
||||||
while(*cmd_info[i].command != '\n') i++;
|
while (*cmd_info[i].command != '\n')
|
||||||
|
i++;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2);
|
CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2);
|
||||||
@@ -173,22 +175,38 @@ void free_social_messages(void)
|
|||||||
free(soc_mess_list);
|
free(soc_mess_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_action(struct social_messg *mess) {
|
void free_action(struct social_messg *mess)
|
||||||
if (mess->command) free(mess->command);
|
{
|
||||||
if (mess->sort_as) free(mess->sort_as);
|
if (mess->command)
|
||||||
if (mess->char_no_arg) free(mess->char_no_arg);
|
free(mess->command);
|
||||||
if (mess->others_no_arg) free(mess->others_no_arg);
|
if (mess->sort_as)
|
||||||
if (mess->char_found) free(mess->char_found);
|
free(mess->sort_as);
|
||||||
if (mess->others_found) free(mess->others_found);
|
if (mess->char_no_arg)
|
||||||
if (mess->vict_found) free(mess->vict_found);
|
free(mess->char_no_arg);
|
||||||
if (mess->char_body_found) free(mess->char_body_found);
|
if (mess->others_no_arg)
|
||||||
if (mess->others_body_found) free(mess->others_body_found);
|
free(mess->others_no_arg);
|
||||||
if (mess->vict_body_found) free(mess->vict_body_found);
|
if (mess->char_found)
|
||||||
if (mess->not_found) free(mess->not_found);
|
free(mess->char_found);
|
||||||
if (mess->char_auto) free(mess->char_auto);
|
if (mess->others_found)
|
||||||
if (mess->others_auto) free(mess->others_auto);
|
free(mess->others_found);
|
||||||
if (mess->char_obj_found) free(mess->char_obj_found);
|
if (mess->vict_found)
|
||||||
if (mess->others_obj_found) free(mess->others_obj_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));
|
memset(mess, 0, sizeof(struct social_messg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +240,7 @@ ACMD(do_gmote)
|
|||||||
int act_nr, length;
|
int act_nr, length;
|
||||||
char arg[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||||
struct social_messg *action;
|
struct social_messg *action;
|
||||||
struct char_data *vict = NULL;
|
char_data *vict = NULL;
|
||||||
|
|
||||||
half_chop(argument, buf, arg);
|
half_chop(argument, buf, arg);
|
||||||
|
|
||||||
|
|||||||
+234
-227
File diff suppressed because it is too large
Load Diff
+65
-38
@@ -22,20 +22,19 @@
|
|||||||
|
|
||||||
/* local utility functions */
|
/* local utility functions */
|
||||||
static int aedit_find_command(const char *txt);
|
static int aedit_find_command(const char *txt);
|
||||||
static void aedit_disp_menu(struct descriptor_data * d);
|
static void aedit_disp_menu(descriptor_data *d);
|
||||||
static void aedit_save_to_disk(struct descriptor_data *d);
|
static void aedit_save_to_disk(descriptor_data *d);
|
||||||
/* used in aedit parse */
|
/* used in aedit parse */
|
||||||
static void aedit_setup_new(struct descriptor_data *d);
|
static void aedit_setup_new(descriptor_data *d);
|
||||||
static void aedit_setup_existing(struct descriptor_data *d, int real_num);
|
static void aedit_setup_existing(descriptor_data *d, int real_num);
|
||||||
static void aedit_save_internally(struct descriptor_data *d);
|
static void aedit_save_internally(descriptor_data *d);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Utils and exported functions. */
|
/* Utils and exported functions. */
|
||||||
ACMD(do_oasis_aedit)
|
ACMD(do_oasis_aedit)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* No building as a mob or while being forced. */
|
||||||
@@ -107,7 +106,8 @@ ACMD(do_oasis_aedit)
|
|||||||
mudlog(CMP, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "OLC: %s starts editing actions.", GET_NAME(ch));
|
mudlog(CMP, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "OLC: %s starts editing actions.", GET_NAME(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aedit_setup_new(struct descriptor_data *d) {
|
static void aedit_setup_new(descriptor_data *d)
|
||||||
|
{
|
||||||
CREATE(OLC_ACTION(d), struct social_messg, 1);
|
CREATE(OLC_ACTION(d), struct social_messg, 1);
|
||||||
OLC_ACTION(d)->command = strdup(OLC_STORAGE(d));
|
OLC_ACTION(d)->command = strdup(OLC_STORAGE(d));
|
||||||
OLC_ACTION(d)->sort_as = strdup(OLC_STORAGE(d));
|
OLC_ACTION(d)->sort_as = strdup(OLC_STORAGE(d));
|
||||||
@@ -132,7 +132,8 @@ static void aedit_setup_new(struct descriptor_data *d) {
|
|||||||
OLC_VAL(d) = 0;
|
OLC_VAL(d) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aedit_setup_existing(struct descriptor_data *d, int real_num) {
|
static void aedit_setup_existing(descriptor_data *d, int real_num)
|
||||||
|
{
|
||||||
CREATE(OLC_ACTION(d), struct social_messg, 1);
|
CREATE(OLC_ACTION(d), struct social_messg, 1);
|
||||||
OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command);
|
OLC_ACTION(d)->command = strdup(soc_mess_list[real_num].command);
|
||||||
OLC_ACTION(d)->sort_as = strdup(soc_mess_list[real_num].sort_as);
|
OLC_ACTION(d)->sort_as = strdup(soc_mess_list[real_num].sort_as);
|
||||||
@@ -170,7 +171,8 @@ static void aedit_setup_existing(struct descriptor_data *d, int real_num) {
|
|||||||
aedit_disp_menu(d);
|
aedit_disp_menu(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aedit_save_internally(struct descriptor_data *d) {
|
static void aedit_save_internally(descriptor_data *d)
|
||||||
|
{
|
||||||
struct social_messg *new_soc_mess_list = NULL;
|
struct social_messg *new_soc_mess_list = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -200,7 +202,8 @@ static void aedit_save_internally(struct descriptor_data *d) {
|
|||||||
aedit_save_to_disk(d); /* autosave by Rumble */
|
aedit_save_to_disk(d); /* autosave by Rumble */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aedit_save_to_disk(struct descriptor_data *d) {
|
static void aedit_save_to_disk(descriptor_data *d)
|
||||||
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -252,9 +255,10 @@ static void aedit_save_to_disk(struct descriptor_data *d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The Main Menu. */
|
/* The Main Menu. */
|
||||||
static void aedit_disp_menu(struct descriptor_data * d) {
|
static void aedit_disp_menu(descriptor_data *d)
|
||||||
|
{
|
||||||
struct social_messg *action = OLC_ACTION(d);
|
struct social_messg *action = OLC_ACTION(d);
|
||||||
struct char_data *ch = d->character;
|
char_data *ch = d->character;
|
||||||
|
|
||||||
get_char_colors(ch);
|
get_char_colors(ch);
|
||||||
|
|
||||||
@@ -322,13 +326,15 @@ static void aedit_disp_menu(struct descriptor_data * d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The main loop. */
|
/* The main loop. */
|
||||||
void aedit_parse(struct descriptor_data * d, char *arg) {
|
void aedit_parse(descriptor_data *d, char *arg)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (OLC_MODE(d)) {
|
switch (OLC_MODE(d)) {
|
||||||
case AEDIT_CONFIRM_SAVESTRING:
|
case AEDIT_CONFIRM_SAVESTRING:
|
||||||
switch (*arg) {
|
switch (*arg) {
|
||||||
case 'y': case 'Y':
|
case 'y':
|
||||||
|
case 'Y':
|
||||||
aedit_save_internally(d);
|
aedit_save_internally(d);
|
||||||
mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits action %s",
|
mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits action %s",
|
||||||
GET_NAME(d->character), OLC_ACTION(d)->command);
|
GET_NAME(d->character), OLC_ACTION(d)->command);
|
||||||
@@ -337,7 +343,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||||
write_to_output(d, "Action saved to disk.\r\n");
|
write_to_output(d, "Action saved to disk.\r\n");
|
||||||
break;
|
break;
|
||||||
case 'n': case 'N':
|
case 'n':
|
||||||
|
case 'N':
|
||||||
/* free everything up, including strings etc */
|
/* free everything up, including strings etc */
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
break;
|
break;
|
||||||
@@ -350,13 +357,16 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
case AEDIT_CONFIRM_EDIT:
|
case AEDIT_CONFIRM_EDIT:
|
||||||
switch (*arg) {
|
switch (*arg) {
|
||||||
case 'y': case 'Y':
|
case 'y':
|
||||||
|
case 'Y':
|
||||||
aedit_setup_existing(d, OLC_ZNUM(d));
|
aedit_setup_existing(d, OLC_ZNUM(d));
|
||||||
break;
|
break;
|
||||||
case 'q': case 'Q':
|
case 'q':
|
||||||
|
case 'Q':
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
break;
|
break;
|
||||||
case 'n': case 'N':
|
case 'n':
|
||||||
|
case 'N':
|
||||||
OLC_ZNUM(d)++;
|
OLC_ZNUM(d)++;
|
||||||
for (; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
for (; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
||||||
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
||||||
@@ -386,10 +396,14 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
case AEDIT_CONFIRM_ADD:
|
case AEDIT_CONFIRM_ADD:
|
||||||
switch (*arg) {
|
switch (*arg) {
|
||||||
case 'y': case 'Y':
|
case 'y':
|
||||||
|
case 'Y':
|
||||||
aedit_setup_new(d);
|
aedit_setup_new(d);
|
||||||
break;
|
break;
|
||||||
case 'n': case 'N': case 'q': case 'Q':
|
case 'n':
|
||||||
|
case 'N':
|
||||||
|
case 'q':
|
||||||
|
case 'Q':
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -402,12 +416,13 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
case AEDIT_MAIN_MENU:
|
case AEDIT_MAIN_MENU:
|
||||||
switch (*arg) {
|
switch (*arg) {
|
||||||
case 'q': case 'Q':
|
case 'q':
|
||||||
|
case 'Q':
|
||||||
if (OLC_VAL(d)) { /* Something was modified */
|
if (OLC_VAL(d)) { /* Something was modified */
|
||||||
write_to_output(d, "Do you wish to save your changes? : ");
|
write_to_output(d, "Do you wish to save your changes? : ");
|
||||||
OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING;
|
OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING;
|
||||||
}
|
} else
|
||||||
else cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
write_to_output(d, "Enter action name: ");
|
write_to_output(d, "Enter action name: ");
|
||||||
@@ -442,21 +457,24 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
aedit_disp_menu(d);
|
aedit_disp_menu(d);
|
||||||
OLC_VAL(d) = 1;
|
OLC_VAL(d) = 1;
|
||||||
break;
|
break;
|
||||||
case 'a': case 'A':
|
case 'a':
|
||||||
|
case 'A':
|
||||||
write_to_output(d, "Enter social shown to the Character when there is no argument supplied.\r\n"
|
write_to_output(d, "Enter social shown to the Character when there is no argument supplied.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->char_no_arg) ? OLC_ACTION(d)->char_no_arg : "NULL"));
|
((OLC_ACTION(d)->char_no_arg) ? OLC_ACTION(d)->char_no_arg : "NULL"));
|
||||||
OLC_MODE(d) = AEDIT_NOVICT_CHAR;
|
OLC_MODE(d) = AEDIT_NOVICT_CHAR;
|
||||||
return;
|
return;
|
||||||
case 'b': case 'B':
|
case 'b':
|
||||||
|
case 'B':
|
||||||
write_to_output(d, "Enter social shown to Others when there is no argument supplied.\r\n"
|
write_to_output(d, "Enter social shown to Others when there is no argument supplied.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->others_no_arg) ? OLC_ACTION(d)->others_no_arg : "NULL"));
|
((OLC_ACTION(d)->others_no_arg) ? OLC_ACTION(d)->others_no_arg : "NULL"));
|
||||||
OLC_MODE(d) = AEDIT_NOVICT_OTHERS;
|
OLC_MODE(d) = AEDIT_NOVICT_OTHERS;
|
||||||
return;
|
return;
|
||||||
case 'c': case 'C':
|
case 'c':
|
||||||
|
case 'C':
|
||||||
write_to_output(d, "Enter text shown to the Character when his victim isnt found.\r\n"
|
write_to_output(d, "Enter text shown to the Character when his victim isnt found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -464,7 +482,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_NOT_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_NOT_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'd': case 'D':
|
case 'd':
|
||||||
|
case 'D':
|
||||||
write_to_output(d, "Enter social shown to the Character when it is its own victim.\r\n"
|
write_to_output(d, "Enter social shown to the Character when it is its own victim.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -472,7 +491,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_SELF_CHAR;
|
OLC_MODE(d) = AEDIT_SELF_CHAR;
|
||||||
return;
|
return;
|
||||||
case 'e': case 'E':
|
case 'e':
|
||||||
|
case 'E':
|
||||||
write_to_output(d, "Enter social shown to Others when the Char is its own victim.\r\n"
|
write_to_output(d, "Enter social shown to Others when the Char is its own victim.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -480,7 +500,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_SELF_OTHERS;
|
OLC_MODE(d) = AEDIT_SELF_OTHERS;
|
||||||
return;
|
return;
|
||||||
case 'f': case 'F':
|
case 'f':
|
||||||
|
case 'F':
|
||||||
write_to_output(d, "Enter normal social shown to the Character when the victim is found.\r\n"
|
write_to_output(d, "Enter normal social shown to the Character when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -488,7 +509,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'g': case 'G':
|
case 'g':
|
||||||
|
case 'G':
|
||||||
write_to_output(d, "Enter normal social shown to Others when the victim is found.\r\n"
|
write_to_output(d, "Enter normal social shown to Others when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -496,7 +518,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'h': case 'H':
|
case 'h':
|
||||||
|
case 'H':
|
||||||
write_to_output(d, "Enter normal social shown to the Victim when the victim is found.\r\n"
|
write_to_output(d, "Enter normal social shown to the Victim when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -504,7 +527,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_VICT_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_VICT_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'i': case 'I':
|
case 'i':
|
||||||
|
case 'I':
|
||||||
write_to_output(d, "Enter 'body part' social shown to the Character when the victim is found.\r\n"
|
write_to_output(d, "Enter 'body part' social shown to the Character when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -512,7 +536,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'j': case 'J':
|
case 'j':
|
||||||
|
case 'J':
|
||||||
write_to_output(d, "Enter 'body part' social shown to Others when the victim is found.\r\n"
|
write_to_output(d, "Enter 'body part' social shown to Others when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -520,7 +545,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'k': case 'K':
|
case 'k':
|
||||||
|
case 'K':
|
||||||
write_to_output(d, "Enter 'body part' social shown to the Victim when the victim is found.\r\n"
|
write_to_output(d, "Enter 'body part' social shown to the Victim when the victim is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -528,7 +554,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'l': case 'L':
|
case 'l':
|
||||||
|
case 'L':
|
||||||
write_to_output(d, "Enter 'object' social shown to the Character when the object is found.\r\n"
|
write_to_output(d, "Enter 'object' social shown to the Character when the object is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -536,7 +563,8 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||||||
|
|
||||||
OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND;
|
OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'm': case 'M':
|
case 'm':
|
||||||
|
case 'M':
|
||||||
write_to_output(d, "Enter 'object' social shown to the Room when the object is found.\r\n"
|
write_to_output(d, "Enter 'object' social shown to the Room when the object is found.\r\n"
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
@@ -818,4 +846,3 @@ static int aedit_find_command(const char *txt)
|
|||||||
return (cmd);
|
return (cmd);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+128
-101
@@ -15,12 +15,8 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "interpreter.h"
|
#include "interpreter.h"
|
||||||
#include "handler.h"
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "spells.h"
|
|
||||||
#include "house.h"
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "dg_scripts.h"
|
|
||||||
#include "asciimap.h"
|
#include "asciimap.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -33,29 +29,28 @@
|
|||||||
|
|
||||||
#define DEFAULT_MAP_SIZE CONFIG_MAP_SIZE
|
#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 CANVAS_WIDTH
|
||||||
|
|
||||||
#define MAX_MAP_DIR 10
|
#define MAX_MAP_DIR 10
|
||||||
#define MAX_MAP_FOLLOW 10
|
|
||||||
|
|
||||||
#define SECT_EMPTY 30 /* anything greater than num sect types */
|
#define SECT_EMPTY 30 /* anything greater than num sect types */
|
||||||
#define SECT_STRANGE (SECT_EMPTY + 1)
|
#define SECT_STRANGE (SECT_EMPTY + 1)
|
||||||
#define SECT_HERE (SECT_STRANGE + 1)
|
#define SECT_HERE (SECT_STRANGE + 1)
|
||||||
|
|
||||||
#define DOOR_NS -1
|
#define DOOR_NS (-1)
|
||||||
#define DOOR_EW -2
|
#define DOOR_EW (-2)
|
||||||
#define DOOR_UP -3
|
#define DOOR_UP (-3)
|
||||||
#define DOOR_DOWN -4
|
#define DOOR_DOWN (-4)
|
||||||
#define DOOR_DIAGNE -5
|
#define DOOR_DIAGNE (-5)
|
||||||
#define DOOR_DIAGNW -6
|
#define DOOR_DIAGNW (-6)
|
||||||
#define VDOOR_NS -7
|
#define VDOOR_NS (-7)
|
||||||
#define VDOOR_EW -8
|
#define VDOOR_EW (-8)
|
||||||
#define VDOOR_DIAGNE -9
|
#define VDOOR_DIAGNE (-9)
|
||||||
#define VDOOR_DIAGNW -10
|
#define VDOOR_DIAGNW (-10)
|
||||||
#define DOOR_UP_AND_NE -11
|
#define DOOR_UP_AND_NE (-11)
|
||||||
#define DOOR_DOWN_AND_SE -12
|
#define DOOR_DOWN_AND_SE (-12)
|
||||||
#define DOOR_NONE -13
|
#define DOOR_NONE (-13)
|
||||||
#define NUM_DOOR_TYPES 13
|
#define NUM_DOOR_TYPES 13
|
||||||
|
|
||||||
#define MAP_CIRCLE 0
|
#define MAP_CIRCLE 0
|
||||||
@@ -64,8 +59,6 @@
|
|||||||
#define MAP_NORMAL 0
|
#define MAP_NORMAL 0
|
||||||
#define MAP_COMPACT 1
|
#define MAP_COMPACT 1
|
||||||
|
|
||||||
static bool show_worldmap(struct char_data *ch);
|
|
||||||
|
|
||||||
struct map_info_type
|
struct map_info_type
|
||||||
{
|
{
|
||||||
int sector_type;
|
int sector_type;
|
||||||
@@ -192,9 +185,12 @@ static int door_offsets[6][2] ={ {-1, 0},{ 0, 1},{ 1, 0},{ 0, -1},{ -1, 1},{ 1,
|
|||||||
static int door_marks[6] = { DOOR_NS, DOOR_EW, DOOR_NS, DOOR_EW, DOOR_UP, DOOR_DOWN };
|
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[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 offsets_worldmap[10][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {0, 0}, {0, 0}, {-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} };
|
{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 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 vdoor_marks[4] = {VDOOR_NS, VDOOR_EW, VDOOR_NS, VDOOR_EW};
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* End Local (File Scope) Defines and Global Variables
|
* End Local (File Scope) Defines and Global Variables
|
||||||
@@ -203,33 +199,36 @@ static int vdoor_marks[4] = { VDOOR_NS, VDOOR_EW, VDOOR_NS, VDOOR_EW };
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Begin Local (File Scope) Function Prototypes
|
* 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 *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 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
|
* 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? */
|
/* Is the map funcionality disabled? */
|
||||||
if (CONFIG_MAP == MAP_OFF)
|
if (CONFIG_MAP == MAP_OFF || (CONFIG_MAP == MAP_IMM_ONLY && GET_LEVEL(ch) < LVL_IMMORT))
|
||||||
return FALSE;
|
|
||||||
else if ((CONFIG_MAP == MAP_IMM_ONLY) && (GET_LEVEL(ch) < LVL_IMMORT))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MapArea function - create the actual map */
|
/* 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;
|
room_rnum prospect_room;
|
||||||
struct room_direction_data *pexit;
|
struct room_direction_data *pexit;
|
||||||
int door, ew_size=0, ns_size=0, x_exit_pos=0, y_exit_pos=0;
|
int door;
|
||||||
sh_int prospect_xpos, prospect_ypos;
|
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)
|
if (map[x][y] < 0)
|
||||||
return; /* this is a door */
|
return; /* this is a door */
|
||||||
@@ -240,56 +239,74 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min,
|
|||||||
else
|
else
|
||||||
map[x][y] = SECT(room);
|
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 */
|
/* Check for exits */
|
||||||
for (door = 0; door < MAX_MAP_DIR; door++) {
|
for (door = 0; door < MAX_MAP_DIR; door++) {
|
||||||
|
|
||||||
if( door < MAX_MAP_FOLLOW &&
|
if (xpos + door_offsets[door][0] >= 0 &&
|
||||||
xpos+door_offsets[door][0] >= 0 &&
|
|
||||||
xpos + door_offsets[door][0] <= ns_size &&
|
xpos + door_offsets[door][0] <= ns_size &&
|
||||||
ypos + door_offsets[door][1] >= 0 &&
|
ypos + door_offsets[door][1] >= 0 &&
|
||||||
ypos+door_offsets[door][1] <= ew_size)
|
ypos + door_offsets[door][1] <= ew_size) { /* Virtual exit */
|
||||||
{ /* 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)
|
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);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pexit = world[room].dir_option[door]) != NULL &&
|
if ((pexit = world[room].dir_option[door]) != NULL &&
|
||||||
(pexit->to_room > 0 ) && (pexit->to_room != NOWHERE) &&
|
pexit->to_room > 0 && pexit->to_room != NOWHERE &&
|
||||||
(!IS_SET(pexit->exit_info, EX_CLOSED)) &&
|
!IS_SET(pexit->exit_info, EX_CLOSED) &&
|
||||||
(!IS_SET(pexit->exit_info, EX_HIDDEN) || PRF_FLAGGED(ch, PRF_HOLYLIGHT)) )
|
(!IS_SET(pexit->exit_info, EX_HIDDEN) || PRF_FLAGGED(ch, PRF_HOLYLIGHT))) { /* A real exit */
|
||||||
{ /* A real exit */
|
|
||||||
|
|
||||||
/* But is the door here... */
|
/* But is the door here... */
|
||||||
switch (door) {
|
switch (door) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
if(xpos > 0 || ypos!=y_exit_pos) continue;
|
if (xpos > 0 || ypos != y_exit_pos)
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
if(xpos < ns_size || ypos!=y_exit_pos) continue;
|
if (xpos < ns_size || ypos != y_exit_pos)
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
if(ypos < ew_size || xpos!=x_exit_pos) continue;
|
if (ypos < ew_size || xpos != x_exit_pos)
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
if(ypos > 0 || xpos!=x_exit_pos) continue;
|
if (ypos > 0 || xpos != x_exit_pos)
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
case NORTHWEST:
|
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;
|
break;
|
||||||
case NORTHEAST:
|
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;
|
break;
|
||||||
case SOUTHEAST:
|
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;
|
break;
|
||||||
case SOUTHWEST:
|
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;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -304,16 +321,16 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!worldmap) {
|
if (!worldmap) {
|
||||||
if ((map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_NONE) ||
|
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]] == SECT_EMPTY) {
|
||||||
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = door_marks[door];
|
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = door_marks[door];
|
||||||
} else {
|
} else {
|
||||||
if ( ((door == NORTHEAST) && (map[x+door_offsets[door][0]][y+door_offsets[door][1]] == DOOR_UP)) ||
|
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)) ) {
|
(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;
|
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)
|
||||||
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)) ) {
|
(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;
|
map[x + door_offsets[door][0]][y + door_offsets[door][1]] = DOOR_DOWN_AND_SE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,21 +355,29 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min,
|
|||||||
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;
|
||||||
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size / 2;
|
prospect_ypos = world[prospect_room].dir_option[rev_dir[door]] ? y_exit_pos : ew_size / 2;
|
||||||
break;
|
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 (worldmap) {
|
||||||
if ( door < MAX_MAP_FOLLOW && map[x+offsets_worldmap[door][0]][y+offsets_worldmap[door][1]] == SECT_EMPTY )
|
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);
|
MapArea(pexit->to_room, ch, x + offsets_worldmap[door][0], y + offsets_worldmap[door][1], min, max,
|
||||||
|
prospect_xpos, prospect_ypos, worldmap);
|
||||||
} else {
|
} else {
|
||||||
if ( door < MAX_MAP_FOLLOW && map[x+offsets[door][0]][y+offsets[door][1]] == SECT_EMPTY )
|
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);
|
MapArea(pexit->to_room, ch, x + offsets[door][0], y + offsets[door][1], min, max, prospect_xpos,
|
||||||
|
prospect_ypos, worldmap);
|
||||||
}
|
}
|
||||||
} /* end if exit there */
|
} /* end if exit there */
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a string representation of the map */
|
/* Returns a string representation of the map */
|
||||||
|
// ReSharper disable once CppDFAConstantParameter
|
||||||
static char *StringMap(int centre, int size)
|
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];
|
||||||
@@ -365,9 +390,7 @@ static char *StringMap(int centre, int size)
|
|||||||
/* every column */
|
/* every column */
|
||||||
for (y = centre - CANVAS_WIDTH / 6; y <= centre + CANVAS_WIDTH / 6; y++) {
|
for (y = centre - CANVAS_WIDTH / 6; y <= centre + CANVAS_WIDTH / 6; y++) {
|
||||||
if (abs(centre - x) <= size && abs(centre - y) <= size)
|
if (abs(centre - x) <= size && abs(centre - y) <= size)
|
||||||
tmp = (map[x][y]<0) ? \
|
tmp = map[x][y] < 0 ? door_info[NUM_DOOR_TYPES + map[x][y]].disp : map_info[map[x][y]].disp;
|
||||||
door_info[NUM_DOOR_TYPES + map[x][y]].disp : \
|
|
||||||
map_info[map[x][y]].disp ;
|
|
||||||
else
|
else
|
||||||
tmp = map_info[SECT_EMPTY].disp;
|
tmp = map_info[SECT_EMPTY].disp;
|
||||||
strcpy(mp, tmp);
|
strcpy(mp, tmp);
|
||||||
@@ -380,6 +403,7 @@ static char *StringMap(int centre, int size)
|
|||||||
return strmap;
|
return strmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once CppDFAConstantParameter
|
||||||
static char *WorldMap(int centre, int size, int mapshape, int maptype)
|
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];
|
||||||
@@ -387,14 +411,12 @@ static char *WorldMap(int centre, int size, int mapshape, int maptype )
|
|||||||
int x, y;
|
int x, y;
|
||||||
int xmin, xmax, ymin, ymax;
|
int xmin, xmax, ymin, ymax;
|
||||||
|
|
||||||
switch(maptype) {
|
if (maptype == MAP_COMPACT) {
|
||||||
case MAP_COMPACT:
|
|
||||||
xmin = centre - size;
|
xmin = centre - size;
|
||||||
xmax = centre + size;
|
xmax = centre + size;
|
||||||
ymin = centre - 2 * size;
|
ymin = centre - 2 * size;
|
||||||
ymax = centre + 2 * size;
|
ymax = centre + 2 * size;
|
||||||
break;
|
} else {
|
||||||
default:
|
|
||||||
xmin = centre - CANVAS_HEIGHT / 2;
|
xmin = centre - CANVAS_HEIGHT / 2;
|
||||||
xmax = centre + CANVAS_HEIGHT / 2;
|
xmax = centre + CANVAS_HEIGHT / 2;
|
||||||
ymin = centre - CANVAS_WIDTH / 2;
|
ymin = centre - CANVAS_WIDTH / 2;
|
||||||
@@ -410,7 +432,8 @@ static char *WorldMap(int centre, int size, int mapshape, int maptype )
|
|||||||
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) ||
|
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))) {
|
(mapshape == MAP_CIRCLE && (centre - x) * (centre - x) + (centre - y) * (centre - y) / 4 <= size * size +
|
||||||
|
1)) {
|
||||||
strcpy(mp, world_map_info[map[x][y]].disp);
|
strcpy(mp, world_map_info[map[x][y]].disp);
|
||||||
mp += strlen(world_map_info[map[x][y]].disp);
|
mp += strlen(world_map_info[map[x][y]].disp);
|
||||||
} else {
|
} else {
|
||||||
@@ -424,6 +447,7 @@ static char *WorldMap(int centre, int size, int mapshape, int maptype )
|
|||||||
return strmap;
|
return strmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once CppDFAConstantParameter
|
||||||
static char *CompactStringMap(int centre, int size)
|
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];
|
||||||
@@ -434,12 +458,8 @@ static char *CompactStringMap(int centre, int size)
|
|||||||
for (x = centre - size; x <= centre + size; x++) {
|
for (x = centre - size; x <= centre + size; x++) {
|
||||||
/* every column */
|
/* every column */
|
||||||
for (y = centre - size; y <= centre + size; y++) {
|
for (y = centre - size; y <= centre + size; y++) {
|
||||||
strcpy(mp, (map[x][y]<0) ? \
|
strcpy(mp, map[x][y] < 0 ? compact_door_info[NUM_DOOR_TYPES + map[x][y]].disp : map_info[map[x][y]].disp);
|
||||||
compact_door_info[NUM_DOOR_TYPES + 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);
|
||||||
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");
|
strcpy(mp, "\r\n");
|
||||||
mp += 2;
|
mp += 2;
|
||||||
@@ -449,24 +469,25 @@ static char *CompactStringMap(int centre, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display a nicely formatted map with a legend */
|
/* 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 size = DEFAULT_MAP_SIZE;
|
||||||
int centre, x, y, min, max;
|
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 count = 0;
|
||||||
int ew_size=0, ns_size=0;
|
const int ew_size = 0, ns_size = 0;
|
||||||
int mapshape = MAP_CIRCLE;
|
int mapshape = MAP_CIRCLE;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if(*arg1)
|
if (*arg1) {
|
||||||
{
|
size = parse_int(arg1);
|
||||||
size = atoi(arg1);
|
|
||||||
}
|
}
|
||||||
if (*arg2)
|
if (*arg2) {
|
||||||
{
|
if (is_abbrev(arg2, "normal"))
|
||||||
if (is_abbrev(arg2, "normal")) worldmap=FALSE;
|
worldmap = FALSE;
|
||||||
else if (is_abbrev(arg2, "world")) worldmap=TRUE;
|
else if (is_abbrev(arg2, "world"))
|
||||||
|
worldmap = TRUE;
|
||||||
else {
|
else {
|
||||||
send_to_char(ch, "Usage: \tymap <distance> [ normal | world ]\tn");
|
send_to_char(ch, "Usage: \tymap <distance> [ normal | world ]\tn");
|
||||||
return;
|
return;
|
||||||
@@ -492,7 +513,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
|
|||||||
/* Blank the map */
|
/* Blank the map */
|
||||||
for (x = 0; x < MAX_MAP; ++x)
|
for (x = 0; x < MAX_MAP; ++x)
|
||||||
for (y = 0; y < MAX_MAP; ++y)
|
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 centre room */
|
/* 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);
|
||||||
@@ -503,7 +524,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
|
|||||||
/* Feel free to put your own MUD name or header in 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"
|
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 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\tn\tn%s Down\\\\", door_info[NUM_DOOR_TYPES + DOOR_DOWN].disp);
|
||||||
count += sprintf(buf + count, "\tn%s You\\\\", map_info[SECT_HERE].disp);
|
count += sprintf(buf + count, "\tn%s You\\\\", map_info[SECT_HERE].disp);
|
||||||
@@ -528,7 +549,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
|
|||||||
|
|
||||||
/* Set up the map */
|
/* Set up the map */
|
||||||
memset(buf, ' ', CANVAS_WIDTH);
|
memset(buf, ' ', CANVAS_WIDTH);
|
||||||
count = (CANVAS_WIDTH);
|
count = CANVAS_WIDTH;
|
||||||
if (worldmap)
|
if (worldmap)
|
||||||
count += sprintf(buf + count, "\r\n%s", WorldMap(centre, size, mapshape, MAP_NORMAL));
|
count += sprintf(buf + count, "\r\n%s", WorldMap(centre, size, mapshape, MAP_NORMAL));
|
||||||
else
|
else
|
||||||
@@ -543,11 +564,11 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
|
|||||||
send_to_char(ch, "%s", buf2);
|
send_to_char(ch, "%s", buf2);
|
||||||
|
|
||||||
send_to_char(ch, "\tD `.-.__--.,-.__.-.-'\tn\r\n");
|
send_to_char(ch, "\tD `.-.__--.,-.__.-.-'\tn\r\n");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a string with the map beside it */
|
/* 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 size, centre, x, y, min, max, char_size;
|
||||||
int ew_size = 0, ns_size = 0;
|
int ew_size = 0, ns_size = 0;
|
||||||
bool worldmap;
|
bool worldmap;
|
||||||
@@ -572,7 +593,7 @@ void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
|
|||||||
|
|
||||||
for (x = 0; x < MAX_MAP; ++x)
|
for (x = 0; x < MAX_MAP; ++x)
|
||||||
for (y = 0; y < MAX_MAP; ++y)
|
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 */
|
/* 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);
|
||||||
@@ -582,26 +603,32 @@ MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldma
|
|||||||
if (worldmap)
|
if (worldmap)
|
||||||
char_size = size * 4 + 5;
|
char_size = size * 4 + 5;
|
||||||
else
|
else
|
||||||
char_size = 3*(size+1) + (size) + 4;
|
char_size = 3 * (size + 1) + size + 4;
|
||||||
|
|
||||||
if (worldmap)
|
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"));
|
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
|
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);
|
room_rnum rm = IN_ROOM(ch);
|
||||||
zone_rnum zn = GET_ROOM_ZONE(rm);
|
zone_rnum zn = GET_ROOM_ZONE(rm);
|
||||||
|
|
||||||
if (ROOM_FLAGGED(rm, ROOM_WORLDMAP)) return TRUE;
|
if (ROOM_FLAGGED(rm, ROOM_WORLDMAP))
|
||||||
if (ZONE_FLAGGED(zn, ZONE_WORLDMAP)) return TRUE;
|
return TRUE;
|
||||||
|
if (ZONE_FLAGGED(zn, ZONE_WORLDMAP))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACMD(do_map) {
|
ACMD(do_map)
|
||||||
|
{
|
||||||
if (!can_see_map(ch)) {
|
if (!can_see_map(ch)) {
|
||||||
send_to_char(ch, "Sorry, the map is disabled!\r\n");
|
send_to_char(ch, "Sorry, the map is disabled!\r\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@
|
|||||||
#define MAP_IMM_ONLY 2
|
#define MAP_IMM_ONLY 2
|
||||||
|
|
||||||
/* Exported function prototypes */
|
/* Exported function prototypes */
|
||||||
bool can_see_map(struct char_data *ch);
|
bool can_see_map(const char_data *ch);
|
||||||
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);
|
||||||
ACMD(do_map);
|
ACMD(do_map);
|
||||||
|
|
||||||
#endif /* ASCIIMAP_H_*/
|
#endif /* ASCIIMAP_H_*/
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "interpreter.h"
|
#include "interpreter.h"
|
||||||
#include "handler.h"
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "ban.h"
|
#include "ban.h"
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ static char *invalid_list[MAX_INVALID_NAMES];
|
|||||||
|
|
||||||
/* local utility functions */
|
/* local utility functions */
|
||||||
static void write_ban_list(void);
|
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[] = {
|
static const char *ban_types[] = {
|
||||||
"no",
|
"no",
|
||||||
@@ -41,27 +40,27 @@ static const char *ban_types[] = {
|
|||||||
void load_banned(void)
|
void load_banned(void)
|
||||||
{
|
{
|
||||||
FILE *fl;
|
FILE *fl;
|
||||||
int i, date;
|
int i;
|
||||||
char site_name[BANNED_SITE_LENGTH + 1], ban_type[100];
|
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;
|
struct ban_list_element *next_node;
|
||||||
|
|
||||||
ban_list = 0;
|
ban_list = 0;
|
||||||
|
|
||||||
if (!(fl = fopen(BAN_FILE, "r"))) {
|
if ((fl = fopen(BAN_FILE, "r")) != NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
log("SYSERR: Unable to open banfile '%s': %s", BAN_FILE, strerror(errno));
|
log("SYSERR: Unable to open banfile '%s': %s", BAN_FILE, strerror(errno));
|
||||||
} else
|
} else
|
||||||
log(" Ban file '%s' doesn't exist.", BAN_FILE);
|
log(" Ban file '%s' doesn't exist.", BAN_FILE);
|
||||||
return;
|
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);
|
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';
|
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->name[MAX_NAME_LENGTH] = '\0';
|
||||||
next_node->date = date;
|
next_node->date = parse_int(date_str);
|
||||||
|
|
||||||
for (i = BAN_NOT; i <= BAN_ALL; i++)
|
for (i = BAN_NOT; i <= BAN_ALL; i++)
|
||||||
if (!strcmp(ban_type, ban_types[i]))
|
if (!strcmp(ban_type, ban_types[i]))
|
||||||
@@ -81,7 +80,7 @@ int isbanned(char *hostname)
|
|||||||
char *nextchar;
|
char *nextchar;
|
||||||
|
|
||||||
if (!hostname || !*hostname)
|
if (!hostname || !*hostname)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (nextchar = hostname; *nextchar; nextchar++)
|
for (nextchar = hostname; *nextchar; nextchar++)
|
||||||
@@ -91,15 +90,15 @@ int isbanned(char *hostname)
|
|||||||
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);
|
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) {
|
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],
|
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;
|
FILE *fl;
|
||||||
|
|
||||||
if (!(fl = fopen(BAN_FILE, "w"))) {
|
if ((fl = fopen(BAN_FILE, "w")) == NULL) {
|
||||||
perror("SYSERR: Unable to open '" BAN_FILE "' for writing");
|
perror("SYSERR: Unable to open '" BAN_FILE "' for writing");
|
||||||
return;
|
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);
|
fclose(fl);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-15.15s %-16.16s\r\n"
|
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-15.15s %-16.16s\r\n"
|
||||||
@@ -216,6 +214,7 @@ ACMD(do_unban)
|
|||||||
REMOVE_FROM_LIST(ban_node, ban_list, next);
|
REMOVE_FROM_LIST(ban_node, ban_list, next);
|
||||||
send_to_char(ch, "Site unbanned.\r\n");
|
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.",
|
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s removed the %s-player ban on %s.",
|
||||||
|
// ReSharper disable once CppDFANullDereference
|
||||||
GET_NAME(ch), ban_types[ban_node->type], ban_node->site);
|
GET_NAME(ch), ban_types[ban_node->type], ban_node->site);
|
||||||
|
|
||||||
free(ban_node);
|
free(ban_node);
|
||||||
@@ -223,12 +222,11 @@ ACMD(do_unban)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Check for invalid names (i.e., profanity, etc.) Written by Sharon P Garza. */
|
/* 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;
|
int i, vowels = 0;
|
||||||
struct descriptor_data *dt;
|
descriptor_data *dt;
|
||||||
char tempname[MAX_INPUT_LENGTH];
|
char tempname[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
/* Make sure someone isn't trying to create this same name. We want to do a
|
/* 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;
|
FILE *fp;
|
||||||
char temp[256];
|
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");
|
perror("SYSERR: Unable to open '" XNAME_FILE "' for reading");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct ban_list_element {
|
|||||||
/* Utility Functions */
|
/* Utility Functions */
|
||||||
void load_banned(void);
|
void load_banned(void);
|
||||||
int isbanned(char *hostname);
|
int isbanned(char *hostname);
|
||||||
int valid_name(char *newname);
|
int valid_name(const char *newname);
|
||||||
void read_invalid_list(void);
|
void read_invalid_list(void);
|
||||||
void free_invalid_list(void);
|
void free_invalid_list(void);
|
||||||
/* Command functions without subcommands */
|
/* Command functions without subcommands */
|
||||||
|
|||||||
+79
-77
@@ -63,7 +63,7 @@ static struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES];
|
|||||||
|
|
||||||
/* local static utility functions */
|
/* local static utility functions */
|
||||||
static int find_slot(void);
|
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 init_boards(void);
|
||||||
static void board_reset_board(int board_type);
|
static void board_reset_board(int board_type);
|
||||||
static void board_clear_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++)
|
for (i = 0; i < INDEX_SIZE; i++)
|
||||||
if (!msg_storage_taken[i]) {
|
if (!msg_storage_taken[i]) {
|
||||||
msg_storage_taken[i] = 1;
|
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 */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next_content)
|
for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next_content)
|
||||||
for (i = 0; i < NUM_OF_BOARDS; i++)
|
for (i = 0; i < NUM_OF_BOARDS; i++)
|
||||||
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
|
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
|
||||||
return (i);
|
return i;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) >= LVL_IMMORT)
|
if (GET_LEVEL(ch) >= LVL_IMMORT)
|
||||||
for (obj = ch->carrying; obj; obj = obj->next_content)
|
for (obj = ch->carrying; obj; obj = obj->next_content)
|
||||||
for (i = 0; i < NUM_OF_BOARDS; i++)
|
for (i = 0; i < NUM_OF_BOARDS; i++)
|
||||||
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
|
if (BOARD_RNUM(i) == GET_OBJ_RNUM(obj))
|
||||||
return (i);
|
return i;
|
||||||
|
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_boards(void)
|
static void init_boards(void)
|
||||||
@@ -117,7 +117,7 @@ static void init_boards(void)
|
|||||||
}
|
}
|
||||||
num_of_msgs[i] = 0;
|
num_of_msgs[i] = 0;
|
||||||
for (j = 0; j < MAX_BOARD_MESSAGES; j++) {
|
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;
|
msg_index[i][j].slot_num = -1;
|
||||||
}
|
}
|
||||||
board_load_board(i);
|
board_load_board(i);
|
||||||
@@ -131,7 +131,7 @@ SPECIAL(gen_board)
|
|||||||
{
|
{
|
||||||
int board_type;
|
int board_type;
|
||||||
static int loaded = 0;
|
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. */
|
/* These were originally globals for some unknown reason. */
|
||||||
int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
|
int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
|
||||||
@@ -141,7 +141,7 @@ SPECIAL(gen_board)
|
|||||||
loaded = 1;
|
loaded = 1;
|
||||||
}
|
}
|
||||||
if (!ch->desc)
|
if (!ch->desc)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
ACMD_READ = find_command("read");
|
ACMD_READ = find_command("read");
|
||||||
ACMD_WRITE = find_command("write");
|
ACMD_WRITE = find_command("write");
|
||||||
@@ -151,41 +151,42 @@ SPECIAL(gen_board)
|
|||||||
|
|
||||||
if (cmd != ACMD_WRITE && cmd != ACMD_LOOK && cmd != ACMD_EXAMINE &&
|
if (cmd != ACMD_WRITE && cmd != ACMD_LOOK && cmd != ACMD_EXAMINE &&
|
||||||
cmd != ACMD_READ && cmd != ACMD_REMOVE)
|
cmd != ACMD_READ && cmd != ACMD_REMOVE)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if ((board_type = find_board(ch)) == -1) {
|
if ((board_type = find_board(ch)) == -1) {
|
||||||
log("SYSERR: degenerate board! (what the hell...)");
|
log("SYSERR: degenerate board! (what the hell...)");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
if (cmd == ACMD_WRITE)
|
if (cmd == ACMD_WRITE)
|
||||||
return (board_write_message(board_type, ch, argument, board));
|
return board_write_message(board_type, ch, argument, board);
|
||||||
else if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE)
|
if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE)
|
||||||
return (board_show_board(board_type, ch, argument, board));
|
return board_show_board(board_type, ch, argument, board);
|
||||||
else if (cmd == ACMD_READ)
|
if (cmd == ACMD_READ)
|
||||||
return (board_display_msg(board_type, ch, argument, board));
|
return board_display_msg(board_type, ch, argument, board);
|
||||||
else if (cmd == ACMD_REMOVE)
|
if (cmd == ACMD_REMOVE)
|
||||||
return (board_remove_msg(board_type, ch, argument, board));
|
return board_remove_msg(board_type, ch, argument, board);
|
||||||
else
|
|
||||||
return (0);
|
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;
|
time_t ct;
|
||||||
char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[100];
|
char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[100];
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < WRITE_LVL(board_type)) {
|
if (GET_LEVEL(ch) < WRITE_LVL(board_type)) {
|
||||||
send_to_char(ch, "You are not holy enough to write on this board.\r\n");
|
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) {
|
if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) {
|
||||||
send_to_char(ch, "The board is full.\r\n");
|
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) {
|
if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) {
|
||||||
send_to_char(ch, "The board is malfunctioning - sorry.\r\n");
|
send_to_char(ch, "The board is malfunctioning - sorry.\r\n");
|
||||||
log("SYSERR: Board: failed to find empty slot on write.");
|
log("SYSERR: Board: failed to find empty slot on write.");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
/* skip blanks */
|
/* skip blanks */
|
||||||
skip_spaces(&arg);
|
skip_spaces(&arg);
|
||||||
@@ -196,7 +197,7 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct
|
|||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
send_to_char(ch, "We must have a headline!\r\n");
|
send_to_char(ch, "We must have a headline!\r\n");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
ct = time(0);
|
ct = time(0);
|
||||||
strftime(tmstr, sizeof(tmstr), "%a %b %d %Y", localtime(&ct));
|
strftime(tmstr, sizeof(tmstr), "%a %b %d %Y", localtime(&ct));
|
||||||
@@ -204,40 +205,41 @@ int board_write_message(int board_type, struct char_data *ch, char *arg, struct
|
|||||||
snprintf(buf2, sizeof(buf2), "(%s)", GET_NAME(ch));
|
snprintf(buf2, sizeof(buf2), "(%s)", GET_NAME(ch));
|
||||||
snprintf(buf, sizeof(buf), "%s %-12s :: %s", tmstr, buf2, arg);
|
snprintf(buf, sizeof(buf), "%s %-12s :: %s", tmstr, buf2, arg);
|
||||||
NEW_MSG_INDEX(board_type).heading = strdup(buf);
|
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_to_char(ch, "Write your message.\r\n");
|
||||||
send_editor_help(ch->desc);
|
send_editor_help(ch->desc);
|
||||||
act("$n starts to write a message.", TRUE, ch, 0, 0, TO_ROOM);
|
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]),
|
string_write(ch->desc, &msg_storage[NEW_MSG_INDEX(board_type).slot_num],
|
||||||
MAX_MESSAGE_LENGTH, board_type + BOARD_MAGIC, NULL);
|
MAX_MESSAGE_LENGTH, board_type + BOARD_MAGIC, NULL);
|
||||||
|
|
||||||
num_of_msgs[board_type]++;
|
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;
|
int i;
|
||||||
char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
|
char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
if (!ch->desc)
|
if (!ch->desc)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
one_argument(arg, tmp);
|
one_argument(arg, tmp);
|
||||||
|
|
||||||
if (!*tmp || !isname(tmp, board->name))
|
if (!*tmp || !isname(tmp, board->name))
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
|
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
|
||||||
send_to_char(ch, "You try but fail to understand the holy words.\r\n");
|
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);
|
act("$n studies the board.", TRUE, ch, 0, 0, TO_ROOM);
|
||||||
|
|
||||||
if (!num_of_msgs[board_type])
|
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 {
|
else {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
int nlen;
|
int nlen;
|
||||||
@@ -270,40 +272,40 @@ int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj
|
|||||||
#endif
|
#endif
|
||||||
page_string(ch->desc, buf, TRUE);
|
page_string(ch->desc, buf, TRUE);
|
||||||
}
|
}
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
fubar:
|
fubar:
|
||||||
log("SYSERR: Board %d is fubar'd.", board_type);
|
log("SYSERR: Board %d is fubar'd.", board_type);
|
||||||
send_to_char(ch, "Sorry, the board isn't working.\r\n");
|
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];
|
char number[MAX_INPUT_LENGTH], buffer[MAX_STRING_LENGTH];
|
||||||
int msg, ind;
|
int msg, ind;
|
||||||
|
|
||||||
one_argument(arg, number);
|
one_argument(arg, number);
|
||||||
if (!*number)
|
if (!*number)
|
||||||
return (0);
|
return 0;
|
||||||
if (isname(number, board->name)) /* so "read board" works */
|
if (isname(number, board->name)) /* so "read board" works */
|
||||||
return (board_show_board(board_type, ch, arg, board));
|
return board_show_board(board_type, ch, arg, board);
|
||||||
if (!is_number(number)) /* read 2.mail, look 2.sword */
|
if (!is_number(number)) /* read 2.mail, look 2.sword */
|
||||||
return (0);
|
return 0;
|
||||||
if (!(msg = atoi(number)))
|
if ((msg = parse_int(number)) == 0)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
|
if (GET_LEVEL(ch) < READ_LVL(board_type)) {
|
||||||
send_to_char(ch, "You try but fail to understand the holy words.\r\n");
|
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]) {
|
if (!num_of_msgs[board_type]) {
|
||||||
send_to_char(ch, "The board is empty!\r\n");
|
send_to_char(ch, "The board is empty!\r\n");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
if (msg < 1 || msg > num_of_msgs[board_type]) {
|
if (msg < 1 || msg > num_of_msgs[board_type]) {
|
||||||
send_to_char(ch, "That message exists only in your imagination.\r\n");
|
send_to_char(ch, "That message exists only in your imagination.\r\n");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
#if NEWEST_AT_TOP
|
#if NEWEST_AT_TOP
|
||||||
ind = num_of_msgs[board_type] - msg;
|
ind = num_of_msgs[board_type] - msg;
|
||||||
@@ -314,15 +316,15 @@ int board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
|
|||||||
MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) {
|
MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) {
|
||||||
send_to_char(ch, "Sorry, the board is not working.\r\n");
|
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)));
|
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");
|
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");
|
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,
|
snprintf(buffer, sizeof(buffer), "Message %d : %s\r\n\r\n%s\r\n", msg,
|
||||||
MSG_HEADING(board_type, ind),
|
MSG_HEADING(board_type, ind),
|
||||||
@@ -330,29 +332,29 @@ int board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
|
|||||||
|
|
||||||
page_string(ch->desc, buffer, TRUE);
|
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;
|
int ind, msg, slot_num;
|
||||||
char number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
char number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
one_argument(arg, number);
|
one_argument(arg, number);
|
||||||
|
|
||||||
if (!*number || !is_number(number))
|
if (!*number || !is_number(number))
|
||||||
return (0);
|
return 0;
|
||||||
if (!(msg = atoi(number)))
|
if ((msg = parse_int(number)) == 0)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
if (!num_of_msgs[board_type]) {
|
if (!num_of_msgs[board_type]) {
|
||||||
send_to_char(ch, "The board is empty!\r\n");
|
send_to_char(ch, "The board is empty!\r\n");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
if (msg < 1 || msg > num_of_msgs[board_type]) {
|
if (msg < 1 || msg > num_of_msgs[board_type]) {
|
||||||
send_to_char(ch, "That message exists only in your imagination.\r\n");
|
send_to_char(ch, "That message exists only in your imagination.\r\n");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
#if NEWEST_AT_TOP
|
#if NEWEST_AT_TOP
|
||||||
ind = num_of_msgs[board_type] - msg;
|
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
|
#endif
|
||||||
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");
|
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));
|
snprintf(buf, sizeof(buf), "(%s)", GET_NAME(ch));
|
||||||
if (GET_LEVEL(ch) < REMOVE_LVL(board_type) &&
|
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");
|
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)) {
|
if (GET_LEVEL(ch) < MSG_LEVEL(board_type, ind)) {
|
||||||
send_to_char(ch, "You can't remove a message holier than yourself.\r\n");
|
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);
|
slot_num = MSG_SLOTNUM(board_type, ind);
|
||||||
if (slot_num < 0 || slot_num >= INDEX_SIZE) {
|
if (slot_num < 0 || slot_num >= INDEX_SIZE) {
|
||||||
send_to_char(ch, "That message is majorly screwed up.\r\n");
|
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)));
|
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)
|
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");
|
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])
|
if (msg_storage[slot_num])
|
||||||
free(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);
|
act(buf, FALSE, ch, 0, 0, TO_ROOM);
|
||||||
board_save_board(board_type);
|
board_save_board(board_type);
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_save_board(int board_type)
|
void board_save_board(int board_type)
|
||||||
@@ -416,26 +418,26 @@ void board_save_board(int board_type)
|
|||||||
remove(FILENAME(board_type));
|
remove(FILENAME(board_type));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(fl = fopen(FILENAME(board_type), "wb"))) {
|
if ((fl = fopen(FILENAME(board_type), "wb")) == NULL) {
|
||||||
perror("SYSERR: Error writing board");
|
perror("SYSERR: Error writing board");
|
||||||
return;
|
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++) {
|
for (i = 0; i < num_of_msgs[board_type]; i++) {
|
||||||
if ((tmp1 = MSG_HEADING(board_type, i)) != NULL)
|
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
|
else
|
||||||
msg_index[board_type][i].heading_len = 0;
|
msg_index[board_type][i].heading_len = 0;
|
||||||
|
|
||||||
if (MSG_SLOTNUM(board_type, i) < 0 ||
|
if (MSG_SLOTNUM(board_type, i) < 0 ||
|
||||||
MSG_SLOTNUM(board_type, i) >= INDEX_SIZE ||
|
MSG_SLOTNUM(board_type, i) >= INDEX_SIZE ||
|
||||||
(!(tmp2 = msg_storage[MSG_SLOTNUM(board_type, i)])))
|
(tmp2 = msg_storage[MSG_SLOTNUM(board_type, i)]) == NULL)
|
||||||
msg_index[board_type][i].message_len = 0;
|
msg_index[board_type][i].message_len = 0;
|
||||||
else
|
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)
|
if (tmp1)
|
||||||
fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
|
fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl);
|
||||||
if (tmp2)
|
if (tmp2)
|
||||||
@@ -451,12 +453,12 @@ void board_load_board(int board_type)
|
|||||||
int i, len1, len2;
|
int i, len1, len2;
|
||||||
char *tmp1, *tmp2;
|
char *tmp1, *tmp2;
|
||||||
|
|
||||||
if (!(fl = fopen(FILENAME(board_type), "rb"))) {
|
if ((fl = fopen(FILENAME(board_type), "rb")) == NULL) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
perror("SYSERR: Error reading board");
|
perror("SYSERR: Error reading board");
|
||||||
return;
|
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;
|
return;
|
||||||
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
|
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
|
||||||
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
|
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
|
||||||
@@ -464,7 +466,7 @@ void board_load_board(int board_type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_of_msgs[board_type]; i++) {
|
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))
|
if (feof(fl))
|
||||||
log("SYSERR: Unexpected EOF encountered in board file %d! Resetting.", board_type);
|
log("SYSERR: Unexpected EOF encountered in board file %d! Resetting.", board_type);
|
||||||
else if (ferror(fl))
|
else if (ferror(fl))
|
||||||
@@ -540,7 +542,7 @@ void board_clear_board(int board_type)
|
|||||||
if (msg_storage[MSG_SLOTNUM(board_type, i)])
|
if (msg_storage[MSG_SLOTNUM(board_type, i)])
|
||||||
free(msg_storage[MSG_SLOTNUM(board_type, i)]);
|
free(msg_storage[MSG_SLOTNUM(board_type, i)]);
|
||||||
msg_storage_taken[MSG_SLOTNUM(board_type, i)] = 0;
|
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;
|
msg_index[board_type][i].slot_num = -1;
|
||||||
}
|
}
|
||||||
num_of_msgs[board_type] = 0;
|
num_of_msgs[board_type] = 0;
|
||||||
|
|||||||
+4
-4
@@ -51,10 +51,10 @@ struct board_info_type {
|
|||||||
#define MSG_LEVEL(i, j) (msg_index[i][j].level)
|
#define MSG_LEVEL(i, j) (msg_index[i][j].level)
|
||||||
|
|
||||||
SPECIAL(gen_board);
|
SPECIAL(gen_board);
|
||||||
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);
|
||||||
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 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 board_write_message(int board_type, struct char_data *ch, char *arg, struct 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_save_board(int board_type);
|
||||||
void board_load_board(int board_type);
|
void board_load_board(int board_type);
|
||||||
void board_clear_all(void);
|
void board_clear_all(void);
|
||||||
|
|||||||
+117
-114
@@ -13,7 +13,6 @@
|
|||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "interpreter.h"
|
|
||||||
#include "handler.h"
|
#include "handler.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "spells.h"
|
#include "spells.h"
|
||||||
@@ -30,18 +29,18 @@
|
|||||||
/* local, file scope restricted functions */
|
/* local, file scope restricted functions */
|
||||||
static mob_vnum castle_virtual(mob_vnum offset);
|
static mob_vnum castle_virtual(mob_vnum offset);
|
||||||
static room_rnum castle_real_room(room_vnum roomoffset);
|
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 char_data *find_npc_by_name(const 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 block_way(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_staff(const char_data *chChar);
|
||||||
static int member_of_royal_guard(struct char_data *chChar);
|
static int member_of_royal_guard(const char_data *chChar);
|
||||||
static struct char_data *find_guard(struct char_data *chAtChar);
|
static char_data *find_guard(const char_data *chAtChar);
|
||||||
static struct char_data *get_victim(struct char_data *chAtChar);
|
static char_data *get_victim(const char_data *chAtChar);
|
||||||
static int banzaii(struct char_data *ch);
|
static int banzaii(char_data *ch);
|
||||||
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);
|
||||||
static int is_trash(struct obj_data *i);
|
static int is_trash(const obj_data *i);
|
||||||
static void fry_victim(struct char_data *ch);
|
static void fry_victim(char_data *ch);
|
||||||
static int castle_cleaner(struct char_data *ch, int cmd, int gripe);
|
static int castle_cleaner(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 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));
|
static void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc));
|
||||||
/* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */
|
/* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */
|
||||||
SPECIAL(CastleGuard);
|
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
|
/* Routine: member_of_staff. Used to see if a character is a member of the
|
||||||
* castle staff. Used mainly by BANZAI:ng NPC:s. */
|
* 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;
|
int ch_num;
|
||||||
|
|
||||||
if (!IS_NPC(chChar))
|
if (!IS_NPC(chChar))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
ch_num = GET_MOB_VNUM(chChar);
|
ch_num = GET_MOB_VNUM(chChar);
|
||||||
|
|
||||||
if (ch_num == castle_virtual(1))
|
if (ch_num == castle_virtual(1))
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
|
|
||||||
if (ch_num > castle_virtual(2) && ch_num < castle_virtual(15))
|
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))
|
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))
|
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
|
/* 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. */
|
* 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;
|
int ch_num;
|
||||||
|
|
||||||
if (!chChar || !IS_NPC(chChar))
|
if (!chChar || !IS_NPC(chChar))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
ch_num = GET_MOB_VNUM(chChar);
|
ch_num = GET_MOB_VNUM(chChar);
|
||||||
|
|
||||||
if (ch_num == castle_virtual(3) || ch_num == castle_virtual(6))
|
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))
|
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))
|
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.
|
/* Function: find_npc_by_name. Returns a pointer to an npc by the given name.
|
||||||
* Used by Tim and Tom. */
|
* 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)
|
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)
|
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
|
||||||
if (IS_NPC(ch) && !strncmp(pszName, ch->player.short_descr, iLen))
|
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 */
|
* 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)
|
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
|
||||||
if (!FIGHTING(ch) && member_of_royal_guard(ch))
|
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
|
/* 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
|
* the same room, fighting someone in the castle staff. Used by BANZAII-ing
|
||||||
* characters and King Welmar... */
|
* 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;
|
int iNum_bad_guys = 0, iVictim;
|
||||||
|
|
||||||
for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
|
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++;
|
iNum_bad_guys++;
|
||||||
|
|
||||||
if (!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 */
|
iVictim = rand_number(0, iNum_bad_guys); /* How nice, we give them a chance */
|
||||||
if (!iVictim)
|
if (!iVictim)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
iNum_bad_guys = 0;
|
iNum_bad_guys = 0;
|
||||||
|
|
||||||
@@ -234,39 +233,40 @@ static struct char_data *get_victim(struct char_data *chAtChar)
|
|||||||
if (++iNum_bad_guys != iVictim)
|
if (++iNum_bad_guys != iVictim)
|
||||||
continue;
|
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. */
|
* 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)))
|
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING || (chOpponent = get_victim(ch)) == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
act("$n roars: 'Protect the Kingdom of Great King Welmar! BANZAIIII!!!'",
|
act("$n roars: 'Protect the Kingdom of Great King Welmar! BANZAIIII!!!'",
|
||||||
FALSE, ch, 0, 0, TO_ROOM);
|
FALSE, ch, 0, 0, TO_ROOM);
|
||||||
hit(ch, chOpponent, TYPE_UNDEFINED);
|
hit(ch, chOpponent, TYPE_UNDEFINED);
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do_npc_rescue. Makes ch_hero rescue ch_victim. Used by Tim and Tom. */
|
/* 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;
|
for (ch_bad_guy = world[IN_ROOM(ch_hero)].people;
|
||||||
ch_bad_guy && (FIGHTING(ch_bad_guy) != ch_victim);
|
ch_bad_guy && FIGHTING(ch_bad_guy) != ch_victim;
|
||||||
ch_bad_guy = ch_bad_guy->next_in_room);
|
ch_bad_guy = ch_bad_guy->next_in_room)
|
||||||
|
;
|
||||||
|
|
||||||
/* NO WAY I'll rescue the one I'm fighting! */
|
/* NO WAY I'll rescue the one I'm fighting! */
|
||||||
if (!ch_bad_guy || ch_bad_guy == ch_hero)
|
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 bravely rescue $N.\r\n", FALSE, ch_hero, 0, ch_victim, TO_CHAR);
|
||||||
act("You are rescued by $N, your loyal friend!\r\n",
|
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_hero, ch_bad_guy);
|
||||||
set_fighting(ch_bad_guy, ch_hero);
|
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. */
|
* 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)
|
int iProhibited_direction)
|
||||||
{
|
{
|
||||||
if (cmd != ++iProhibited_direction)
|
if (cmd != ++iProhibited_direction)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (ch->player.short_descr && !strncmp(ch->player.short_descr, "King Welmar", 11))
|
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))
|
if (IN_ROOM(ch) != real_room(iIn_room))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!member_of_staff(ch))
|
if (!member_of_staff(ch))
|
||||||
act("The guard roars at $n and pushes $m back.", FALSE, ch, 0, 0, TO_ROOM);
|
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");
|
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. */
|
* 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))
|
if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (GET_OBJ_TYPE(i) == ITEM_DRINKCON || GET_OBJ_COST(i) <= 10)
|
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. */
|
* 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)
|
if (ch->points.mana < 10)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Find someone suitable to fry ! */
|
/* Find someone suitable to fry ! */
|
||||||
if (!(tch = get_victim(ch)))
|
if ((tch = get_victim(ch)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (rand_number(0, 8)) {
|
switch (rand_number(0, 8)) {
|
||||||
@@ -358,8 +358,6 @@ static void fry_victim(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ch->points.mana -= 10;
|
ch->points.mana -= 10;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* King_welmar. Control the actions and movements of the King. */
|
/* King_welmar. Control the actions and movements of the King. */
|
||||||
@@ -397,18 +395,19 @@ SPECIAL(king_welmar)
|
|||||||
path_index = 0;
|
path_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd || (GET_POS(ch) < POS_SLEEPING) ||
|
if (cmd || GET_POS(ch) < POS_SLEEPING ||
|
||||||
(GET_POS(ch) == POS_SLEEPING && !move))
|
(GET_POS(ch) == POS_SLEEPING && !move))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (GET_POS(ch) == POS_FIGHTING) {
|
if (GET_POS(ch) == POS_FIGHTING) {
|
||||||
fry_victim(ch);
|
fry_victim(ch);
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
} else if (banzaii(ch))
|
}
|
||||||
return (FALSE);
|
if (banzaii(ch))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!move)
|
if (!move)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
switch (path[path_index]) {
|
switch (path[path_index]) {
|
||||||
case '0':
|
case '0':
|
||||||
@@ -471,10 +470,14 @@ SPECIAL(king_welmar)
|
|||||||
case '.':
|
case '.':
|
||||||
move = FALSE;
|
move = FALSE;
|
||||||
break;
|
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++;
|
path_index++;
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Training_master. Acts actions to the training room, if his students are
|
/* Training_master. Acts actions to the training room, if his students are
|
||||||
@@ -482,25 +485,25 @@ SPECIAL(king_welmar)
|
|||||||
* Master. */
|
* Master. */
|
||||||
SPECIAL(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))
|
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (cmd)
|
if (cmd)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (banzaii(ch) || rand_number(0, 2))
|
if (banzaii(ch) || rand_number(0, 2))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!(pupil1 = find_npc_by_name(ch, "Brian", 5)))
|
if ((pupil1 = find_npc_by_name(ch, "Brian", 5)) == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!(pupil2 = find_npc_by_name(ch, "Mick", 4)))
|
if ((pupil2 = find_npc_by_name(ch, "Mick", 4)) == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (FIGHTING(pupil1) || FIGHTING(pupil2))
|
if (FIGHTING(pupil1) || FIGHTING(pupil2))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (rand_number(0, 1)) {
|
if (rand_number(0, 1)) {
|
||||||
tch = pupil1;
|
tch = pupil1;
|
||||||
@@ -562,7 +565,7 @@ SPECIAL(training_master)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPECIAL(tom)
|
SPECIAL(tom)
|
||||||
@@ -576,12 +579,12 @@ SPECIAL(tim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Common routine for the Castle Twins. */
|
/* 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))
|
if (!AWAKE(ch))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (cmd)
|
if (cmd)
|
||||||
return block_way(ch, cmd, arg, castle_virtual(ctlnum), 1);
|
return block_way(ch, cmd, arg, castle_virtual(ctlnum), 1);
|
||||||
@@ -595,14 +598,14 @@ static int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum
|
|||||||
do_npc_rescue(ch, king);
|
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))
|
if (FIGHTING(twin) && 2 * GET_HIT(twin) < GET_HIT(ch))
|
||||||
do_npc_rescue(ch, twin);
|
do_npc_rescue(ch, twin);
|
||||||
|
|
||||||
if (GET_POS(ch) != POS_FIGHTING)
|
if (GET_POS(ch) != POS_FIGHTING)
|
||||||
banzaii(ch);
|
banzaii(ch);
|
||||||
|
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -614,12 +617,12 @@ SPECIAL(James)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Common code for James and the Cleaning Woman. */
|
/* 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)
|
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) {
|
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
|
||||||
if (!is_trash(i))
|
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_from_room(i);
|
||||||
obj_to_char(i, ch);
|
obj_to_char(i, ch);
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Routine for the Cleaning Woman. Picks up any trash she finds. */
|
/* Routine for the Cleaning Woman. Picks up any trash she finds. */
|
||||||
@@ -647,36 +650,36 @@ SPECIAL(cleaning)
|
|||||||
/* CastleGuard. Standard routine for ordinary castle guards. */
|
/* CastleGuard. Standard routine for ordinary castle guards. */
|
||||||
SPECIAL(CastleGuard)
|
SPECIAL(CastleGuard)
|
||||||
{
|
{
|
||||||
if (cmd || !AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
|
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
return (banzaii(ch));
|
return banzaii(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DicknDave. Routine for the guards Dick and David. */
|
/* DicknDave. Routine for the guards Dick and David. */
|
||||||
SPECIAL(DicknDavid)
|
SPECIAL(DicknDavid)
|
||||||
{
|
{
|
||||||
if (!AWAKE(ch))
|
if (!AWAKE(ch))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!cmd && GET_POS(ch) != POS_FIGHTING)
|
if (!cmd && GET_POS(ch) != POS_FIGHTING)
|
||||||
banzaii(ch);
|
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. */
|
/*Peter. Routine for Captain of the Guards. */
|
||||||
SPECIAL(peter)
|
SPECIAL(peter)
|
||||||
{
|
{
|
||||||
struct char_data *ch_guard = NULL;
|
char_data *ch_guard = NULL;
|
||||||
|
|
||||||
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
|
if (cmd || !AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (banzaii(ch))
|
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)) {
|
switch (rand_number(0, 5)) {
|
||||||
case 0:
|
case 0:
|
||||||
act("$N comes sharply into attention as $n inspects $M.",
|
act("$N comes sharply into attention as $n inspects $M.",
|
||||||
@@ -725,32 +728,32 @@ SPECIAL(peter)
|
|||||||
break;
|
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) */
|
* modified by Pjotr.(Original code from Master) */
|
||||||
SPECIAL(jerry)
|
SPECIAL(jerry)
|
||||||
{
|
{
|
||||||
struct char_data *gambler1, *gambler2 = NULL, *tch;
|
char_data *gambler1, *gambler2 = NULL, *tch;
|
||||||
|
|
||||||
if (!AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
|
if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (cmd)
|
if (cmd)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (banzaii(ch) || rand_number(0, 2))
|
if (banzaii(ch) || rand_number(0, 2))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!(gambler1 = ch))
|
if ((gambler1 = ch) == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (!(gambler2 = find_npc_by_name(ch, "Michael", 7)))
|
if ((gambler2 = find_npc_by_name(ch, "Michael", 7)) == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (FIGHTING(gambler1) || FIGHTING(gambler2))
|
if (FIGHTING(gambler1) || FIGHTING(gambler2))
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
if (rand_number(0, 1)) {
|
if (rand_number(0, 1)) {
|
||||||
tch = gambler1;
|
tch = gambler1;
|
||||||
@@ -808,5 +811,5 @@ SPECIAL(jerry)
|
|||||||
FALSE, gambler1, 0, gambler2, TO_VICT);
|
FALSE, gambler1, 0, gambler2, TO_VICT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-31
@@ -19,20 +19,20 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
/* local scope functions, not used externally */
|
/* local scope functions, not used externally */
|
||||||
static void cedit_disp_menu(struct descriptor_data *d);
|
static void cedit_disp_menu(descriptor_data *d);
|
||||||
static void cedit_save_internally(struct descriptor_data *d);
|
static void cedit_save_internally(descriptor_data *d);
|
||||||
static void cedit_disp_game_play_options(struct descriptor_data *d);
|
static void cedit_disp_game_play_options(descriptor_data *d);
|
||||||
static void cedit_disp_crash_save_options(struct descriptor_data *d);
|
static void cedit_disp_crash_save_options(descriptor_data *d);
|
||||||
static void cedit_disp_room_numbers(struct descriptor_data *d);
|
static void cedit_disp_room_numbers(descriptor_data *d);
|
||||||
static void cedit_disp_operation_options(struct descriptor_data *d);
|
static void cedit_disp_operation_options(descriptor_data *d);
|
||||||
static void cedit_disp_autowiz_options(struct descriptor_data *d);
|
static void cedit_disp_autowiz_options(descriptor_data *d);
|
||||||
static void reassign_rooms(void);
|
static void reassign_rooms(void);
|
||||||
static void cedit_setup(struct descriptor_data *d);
|
static void cedit_setup(descriptor_data *d);
|
||||||
|
|
||||||
|
|
||||||
ACMD(do_oasis_cedit)
|
ACMD(do_oasis_cedit)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* No building as a mob or while being forced. */
|
||||||
@@ -72,7 +72,7 @@ ACMD(do_oasis_cedit)
|
|||||||
cedit_save_to_disk();
|
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 the config_data struct. */
|
||||||
CREATE(OLC_CONFIG(d), struct config_data, 1);
|
CREATE(OLC_CONFIG(d), struct config_data, 1);
|
||||||
@@ -178,7 +178,7 @@ static void cedit_setup(struct descriptor_data *d)
|
|||||||
cedit_disp_menu(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 */
|
/* see if we need to reassign spec procs on rooms */
|
||||||
int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps);
|
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. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
@@ -606,7 +606,7 @@ static void cedit_disp_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = CEDIT_MAIN_MENU;
|
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;
|
int m_opt;
|
||||||
m_opt = OLC_CONFIG(d)->play.map_option;
|
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;
|
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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
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;
|
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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -733,7 +733,7 @@ static void cedit_disp_room_numbers(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU;
|
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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -785,7 +785,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU;
|
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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -804,7 +804,7 @@ static void cedit_disp_autowiz_options(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The event handler. */
|
/* The event handler. */
|
||||||
void cedit_parse(struct descriptor_data *d, char *arg)
|
void cedit_parse(descriptor_data *d, char *arg)
|
||||||
{
|
{
|
||||||
char *oldtext = NULL;
|
char *oldtext = NULL;
|
||||||
|
|
||||||
@@ -1520,12 +1520,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the room's vnum where mortals should load into : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the room's vnum where mortals should load into : ");
|
"Enter the room's vnum where mortals should load into : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1535,12 +1535,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the room's vnum where immortals should load into : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the room's vnum where immortals should load into : ");
|
"Enter the room's vnum where immortals should load into : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1550,12 +1550,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the room's vnum where frozen people should load into : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the room's vnum where frozen people should load into : ");
|
"Enter the room's vnum where frozen people should load into : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1565,12 +1565,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the vnum for donation room #1 : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the vnum for donation room #1 : ");
|
"Enter the vnum for donation room #1 : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1580,12 +1580,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the vnum for donation room #2 : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the vnum for donation room #2 : ");
|
"Enter the vnum for donation room #2 : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1595,12 +1595,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"That is an invalid choice!\r\n"
|
"That is an invalid choice!\r\n"
|
||||||
"Enter the vnum for donation room #3 : ");
|
"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,
|
write_to_output(d,
|
||||||
"That room doesn't exist!\r\n"
|
"That room doesn't exist!\r\n"
|
||||||
"Enter the vnum for donation room #3 : ");
|
"Enter the vnum for donation room #3 : ");
|
||||||
} else {
|
} 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);
|
cedit_disp_room_numbers(d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1729,7 +1729,7 @@ static void reassign_rooms(void)
|
|||||||
assign_rooms();
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case CEDIT_MENU:
|
case CEDIT_MENU:
|
||||||
|
|||||||
+4
-4
@@ -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
|
/* 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
|
* 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. */
|
* 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;
|
int i, j, k, temp;
|
||||||
ubyte table[6];
|
ubyte table[6];
|
||||||
@@ -1410,7 +1410,7 @@ void roll_real_abils(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Some initializations for characters, including initial skills */
|
/* 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_LEVEL(ch) = 1;
|
||||||
GET_EXP(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
|
/* This function controls the change to maxmove, maxmana, and maxhp for each
|
||||||
* class every time they gain a level. */
|
* 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;
|
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
|
/* 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. */
|
* 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))
|
if (OBJ_FLAGGED(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
+3
-3
@@ -15,12 +15,12 @@
|
|||||||
|
|
||||||
/* Functions available through class.c */
|
/* Functions available through class.c */
|
||||||
int backstab_mult(int level);
|
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);
|
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 level_exp(int chclass, int level);
|
||||||
int parse_class(char arg);
|
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);
|
byte saving_throws(int class_num, int type, int level);
|
||||||
int thaco(int class_num, int level);
|
int thaco(int class_num, int level);
|
||||||
const char *title_female(int chclass, int level);
|
const char *title_female(int chclass, int level);
|
||||||
|
|||||||
+168
-164
@@ -87,11 +87,8 @@
|
|||||||
#define INVALID_SOCKET (-1)
|
#define INVALID_SOCKET (-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern time_t motdmod;
|
|
||||||
extern time_t newsmod;
|
|
||||||
|
|
||||||
/* locally defined globals, used externally */
|
/* locally defined globals, used externally */
|
||||||
struct descriptor_data *descriptor_list = NULL; /* master desc list */
|
descriptor_data *descriptor_list = NULL; /* master desc list */
|
||||||
int buf_largecount = 0; /* # of large buffers which exist */
|
int buf_largecount = 0; /* # of large buffers which exist */
|
||||||
int buf_overflows = 0; /* # of overflows of output */
|
int buf_overflows = 0; /* # of overflows of output */
|
||||||
int buf_switches = 0; /* # of switches from small to large buf */
|
int buf_switches = 0; /* # of switches from small to large buf */
|
||||||
@@ -108,7 +105,7 @@ int next_tick = SECS_PER_MUD_HOUR; /* Tick countdown */
|
|||||||
|
|
||||||
/* static local global variable declarations (current file scope only) */
|
/* static local global variable declarations (current file scope only) */
|
||||||
static struct txt_block *bufpool = 0; /* pool of large output buffers */
|
static struct txt_block *bufpool = 0; /* pool of large output buffers */
|
||||||
static int max_players = 0; /* max descriptors available */
|
static unsigned long max_players = 0; /* max descriptors available */
|
||||||
static int tics_passed = 0; /* for extern checkpointing */
|
static int tics_passed = 0; /* for extern checkpointing */
|
||||||
static struct timeval null_time; /* zero-valued time structure */
|
static struct timeval null_time; /* zero-valued time structure */
|
||||||
static byte reread_wizlist; /* signal: SIGUSR1 */
|
static byte reread_wizlist; /* signal: SIGUSR1 */
|
||||||
@@ -134,18 +131,18 @@ static void init_game(ush_int port);
|
|||||||
static void signal_setup(void);
|
static void signal_setup(void);
|
||||||
static socket_t init_socket(ush_int port);
|
static socket_t init_socket(ush_int port);
|
||||||
static int new_descriptor(socket_t s);
|
static int new_descriptor(socket_t s);
|
||||||
static int get_max_players(void);
|
static unsigned long get_max_players(void);
|
||||||
static int process_output(struct descriptor_data *t);
|
static ssize_t process_output(descriptor_data *t);
|
||||||
static int process_input(struct descriptor_data *t);
|
static int process_input(descriptor_data *t);
|
||||||
static void timediff(struct timeval *diff, struct timeval *a, struct timeval *b);
|
static void timediff(struct timeval *rslt, const struct timeval *a, const struct timeval *b);
|
||||||
static void timeadd(struct timeval *sum, struct timeval *a, struct timeval *b);
|
static void timeadd(struct timeval *rslt, const struct timeval *a, const struct timeval *b);
|
||||||
static void flush_queues(struct descriptor_data *d);
|
static void flush_queues(descriptor_data *d);
|
||||||
static void nonblock(socket_t s);
|
static void nonblock(socket_t s);
|
||||||
static int perform_subst(struct descriptor_data *t, char *orig, char *subst);
|
static int perform_subst(descriptor_data *t, const char *orig, char *subst);
|
||||||
static void record_usage(void);
|
static void record_usage(void);
|
||||||
static char *make_prompt(struct descriptor_data *point);
|
static char *make_prompt(const descriptor_data *d);
|
||||||
static void check_idle_passwords(void);
|
static void check_idle_passwords(void);
|
||||||
static void init_descriptor (struct descriptor_data *newd, int desc);
|
static void init_descriptor (descriptor_data *newd, int desc);
|
||||||
|
|
||||||
static struct in_addr *get_bind_addr(void);
|
static struct in_addr *get_bind_addr(void);
|
||||||
static int parse_ip(const char *addr, struct in_addr *inaddr);
|
static int parse_ip(const char *addr, struct in_addr *inaddr);
|
||||||
@@ -318,7 +315,8 @@ int main(int argc, char **argv)
|
|||||||
if (!isdigit(*argv[pos])) {
|
if (!isdigit(*argv[pos])) {
|
||||||
printf("Usage: %s [-c] [-m] [-q] [-r] [-s] [-d pathname] [port #]\n", argv[0]);
|
printf("Usage: %s [-c] [-m] [-q] [-r] [-s] [-d pathname] [port #]\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if ((port = atoi(argv[pos])) <= 1024) {
|
}
|
||||||
|
if ((port = atoi(argv[pos])) <= 1024) {
|
||||||
printf("SYSERR: Illegal port number %d.\n", port);
|
printf("SYSERR: Illegal port number %d.\n", port);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -380,13 +378,13 @@ int main(int argc, char **argv)
|
|||||||
zmalloc_check();
|
zmalloc_check();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reload players after a copyover */
|
/* Reload players after a copyover */
|
||||||
void copyover_recover()
|
void copyover_recover()
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char host[1024], guiopt[1024];
|
char host[1024], guiopt[1024];
|
||||||
int desc, i, player_i;
|
int desc, i, player_i;
|
||||||
@@ -448,7 +446,7 @@ void copyover_recover()
|
|||||||
CopyoverSet(d,guiopt);
|
CopyoverSet(d,guiopt);
|
||||||
|
|
||||||
/* Now, find the pfile */
|
/* Now, find the pfile */
|
||||||
CREATE(d->character, struct char_data, 1);
|
CREATE(d->character, char_data, 1);
|
||||||
clear_char(d->character);
|
clear_char(d->character);
|
||||||
CREATE(d->character->player_specials, struct player_special_data, 1);
|
CREATE(d->character->player_specials, struct player_special_data, 1);
|
||||||
|
|
||||||
@@ -644,13 +642,13 @@ static socket_t init_socket(ush_int local_port)
|
|||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_max_players(void)
|
static unsigned long get_max_players(void)
|
||||||
{
|
{
|
||||||
#ifndef CIRCLE_UNIX
|
#ifndef CIRCLE_UNIX
|
||||||
return (CONFIG_MAX_PLAYING);
|
return (CONFIG_MAX_PLAYING);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int max_descs = 0;
|
unsigned long max_descs = 0;
|
||||||
const char *method;
|
const char *method;
|
||||||
|
|
||||||
/* First, we'll try using getrlimit/setrlimit. This will probably work
|
/* First, we'll try using getrlimit/setrlimit. This will probably work
|
||||||
@@ -683,7 +681,7 @@ static int get_max_players(void)
|
|||||||
if (limit.rlim_max == RLIM_INFINITY)
|
if (limit.rlim_max == RLIM_INFINITY)
|
||||||
max_descs = CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS;
|
max_descs = CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS;
|
||||||
else
|
else
|
||||||
max_descs = MIN(CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS, limit.rlim_max);
|
max_descs = ULMIN(CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS, limit.rlim_max);
|
||||||
#else
|
#else
|
||||||
max_descs = MIN(CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS, limit.rlim_max);
|
max_descs = MIN(CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS, limit.rlim_max);
|
||||||
#endif
|
#endif
|
||||||
@@ -717,15 +715,15 @@ static int get_max_players(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* now calculate max _players_ based on max descs */
|
/* now calculate max _players_ based on max descs */
|
||||||
max_descs = MIN(CONFIG_MAX_PLAYING, max_descs - NUM_RESERVED_DESCS);
|
max_descs = ULMIN(CONFIG_MAX_PLAYING, max_descs - NUM_RESERVED_DESCS);
|
||||||
|
|
||||||
if (max_descs <= 0) {
|
if (max_descs <= 0) {
|
||||||
log("SYSERR: Non-positive max player limit! (Set at %d using %s).",
|
log("SYSERR: Non-positive max player limit! (Set at %ld using %s).",
|
||||||
max_descs, method);
|
max_descs, method);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
log(" Setting player limit to %d using %s.", max_descs, method);
|
log(" Setting player limit to %ld using %s.", max_descs, method);
|
||||||
return (max_descs);
|
return max_descs;
|
||||||
#endif /* CIRCLE_UNIX */
|
#endif /* CIRCLE_UNIX */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,8 +738,9 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
struct timeval last_time, opt_time, process_time, temp_time;
|
struct timeval last_time, opt_time, process_time, temp_time;
|
||||||
struct timeval before_sleep, now, timeout;
|
struct timeval before_sleep, now, timeout;
|
||||||
char comm[MAX_INPUT_LENGTH];
|
char comm[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d, *next_d;
|
descriptor_data *d, *next_d;
|
||||||
int missed_pulses, maxdesc, aliased;
|
int maxdesc, aliased;
|
||||||
|
long missed_pulses;
|
||||||
|
|
||||||
/* initialize various time values */
|
/* initialize various time values */
|
||||||
null_time.tv_sec = 0;
|
null_time.tv_sec = 0;
|
||||||
@@ -767,7 +766,8 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
perror("SYSERR: Select coma");
|
perror("SYSERR: Select coma");
|
||||||
} else
|
} else
|
||||||
log("New connection. Waking up.");
|
log("New connection. Waking up.");
|
||||||
gettimeofday(&last_time, (struct timezone *) 0);
|
|
||||||
|
gettimeofday(&last_time, 0);
|
||||||
}
|
}
|
||||||
/* Set up the input, output, and exception sets for select(). */
|
/* Set up the input, output, and exception sets for select(). */
|
||||||
FD_ZERO(&input_set);
|
FD_ZERO(&input_set);
|
||||||
@@ -791,7 +791,7 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
* to sleep until the next 0.1 second tick. The first step is to
|
* to sleep until the next 0.1 second tick. The first step is to
|
||||||
* calculate how long we took processing the previous iteration. */
|
* calculate how long we took processing the previous iteration. */
|
||||||
|
|
||||||
gettimeofday(&before_sleep, (struct timezone *) 0); /* current time */
|
gettimeofday(&before_sleep, 0); /* current time */
|
||||||
timediff(&process_time, &before_sleep, &last_time);
|
timediff(&process_time, &before_sleep, &last_time);
|
||||||
|
|
||||||
/* If we were asleep for more than one pass, count missed pulses and sleep
|
/* If we were asleep for more than one pass, count missed pulses and sleep
|
||||||
@@ -810,13 +810,13 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
timeadd(&last_time, &before_sleep, &temp_time);
|
timeadd(&last_time, &before_sleep, &temp_time);
|
||||||
|
|
||||||
/* Now keep sleeping until that time has come */
|
/* Now keep sleeping until that time has come */
|
||||||
gettimeofday(&now, (struct timezone *) 0);
|
gettimeofday(&now, 0);
|
||||||
timediff(&timeout, &last_time, &now);
|
timediff(&timeout, &last_time, &now);
|
||||||
|
|
||||||
/* Go to sleep */
|
/* Go to sleep */
|
||||||
do {
|
do {
|
||||||
circle_sleep(&timeout);
|
circle_sleep(&timeout);
|
||||||
gettimeofday(&now, (struct timezone *) 0);
|
gettimeofday(&now, 0);
|
||||||
timediff(&timeout, &last_time, &now);
|
timediff(&timeout, &last_time, &now);
|
||||||
} while (timeout.tv_usec || timeout.tv_sec);
|
} while (timeout.tv_usec || timeout.tv_sec);
|
||||||
|
|
||||||
@@ -931,13 +931,13 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
missed_pulses++;
|
missed_pulses++;
|
||||||
|
|
||||||
if (missed_pulses <= 0) {
|
if (missed_pulses <= 0) {
|
||||||
log("SYSERR: **BAD** MISSED_PULSES NONPOSITIVE (%d), TIME GOING BACKWARDS!!", missed_pulses);
|
log("SYSERR: **BAD** MISSED_PULSES NONPOSITIVE (%ld), TIME GOING BACKWARDS!!", missed_pulses);
|
||||||
missed_pulses = 1;
|
missed_pulses = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we missed more than 30 seconds worth of pulses, just do 30 secs */
|
/* If we missed more than 30 seconds worth of pulses, just do 30 secs */
|
||||||
if (missed_pulses > 30 RL_SEC) {
|
if (missed_pulses > 30 RL_SEC) {
|
||||||
log("SYSERR: Missed %d seconds worth of pulses.", missed_pulses / PASSES_PER_SEC);
|
log("SYSERR: Missed %ld seconds worth of pulses.", missed_pulses / PASSES_PER_SEC);
|
||||||
missed_pulses = 30 RL_SEC;
|
missed_pulses = 30 RL_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -968,7 +968,7 @@ void game_loop(socket_t local_mother_desc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void heartbeat(int heart_pulse)
|
void heartbeat(const unsigned long heart_pulse)
|
||||||
{
|
{
|
||||||
static int mins_since_crashsave = 0;
|
static int mins_since_crashsave = 0;
|
||||||
|
|
||||||
@@ -1026,7 +1026,7 @@ void heartbeat(int heart_pulse)
|
|||||||
* Based on code submitted by ss@sirocco.cup.hp.com. Code to return the time
|
* Based on code submitted by ss@sirocco.cup.hp.com. Code to return the time
|
||||||
* difference between a and b (a-b). Always returns a nonnegative value
|
* difference between a and b (a-b). Always returns a nonnegative value
|
||||||
* (floors at 0). */
|
* (floors at 0). */
|
||||||
static void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
|
static void timediff(struct timeval *rslt, const struct timeval *a, const struct timeval *b)
|
||||||
{
|
{
|
||||||
if (a->tv_sec < b->tv_sec)
|
if (a->tv_sec < b->tv_sec)
|
||||||
*rslt = null_time;
|
*rslt = null_time;
|
||||||
@@ -1048,7 +1048,7 @@ static void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */
|
/* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */
|
||||||
static void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
|
static void timeadd(struct timeval *rslt, const struct timeval *a, const struct timeval *b)
|
||||||
{
|
{
|
||||||
rslt->tv_sec = a->tv_sec + b->tv_sec;
|
rslt->tv_sec = a->tv_sec + b->tv_sec;
|
||||||
rslt->tv_usec = a->tv_usec + b->tv_usec;
|
rslt->tv_usec = a->tv_usec + b->tv_usec;
|
||||||
@@ -1062,7 +1062,7 @@ static void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
|
|||||||
static void record_usage(void)
|
static void record_usage(void)
|
||||||
{
|
{
|
||||||
int sockets_connected = 0, sockets_playing = 0;
|
int sockets_connected = 0, sockets_playing = 0;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
for (d = descriptor_list; d; d = d->next) {
|
for (d = descriptor_list; d; d = d->next) {
|
||||||
sockets_connected++;
|
sockets_connected++;
|
||||||
@@ -1085,7 +1085,7 @@ static void record_usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Turn off echoing (specific to telnet client) */
|
/* Turn off echoing (specific to telnet client) */
|
||||||
void echo_off(struct descriptor_data *d)
|
void echo_off(descriptor_data *d)
|
||||||
{
|
{
|
||||||
char off_string[] =
|
char off_string[] =
|
||||||
{
|
{
|
||||||
@@ -1099,7 +1099,7 @@ void echo_off(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Turn on echoing (specific to telnet client) */
|
/* Turn on echoing (specific to telnet client) */
|
||||||
void echo_on(struct descriptor_data *d)
|
void echo_on(descriptor_data *d)
|
||||||
{
|
{
|
||||||
char on_string[] =
|
char on_string[] =
|
||||||
{
|
{
|
||||||
@@ -1112,7 +1112,7 @@ void echo_on(struct descriptor_data *d)
|
|||||||
write_to_output(d, "%s", on_string);
|
write_to_output(d, "%s", on_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *make_prompt(struct descriptor_data *d)
|
static char *make_prompt(const descriptor_data *d)
|
||||||
{
|
{
|
||||||
static char prompt[MAX_PROMPT_LENGTH];
|
static char prompt[MAX_PROMPT_LENGTH];
|
||||||
|
|
||||||
@@ -1137,7 +1137,7 @@ static char *make_prompt(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
/* show only when below 25% */
|
/* show only when below 25% */
|
||||||
if (PRF_FLAGGED(d->character, PRF_DISPAUTO) && len < sizeof(prompt)) {
|
if (PRF_FLAGGED(d->character, PRF_DISPAUTO) && len < sizeof(prompt)) {
|
||||||
struct char_data *ch = d->character;
|
const char_data *ch = d->character;
|
||||||
if (GET_HIT(ch) << 2 < GET_MAX_HIT(ch) ) {
|
if (GET_HIT(ch) << 2 < GET_MAX_HIT(ch) ) {
|
||||||
count = snprintf(prompt + len, sizeof(prompt) - len, "%dH ", GET_HIT(ch));
|
count = snprintf(prompt + len, sizeof(prompt) - len, "%dH ", GET_HIT(ch));
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
@@ -1206,11 +1206,11 @@ static char *make_prompt(struct descriptor_data *d)
|
|||||||
else
|
else
|
||||||
*prompt = '\0';
|
*prompt = '\0';
|
||||||
|
|
||||||
return (prompt);
|
return prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: 'txt' must be at most MAX_INPUT_LENGTH big. */
|
/* NOTE: 'txt' must be at most MAX_INPUT_LENGTH big. */
|
||||||
void write_to_q(const char *txt, struct txt_q *queue, int aliased)
|
void write_to_q(const char *txt, struct txt_q *queue, const int aliased)
|
||||||
{
|
{
|
||||||
struct txt_block *newt;
|
struct txt_block *newt;
|
||||||
|
|
||||||
@@ -1250,7 +1250,7 @@ static int get_from_q(struct txt_q *queue, char *dest, int *aliased)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Empty the queues before closing connection */
|
/* Empty the queues before closing connection */
|
||||||
static void flush_queues(struct descriptor_data *d)
|
static void flush_queues(descriptor_data *d)
|
||||||
{
|
{
|
||||||
if (d->large_outbuf) {
|
if (d->large_outbuf) {
|
||||||
d->large_outbuf->next = bufpool;
|
d->large_outbuf->next = bufpool;
|
||||||
@@ -1265,7 +1265,7 @@ static void flush_queues(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add a new string to a player's output queue. For outside use. */
|
/* Add a new string to a player's output queue. For outside use. */
|
||||||
size_t write_to_output(struct descriptor_data *t, const char *txt, ...)
|
size_t write_to_output(descriptor_data *t, const char *txt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
size_t left;
|
size_t left;
|
||||||
@@ -1278,23 +1278,23 @@ size_t write_to_output(struct descriptor_data *t, const char *txt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add a new string to a player's output queue. */
|
/* Add a new string to a player's output queue. */
|
||||||
size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list args)
|
size_t vwrite_to_output(descriptor_data *t, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
const char *text_overflow = "\r\nOVERFLOW\r\n";
|
const char *text_overflow = "\r\nOVERFLOW\r\n";
|
||||||
static char txt[MAX_STRING_LENGTH];
|
static char txt[MAX_STRING_LENGTH];
|
||||||
size_t wantsize;
|
size_t wantsize;
|
||||||
int size;
|
size_t size;
|
||||||
|
|
||||||
/* if we're in the overflow state already, ignore this new output */
|
/* if we're in the overflow state already, ignore this new output */
|
||||||
if (t->bufspace == 0)
|
if (t->bufspace == 0)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
wantsize = size = vsnprintf(txt, sizeof(txt), format, args);
|
wantsize = size = vsnprintf(txt, sizeof(txt), format, args);
|
||||||
|
|
||||||
strcpy(txt, ProtocolOutput( t, txt, (int*)&wantsize )); /* <--- Add this line */
|
strcpy(txt, ProtocolOutput( t, txt, &wantsize ));
|
||||||
size = wantsize; /* <--- Add this line */
|
size = wantsize;
|
||||||
if ( t->pProtocol->WriteOOB > 0 ) /* <--- Add this line */
|
if ( t->pProtocol->WriteOOB > 0 )
|
||||||
--t->pProtocol->WriteOOB; /* <--- Add this line */
|
--t->pProtocol->WriteOOB;
|
||||||
|
|
||||||
/* If exceeding the size of the buffer, truncate it for the overflow message */
|
/* If exceeding the size of the buffer, truncate it for the overflow message */
|
||||||
if (size < 0 || wantsize >= sizeof(txt)) {
|
if (size < 0 || wantsize >= sizeof(txt)) {
|
||||||
@@ -1315,9 +1315,9 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
|
|||||||
* text just barely fits, then it's switched to a large buffer instead. */
|
* text just barely fits, then it's switched to a large buffer instead. */
|
||||||
if (t->bufspace > size) {
|
if (t->bufspace > size) {
|
||||||
strcpy(t->output + t->bufptr, txt); /* strcpy: OK (size checked above) */
|
strcpy(t->output + t->bufptr, txt); /* strcpy: OK (size checked above) */
|
||||||
t->bufspace -= size;
|
t->bufspace -= (ssize_t)size;
|
||||||
t->bufptr += size;
|
t->bufptr += (ssize_t)size;
|
||||||
return (t->bufspace);
|
return t->bufspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_switches++;
|
buf_switches++;
|
||||||
@@ -1337,12 +1337,12 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
|
|||||||
strcat(t->output, txt); /* strcat: OK (size checked) */
|
strcat(t->output, txt); /* strcat: OK (size checked) */
|
||||||
|
|
||||||
/* set the pointer for the next write */
|
/* set the pointer for the next write */
|
||||||
t->bufptr = strlen(t->output);
|
t->bufptr = (ssize_t)strlen(t->output); // cast ok, strlen <<< SSIZE_MAX
|
||||||
|
|
||||||
/* calculate how much space is left in the buffer */
|
/* calculate how much space is left in the buffer */
|
||||||
t->bufspace = LARGE_BUFSIZE - 1 - t->bufptr;
|
t->bufspace = LARGE_BUFSIZE - 1 - t->bufptr;
|
||||||
|
|
||||||
return (t->bufspace);
|
return t->bufspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_bufpool(void)
|
static void free_bufpool(void)
|
||||||
@@ -1423,7 +1423,7 @@ int parse_ip(const char *addr, struct in_addr *inaddr)
|
|||||||
"functions to parse IP addresses (how bizarre!)");
|
"functions to parse IP addresses (how bizarre!)");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif /* INET_ATON and INET_ADDR */
|
#endif /* HAVE_INET_ATON HAVE_INET_ADDR */
|
||||||
|
|
||||||
/* Sets the kernel's send buffer size for the descriptor */
|
/* Sets the kernel's send buffer size for the descriptor */
|
||||||
static int set_sendbuf(socket_t s)
|
static int set_sendbuf(socket_t s)
|
||||||
@@ -1441,7 +1441,7 @@ static int set_sendbuf(socket_t s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a descriptor */
|
/* Initialize a descriptor */
|
||||||
static void init_descriptor (struct descriptor_data *newd, int desc)
|
static void init_descriptor (descriptor_data *newd, int desc)
|
||||||
{
|
{
|
||||||
static int last_desc = 0; /* last descriptor number */
|
static int last_desc = 0; /* last descriptor number */
|
||||||
|
|
||||||
@@ -1467,9 +1467,9 @@ static int new_descriptor(socket_t s)
|
|||||||
{
|
{
|
||||||
socket_t desc;
|
socket_t desc;
|
||||||
int sockets_connected = 0;
|
int sockets_connected = 0;
|
||||||
int greetsize;
|
size_t greetsize;
|
||||||
socklen_t i;
|
socklen_t i;
|
||||||
struct descriptor_data *newd;
|
descriptor_data *newd;
|
||||||
struct sockaddr_in peer;
|
struct sockaddr_in peer;
|
||||||
struct hostent *from;
|
struct hostent *from;
|
||||||
|
|
||||||
@@ -1477,7 +1477,7 @@ static int new_descriptor(socket_t s)
|
|||||||
i = sizeof(peer);
|
i = sizeof(peer);
|
||||||
if ((desc = accept(s, (struct sockaddr *) &peer, &i)) == INVALID_SOCKET) {
|
if ((desc = accept(s, (struct sockaddr *) &peer, &i)) == INVALID_SOCKET) {
|
||||||
perror("SYSERR: accept");
|
perror("SYSERR: accept");
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
/* keep it from blocking */
|
/* keep it from blocking */
|
||||||
nonblock(desc);
|
nonblock(desc);
|
||||||
@@ -1485,7 +1485,7 @@ static int new_descriptor(socket_t s)
|
|||||||
/* set the send buffer size */
|
/* set the send buffer size */
|
||||||
if (set_sendbuf(desc) < 0) {
|
if (set_sendbuf(desc) < 0) {
|
||||||
CLOSE_SOCKET(desc);
|
CLOSE_SOCKET(desc);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure we have room for it */
|
/* make sure we have room for it */
|
||||||
@@ -1495,15 +1495,15 @@ static int new_descriptor(socket_t s)
|
|||||||
if (sockets_connected >= CONFIG_MAX_PLAYING) {
|
if (sockets_connected >= CONFIG_MAX_PLAYING) {
|
||||||
write_to_descriptor(desc, "Sorry, the game is full right now... please try again later!\r\n");
|
write_to_descriptor(desc, "Sorry, the game is full right now... please try again later!\r\n");
|
||||||
CLOSE_SOCKET(desc);
|
CLOSE_SOCKET(desc);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
/* create a new descriptor */
|
/* create a new descriptor */
|
||||||
CREATE(newd, struct descriptor_data, 1);
|
CREATE(newd, struct descriptor_data, 1);
|
||||||
|
|
||||||
/* find the sitename */
|
/* find the sitename */
|
||||||
if (CONFIG_NS_IS_SLOW ||
|
if (CONFIG_NS_IS_SLOW ||
|
||||||
!(from = gethostbyaddr((char *) &peer.sin_addr,
|
!((from = gethostbyaddr((char *) &peer.sin_addr,
|
||||||
sizeof(peer.sin_addr), AF_INET))) {
|
sizeof(peer.sin_addr), AF_INET)))) {
|
||||||
|
|
||||||
/* resolution failed */
|
/* resolution failed */
|
||||||
if (!CONFIG_NS_IS_SLOW)
|
if (!CONFIG_NS_IS_SLOW)
|
||||||
@@ -1522,7 +1522,7 @@ static int new_descriptor(socket_t s)
|
|||||||
CLOSE_SOCKET(desc);
|
CLOSE_SOCKET(desc);
|
||||||
mudlog(CMP, LVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host);
|
mudlog(CMP, LVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host);
|
||||||
free(newd);
|
free(newd);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize descriptor data */
|
/* initialize descriptor data */
|
||||||
@@ -1551,10 +1551,10 @@ static int new_descriptor(socket_t s)
|
|||||||
* 14 bytes: overflow message
|
* 14 bytes: overflow message
|
||||||
* 2 bytes: extra \r\n for non-comapct
|
* 2 bytes: extra \r\n for non-comapct
|
||||||
* 14 bytes: unused */
|
* 14 bytes: unused */
|
||||||
static int process_output(struct descriptor_data *t)
|
static ssize_t process_output(descriptor_data *t)
|
||||||
{
|
{
|
||||||
char i[MAX_SOCK_BUF], *osb = i + 2;
|
char i[MAX_SOCK_BUF], *osb = i + 2;
|
||||||
int result;
|
ssize_t result;
|
||||||
|
|
||||||
/* we may need this \r\n for later -- see below */
|
/* we may need this \r\n for later -- see below */
|
||||||
strcpy(i, "\r\n"); /* strcpy: OK (for 'MAX_SOCK_BUF >= 3') */
|
strcpy(i, "\r\n"); /* strcpy: OK (for 'MAX_SOCK_BUF >= 3') */
|
||||||
@@ -1584,15 +1584,14 @@ static int process_output(struct descriptor_data *t)
|
|||||||
} else
|
} else
|
||||||
result = write_to_descriptor(t->descriptor, osb);
|
result = write_to_descriptor(t->descriptor, osb);
|
||||||
|
|
||||||
if (result < 0) { /* Oops, fatal error. Bye! */
|
if (result < 0) /* Oops, fatal error. Bye! */
|
||||||
// close_socket(t); // close_socket is called after return of negative result
|
return -1;
|
||||||
return (-1);
|
if (result == 0) /* Socket buffer full. Try later. */
|
||||||
} else if (result == 0) /* Socket buffer full. Try later. */
|
return 0;
|
||||||
return (0);
|
|
||||||
|
|
||||||
/* Handle snooping: prepend "% " and send to snooper. */
|
/* Handle snooping: prepend "% " and send to snooper. */
|
||||||
if (t->snoop_by)
|
if (t->snoop_by)
|
||||||
write_to_output(t->snoop_by, "%% %*s%%%%", result, t->output);
|
write_to_output(t->snoop_by, "%% %*s%%%%", (int)result, t->output);
|
||||||
|
|
||||||
/* The common case: all saved output was handed off to the kernel buffer. */
|
/* The common case: all saved output was handed off to the kernel buffer. */
|
||||||
if (result >= t->bufptr) {
|
if (result >= t->bufptr) {
|
||||||
@@ -1607,17 +1606,17 @@ static int process_output(struct descriptor_data *t)
|
|||||||
/* reset total bufspace back to that of a small buffer */
|
/* reset total bufspace back to that of a small buffer */
|
||||||
t->bufspace = SMALL_BUFSIZE - 1;
|
t->bufspace = SMALL_BUFSIZE - 1;
|
||||||
t->bufptr = 0;
|
t->bufptr = 0;
|
||||||
*(t->output) = '\0';
|
*t->output = '\0';
|
||||||
|
|
||||||
/* If the overflow message or prompt were partially written, try to save
|
/* If the overflow message or prompt were partially written, try to save
|
||||||
* them. There will be enough space for them if this is true. 'result'
|
* them. There will be enough space for them if this is true. 'result'
|
||||||
* is effectively unsigned here anyway. */
|
* is effectively unsigned here anyway. */
|
||||||
if ((unsigned int)result < strlen(osb)) {
|
if ((unsigned int)result < strlen(osb)) {
|
||||||
size_t savetextlen = strlen(osb + result);
|
const size_t savetextlen = strlen(osb + result);
|
||||||
|
|
||||||
strcat(t->output, osb + result);
|
strcat(t->output, osb + result);
|
||||||
t->bufptr -= savetextlen;
|
t->bufptr -= (ssize_t)savetextlen; // safe cast - savetextlen will always be <<< SSIZE_MAX
|
||||||
t->bufspace += savetextlen;
|
t->bufspace += (ssize_t)savetextlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1627,7 +1626,7 @@ static int process_output(struct descriptor_data *t)
|
|||||||
t->bufspace += result;
|
t->bufspace += result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* perform_socket_write: takes a descriptor, a pointer to text, and a
|
/* perform_socket_write: takes a descriptor, a pointer to text, and a
|
||||||
@@ -1684,13 +1683,13 @@ static ssize_t perform_socket_write(socket_t desc, const char *txt, size_t lengt
|
|||||||
|
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
/* Write was successful. */
|
/* Write was successful. */
|
||||||
return (result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
/* This should never happen! */
|
/* This should never happen! */
|
||||||
log("SYSERR: Huh?? write() returned 0??? Please report this!");
|
log("SYSERR: Huh?? write() returned 0??? Please report this!");
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* result < 0, so an error was encountered - is it transient? Unfortunately,
|
/* result < 0, so an error was encountered - is it transient? Unfortunately,
|
||||||
@@ -1698,21 +1697,21 @@ static ssize_t perform_socket_write(socket_t desc, const char *txt, size_t lengt
|
|||||||
|
|
||||||
#ifdef EAGAIN /* POSIX */
|
#ifdef EAGAIN /* POSIX */
|
||||||
if (errno == EAGAIN)
|
if (errno == EAGAIN)
|
||||||
return (0);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EWOULDBLOCK /* BSD */
|
#ifdef EWOULDBLOCK /* BSD */
|
||||||
if (errno == EWOULDBLOCK)
|
if (errno == EWOULDBLOCK)
|
||||||
return (0);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EDEADLK /* Macintosh */
|
#ifdef EDEADLK /* Macintosh */
|
||||||
if (errno == EDEADLK)
|
if (errno == EDEADLK)
|
||||||
return (0);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Looks like the error was fatal. Too bad. */
|
/* Looks like the error was fatal. Too bad. */
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* CIRCLE_WINDOWS */
|
#endif /* CIRCLE_WINDOWS */
|
||||||
|
|
||||||
@@ -1721,10 +1720,10 @@ static ssize_t perform_socket_write(socket_t desc, const char *txt, size_t lengt
|
|||||||
* delivered to the OS, or until an error is encountered. Returns:
|
* delivered to the OS, or until an error is encountered. Returns:
|
||||||
* >=0 If all is well and good.
|
* >=0 If all is well and good.
|
||||||
* -1 If an error was encountered, so that the player should be cut off. */
|
* -1 If an error was encountered, so that the player should be cut off. */
|
||||||
int write_to_descriptor(socket_t desc, const char *txt)
|
ssize_t write_to_descriptor(socket_t desc, const char *txt)
|
||||||
{
|
{
|
||||||
ssize_t bytes_written;
|
ssize_t bytes_written, write_total = 0;
|
||||||
size_t total = strlen(txt), write_total = 0;
|
size_t total = strlen(txt);
|
||||||
|
|
||||||
while (total > 0) {
|
while (total > 0) {
|
||||||
bytes_written = perform_socket_write(desc, txt, total);
|
bytes_written = perform_socket_write(desc, txt, total);
|
||||||
@@ -1733,17 +1732,17 @@ int write_to_descriptor(socket_t desc, const char *txt)
|
|||||||
/* Fatal error. Disconnect the player. */
|
/* Fatal error. Disconnect the player. */
|
||||||
perror("SYSERR: Write to socket");
|
perror("SYSERR: Write to socket");
|
||||||
return (-1);
|
return (-1);
|
||||||
} else if (bytes_written == 0) {
|
}
|
||||||
|
if (bytes_written == 0) {
|
||||||
/* Temporary failure -- socket buffer full. */
|
/* Temporary failure -- socket buffer full. */
|
||||||
return (write_total);
|
return write_total;
|
||||||
} else {
|
}
|
||||||
txt += bytes_written;
|
txt += bytes_written;
|
||||||
total -= bytes_written;
|
total -= bytes_written;
|
||||||
write_total += bytes_written;
|
write_total += bytes_written;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (write_total);
|
return write_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same information about perform_socket_write applies here. I like
|
/* Same information about perform_socket_write applies here. I like
|
||||||
@@ -1819,11 +1818,11 @@ static ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space
|
|||||||
* above, 'tmp' lost the '+8' since it doesn't need it and the code has been
|
* above, 'tmp' lost the '+8' since it doesn't need it and the code has been
|
||||||
* changed to reserve space by accepting one less character. (Do you really
|
* changed to reserve space by accepting one less character. (Do you really
|
||||||
* need 256 characters on a line?) -gg 1/21/2000 */
|
* need 256 characters on a line?) -gg 1/21/2000 */
|
||||||
static int process_input(struct descriptor_data *t)
|
static int process_input(descriptor_data *t)
|
||||||
{
|
{
|
||||||
int buf_length, failed_subst;
|
int failed_subst;
|
||||||
ssize_t bytes_read;
|
ssize_t bytes_read;
|
||||||
size_t space_left;
|
size_t buf_length, space_left;
|
||||||
char *ptr, *read_point, *write_point, *nl_pos = NULL;
|
char *ptr, *read_point, *write_point, *nl_pos = NULL;
|
||||||
char tmp[MAX_INPUT_LENGTH];
|
char tmp[MAX_INPUT_LENGTH];
|
||||||
static char read_buf[MAX_PROTOCOL_BUFFER] = { '\0' }; /* KaVir's plugin */
|
static char read_buf[MAX_PROTOCOL_BUFFER] = { '\0' }; /* KaVir's plugin */
|
||||||
@@ -1836,7 +1835,7 @@ static int process_input(struct descriptor_data *t)
|
|||||||
do {
|
do {
|
||||||
if (space_left <= 0) {
|
if (space_left <= 0) {
|
||||||
log("WARNING: process_input: about to close connection: input overflow");
|
log("WARNING: process_input: about to close connection: input overflow");
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read # of "bytes_read" from socket, and if we have something, mark the sizeof data
|
/* Read # of "bytes_read" from socket, and if we have something, mark the sizeof data
|
||||||
@@ -1850,9 +1849,9 @@ static int process_input(struct descriptor_data *t)
|
|||||||
bytes_read = ProtocolInput( t, read_buf, bytes_read, t->inbuf );
|
bytes_read = ProtocolInput( t, read_buf, bytes_read, t->inbuf );
|
||||||
|
|
||||||
if (bytes_read < 0) /* Error, disconnect them. */
|
if (bytes_read < 0) /* Error, disconnect them. */
|
||||||
return (-1);
|
return -1;
|
||||||
else if (bytes_read == 0) /* Just blocking, no problems. */
|
if (bytes_read == 0) /* Just blocking, no problems. */
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
/* at this point, we know we got some data from the read */
|
/* at this point, we know we got some data from the read */
|
||||||
*(read_point + bytes_read) = '\0'; /* terminate the string */
|
*(read_point + bytes_read) = '\0'; /* terminate the string */
|
||||||
@@ -1912,23 +1911,24 @@ static int process_input(struct descriptor_data *t)
|
|||||||
|
|
||||||
*write_point = '\0';
|
*write_point = '\0';
|
||||||
|
|
||||||
if ((space_left <= 0) && (ptr < nl_pos)) {
|
if (space_left <= 0 && ptr < nl_pos) {
|
||||||
char buffer[MAX_INPUT_LENGTH + 64];
|
char buffer[MAX_INPUT_LENGTH + 64];
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "Line too long. Truncated to:\r\n%s\r\n", tmp);
|
snprintf(buffer, sizeof(buffer), "Line too long. Truncated to:\r\n%s\r\n", tmp);
|
||||||
if (write_to_descriptor(t->descriptor, buffer) < 0)
|
if (write_to_descriptor(t->descriptor, buffer) < 0)
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
if (t->snoop_by)
|
if (t->snoop_by)
|
||||||
write_to_output(t->snoop_by, "%% %s\r\n", tmp);
|
write_to_output(t->snoop_by, "%% %s\r\n", tmp);
|
||||||
|
|
||||||
failed_subst = 0;
|
failed_subst = 0;
|
||||||
|
|
||||||
if (*tmp == '!' && !(*(tmp + 1))) /* Redo last command. */
|
if (*tmp == '!' && !*(tmp + 1)) /* Redo last command. */
|
||||||
strcpy(tmp, t->last_input); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
strcpy(tmp, t->last_input); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
||||||
else if (*tmp == '!' && *(tmp + 1)) {
|
else if (*tmp == '!' && *(tmp + 1)) {
|
||||||
char *commandln = (tmp + 1);
|
char *commandln = tmp + 1;
|
||||||
int starting_pos = t->history_pos,
|
int starting_pos = t->history_pos,
|
||||||
cnt = (t->history_pos == 0 ? HISTORY_SIZE - 1 : t->history_pos - 1);
|
cnt = t->history_pos == 0 ? HISTORY_SIZE - 1 : t->history_pos - 1;
|
||||||
|
|
||||||
skip_spaces(&commandln);
|
skip_spaces(&commandln);
|
||||||
for (; cnt != starting_pos; cnt--) {
|
for (; cnt != starting_pos; cnt--) {
|
||||||
@@ -1942,7 +1942,7 @@ static int process_input(struct descriptor_data *t)
|
|||||||
cnt = HISTORY_SIZE;
|
cnt = HISTORY_SIZE;
|
||||||
}
|
}
|
||||||
} else if (*tmp == '^') {
|
} else if (*tmp == '^') {
|
||||||
if (!(failed_subst = perform_subst(t, t->last_input, tmp)))
|
if (!((failed_subst = perform_subst(t, t->last_input, tmp))))
|
||||||
strcpy(t->last_input, tmp); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
strcpy(t->last_input, tmp); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
||||||
} else {
|
} else {
|
||||||
strcpy(t->last_input, tmp); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
strcpy(t->last_input, tmp); /* strcpy: OK (by mutual MAX_INPUT_LENGTH) */
|
||||||
@@ -1954,8 +1954,7 @@ static int process_input(struct descriptor_data *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The '--' command flushes the queue. */
|
/* The '--' command flushes the queue. */
|
||||||
if ( (*tmp == '-') && (*(tmp+1) == '-') && !(*(tmp+2)) )
|
if ( *tmp == '-' && *(tmp+1) == '-' && !*(tmp+2) ) {
|
||||||
{
|
|
||||||
write_to_output(t, "All queued commands cancelled.\r\n");
|
write_to_output(t, "All queued commands cancelled.\r\n");
|
||||||
flush_queues(t); /* Flush the command queue */
|
flush_queues(t); /* Flush the command queue */
|
||||||
failed_subst = 1; /* Allow the read point to be moved, but don't add to queue */
|
failed_subst = 1; /* Allow the read point to be moved, but don't add to queue */
|
||||||
@@ -1981,13 +1980,13 @@ static int process_input(struct descriptor_data *t)
|
|||||||
*(write_point++) = *(read_point++);
|
*(write_point++) = *(read_point++);
|
||||||
*write_point = '\0';
|
*write_point = '\0';
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform substitution for the '^..^' csh-esque syntax orig is the orig string,
|
/* Perform substitution for the '^..^' csh-esque syntax orig is the orig string,
|
||||||
* i.e. the one being modified. subst contains the substition string, i.e.
|
* i.e. the one being modified. subst contains the substition string, i.e.
|
||||||
* "^telm^tell" */
|
* "^telm^tell" */
|
||||||
static int perform_subst(struct descriptor_data *t, char *orig, char *subst)
|
static int perform_subst(descriptor_data *t, const char *orig, char *subst)
|
||||||
{
|
{
|
||||||
char newsub[MAX_INPUT_LENGTH + 5];
|
char newsub[MAX_INPUT_LENGTH + 5];
|
||||||
|
|
||||||
@@ -1998,16 +1997,16 @@ static int perform_subst(struct descriptor_data *t, char *orig, char *subst)
|
|||||||
first = subst + 1;
|
first = subst + 1;
|
||||||
|
|
||||||
/* now find the second '^' */
|
/* now find the second '^' */
|
||||||
if (!(second = strchr(first, '^'))) {
|
if (!((second = strchr(first, '^')))) {
|
||||||
write_to_output(t, "Invalid substitution.\r\n");
|
write_to_output(t, "Invalid substitution.\r\n");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
/* terminate "first" at the position of the '^' and make 'second' point
|
/* terminate "first" at the position of the '^' and make 'second' point
|
||||||
* to the beginning of the second string */
|
* to the beginning of the second string */
|
||||||
*(second++) = '\0';
|
*second++ = '\0';
|
||||||
|
|
||||||
/* now, see if the contents of the first string appear in the original */
|
/* now, see if the contents of the first string appear in the original */
|
||||||
if (!(strpos = strstr(orig, first))) {
|
if (!((strpos = strstr(orig, first)))) {
|
||||||
write_to_output(t, "Invalid substitution.\r\n");
|
write_to_output(t, "Invalid substitution.\r\n");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -2022,7 +2021,7 @@ static int perform_subst(struct descriptor_data *t, char *orig, char *subst)
|
|||||||
|
|
||||||
/* now, if there's anything left in the original after the string to
|
/* now, if there's anything left in the original after the string to
|
||||||
* replaced, copy that too. */
|
* replaced, copy that too. */
|
||||||
if (((strpos - orig) + strlen(first)) < strlen(orig))
|
if (strpos - orig + strlen(first) < strlen(orig))
|
||||||
strncat(newsub, strpos + strlen(first), MAX_INPUT_LENGTH - strlen(newsub) - 1); /* strncpy: OK */
|
strncat(newsub, strpos + strlen(first), MAX_INPUT_LENGTH - strlen(newsub) - 1); /* strncpy: OK */
|
||||||
|
|
||||||
/* terminate the string in case of an overflow from strncat */
|
/* terminate the string in case of an overflow from strncat */
|
||||||
@@ -2032,9 +2031,9 @@ static int perform_subst(struct descriptor_data *t, char *orig, char *subst)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_socket(struct descriptor_data *d)
|
void close_socket(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct descriptor_data *temp;
|
descriptor_data *temp;
|
||||||
|
|
||||||
REMOVE_FROM_LIST(d, descriptor_list, next);
|
REMOVE_FROM_LIST(d, descriptor_list, next);
|
||||||
CLOSE_SOCKET(d->descriptor);
|
CLOSE_SOCKET(d->descriptor);
|
||||||
@@ -2067,7 +2066,7 @@ void close_socket(struct descriptor_data *d)
|
|||||||
add_llog_entry(d->character, LAST_DISCONNECT);
|
add_llog_entry(d->character, LAST_DISCONNECT);
|
||||||
|
|
||||||
if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {
|
if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {
|
||||||
struct char_data *link_challenged = d->original ? d->original : d->character;
|
char_data *link_challenged = d->original ? d->original : d->character;
|
||||||
|
|
||||||
/* We are guaranteed to have a person. */
|
/* We are guaranteed to have a person. */
|
||||||
act("$n has lost $s link.", TRUE, link_challenged, 0, 0, TO_ROOM);
|
act("$n has lost $s link.", TRUE, link_challenged, 0, 0, TO_ROOM);
|
||||||
@@ -2135,7 +2134,7 @@ void close_socket(struct descriptor_data *d)
|
|||||||
|
|
||||||
static void check_idle_passwords(void)
|
static void check_idle_passwords(void)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d, *next_d;
|
descriptor_data *d, *next_d;
|
||||||
|
|
||||||
for (d = descriptor_list; d; d = next_d) {
|
for (d = descriptor_list; d; d = next_d) {
|
||||||
next_d = d->next;
|
next_d = d->next;
|
||||||
@@ -2144,13 +2143,12 @@ static void check_idle_passwords(void)
|
|||||||
if (!d->idle_tics) {
|
if (!d->idle_tics) {
|
||||||
d->idle_tics++;
|
d->idle_tics++;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
echo_on(d);
|
echo_on(d);
|
||||||
write_to_output(d, "\r\nTimed out... goodbye.\r\n");
|
write_to_output(d, "\r\nTimed out... goodbye.\r\n");
|
||||||
STATE(d) = CON_CLOSE;
|
STATE(d) = CON_CLOSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* I tried to universally convert Circle over to POSIX compliance, but
|
/* I tried to universally convert Circle over to POSIX compliance, but
|
||||||
* alas, some systems are still straggling behind and don't have all the
|
* alas, some systems are still straggling behind and don't have all the
|
||||||
@@ -2231,7 +2229,8 @@ static RETSIGTYPE unrestrict_game(int sig)
|
|||||||
/* clean up our zombie kids to avoid defunct processes */
|
/* clean up our zombie kids to avoid defunct processes */
|
||||||
static RETSIGTYPE reap(int sig)
|
static RETSIGTYPE reap(int sig)
|
||||||
{
|
{
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||||
|
;
|
||||||
|
|
||||||
my_signal(SIGCHLD, reap);
|
my_signal(SIGCHLD, reap);
|
||||||
}
|
}
|
||||||
@@ -2324,7 +2323,7 @@ static void signal_setup(void)
|
|||||||
/* Public routines for system-to-player-communication. */
|
/* Public routines for system-to-player-communication. */
|
||||||
void game_info(const char *format, ...)
|
void game_info(const char *format, ...)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
char messg[MAX_STRING_LENGTH];
|
char messg[MAX_STRING_LENGTH];
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
@@ -2344,7 +2343,7 @@ void game_info(const char *format, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t send_to_char(struct char_data *ch, const char *messg, ...)
|
size_t send_to_char(const char_data *ch, const char *messg, ...)
|
||||||
{
|
{
|
||||||
if (ch->desc && messg && *messg) {
|
if (ch->desc && messg && *messg) {
|
||||||
size_t left;
|
size_t left;
|
||||||
@@ -2360,7 +2359,7 @@ size_t send_to_char(struct char_data *ch, const char *messg, ...)
|
|||||||
|
|
||||||
void send_to_all(const char *messg, ...)
|
void send_to_all(const char *messg, ...)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (messg == NULL)
|
if (messg == NULL)
|
||||||
@@ -2378,7 +2377,7 @@ void send_to_all(const char *messg, ...)
|
|||||||
|
|
||||||
void send_to_outdoor(const char *messg, ...)
|
void send_to_outdoor(const char *messg, ...)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (!messg || !*messg)
|
if (!messg || !*messg)
|
||||||
@@ -2399,7 +2398,7 @@ void send_to_outdoor(const char *messg, ...)
|
|||||||
|
|
||||||
void send_to_room(room_rnum room, const char *messg, ...)
|
void send_to_room(room_rnum room, const char *messg, ...)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (messg == NULL)
|
if (messg == NULL)
|
||||||
@@ -2418,9 +2417,9 @@ void send_to_room(room_rnum room, const char *messg, ...)
|
|||||||
/* Sends a message to the entire group, except for ch.
|
/* Sends a message to the entire group, except for ch.
|
||||||
* Send 'ch' as NULL, if you want to message to reach
|
* Send 'ch' as NULL, if you want to message to reach
|
||||||
* everyone. -Vatiken */
|
* everyone. -Vatiken */
|
||||||
void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...)
|
void send_to_group(const char_data *ch, const struct group_data *group, const char * msg, ...)
|
||||||
{
|
{
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
@@ -2441,10 +2440,15 @@ void send_to_group(struct char_data *ch, struct group_data *group, const char *
|
|||||||
/* Thx to Jamie Nelson of 4D for this contribution */
|
/* Thx to Jamie Nelson of 4D for this contribution */
|
||||||
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
|
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
if (start == NOWHERE || finish == NOWHERE) {
|
||||||
|
log("send_to_range passed start room or end room NOWHERE.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (start > finish) {
|
if (start > finish) {
|
||||||
log("send_to_range passed start room value greater then finish.");
|
log("send_to_range passed start room value greater then finish.");
|
||||||
return;
|
return;
|
||||||
@@ -2470,14 +2474,15 @@ static const char *ACTNULL = "<NULL>";
|
|||||||
#define CHECK_NULL(pointer, expression) \
|
#define CHECK_NULL(pointer, expression) \
|
||||||
if ((pointer) == NULL) i = ACTNULL; else i = (expression);
|
if ((pointer) == NULL) i = ACTNULL; else i = (expression);
|
||||||
/* higher-level communication: the act() function */
|
/* higher-level communication: the act() function */
|
||||||
void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
void perform_act(const char *orig, char_data *ch, obj_data *obj,
|
||||||
void *vict_obj, struct char_data *to)
|
// ReSharper disable once CppParameterMayBeConstPtrOrRef
|
||||||
|
void *vict_obj, char_data *to)
|
||||||
{
|
{
|
||||||
const char *i = NULL;
|
const char *i = NULL;
|
||||||
char lbuf[MAX_STRING_LENGTH], *buf, *j;
|
char lbuf[MAX_STRING_LENGTH], *buf, *j;
|
||||||
bool uppercasenext = FALSE;
|
bool uppercasenext = FALSE;
|
||||||
struct char_data *dg_victim = (to == vict_obj) ? vict_obj : NULL;
|
char_data *dg_victim = (to == vict_obj) ? vict_obj : NULL;
|
||||||
struct obj_data *dg_target = NULL;
|
obj_data *dg_target = NULL;
|
||||||
char *dg_arg = NULL;
|
char *dg_arg = NULL;
|
||||||
|
|
||||||
buf = lbuf;
|
buf = lbuf;
|
||||||
@@ -2489,50 +2494,50 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
|||||||
i = PERS(ch, to);
|
i = PERS(ch, to);
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
CHECK_NULL(vict_obj, PERS((const struct char_data *) vict_obj, to));
|
CHECK_NULL(vict_obj, PERS((const char_data *) vict_obj, to));
|
||||||
dg_victim = (struct char_data *) vict_obj;
|
dg_victim = (char_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
i = HMHR(ch);
|
i = HMHR(ch);
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
CHECK_NULL(vict_obj, HMHR((const struct char_data *) vict_obj));
|
CHECK_NULL(vict_obj, HMHR((const char_data *) vict_obj));
|
||||||
dg_victim = (struct char_data *) vict_obj;
|
dg_victim = (char_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
i = HSHR(ch);
|
i = HSHR(ch);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
CHECK_NULL(vict_obj, HSHR((const struct char_data *) vict_obj));
|
CHECK_NULL(vict_obj, HSHR((const char_data *) vict_obj));
|
||||||
dg_victim = (struct char_data *) vict_obj;
|
dg_victim = (char_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
i = HSSH(ch);
|
i = HSSH(ch);
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
CHECK_NULL(vict_obj, HSSH((const struct char_data *) vict_obj));
|
CHECK_NULL(vict_obj, HSSH((const char_data *) vict_obj));
|
||||||
dg_victim = (struct char_data *) vict_obj;
|
dg_victim = (char_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
CHECK_NULL(obj, OBJN(obj, to));
|
CHECK_NULL(obj, OBJN(obj, to));
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
CHECK_NULL(vict_obj, OBJN((const struct obj_data *) vict_obj, to));
|
CHECK_NULL(vict_obj, OBJN((const obj_data *) vict_obj, to));
|
||||||
dg_target = (struct obj_data *) vict_obj;
|
dg_target = (obj_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
CHECK_NULL(obj, OBJS(obj, to));
|
CHECK_NULL(obj, OBJS(obj, to));
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
CHECK_NULL(vict_obj, OBJS((const struct obj_data *) vict_obj, to));
|
CHECK_NULL(vict_obj, OBJS((const obj_data *) vict_obj, to));
|
||||||
dg_target = (struct obj_data *) vict_obj;
|
dg_target = (obj_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
CHECK_NULL(obj, SANA(obj));
|
CHECK_NULL(obj, SANA(obj));
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
CHECK_NULL(vict_obj, SANA((const struct obj_data *) vict_obj));
|
CHECK_NULL(vict_obj, SANA((const obj_data *) vict_obj));
|
||||||
dg_target = (struct obj_data *) vict_obj;
|
dg_target = (obj_data *) vict_obj;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
CHECK_NULL(vict_obj, (const char *) vict_obj);
|
CHECK_NULL(vict_obj, (const char *) vict_obj);
|
||||||
@@ -2542,11 +2547,12 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
|||||||
CHECK_NULL(obj, (char *) obj);
|
CHECK_NULL(obj, (char *) obj);
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
CHECK_NULL(vict_obj, fname((const char *) vict_obj));
|
CHECK_NULL(vict_obj, fname(vict_obj));
|
||||||
break;
|
break;
|
||||||
/* uppercase previous word */
|
/* uppercase previous word */
|
||||||
case 'u':
|
case 'u':
|
||||||
for (j=buf; j > lbuf && !isspace((int) *(j-1)); j--);
|
for (j=buf; j > lbuf && !isspace((int) *(j-1)); j--)
|
||||||
|
;
|
||||||
if (j != buf)
|
if (j != buf)
|
||||||
*j = UPPER(*j);
|
*j = UPPER(*j);
|
||||||
i = "";
|
i = "";
|
||||||
@@ -2565,17 +2571,15 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
|||||||
i = "";
|
i = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while ((*buf = *(i++)))
|
while ((*buf = *(i++))) {
|
||||||
{
|
if (uppercasenext && !isspace((int) *buf)) {
|
||||||
if (uppercasenext && !isspace((int) *buf))
|
|
||||||
{
|
|
||||||
*buf = UPPER(*buf);
|
*buf = UPPER(*buf);
|
||||||
uppercasenext = FALSE;
|
uppercasenext = FALSE;
|
||||||
}
|
}
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
orig++;
|
orig++;
|
||||||
} else if (!(*(buf++) = *(orig++))) {
|
} else if (!((*buf++ = *orig++))) {
|
||||||
break;
|
break;
|
||||||
} else if (uppercasenext && !isspace((int) *(buf-1))) {
|
} else if (uppercasenext && !isspace((int) *(buf-1))) {
|
||||||
*(buf-1) = UPPER(*(buf-1));
|
*(buf-1) = UPPER(*(buf-1));
|
||||||
@@ -2598,10 +2602,10 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
|||||||
last_act_message = strdup(lbuf);
|
last_act_message = strdup(lbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *act(const char *str, int hide_invisible, struct char_data *ch,
|
char *act(const char *str, int hide_invisible, char_data *ch,
|
||||||
struct obj_data *obj, void *vict_obj, int type)
|
obj_data *obj, void *vict_obj, int type)
|
||||||
{
|
{
|
||||||
struct char_data *to;
|
char_data *to;
|
||||||
int to_sleeping;
|
int to_sleeping;
|
||||||
|
|
||||||
if (!str || !*str)
|
if (!str || !*str)
|
||||||
@@ -2616,12 +2620,12 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
|
|||||||
* short, it is a hack. */
|
* short, it is a hack. */
|
||||||
|
|
||||||
/* check if TO_SLEEP is there, and remove it if it is. */
|
/* check if TO_SLEEP is there, and remove it if it is. */
|
||||||
if ((to_sleeping = (type & TO_SLEEP)))
|
if ((to_sleeping = type & TO_SLEEP))
|
||||||
type &= ~TO_SLEEP;
|
type &= ~TO_SLEEP;
|
||||||
|
|
||||||
/* this is a hack as well - DG_NO_TRIG is 256 -- Welcor */
|
/* this is a hack as well - DG_NO_TRIG is 256 -- Welcor */
|
||||||
/* If the bit is set, unset dg_act_check, thus the ! below */
|
/* If the bit is set, unset dg_act_check, thus the ! below */
|
||||||
if (!(dg_act_check = !IS_SET(type, DG_NO_TRIG)))
|
if (!((dg_act_check = !IS_SET(type, DG_NO_TRIG))))
|
||||||
REMOVE_BIT(type, DG_NO_TRIG);
|
REMOVE_BIT(type, DG_NO_TRIG);
|
||||||
|
|
||||||
if (type == TO_CHAR) {
|
if (type == TO_CHAR) {
|
||||||
@@ -2641,7 +2645,7 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type == TO_GMOTE && !IS_NPC(ch)) {
|
if (type == TO_GMOTE && !IS_NPC(ch)) {
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
for (i = descriptor_list; i; i = i->next) {
|
for (i = descriptor_list; i; i = i->next) {
|
||||||
@@ -2764,17 +2768,17 @@ static void circle_sleep(struct timeval *timeout)
|
|||||||
/* KaVir's plugin*/
|
/* KaVir's plugin*/
|
||||||
static void msdp_update( void )
|
static void msdp_update( void )
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int PlayerCount = 0;
|
int PlayerCount = 0;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
extern const char *pc_class_types[];
|
extern const char *pc_class_types[];
|
||||||
|
|
||||||
for (d = descriptor_list; d; d = d->next)
|
for (d = descriptor_list; d; d = d->next)
|
||||||
{
|
{
|
||||||
struct char_data *ch = d->character;
|
char_data *ch = d->character;
|
||||||
if ( ch && !IS_NPC(ch) && d->connected == CON_PLAYING )
|
if ( ch && !IS_NPC(ch) && d->connected == CON_PLAYING )
|
||||||
{
|
{
|
||||||
struct char_data *pOpponent = FIGHTING(ch);
|
char_data *pOpponent = FIGHTING(ch);
|
||||||
++PlayerCount;
|
++PlayerCount;
|
||||||
|
|
||||||
MSDPSetString( d, eMSDP_CHARACTER_NAME, GET_NAME(ch) );
|
MSDPSetString( d, eMSDP_CHARACTER_NAME, GET_NAME(ch) );
|
||||||
|
|||||||
+16
-22
@@ -17,20 +17,14 @@
|
|||||||
#define COPYOVER_FILE "copyover.dat"
|
#define COPYOVER_FILE "copyover.dat"
|
||||||
|
|
||||||
/* comm.c */
|
/* 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)));
|
void game_info(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__
|
size_t send_to_char(const char_data *ch, const char *messg, ...) __attribute__((format (printf, 2, 3)));
|
||||||
((format (printf, 2, 3)));
|
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1,
|
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
2)));
|
void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format
|
void send_to_group(const char_data *ch, const struct group_data *group, const char * msg, ...) __attribute__ ((format(printf, 3, 4)));
|
||||||
(printf, 2, 3)));
|
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) __attribute__ ((format (printf, 3, 4)));
|
||||||
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)));
|
|
||||||
|
|
||||||
/* Act type settings and flags */
|
/* Act type settings and flags */
|
||||||
#define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */
|
#define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */
|
||||||
@@ -43,24 +37,24 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
|
|||||||
|
|
||||||
|
|
||||||
/* act functions */
|
/* act functions */
|
||||||
void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj, void *vict_obj, struct char_data *to);
|
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, struct char_data *ch, struct obj_data *obj, void *vict_obj, int type);
|
char * act(const char *str, int hide_invisible, char_data *ch, obj_data *obj, void *vict_obj, int type);
|
||||||
|
|
||||||
/* I/O functions */
|
/* I/O functions */
|
||||||
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
|
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
|
||||||
int write_to_descriptor(socket_t desc, const char *txt);
|
ssize_t 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 write_to_output(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);
|
size_t vwrite_to_output(descriptor_data *d, const char *format, va_list args);
|
||||||
|
|
||||||
typedef RETSIGTYPE sigfunc(int);
|
typedef RETSIGTYPE sigfunc(int);
|
||||||
|
|
||||||
void echo_off(struct descriptor_data *d);
|
void echo_off(descriptor_data *d);
|
||||||
void echo_on(struct descriptor_data *d);
|
void echo_on(descriptor_data *d);
|
||||||
void game_loop(socket_t mother_desc);
|
void game_loop(socket_t mother_desc);
|
||||||
void heartbeat(int heart_pulse);
|
void heartbeat(unsigned long heart_pulse);
|
||||||
void copyover_recover(void);
|
void copyover_recover(void);
|
||||||
|
|
||||||
extern struct descriptor_data *descriptor_list;
|
extern descriptor_data *descriptor_list;
|
||||||
extern int buf_largecount;
|
extern int buf_largecount;
|
||||||
extern int buf_overflows;
|
extern int buf_overflows;
|
||||||
extern int buf_switches;
|
extern int buf_switches;
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ struct config_data config_info; /* Game configuration list. */
|
|||||||
struct room_data *world = NULL; /* array of rooms */
|
struct room_data *world = NULL; /* array of rooms */
|
||||||
room_rnum top_of_world = 0; /* ref to top element of world */
|
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 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 */
|
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 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 */
|
obj_rnum top_of_objt = 0; /* top of object index table */
|
||||||
|
|
||||||
struct zone_data *zone_table; /* zone table */
|
struct zone_data *zone_table; /* zone table */
|
||||||
@@ -128,9 +128,9 @@ static int converting = FALSE;
|
|||||||
|
|
||||||
/* Local (file scope) utility functions */
|
/* 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_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_spell_number(obj_data *obj, int val);
|
||||||
static int check_object_level(struct obj_data *obj, int val);
|
static int check_object_level(obj_data *obj, int val);
|
||||||
static int check_object(struct obj_data *);
|
static int check_object(obj_data *);
|
||||||
static void load_zones(FILE *fl, char *zonename);
|
static void load_zones(FILE *fl, char *zonename);
|
||||||
static int file_to_string(const char *name, char *buf);
|
static int file_to_string(const char *name, char *buf);
|
||||||
static int file_to_string_alloc(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)
|
void destroy_db(void)
|
||||||
{
|
{
|
||||||
ssize_t cnt, itr;
|
ssize_t cnt, itr;
|
||||||
struct char_data *chtmp, *i = character_list;
|
char_data *chtmp, *i = character_list;
|
||||||
struct obj_data *objtmp;
|
obj_data *objtmp;
|
||||||
|
|
||||||
/* Active Mobiles & Players */
|
/* Active Mobiles & Players */
|
||||||
while (i) {
|
while (i) {
|
||||||
@@ -1040,17 +1040,17 @@ void index_boot(int mode)
|
|||||||
log(" %d rooms, %d bytes.", rec_count, size[0]);
|
log(" %d rooms, %d bytes.", rec_count, size[0]);
|
||||||
break;
|
break;
|
||||||
case DB_BOOT_MOB:
|
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);
|
CREATE(mob_index, struct index_data, rec_count);
|
||||||
size[0] = sizeof(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]);
|
log(" %d mobs, %d bytes in index, %d bytes in prototypes.", rec_count, size[0], size[1]);
|
||||||
break;
|
break;
|
||||||
case DB_BOOT_OBJ:
|
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);
|
CREATE(obj_index, struct index_data, rec_count);
|
||||||
size[0] = sizeof(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]);
|
log(" %d objs, %d bytes in index, %d bytes in prototypes.", rec_count, size[0], size[1]);
|
||||||
break;
|
break;
|
||||||
case DB_BOOT_ZON:
|
case DB_BOOT_ZON:
|
||||||
@@ -2349,7 +2349,7 @@ static int hsort(const void *a, const void *b)
|
|||||||
return (str_cmp(a1->keywords, b1->keywords));
|
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;
|
int nr, found = 0;
|
||||||
|
|
||||||
@@ -2362,7 +2362,7 @@ int vnum_mobile(char *searchname, struct char_data *ch)
|
|||||||
return (found);
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnum_object(char *searchname, struct char_data *ch)
|
int vnum_object(char *searchname, char_data *ch)
|
||||||
{
|
{
|
||||||
int nr, found = 0;
|
int nr, found = 0;
|
||||||
|
|
||||||
@@ -2375,7 +2375,7 @@ int vnum_object(char *searchname, struct char_data *ch)
|
|||||||
return (found);
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnum_room(char *searchname, struct char_data *ch)
|
int vnum_room(char *searchname, char_data *ch)
|
||||||
{
|
{
|
||||||
int nr, found = 0;
|
int nr, found = 0;
|
||||||
|
|
||||||
@@ -2387,7 +2387,7 @@ int vnum_room(char *searchname, struct char_data *ch)
|
|||||||
return (found);
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnum_trig(char *searchname, struct char_data *ch)
|
int vnum_trig(char *searchname, char_data *ch)
|
||||||
{
|
{
|
||||||
int nr, found = 0;
|
int nr, found = 0;
|
||||||
for (nr = 0; nr < top_of_trigt; nr++)
|
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 */
|
/* 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);
|
clear_char(ch);
|
||||||
|
|
||||||
new_mobile_data(ch);
|
new_mobile_data(ch);
|
||||||
@@ -2415,7 +2415,7 @@ struct char_data *create_char(void)
|
|||||||
return (ch);
|
return (ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_mobile_data(struct char_data *ch)
|
void new_mobile_data(char_data *ch)
|
||||||
{
|
{
|
||||||
ch->events = NULL;
|
ch->events = NULL;
|
||||||
ch->group = NULL;
|
ch->group = NULL;
|
||||||
@@ -2423,10 +2423,10 @@ void new_mobile_data(struct char_data *ch)
|
|||||||
|
|
||||||
|
|
||||||
/* create a new mobile from a prototype */
|
/* 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;
|
mob_rnum i;
|
||||||
struct char_data *mob;
|
char_data *mob;
|
||||||
|
|
||||||
if (type == VIRTUAL) {
|
if (type == VIRTUAL) {
|
||||||
if ((i = real_mobile(nr)) == NOBODY) {
|
if ((i = real_mobile(nr)) == NOBODY) {
|
||||||
@@ -2436,7 +2436,7 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
|
|||||||
} else
|
} else
|
||||||
i = nr;
|
i = nr;
|
||||||
|
|
||||||
CREATE(mob, struct char_data, 1);
|
CREATE(mob, char_data, 1);
|
||||||
clear_char(mob);
|
clear_char(mob);
|
||||||
|
|
||||||
*mob = mob_proto[i];
|
*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 */
|
/* 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);
|
clear_object(obj);
|
||||||
obj->next = object_list;
|
obj->next = object_list;
|
||||||
object_list = obj;
|
object_list = obj;
|
||||||
@@ -2487,9 +2487,9 @@ struct obj_data *create_obj(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create a new object from a prototype */
|
/* 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;
|
obj_rnum i = type == VIRTUAL ? real_object(nr) : nr;
|
||||||
|
|
||||||
if (i == NOTHING || i > top_of_objt) {
|
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);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(obj, struct obj_data, 1);
|
CREATE(obj, obj_data, 1);
|
||||||
clear_object(obj);
|
clear_object(obj);
|
||||||
*obj = obj_proto[i];
|
*obj = obj_proto[i];
|
||||||
obj->next = object_list;
|
obj->next = object_list;
|
||||||
@@ -2565,7 +2565,7 @@ void zone_update(void)
|
|||||||
reset_zone(update_u->zone_to_reset);
|
reset_zone(update_u->zone_to_reset);
|
||||||
mudlog(CMP, LVL_IMPL+1, FALSE, "Auto zone reset: %s (Zone %d)",
|
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);
|
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)
|
for (pt = descriptor_list; pt; pt = pt->next)
|
||||||
if (IS_PLAYING(pt) && pt->character && PRF_FLAGGED(pt->character, PRF_ZONERESETS))
|
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",
|
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)
|
void reset_zone(zone_rnum zone)
|
||||||
{
|
{
|
||||||
int cmd_no, last_cmd = 0;
|
int cmd_no, last_cmd = 0;
|
||||||
struct char_data *mob = NULL;
|
char_data *mob = NULL;
|
||||||
struct obj_data *obj, *obj_to;
|
obj_data *obj, *obj_to;
|
||||||
room_vnum rvnum;
|
room_vnum rvnum;
|
||||||
room_rnum rrnum;
|
room_rnum rrnum;
|
||||||
struct char_data *tmob=NULL; /* for trigger assignment */
|
char_data *tmob=NULL; /* for trigger assignment */
|
||||||
struct obj_data *tobj=NULL; /* for trigger assignment */
|
obj_data *tobj=NULL; /* for trigger assignment */
|
||||||
|
|
||||||
for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) {
|
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 */
|
/* for use in reset_zone; return TRUE if zone 'nr' is free of PC's */
|
||||||
int is_empty(zone_rnum zone_nr)
|
int is_empty(zone_rnum zone_nr)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
|
|
||||||
for (i = descriptor_list; i; i = i->next) {
|
for (i = descriptor_list; i; i = i->next) {
|
||||||
if (STATE(i) != CON_PLAYING)
|
if (STATE(i) != CON_PLAYING)
|
||||||
@@ -3226,7 +3226,7 @@ static void free_followers(struct follow_type *k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* release memory allocated for a char struct */
|
/* release memory allocated for a char struct */
|
||||||
void free_char(struct char_data *ch)
|
void free_char(char_data *ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct alias_data *a;
|
struct alias_data *a;
|
||||||
@@ -3320,7 +3320,7 @@ void free_char(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* release memory allocated for an obj struct */
|
/* 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) {
|
if (GET_OBJ_RNUM(obj) == NOWHERE) {
|
||||||
free_object_strings(obj);
|
free_object_strings(obj);
|
||||||
@@ -3357,7 +3357,7 @@ static int file_to_string_alloc(const char *name, char **buf)
|
|||||||
{
|
{
|
||||||
int temppage;
|
int temppage;
|
||||||
char temp[MAX_STRING_LENGTH];
|
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)
|
for (in_use = descriptor_list; in_use; in_use = in_use->next)
|
||||||
if (in_use->showstr_vector && *in_use->showstr_vector == *buf)
|
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 */
|
/* 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;
|
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 */
|
/* 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;
|
IN_ROOM(ch) = NOWHERE;
|
||||||
GET_PFILEPOS(ch) = -1;
|
GET_PFILEPOS(ch) = -1;
|
||||||
@@ -3484,9 +3484,9 @@ void clear_char(struct char_data *ch)
|
|||||||
ch->points.max_mana = 100;
|
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;
|
obj->item_number = NOTHING;
|
||||||
IN_ROOM(obj) = NOWHERE;
|
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
|
/* Called during character creation after picking character class (and then
|
||||||
* never again for that character). */
|
* never again for that character). */
|
||||||
void init_char(struct char_data *ch)
|
void init_char(char_data *ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -3597,7 +3597,7 @@ room_rnum real_room(room_vnum vnum)
|
|||||||
bot = 0;
|
bot = 0;
|
||||||
top = top_of_world;
|
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);
|
return (NOWHERE);
|
||||||
|
|
||||||
/* perform binary search on world-table */
|
/* perform binary search on world-table */
|
||||||
@@ -3623,7 +3623,7 @@ mob_rnum real_mobile(mob_vnum vnum)
|
|||||||
top = top_of_mobt;
|
top = top_of_mobt;
|
||||||
|
|
||||||
/* quickly reject out-of-range vnums */
|
/* 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);
|
return (NOBODY);
|
||||||
|
|
||||||
/* perform binary search on mob-table */
|
/* perform binary search on mob-table */
|
||||||
@@ -3649,7 +3649,7 @@ obj_rnum real_object(obj_vnum vnum)
|
|||||||
top = top_of_objt;
|
top = top_of_objt;
|
||||||
|
|
||||||
/* quickly reject out-of-range vnums */
|
/* 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);
|
return (NOTHING);
|
||||||
|
|
||||||
/* perform binary search on obj-table */
|
/* perform binary search on obj-table */
|
||||||
@@ -3674,7 +3674,7 @@ zone_rnum real_zone(zone_vnum vnum)
|
|||||||
bot = 0;
|
bot = 0;
|
||||||
top = top_of_zone_table;
|
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);
|
return (NOWHERE);
|
||||||
|
|
||||||
/* perform binary search on zone-table */
|
/* 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. */
|
/* 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];
|
char objname[MAX_INPUT_LENGTH + 32];
|
||||||
int error = FALSE, y;
|
int error = FALSE, y;
|
||||||
@@ -3770,7 +3770,7 @@ static int check_object(struct obj_data *obj)
|
|||||||
return (error);
|
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;
|
int error = FALSE;
|
||||||
const char *spellname;
|
const char *spellname;
|
||||||
@@ -3804,7 +3804,7 @@ static int check_object_spell_number(struct obj_data *obj, int val)
|
|||||||
return (error);
|
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;
|
int error = FALSE;
|
||||||
|
|
||||||
|
|||||||
@@ -174,8 +174,7 @@ struct reset_com {
|
|||||||
/* zone definition structure. for the 'zone-table' */
|
/* zone definition structure. for the 'zone-table' */
|
||||||
struct zone_data {
|
struct zone_data {
|
||||||
char *name; /* name of this zone */
|
char *name; /* name of this zone */
|
||||||
char *builders; /* namelist of builders allowed to */
|
char *builders; /* namelist of builders allowed to modify this zone. */
|
||||||
/* modify this zone. */
|
|
||||||
int lifespan; /* how long between resets (minutes) */
|
int lifespan; /* how long between resets (minutes) */
|
||||||
int age; /* current age of this zone (minutes) */
|
int age; /* current age of this zone (minutes) */
|
||||||
room_vnum bot; /* starting room number for this zone */
|
room_vnum bot; /* starting room number for this zone */
|
||||||
@@ -229,7 +228,7 @@ struct help_index_element {
|
|||||||
|
|
||||||
/* for the "buffered" rent and house object loading */
|
/* for the "buffered" rent and house object loading */
|
||||||
struct obj_save_data_t {
|
struct obj_save_data_t {
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int locate;
|
int locate;
|
||||||
struct obj_save_data_t *next;
|
struct obj_save_data_t *next;
|
||||||
};
|
};
|
||||||
@@ -256,7 +255,7 @@ void free_text_files(void);
|
|||||||
void free_help_table(void);
|
void free_help_table(void);
|
||||||
void free_player_index(void);
|
void free_player_index(void);
|
||||||
void load_help(FILE *fl, char *name);
|
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);
|
zone_rnum real_zone(zone_vnum vnum);
|
||||||
room_rnum real_room(room_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 */
|
/* Public Procedures from objsave.c */
|
||||||
void Crash_save_all(void);
|
void Crash_save_all(void);
|
||||||
void Crash_idlesave(struct char_data *ch);
|
void Crash_idlesave(char_data *ch);
|
||||||
void Crash_crashsave(struct char_data *ch);
|
void Crash_crashsave(char_data *ch);
|
||||||
int Crash_load(struct char_data *ch);
|
int Crash_load(char_data *ch);
|
||||||
void Crash_listrent(struct char_data *ch, char *name);
|
void Crash_listrent(char_data *ch, char *name);
|
||||||
int Crash_clean_file(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);
|
int Crash_delete_file(char *name);
|
||||||
void update_obj_file(void);
|
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);
|
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 functions */
|
||||||
SPECIAL(receptionist);
|
SPECIAL(receptionist);
|
||||||
SPECIAL(cryogenicist);
|
SPECIAL(cryogenicist);
|
||||||
|
|
||||||
/* Functions from players.c */
|
/* Functions from players.c */
|
||||||
void tag_argument(char *argument, char *tag);
|
void tag_argument(char *argument, char *tag);
|
||||||
int load_char(const char *name, struct char_data *ch);
|
int load_char(const char *name, char_data *ch);
|
||||||
void save_char(struct char_data *ch);
|
void save_char(char_data *ch);
|
||||||
void init_char(struct char_data *ch);
|
void init_char(char_data *ch);
|
||||||
struct char_data* create_char(void);
|
char_data* create_char(void);
|
||||||
struct char_data *read_mobile(mob_vnum nr, int type);
|
char_data *read_mobile(mob_vnum nr, int type);
|
||||||
int vnum_mobile(char *searchname, struct char_data *ch);
|
int vnum_mobile(char *searchname, char_data *ch);
|
||||||
void clear_char(struct char_data *ch);
|
void clear_char(char_data *ch);
|
||||||
void reset_char(struct char_data *ch);
|
void reset_char(char_data *ch);
|
||||||
void free_char(struct char_data *ch);
|
void free_char(char_data *ch);
|
||||||
void save_player_index(void);
|
void save_player_index(void);
|
||||||
long get_ptable_by_name(const char *name);
|
long get_ptable_by_name(const char *name);
|
||||||
void remove_player(int pfilepos);
|
void remove_player(int pfilepos);
|
||||||
void clean_pfiles(void);
|
void clean_pfiles(void);
|
||||||
void build_player_index(void);
|
void build_player_index(void);
|
||||||
|
|
||||||
struct obj_data *create_obj(void);
|
obj_data *create_obj(void);
|
||||||
void clear_object(struct obj_data *obj);
|
void clear_object(obj_data *obj);
|
||||||
void free_obj(struct obj_data *obj);
|
void free_obj(obj_data *obj);
|
||||||
struct obj_data *read_object(obj_vnum nr, int type);
|
obj_data *read_object(obj_vnum nr, int type);
|
||||||
int vnum_object(char *searchname, struct char_data *ch);
|
int vnum_object(char *searchname, char_data *ch);
|
||||||
int vnum_room(char *, struct char_data *);
|
int vnum_room(char *, char_data *);
|
||||||
int vnum_trig(char *, struct char_data *);
|
int vnum_trig(char *, char_data *);
|
||||||
|
|
||||||
void setup_dir(FILE *fl, int room, int dir);
|
void setup_dir(FILE *fl, int room, int dir);
|
||||||
void index_boot(int mode);
|
void index_boot(int mode);
|
||||||
@@ -366,15 +365,15 @@ extern room_rnum top_of_world;
|
|||||||
extern struct zone_data *zone_table;
|
extern struct zone_data *zone_table;
|
||||||
extern zone_rnum top_of_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 index_data *mob_index;
|
||||||
extern struct char_data *mob_proto;
|
extern char_data *mob_proto;
|
||||||
extern mob_rnum top_of_mobt;
|
extern mob_rnum top_of_mobt;
|
||||||
|
|
||||||
extern struct index_data *obj_index;
|
extern struct index_data *obj_index;
|
||||||
extern struct obj_data *object_list;
|
extern obj_data *object_list;
|
||||||
extern struct obj_data *obj_proto;
|
extern obj_data *obj_proto;
|
||||||
extern obj_rnum top_of_objt;
|
extern obj_rnum top_of_objt;
|
||||||
|
|
||||||
extern struct social_messg *soc_mess_list;
|
extern struct social_messg *soc_mess_list;
|
||||||
|
|||||||
+1
-1
@@ -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)
|
void send_to_zone(char *messg, zone_rnum zone)
|
||||||
{
|
{
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
|
|
||||||
if (!messg || !*messg)
|
if (!messg || !*messg)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+3
-3
@@ -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];
|
char junk[8];
|
||||||
int vnum, rnum, count;
|
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)
|
void assign_triggers(void *i, int type)
|
||||||
{
|
{
|
||||||
struct char_data *mob = NULL;
|
char_data *mob = NULL;
|
||||||
struct obj_data *obj = NULL;
|
obj_data *obj = NULL;
|
||||||
struct room_data *room = NULL;
|
struct room_data *room = NULL;
|
||||||
int rnum;
|
int rnum;
|
||||||
struct trig_proto_list *trg_proto;
|
struct trig_proto_list *trg_proto;
|
||||||
|
|||||||
+8
-8
@@ -119,12 +119,12 @@ void extract_script(void *thing, int type)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
mob = (struct char_data *)thing;
|
mob = (char_data *)thing;
|
||||||
sc = SCRIPT(mob);
|
sc = SCRIPT(mob);
|
||||||
SCRIPT(mob) = NULL;
|
SCRIPT(mob) = NULL;
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
obj = (struct obj_data *)thing;
|
obj = (obj_data *)thing;
|
||||||
sc = SCRIPT(obj);
|
sc = SCRIPT(obj);
|
||||||
SCRIPT(obj) = NULL;
|
SCRIPT(obj) = NULL;
|
||||||
break;
|
break;
|
||||||
@@ -137,8 +137,8 @@ void extract_script(void *thing, int type)
|
|||||||
|
|
||||||
#if 1 /* debugging */
|
#if 1 /* debugging */
|
||||||
{
|
{
|
||||||
struct char_data *i = character_list;
|
char_data *i = character_list;
|
||||||
struct obj_data *j = object_list;
|
obj_data *j = object_list;
|
||||||
room_rnum k;
|
room_rnum k;
|
||||||
if (sc) {
|
if (sc) {
|
||||||
for ( ; i ; i = i->next)
|
for ( ; i ; i = i->next)
|
||||||
@@ -185,12 +185,12 @@ void free_proto_script(void *thing, int type)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
mob = (struct char_data *)thing;
|
mob = (char_data *)thing;
|
||||||
proto = mob->proto_script;
|
proto = mob->proto_script;
|
||||||
mob->proto_script = NULL;
|
mob->proto_script = NULL;
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
obj = (struct obj_data *)thing;
|
obj = (obj_data *)thing;
|
||||||
proto = obj->proto_script;
|
proto = obj->proto_script;
|
||||||
obj->proto_script = NULL;
|
obj->proto_script = NULL;
|
||||||
break;
|
break;
|
||||||
@@ -202,8 +202,8 @@ void free_proto_script(void *thing, int type)
|
|||||||
}
|
}
|
||||||
#if 1 /* debugging */
|
#if 1 /* debugging */
|
||||||
{
|
{
|
||||||
struct char_data *i = character_list;
|
char_data *i = character_list;
|
||||||
struct obj_data *j = object_list;
|
obj_data *j = object_list;
|
||||||
room_rnum k;
|
room_rnum k;
|
||||||
if (proto) {
|
if (proto) {
|
||||||
for ( ; i ; i = i->next)
|
for ( ; i ; i = i->next)
|
||||||
|
|||||||
+10
-10
@@ -35,9 +35,9 @@
|
|||||||
* the spell is set to TAR_IGNORE. Also, group spells are not permitted. */
|
* 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)
|
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd)
|
||||||
{
|
{
|
||||||
struct char_data *caster = NULL;
|
char_data *caster = NULL;
|
||||||
struct char_data *tch = NULL;
|
char_data *tch = NULL;
|
||||||
struct obj_data *tobj = NULL;
|
obj_data *tobj = NULL;
|
||||||
struct room_data *caster_room = NULL;
|
struct room_data *caster_room = NULL;
|
||||||
char *s, *t;
|
char *s, *t;
|
||||||
int spellnum, target = 0;
|
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 */
|
/* need to get the caster or the room of the temporary caster */
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
caster = (struct char_data *)go;
|
caster = (char_data *)go;
|
||||||
break;
|
break;
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
caster_room = (struct room_data *)go;
|
caster_room = (struct room_data *)go;
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
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) {
|
if (!caster_room) {
|
||||||
script_log("dg_do_cast: unknown room for object-caster!");
|
script_log("dg_do_cast: unknown room for object-caster!");
|
||||||
return;
|
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.... */
|
/* set the caster's name to that of the object, or the gods.... */
|
||||||
if (type==OBJ_TRIGGER)
|
if (type==OBJ_TRIGGER)
|
||||||
caster->player.short_descr =
|
caster->player.short_descr =
|
||||||
strdup(((struct obj_data *)go)->short_description);
|
strdup(((obj_data *)go)->short_description);
|
||||||
else if (type==WLD_TRIGGER)
|
else if (type==WLD_TRIGGER)
|
||||||
caster->player.short_descr = strdup("The gods");
|
caster->player.short_descr = strdup("The gods");
|
||||||
caster->next_in_room = caster_room->people;
|
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,
|
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int script_type, char *cmd)
|
int script_type, char *cmd)
|
||||||
{
|
{
|
||||||
struct char_data *ch = NULL;
|
char_data *ch = NULL;
|
||||||
int value=0, duration=0;
|
int value=0, duration=0;
|
||||||
char junk[MAX_INPUT_LENGTH]; /* will be set to "dg_affect" */
|
char junk[MAX_INPUT_LENGTH]; /* will be set to "dg_affect" */
|
||||||
char charname[MAX_INPUT_LENGTH], property[MAX_INPUT_LENGTH];
|
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);
|
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)) {
|
switch (GET_POS(ch)) {
|
||||||
case POS_MORTALLYW:
|
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
|
/* 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
|
* - allow_gods is false when called by %force%, for instance, while true for
|
||||||
* %teleport%. - Welcor */
|
* %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))
|
if (IS_NPC(ch))
|
||||||
return TRUE; /* all npcs are allowed as targets */
|
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... */
|
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)) {
|
if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) {
|
||||||
send_to_char(vict, "Being the cool immortal you are, you sidestep a trap, "
|
send_to_char(vict, "Being the cool immortal you are, you sidestep a trap, "
|
||||||
|
|||||||
+10
-10
@@ -320,7 +320,7 @@ ACMD(do_mzoneecho)
|
|||||||
if (!*room_number || !*msg)
|
if (!*room_number || !*msg)
|
||||||
mob_log(ch, "mzoneecho called with too few args");
|
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");
|
mob_log(ch, "mzoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -355,7 +355,7 @@ ACMD(do_mload)
|
|||||||
|
|
||||||
target = two_arguments(argument, arg1, arg2);
|
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");
|
mob_log(ch, "mload: bad syntax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ ACMD(do_mload)
|
|||||||
if (!target || !*target) {
|
if (!target || !*target) {
|
||||||
rnum = IN_ROOM(ch);
|
rnum = IN_ROOM(ch);
|
||||||
} else {
|
} 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 "
|
mob_log(ch, "mload: room target vnum doesn't exist "
|
||||||
"(loading mob vnum %d to room %s)", number, target);
|
"(loading mob vnum %d to room %s)", number, target);
|
||||||
return;
|
return;
|
||||||
@@ -699,7 +699,7 @@ ACMD(do_mforce)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!str_cmp(arg, "all")) {
|
if (!str_cmp(arg, "all")) {
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
char_data *vch;
|
char_data *vch;
|
||||||
|
|
||||||
for (i = descriptor_list; i ; i = i->next) {
|
for (i = descriptor_list; i ; i = i->next) {
|
||||||
@@ -914,10 +914,10 @@ ACMD(do_mtransform)
|
|||||||
mob_log(ch, "mtransform: bad argument");
|
mob_log(ch, "mtransform: bad argument");
|
||||||
else {
|
else {
|
||||||
if (isdigit(*arg))
|
if (isdigit(*arg))
|
||||||
m = read_mobile(atoi(arg), VIRTUAL);
|
m = read_mobile(atoidx(arg), VIRTUAL);
|
||||||
else {
|
else {
|
||||||
keep_hp = 0;
|
keep_hp = 0;
|
||||||
m = read_mobile(atoi(arg+1), VIRTUAL);
|
m = read_mobile(atoidx(arg+1), VIRTUAL);
|
||||||
}
|
}
|
||||||
if (m==NULL) {
|
if (m==NULL) {
|
||||||
mob_log(ch, "mtransform: bad mobile vnum");
|
mob_log(ch, "mtransform: bad mobile vnum");
|
||||||
@@ -1070,7 +1070,7 @@ ACMD(do_mdoor)
|
|||||||
newexit->exit_info = (sh_int)asciiflag_conv(value);
|
newexit->exit_info = (sh_int)asciiflag_conv(value);
|
||||||
break;
|
break;
|
||||||
case 3: /* key */
|
case 3: /* key */
|
||||||
newexit->key = atoi(value);
|
newexit->key = atoidx(value);
|
||||||
break;
|
break;
|
||||||
case 4: /* name */
|
case 4: /* name */
|
||||||
if (newexit->keyword)
|
if (newexit->keyword)
|
||||||
@@ -1079,7 +1079,7 @@ ACMD(do_mdoor)
|
|||||||
strcpy(newexit->keyword, value);
|
strcpy(newexit->keyword, value);
|
||||||
break;
|
break;
|
||||||
case 5: /* room */
|
case 5: /* room */
|
||||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
if ((to_room = real_room(atoidx(value))) != NOWHERE)
|
||||||
newexit->to_room = to_room;
|
newexit->to_room = to_room;
|
||||||
else
|
else
|
||||||
mob_log(ch, "mdoor: invalid door target");
|
mob_log(ch, "mdoor: invalid door target");
|
||||||
@@ -1091,7 +1091,7 @@ ACMD(do_mdoor)
|
|||||||
ACMD(do_mfollow)
|
ACMD(do_mfollow)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct char_data *leader;
|
char_data *leader;
|
||||||
struct follow_type *j, *k;
|
struct follow_type *j, *k;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
@@ -1176,5 +1176,5 @@ ACMD(do_mrecho)
|
|||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
mob_log(ch, "mrecho called with too few args");
|
mob_log(ch, "mrecho called with too few args");
|
||||||
else
|
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
@@ -88,7 +88,7 @@ room_rnum obj_room(obj_data *obj)
|
|||||||
/* returns the real room number, or NOWHERE if not found or invalid */
|
/* returns the real room number, or NOWHERE if not found or invalid */
|
||||||
static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
|
static room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
|
||||||
{
|
{
|
||||||
int tmp;
|
room_vnum tmp;
|
||||||
room_rnum location;
|
room_rnum location;
|
||||||
char_data *target_mob;
|
char_data *target_mob;
|
||||||
obj_data *target_obj;
|
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, '.'))
|
if (isdigit(*roomstr) && !strchr(roomstr, '.'))
|
||||||
{
|
{
|
||||||
tmp = atoi(roomstr);
|
tmp = atoidx(roomstr);
|
||||||
if ((location = real_room(tmp)) == NOWHERE)
|
if ((location = real_room(tmp)) == NOWHERE)
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ static OCMD(do_ozoneecho)
|
|||||||
if (!*room_number || !*msg)
|
if (!*room_number || !*msg)
|
||||||
obj_log(obj, "ozoneecho called with too few args");
|
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");
|
obj_log(obj, "ozoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -275,7 +275,7 @@ static OCMD(do_orecho)
|
|||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
obj_log(obj, "orecho: too few args");
|
obj_log(obj, "orecho: too few args");
|
||||||
else
|
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];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
obj_data *o, tmpobj;
|
obj_data *o, tmpobj;
|
||||||
struct char_data *wearer=NULL;
|
char_data *wearer=NULL;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
@@ -310,7 +310,7 @@ static OCMD(do_otransform)
|
|||||||
else if (!isdigit(*arg))
|
else if (!isdigit(*arg))
|
||||||
obj_log(obj, "otransform: bad argument");
|
obj_log(obj, "otransform: bad argument");
|
||||||
else {
|
else {
|
||||||
o = read_object(atoi(arg), VIRTUAL);
|
o = read_object(atoidx(arg), VIRTUAL);
|
||||||
if (o==NULL) {
|
if (o==NULL) {
|
||||||
obj_log(obj, "otransform: bad object vnum");
|
obj_log(obj, "otransform: bad object vnum");
|
||||||
return;
|
return;
|
||||||
@@ -459,7 +459,7 @@ static OCMD(do_dgoload)
|
|||||||
|
|
||||||
target = two_arguments(argument, arg1, arg2);
|
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");
|
obj_log(obj, "oload: bad syntax");
|
||||||
return;
|
return;
|
||||||
@@ -477,7 +477,7 @@ static OCMD(do_dgoload)
|
|||||||
if (!target || !*target) {
|
if (!target || !*target) {
|
||||||
rnum = room;
|
rnum = room;
|
||||||
} else {
|
} 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 "
|
obj_log(obj, "oload: room target vnum doesn't exist "
|
||||||
"(loading mob vnum %d to room %s)", number, target);
|
"(loading mob vnum %d to room %s)", number, target);
|
||||||
return;
|
return;
|
||||||
@@ -671,7 +671,7 @@ static OCMD(do_odoor)
|
|||||||
newexit->exit_info = (sh_int)asciiflag_conv(value);
|
newexit->exit_info = (sh_int)asciiflag_conv(value);
|
||||||
break;
|
break;
|
||||||
case 3: /* key */
|
case 3: /* key */
|
||||||
newexit->key = atoi(value);
|
newexit->key = atoidx(value);
|
||||||
break;
|
break;
|
||||||
case 4: /* name */
|
case 4: /* name */
|
||||||
if (newexit->keyword)
|
if (newexit->keyword)
|
||||||
@@ -680,7 +680,7 @@ static OCMD(do_odoor)
|
|||||||
strcpy(newexit->keyword, value);
|
strcpy(newexit->keyword, value);
|
||||||
break;
|
break;
|
||||||
case 5: /* room */
|
case 5: /* room */
|
||||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
if ((to_room = real_room(atoidx(value))) != NOWHERE)
|
||||||
newexit->to_room = to_room;
|
newexit->to_room = to_room;
|
||||||
else
|
else
|
||||||
obj_log(obj, "odoor: invalid door target");
|
obj_log(obj, "odoor: invalid door target");
|
||||||
@@ -693,7 +693,7 @@ static OCMD(do_osetval)
|
|||||||
{
|
{
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int position, new_value, worn_on;
|
int position, new_value, worn_on;
|
||||||
struct char_data *worn_by = NULL;
|
char_data *worn_by = NULL;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if (!*arg1 || !*arg2 || !is_number(arg1) || !is_number(arg2)) {
|
if (!*arg1 || !*arg2 || !is_number(arg1) || !is_number(arg2)) {
|
||||||
@@ -725,8 +725,8 @@ static OCMD(do_osetval)
|
|||||||
static OCMD(do_oat)
|
static OCMD(do_oat)
|
||||||
{
|
{
|
||||||
room_rnum loc = NOWHERE;
|
room_rnum loc = NOWHERE;
|
||||||
struct char_data *ch;
|
char_data *ch;
|
||||||
struct obj_data *object;
|
obj_data *object;
|
||||||
char arg[MAX_INPUT_LENGTH], *command;
|
char arg[MAX_INPUT_LENGTH], *command;
|
||||||
|
|
||||||
command = any_one_arg(argument, arg);
|
command = any_one_arg(argument, arg);
|
||||||
@@ -743,7 +743,7 @@ static OCMD(do_oat)
|
|||||||
return;
|
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);
|
else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch);
|
||||||
|
|
||||||
if (loc == NOWHERE) {
|
if (loc == NOWHERE) {
|
||||||
|
|||||||
+20
-20
@@ -24,17 +24,17 @@
|
|||||||
|
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void trigedit_disp_menu(struct descriptor_data *d);
|
static void trigedit_disp_menu(descriptor_data *d);
|
||||||
static void trigedit_disp_types(struct descriptor_data *d);
|
static void trigedit_disp_types(descriptor_data *d);
|
||||||
static void trigedit_create_index(int znum, char *type);
|
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 */
|
/* Trigedit */
|
||||||
ACMD(do_oasis_trigedit)
|
ACMD(do_oasis_trigedit)
|
||||||
{
|
{
|
||||||
int number, real_num;
|
int number, real_num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* No building as a mob or while being forced. */
|
||||||
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
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;
|
struct trig_proto_list *t;
|
||||||
|
|
||||||
if (type==MOB_TRIGGER)
|
if (type==MOB_TRIGGER)
|
||||||
t = ((struct char_data *)item)->proto_script;
|
t = ((char_data *)item)->proto_script;
|
||||||
else if (type==OBJ_TRIGGER)
|
else if (type==OBJ_TRIGGER)
|
||||||
t = ((struct obj_data *)item)->proto_script;
|
t = ((obj_data *)item)->proto_script;
|
||||||
else if (type==WLD_TRIGGER)
|
else if (type==WLD_TRIGGER)
|
||||||
t = ((struct room_data *)item)->proto_script;
|
t = ((struct room_data *)item)->proto_script;
|
||||||
else {
|
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;
|
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.) */
|
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 trig_data *trig;
|
||||||
struct cmdlist_element *c;
|
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.) */
|
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);
|
struct trig_data *trig = OLC_TRIG(d);
|
||||||
char *attach_type;
|
char *attach_type;
|
||||||
@@ -227,7 +227,7 @@ static void trigedit_disp_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
|
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;
|
int i, columns = 0;
|
||||||
const char **types;
|
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);
|
ACMD(do_action);
|
||||||
char buffer[MAX_STRING_LENGTH] = "";
|
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;
|
int i = 0;
|
||||||
|
|
||||||
@@ -602,7 +602,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case TRIGEDIT_COPY:
|
case TRIGEDIT_COPY:
|
||||||
if ((i = real_trigger(atoi(arg))) != NOWHERE) {
|
if ((i = real_trigger(atoidx(arg))) != NOWHERE) {
|
||||||
trigedit_setup_existing(d, i);
|
trigedit_setup_existing(d, i);
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "That trigger does not exist.\r\n");
|
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 */
|
/* 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;
|
int i;
|
||||||
trig_rnum rnum;
|
trig_rnum rnum;
|
||||||
@@ -629,7 +629,7 @@ void trigedit_save(struct descriptor_data *d)
|
|||||||
trig_data *live_trig;
|
trig_data *live_trig;
|
||||||
struct cmdlist_element *cmd, *next_cmd;
|
struct cmdlist_element *cmd, *next_cmd;
|
||||||
struct index_data **new_index;
|
struct index_data **new_index;
|
||||||
struct descriptor_data *dsc;
|
descriptor_data *dsc;
|
||||||
FILE *trig_file;
|
FILE *trig_file;
|
||||||
int zone, top;
|
int zone, top;
|
||||||
char buf[MAX_CMD_LENGTH];
|
char buf[MAX_CMD_LENGTH];
|
||||||
@@ -911,7 +911,7 @@ static void trigedit_create_index(int znum, char *type)
|
|||||||
rename(new_name, old_name);
|
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;
|
struct trig_proto_list *origscript, *editscript;
|
||||||
|
|
||||||
@@ -936,7 +936,7 @@ void dg_olc_script_copy(struct descriptor_data *d)
|
|||||||
OLC_SCRIPT(d) = NULL;
|
OLC_SCRIPT(d) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dg_script_menu(struct descriptor_data *d)
|
void dg_script_menu(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct trig_proto_list *editscript;
|
struct trig_proto_list *editscript;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -972,7 +972,7 @@ void dg_script_menu(struct descriptor_data *d)
|
|||||||
grn, nrm, grn, nrm, grn, nrm);
|
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;
|
struct trig_proto_list *trig, *currtrig;
|
||||||
int count, pos, vnum;
|
int count, pos, vnum;
|
||||||
@@ -1077,7 +1077,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
|
|||||||
return 1;
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case TRIGEDIT_COMMANDS:
|
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 nsc[MAX_CMD_LENGTH], *t, line[READ_SIZE];
|
||||||
char *sc;
|
char *sc;
|
||||||
|
|||||||
+3
-3
@@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
/* prototype exported functions from dg_olc.c */
|
/* prototype exported functions from dg_olc.c */
|
||||||
void script_save_to_disk(FILE *fp, void *item, int type);
|
void script_save_to_disk(FILE *fp, void *item, int type);
|
||||||
void dg_olc_script_copy(struct descriptor_data *d);
|
void dg_olc_script_copy(descriptor_data *d);
|
||||||
void dg_script_menu(struct descriptor_data *d);
|
void dg_script_menu(descriptor_data *d);
|
||||||
int dg_script_edit_parse(struct descriptor_data *d, char *arg);
|
int dg_script_edit_parse(descriptor_data *d, char *arg);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _DG_OLC_H_ */
|
#endif /* _DG_OLC_H_ */
|
||||||
|
|||||||
+52
-46
@@ -35,7 +35,7 @@
|
|||||||
/* Local functions not used elsewhere */
|
/* Local functions not used elsewhere */
|
||||||
static obj_data *find_obj(long n);
|
static obj_data *find_obj(long n);
|
||||||
static room_data *find_room(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 void script_stat(char_data *ch, struct script_data *sc);
|
||||||
static int remove_trigger(struct script_data *sc, char *name);
|
static int remove_trigger(struct script_data *sc, char *name);
|
||||||
static int is_num(char *arg);
|
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,
|
static struct cmdlist_element * find_case(struct trig_data *trig, struct cmdlist_element *cl,
|
||||||
void *go, struct script_data *sc, int type, char *cond);
|
void *go, struct script_data *sc, int type, char *cond);
|
||||||
static struct cmdlist_element *find_done(struct cmdlist_element *cl);
|
static struct cmdlist_element *find_done(struct cmdlist_element *cl);
|
||||||
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);
|
||||||
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);
|
||||||
static EVENTFUNC(trig_wait_event);
|
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)
|
if (id == obj->script_id)
|
||||||
return (obj);
|
return (obj);
|
||||||
} else if (is_number(name)) {
|
} else if (is_number(name)) {
|
||||||
obj_vnum ovnum = atoi(name);
|
obj_vnum ovnum = atoidx(name);
|
||||||
for (j = 0; j < NUM_WEARS; j++)
|
for (j = 0; j < NUM_WEARS; j++)
|
||||||
if ((obj = GET_EQ(ch, j)))
|
if ((obj = GET_EQ(ch, j)))
|
||||||
if (GET_OBJ_VNUM(obj) == ovnum)
|
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.
|
* @param pos The defined wear location to check.
|
||||||
* @retval int TRUE if obj can be worn on pos, FALSE if not.
|
* @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) {
|
switch (pos) {
|
||||||
case WEAR_HOLD:
|
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
|
* @retval char_data * Pointer to the character structure if it exists, or NULL
|
||||||
* if it cannot be found.
|
* 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 */
|
if (n>=ROOM_ID_BASE) /* See note in dg_scripts.h */
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -486,7 +486,7 @@ room_data *get_room(char *name)
|
|||||||
|
|
||||||
if (*name == UID_CHAR)
|
if (*name == UID_CHAR)
|
||||||
return find_room(atoi(name + 1));
|
return find_room(atoi(name + 1));
|
||||||
else if ((nr = real_room(atoi(name))) == NOWHERE)
|
else if ((nr = real_room(atoidx(name))) == NOWHERE)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return &world[nr];
|
return &world[nr];
|
||||||
@@ -722,14 +722,14 @@ static EVENTFUNC(trig_wait_event)
|
|||||||
{
|
{
|
||||||
int found = FALSE;
|
int found = FALSE;
|
||||||
if (type == MOB_TRIGGER) {
|
if (type == MOB_TRIGGER) {
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
for (tch = character_list;tch && !found;tch = tch->next)
|
for (tch = character_list;tch && !found;tch = tch->next)
|
||||||
if (tch == (struct char_data *)go)
|
if (tch == (char_data *)go)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
} else if (type == OBJ_TRIGGER) {
|
} else if (type == OBJ_TRIGGER) {
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
for (obj = object_list;obj && !found;obj = obj->next)
|
for (obj = object_list;obj && !found;obj = obj->next)
|
||||||
if (obj == (struct obj_data *)go)
|
if (obj == (obj_data *)go)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
room_rnum i;
|
room_rnum i;
|
||||||
@@ -753,7 +753,7 @@ static EVENTFUNC(trig_wait_event)
|
|||||||
return 0;
|
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;
|
struct cmdlist_element *cmd_list;
|
||||||
char sb[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
|
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");
|
send_to_char(ch, "Triggers:\r\n");
|
||||||
if (!SCRIPT(rm)) {
|
if (!SCRIPT(rm)) {
|
||||||
@@ -944,8 +944,11 @@ ACMD(do_attach)
|
|||||||
trig_data *trig;
|
trig_data *trig;
|
||||||
char targ_name[MAX_INPUT_LENGTH], trig_name[MAX_INPUT_LENGTH];
|
char targ_name[MAX_INPUT_LENGTH], trig_name[MAX_INPUT_LENGTH];
|
||||||
char loc_name[MAX_INPUT_LENGTH], arg[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;
|
room_rnum rnum;
|
||||||
|
IDXTYPE num_arg;
|
||||||
|
trig_vnum tn;
|
||||||
|
|
||||||
argument = two_arguments(argument, arg, trig_name);
|
argument = two_arguments(argument, arg, trig_name);
|
||||||
two_arguments(argument, targ_name, loc_name);
|
two_arguments(argument, targ_name, loc_name);
|
||||||
@@ -955,8 +958,8 @@ ACMD(do_attach)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_arg = atoi(targ_name);
|
num_arg = atoidx(targ_name);
|
||||||
tn = atoi(trig_name);
|
tn = atoidx(trig_name);
|
||||||
loc = (*loc_name) ? atoi(loc_name) : -1;
|
loc = (*loc_name) ? atoi(loc_name) : -1;
|
||||||
|
|
||||||
if (is_abbrev(arg, "mobile") || is_abbrev(arg, "mtr")) {
|
if (is_abbrev(arg, "mobile") || is_abbrev(arg, "mtr")) {
|
||||||
@@ -1147,13 +1150,15 @@ ACMD(do_detach)
|
|||||||
struct room_data *room;
|
struct room_data *room;
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], arg3[MAX_INPUT_LENGTH], *snum;
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], arg3[MAX_INPUT_LENGTH], *snum;
|
||||||
char *trigger = 0;
|
char *trigger = 0;
|
||||||
int num_arg, tn, rn;
|
IDXTYPE num_arg;
|
||||||
|
trig_vnum tn;
|
||||||
|
trig_rnum rn;
|
||||||
room_rnum rnum;
|
room_rnum rnum;
|
||||||
trig_data *trig;
|
trig_data *trig;
|
||||||
|
|
||||||
argument = two_arguments(argument, arg1, arg2);
|
argument = two_arguments(argument, arg1, arg2);
|
||||||
one_argument(argument, arg3);
|
one_argument(argument, arg3);
|
||||||
tn = atoi(arg3);
|
tn = atoidx(arg3);
|
||||||
rn = real_trigger(tn);
|
rn = real_trigger(tn);
|
||||||
trig = read_trigger(rn);
|
trig = read_trigger(rn);
|
||||||
|
|
||||||
@@ -1164,7 +1169,7 @@ ACMD(do_detach)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* vnum of mob/obj, if given */
|
/* vnum of mob/obj, if given */
|
||||||
num_arg = atoi(arg2);
|
num_arg = atoidx(arg2);
|
||||||
|
|
||||||
if (!str_cmp(arg1, "room") || !str_cmp(arg1, "wtr")) {
|
if (!str_cmp(arg1, "room") || !str_cmp(arg1, "wtr")) {
|
||||||
if (!*arg3 || (strchr(arg2, '.')))
|
if (!*arg3 || (strchr(arg2, '.')))
|
||||||
@@ -1321,7 +1326,7 @@ ACMD(do_detach)
|
|||||||
void script_vlog(const char *format, va_list args)
|
void script_vlog(const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char output[MAX_STRING_LENGTH];
|
char output[MAX_STRING_LENGTH];
|
||||||
struct descriptor_data *i;
|
descriptor_data *i;
|
||||||
|
|
||||||
/* parse the args, making the error message */
|
/* parse the args, making the error message */
|
||||||
vsnprintf(output, sizeof(output) - 2, format, args);
|
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;
|
char_data *c=NULL;
|
||||||
obj_data *o=NULL;
|
obj_data *o=NULL;
|
||||||
room_data *r=NULL;
|
room_data *r=NULL;
|
||||||
long trignum, id;
|
long id;
|
||||||
|
trig_rnum trignum;
|
||||||
|
|
||||||
id_p = two_arguments(cmd, arg, trignum_s);
|
id_p = two_arguments(cmd, arg, trignum_s);
|
||||||
skip_spaces(&id_p);
|
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 */
|
/* 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))) {
|
if (trignum == NOTHING || !(newtrig=read_trigger(trignum))) {
|
||||||
script_log("Trigger: %s, VNum %d. attach invalid trigger: '%s'",
|
script_log("Trigger: %s, VNum %d. attach invalid trigger: '%s'",
|
||||||
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), trignum_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 (IN_ROOM(obj) != NOWHERE) return &world[IN_ROOM(obj)];
|
||||||
if (obj->carried_by) return &world[IN_ROOM(obj->carried_by)];
|
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")) {
|
if (is_abbrev(arg, "mob")) {
|
||||||
struct char_data *c = NULL;
|
char_data *c = NULL;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
c = get_char_in_room((struct room_data *)go, name);
|
c = get_char_in_room((struct room_data *)go, name);
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
c = get_char_near_obj((struct obj_data *)go, name);
|
c = get_char_near_obj((obj_data *)go, name);
|
||||||
break;
|
break;
|
||||||
case MOB_TRIGGER:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if (c)
|
if (c)
|
||||||
snprintf(uid, sizeof(uid), "%c%ld", UID_CHAR, char_script_id(c));
|
snprintf(uid, sizeof(uid), "%c%ld", UID_CHAR, char_script_id(c));
|
||||||
} else if (is_abbrev(arg, "obj")) {
|
} else if (is_abbrev(arg, "obj")) {
|
||||||
struct obj_data *o = NULL;
|
obj_data *o = NULL;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
o = get_obj_in_room((struct room_data *)go, name);
|
o = get_obj_in_room((struct room_data *)go, name);
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
o = get_obj_near_obj((struct obj_data *)go, name);
|
o = get_obj_near_obj((obj_data *)go, name);
|
||||||
break;
|
break;
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
if ((o = get_obj_in_list_vis((struct char_data *)go, name, NULL,
|
if ((o = get_obj_in_list_vis((char_data *)go, name, NULL,
|
||||||
((struct char_data *)go)->carrying)) == NULL)
|
((char_data *)go)->carrying)) == NULL)
|
||||||
o = get_obj_in_list_vis((struct char_data *)go, name, NULL,
|
o = get_obj_in_list_vis((char_data *)go, name, NULL,
|
||||||
world[IN_ROOM((struct char_data *)go)].contents);
|
world[IN_ROOM((char_data *)go)].contents);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (o)
|
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);
|
r = real_room(((struct room_data *) go)->number);
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
r = obj_room((struct obj_data *)go);
|
r = obj_room((obj_data *)go);
|
||||||
break;
|
break;
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
r = IN_ROOM((struct char_data *)go);
|
r = IN_ROOM((char_data *)go);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r != NOWHERE)
|
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
|
/* Called from do_set - return 0 for failure, 1 for success. ch and vict are
|
||||||
* verified. */
|
* 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;
|
char var_name[MAX_INPUT_LENGTH], *var_value;
|
||||||
|
|
||||||
@@ -2725,7 +2731,7 @@ trig_rnum real_trigger(trig_vnum vnum)
|
|||||||
bot = 0;
|
bot = 0;
|
||||||
top = top_of_trigt - 1;
|
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);
|
return (NOTHING);
|
||||||
|
|
||||||
/* perform binary search on trigger-table */
|
/* perform binary search on trigger-table */
|
||||||
@@ -2749,7 +2755,7 @@ ACMD(do_tstat)
|
|||||||
|
|
||||||
half_chop(argument, str, argument);
|
half_chop(argument, str, argument);
|
||||||
if (*str) {
|
if (*str) {
|
||||||
rnum = real_trigger(atoi(str));
|
rnum = real_trigger(atoidx(str));
|
||||||
if (rnum == NOTHING) {
|
if (rnum == NOTHING) {
|
||||||
send_to_char(ch, "That vnum does not exist.\r\n");
|
send_to_char(ch, "That vnum does not exist.\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -2821,7 +2827,7 @@ static struct cmdlist_element *find_done(struct cmdlist_element *cl)
|
|||||||
|
|
||||||
|
|
||||||
/* load in a character's saved variables */
|
/* load in a character's saved variables */
|
||||||
void read_saved_vars(struct char_data *ch)
|
void read_saved_vars(char_data *ch)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
long context;
|
long context;
|
||||||
@@ -2868,7 +2874,7 @@ void read_saved_vars(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* save a characters variables out to disk */
|
/* save a characters variables out to disk */
|
||||||
void save_char_vars(struct char_data *ch)
|
void save_char_vars(char_data *ch)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char fn[127];
|
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*/
|
/* 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;
|
long context;
|
||||||
char input_line[1024], *temp, *p;
|
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 */
|
/* 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;
|
struct trig_var_data *vars;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -3008,23 +3014,23 @@ static inline struct lookup_table_t *find_element_by_uid_in_lookup_table(long ui
|
|||||||
return lt;
|
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);
|
struct lookup_table_t *lt = find_element_by_uid_in_lookup_table(uid);
|
||||||
|
|
||||||
if (lt)
|
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);
|
log("find_char_by_uid_in_lookup_table : No entity with number %ld in lookup table", uid);
|
||||||
return NULL;
|
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);
|
struct lookup_table_t *lt = find_element_by_uid_in_lookup_table(uid);
|
||||||
|
|
||||||
if (lt)
|
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);
|
log("find_obj_by_uid_in_lookup_table : No entity with number %ld in lookup table", uid);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3096,7 +3102,7 @@ bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *
|
|||||||
return FALSE;
|
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;
|
trig_data *t;
|
||||||
|
|
||||||
|
|||||||
+35
-54
@@ -16,6 +16,7 @@
|
|||||||
#define _DG_SCRIPTS_H_
|
#define _DG_SCRIPTS_H_
|
||||||
|
|
||||||
#include "utils.h" /* To make sure ACMD is defined */
|
#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 MOB_TRIGGER 0
|
||||||
#define OBJ_TRIGGER 1
|
#define OBJ_TRIGGER 1
|
||||||
@@ -126,8 +127,7 @@
|
|||||||
* same time. */
|
* same time. */
|
||||||
#define PULSE_DG_SCRIPT (13 RL_SEC)
|
#define PULSE_DG_SCRIPT (13 RL_SEC)
|
||||||
|
|
||||||
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
|
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can recurse into each other */
|
||||||
recurse into each other */
|
|
||||||
|
|
||||||
#define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */
|
#define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */
|
||||||
|
|
||||||
@@ -193,21 +193,13 @@ struct script_memory {
|
|||||||
struct script_memory *next;
|
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 */
|
/* function prototypes from dg_triggers.c */
|
||||||
char *one_phrase(char *arg, char *first_arg);
|
char *one_phrase(char *arg, char *first_arg);
|
||||||
int is_substring(char *sub, char *string);
|
int is_substring(char *sub, char *string);
|
||||||
int word_check(char *str, char *wordlist);
|
int word_check(char *str, char *wordlist);
|
||||||
|
|
||||||
void act_mtrigger(const char_data *ch, char *str,
|
void act_mtrigger(const char_data *ch, char *str, char_data *actor, char_data *victim, obj_data *object,
|
||||||
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
|
obj_data *target, char *arg);
|
||||||
void speech_mtrigger(char_data *actor, char *str);
|
void speech_mtrigger(char_data *actor, char *str);
|
||||||
void speech_wtrigger(char_data *actor, char *str);
|
void speech_wtrigger(char_data *actor, char *str);
|
||||||
void greet_memory_mtrigger(char_data *ch);
|
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);
|
void timer_otrigger(obj_data *obj);
|
||||||
int get_otrigger(obj_data *obj, char_data *actor);
|
int get_otrigger(obj_data *obj, char_data *actor);
|
||||||
int drop_wtrigger(obj_data *obj, char_data *actor);
|
int drop_wtrigger(obj_data *obj, char_data *actor);
|
||||||
int give_otrigger(obj_data *obj, char_data *actor,
|
int give_otrigger(obj_data *obj, char_data *actor, char_data *victim);
|
||||||
char_data *victim);
|
int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj);
|
||||||
int receive_mtrigger(char_data *ch, char_data *actor,
|
void bribe_mtrigger(char_data *ch, char_data *actor, int amount);
|
||||||
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 wear_otrigger(obj_data *obj, char_data *actor, int where);
|
||||||
int remove_otrigger(obj_data *obj, char_data *actor);
|
int remove_otrigger(obj_data *obj, char_data *actor);
|
||||||
|
|
||||||
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
|
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, char *argument, int type);
|
||||||
char *argument, int type);
|
|
||||||
int command_mtrigger(char_data *actor, char *cmd, char *argument);
|
int command_mtrigger(char_data *actor, char *cmd, char *argument);
|
||||||
int command_otrigger(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);
|
int command_wtrigger(char_data *actor, char *cmd, char *argument);
|
||||||
@@ -273,8 +261,8 @@ ACMD(do_vdelete);
|
|||||||
ACMD(do_tstat);
|
ACMD(do_tstat);
|
||||||
char *str_str(char *cs, char *ct);
|
char *str_str(char *cs, char *ct);
|
||||||
int find_eq_pos_script(char *arg);
|
int find_eq_pos_script(char *arg);
|
||||||
int can_wear_on_pos(struct obj_data *obj, int pos);
|
int can_wear_on_pos(obj_data *obj, int pos);
|
||||||
struct char_data *find_char(long n);
|
char_data *find_char(long n);
|
||||||
char_data *get_char(char *name);
|
char_data *get_char(char *name);
|
||||||
char_data *get_char_near_obj(obj_data *obj, char *name);
|
char_data *get_char_near_obj(obj_data *obj, char *name);
|
||||||
char_data *get_char_in_room(room_data *room, 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 script_trigger_check(void);
|
||||||
void check_time_triggers(void);
|
void check_time_triggers(void);
|
||||||
void find_uid_name(char *uid, char *name, size_t nlen);
|
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_object(char_data *ch, obj_data *j);
|
||||||
void do_sstat_character(char_data *ch, char_data *k);
|
void do_sstat_character(char_data *ch, char_data *k);
|
||||||
void add_trigger(struct script_data *sc, trig_data *t, int loc);
|
void add_trigger(struct script_data *sc, trig_data *t, int loc);
|
||||||
void script_vlog(const char *format, va_list args);
|
void script_vlog(const char *format, va_list args);
|
||||||
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
char *matching_quote(char *p);
|
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[]);
|
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 read_saved_vars_ascii(FILE *file, char_data *ch, int count);
|
||||||
void save_char_vars_ascii(FILE *file, struct char_data *ch);
|
void save_char_vars_ascii(FILE *file, char_data *ch);
|
||||||
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);
|
||||||
int trig_is_attached(struct script_data *sc, int trig_num);
|
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 */
|
/* 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. */
|
/* 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);
|
int script_driver(void *go_adress, trig_data *trig, int type, int mode);
|
||||||
trig_rnum real_trigger(trig_vnum vnum);
|
trig_rnum real_trigger(trig_vnum vnum);
|
||||||
void process_eval(void *go, struct script_data *sc, trig_data *trig,
|
void process_eval(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
|
||||||
int type, char *cmd);
|
void read_saved_vars(char_data *ch);
|
||||||
void read_saved_vars(struct char_data *ch);
|
void save_char_vars(char_data *ch);
|
||||||
void save_char_vars(struct char_data *ch);
|
|
||||||
void init_lookup_table(void);
|
void init_lookup_table(void);
|
||||||
void add_to_lookup_table(long uid, void *c);
|
void add_to_lookup_table(long uid, void *c);
|
||||||
void remove_from_lookup_table(long uid);
|
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);
|
trig_data *read_trigger(int nr);
|
||||||
void trig_data_copy(trig_data *this_data, const trig_data *trg);
|
void trig_data_copy(trig_data *this_data, const trig_data *trg);
|
||||||
void dg_read_trigger(FILE *fp, void *proto, int type);
|
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);
|
void assign_triggers(void *i, int type);
|
||||||
|
|
||||||
/* From dg_variables.c */
|
/* From dg_variables.c */
|
||||||
void add_var(struct trig_var_data **var_list, const char *name, const char *value, long id);
|
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);
|
int item_in_list(char *item, obj_data *list);
|
||||||
char *skill_percent(struct char_data *ch, char *skill);
|
char *skill_percent(char_data *ch, char *skill);
|
||||||
int char_has_item(char *item, struct char_data *ch);
|
int char_has_item(char *item, char_data *ch);
|
||||||
void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
void var_subst(void *go, struct script_data *sc, trig_data *trig, int type, char *line, char *buf);
|
||||||
int type, char *line, char *buf);
|
int text_processed(char *field, char *subfield, struct trig_var_data *vd, char *str, size_t slen);
|
||||||
int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
void find_replacement(void *go, struct script_data *sc, trig_data *trig, int type, char *var, char *field,
|
||||||
char *str, size_t slen);
|
char *subfield, 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 */
|
/* From dg_handler.c */
|
||||||
void free_var_el(struct trig_var_data *var);
|
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);
|
void send_to_zone(char *messg, zone_rnum zone);
|
||||||
|
|
||||||
/* from dg_misc.c */
|
/* from dg_misc.c */
|
||||||
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
|
||||||
int type, char *cmd);
|
void do_dg_affect(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,
|
void send_char_pos(char_data *ch, int dam);
|
||||||
int type, char *cmd);
|
|
||||||
void send_char_pos(struct char_data *ch, int dam);
|
|
||||||
int valid_dg_target(char_data *ch, int bitvector);
|
int valid_dg_target(char_data *ch, int bitvector);
|
||||||
void script_damage(char_data *vict, int dam);
|
void script_damage(char_data *vict, int dam);
|
||||||
|
|
||||||
@@ -390,10 +373,10 @@ ACMD(do_mzoneecho);
|
|||||||
ACMD(do_mlog);
|
ACMD(do_mlog);
|
||||||
|
|
||||||
/* from dg_olc.c... thinking these should be moved to oasis.h */
|
/* from dg_olc.c... thinking these should be moved to oasis.h */
|
||||||
void trigedit_save(struct descriptor_data *d);
|
void trigedit_save(descriptor_data *d);
|
||||||
void trigedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void trigedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
int format_script(struct descriptor_data *d);
|
int format_script(descriptor_data *d);
|
||||||
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
|
void trigedit_setup_existing(descriptor_data *d, int rtrg_num);
|
||||||
|
|
||||||
/* from dg_objcmd.c */
|
/* from dg_objcmd.c */
|
||||||
room_rnum obj_room(obj_data *obj);
|
room_rnum obj_room(obj_data *obj);
|
||||||
@@ -435,10 +418,8 @@ void wld_command_interpreter(room_data *room, char *argument);
|
|||||||
|
|
||||||
#define GET_SHORT(ch) ((ch)->player.short_descr)
|
#define GET_SHORT(ch) ((ch)->player.short_descr)
|
||||||
|
|
||||||
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \
|
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
|
||||||
IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
|
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && !GET_TRIG_DEPTH(t))
|
||||||
#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
|
/* This formerly used 'go' instead of 'id' and referenced 'go->id' but this is
|
||||||
|
|||||||
+3
-3
@@ -412,7 +412,7 @@ void act_mtrigger(const char_data *ch, char *str, char_data *actor,
|
|||||||
|
|
||||||
void fight_mtrigger(char_data *ch)
|
void fight_mtrigger(char_data *ch)
|
||||||
{
|
{
|
||||||
struct char_data *actor;
|
char_data *actor;
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ void fight_mtrigger(char_data *ch)
|
|||||||
|
|
||||||
void hitprcnt_mtrigger(char_data *ch)
|
void hitprcnt_mtrigger(char_data *ch)
|
||||||
{
|
{
|
||||||
struct char_data *actor;
|
char_data *actor;
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
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;
|
trig_data *t;
|
||||||
|
|
||||||
|
|||||||
+21
-20
@@ -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 */
|
/* 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];
|
static char retval[16];
|
||||||
int skillnum;
|
int skillnum;
|
||||||
@@ -98,7 +98,7 @@ int item_in_list(char *item, obj_data *list)
|
|||||||
count += item_in_list(item, i->contains);
|
count += item_in_list(item, i->contains);
|
||||||
}
|
}
|
||||||
} else if (is_number(item)) { /* check for vnum */
|
} 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) {
|
for (i = list; i; i = i->next_content) {
|
||||||
if (GET_OBJ_VNUM(i) == ovnum)
|
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,
|
/* 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
|
* searched for by name or id. Searching equipment as well as inventory, and
|
||||||
* containers. Jamie Nelson */
|
* 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 */
|
/* If this works, no more searching needed */
|
||||||
@@ -133,7 +133,7 @@ int char_has_item(char *item, struct char_data *ch)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_oset(struct obj_data * obj, char * argument)
|
static int handle_oset(obj_data * obj, char * argument)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
@@ -141,7 +141,7 @@ static int handle_oset(struct obj_data * obj, char * argument)
|
|||||||
|
|
||||||
struct oset_handler {
|
struct oset_handler {
|
||||||
const char * type;
|
const char * type;
|
||||||
bool (* name)(struct obj_data *, char *);
|
bool (* name)(obj_data *, char *);
|
||||||
} handler[] = {
|
} handler[] = {
|
||||||
{ "alias", oset_alias },
|
{ "alias", oset_alias },
|
||||||
{ "apply", oset_apply },
|
{ "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;
|
struct room_data *room, *r = NULL;
|
||||||
char *name;
|
char *name;
|
||||||
int num, count, i, j, doors;
|
int num, count, i, j, doors;
|
||||||
|
IDXTYPE idx;
|
||||||
|
|
||||||
char *log_cmd[] = {"mlog ", "olog ", "wlog " };
|
char *log_cmd[] = {"mlog ", "olog ", "wlog " };
|
||||||
char *send_cmd[] = {"msend ", "osend ", "wsend " };
|
char *send_cmd[] = {"msend ", "osend ", "wsend " };
|
||||||
@@ -429,7 +430,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!str_cmp(var, "people")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
else if (!str_cmp(var, "happyhour")) {
|
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");
|
script_log("findmob.vnum(mvnum) - illegal syntax");
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
} else {
|
} else {
|
||||||
room_rnum rrnum = real_room(atoi(field));
|
room_rnum rrnum = real_room(atoidx(field));
|
||||||
mob_vnum mvnum = atoi(subfield);
|
mob_vnum mvnum = atoidx(subfield);
|
||||||
|
|
||||||
if (rrnum == NOWHERE) {
|
if (rrnum == NOWHERE) {
|
||||||
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
|
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");
|
script_log("findobj.vnum(ovnum) - illegal syntax");
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
} else {
|
} else {
|
||||||
room_rnum rrnum = real_room(atoi(field));
|
room_rnum rrnum = real_room(atoidx(field));
|
||||||
|
|
||||||
if (rrnum == NOWHERE) {
|
if (rrnum == NOWHERE) {
|
||||||
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
|
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);
|
in_room = real_room(((struct room_data *) go)->number);
|
||||||
break;
|
break;
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
in_room = obj_room((struct obj_data *) go);
|
in_room = obj_room((obj_data *) go);
|
||||||
break;
|
break;
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
in_room = IN_ROOM((struct char_data *)go);
|
in_room = IN_ROOM((char_data *)go);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (in_room == NOWHERE) {
|
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"))
|
else if (!str_cmp(field, "questdone"))
|
||||||
{
|
{
|
||||||
if (!IS_NPC(c) && subfield && *subfield) {
|
if (!IS_NPC(c) && subfield && *subfield) {
|
||||||
int q_num = atoi(subfield);
|
qst_vnum q_num = atoidx(subfield);
|
||||||
if (is_complete(c, q_num))
|
if (is_complete(c, q_num))
|
||||||
strcpy(str, "1");
|
strcpy(str, "1");
|
||||||
else
|
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
|
* something like if %actor.vnum(500)%. It should return false for PC's instead
|
||||||
* -- Fizban 02/18
|
* -- 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 {
|
} else {
|
||||||
if (IS_NPC(c))
|
if (IS_NPC(c))
|
||||||
snprintf(str, slen, "%d", GET_MOB_VNUM(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))
|
if (!(subfield && *subfield))
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
else {
|
else {
|
||||||
i = atoi(subfield);
|
idx = atoidx(subfield);
|
||||||
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(o), i));
|
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(o), idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1311,7 +1312,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||||||
case 'v':
|
case 'v':
|
||||||
if (!str_cmp(field, "vnum"))
|
if (!str_cmp(field, "vnum"))
|
||||||
if (subfield && *subfield) {
|
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 {
|
} else {
|
||||||
snprintf(str, slen, "%d", GET_OBJ_VNUM(o));
|
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")) {
|
else if (!str_cmp(field, "vnum")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
|
snprintf(str, slen, "%d", r->number == atoidx(subfield));
|
||||||
} else {
|
} else {
|
||||||
snprintf(str, slen,"%d",r->number);
|
snprintf(str, slen,"%d",r->number);
|
||||||
}
|
}
|
||||||
} else if (!str_cmp(field, "contents")) {
|
} else if (!str_cmp(field, "contents")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
for (obj = r->contents; obj; obj = obj->next_content) {
|
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 */
|
/* arg given, found */
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, obj_script_id(obj));
|
snprintf(str, slen, "%c%ld", UID_CHAR, obj_script_id(obj));
|
||||||
return;
|
return;
|
||||||
@@ -1457,8 +1458,8 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||||||
if (!(subfield && *subfield))
|
if (!(subfield && *subfield))
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
else {
|
else {
|
||||||
i = atoi(subfield);
|
idx = atoidx(subfield);
|
||||||
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(r), i));
|
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(r), idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!str_cmp(field, "zonenumber"))
|
else if (!str_cmp(field, "zonenumber"))
|
||||||
|
|||||||
+15
-13
@@ -169,7 +169,7 @@ WCMD(do_wzoneecho)
|
|||||||
if (!*room_num || !*msg)
|
if (!*room_num || !*msg)
|
||||||
wld_log(room, "wzoneecho called with too few args");
|
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");
|
wld_log(room, "wzoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -191,7 +191,7 @@ WCMD(do_wrecho)
|
|||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
wld_log(room, "wrecho: too few args");
|
wld_log(room, "wrecho: too few args");
|
||||||
else
|
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);
|
newexit->exit_info = (sh_int)asciiflag_conv(value);
|
||||||
break;
|
break;
|
||||||
case 3: /* key */
|
case 3: /* key */
|
||||||
newexit->key = atoi(value);
|
newexit->key = atoidx(value);
|
||||||
break;
|
break;
|
||||||
case 4: /* name */
|
case 4: /* name */
|
||||||
if (newexit->keyword)
|
if (newexit->keyword)
|
||||||
@@ -279,7 +279,7 @@ WCMD(do_wdoor)
|
|||||||
strcpy(newexit->keyword, value);
|
strcpy(newexit->keyword, value);
|
||||||
break;
|
break;
|
||||||
case 5: /* room */
|
case 5: /* room */
|
||||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
if ((to_room = real_room(atoidx(value))) != NOWHERE)
|
||||||
newexit->to_room = to_room;
|
newexit->to_room = to_room;
|
||||||
else
|
else
|
||||||
wld_log(room, "wdoor: invalid door target");
|
wld_log(room, "wdoor: invalid door target");
|
||||||
@@ -291,7 +291,8 @@ WCMD(do_wdoor)
|
|||||||
WCMD(do_wteleport)
|
WCMD(do_wteleport)
|
||||||
{
|
{
|
||||||
char_data *ch, *next_ch;
|
char_data *ch, *next_ch;
|
||||||
room_rnum target, nr;
|
room_rnum target;
|
||||||
|
room_vnum nr;
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
@@ -301,7 +302,7 @@ WCMD(do_wteleport)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr = atoi(arg2);
|
nr = atoidx(arg2);
|
||||||
target = real_room(nr);
|
target = real_room(nr);
|
||||||
|
|
||||||
if (target == NOWHERE)
|
if (target == NOWHERE)
|
||||||
@@ -435,7 +436,7 @@ WCMD(do_wpurge)
|
|||||||
WCMD(do_wload)
|
WCMD(do_wload)
|
||||||
{
|
{
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int number = 0;
|
IDXTYPE number = NOTHING;
|
||||||
char_data *mob;
|
char_data *mob;
|
||||||
obj_data *object;
|
obj_data *object;
|
||||||
char *target;
|
char *target;
|
||||||
@@ -445,7 +446,7 @@ WCMD(do_wload)
|
|||||||
|
|
||||||
target = two_arguments(argument, arg1, arg2);
|
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");
|
wld_log(room, "wload: bad syntax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -456,7 +457,7 @@ WCMD(do_wload)
|
|||||||
if (!target || !*target) {
|
if (!target || !*target) {
|
||||||
rnum = real_room(room->number);
|
rnum = real_room(room->number);
|
||||||
} else {
|
} 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);
|
wld_log(room, "wload: room target vnum doesn't exist (loading mob vnum %d to room %s)", number, target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -547,7 +548,7 @@ WCMD(do_wdamage) {
|
|||||||
WCMD(do_wat)
|
WCMD(do_wat)
|
||||||
{
|
{
|
||||||
room_rnum loc = NOWHERE;
|
room_rnum loc = NOWHERE;
|
||||||
struct char_data *ch;
|
char_data *ch;
|
||||||
char arg[MAX_INPUT_LENGTH], *command;
|
char arg[MAX_INPUT_LENGTH], *command;
|
||||||
|
|
||||||
command = any_one_arg(argument, arg);
|
command = any_one_arg(argument, arg);
|
||||||
@@ -564,7 +565,7 @@ WCMD(do_wat)
|
|||||||
return;
|
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);
|
else if ((ch = get_char_by_room(room, arg))) loc = IN_ROOM(ch);
|
||||||
|
|
||||||
if (loc == NOWHERE) {
|
if (loc == NOWHERE) {
|
||||||
@@ -577,7 +578,8 @@ WCMD(do_wat)
|
|||||||
WCMD(do_wmove)
|
WCMD(do_wmove)
|
||||||
{
|
{
|
||||||
obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
room_rnum target, nr;
|
room_rnum target;
|
||||||
|
room_vnum nr;
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
@@ -587,7 +589,7 @@ WCMD(do_wmove)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr = atoi(arg2);
|
nr = atoidx(arg2);
|
||||||
target = real_room(nr);
|
target = real_room(nr);
|
||||||
|
|
||||||
if (target == NOWHERE) {
|
if (target == NOWHERE) {
|
||||||
|
|||||||
@@ -1054,7 +1054,7 @@ INCLUDE_FILE_PATTERNS =
|
|||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of 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
|
# 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.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|||||||
@@ -1054,7 +1054,7 @@ INCLUDE_FILE_PATTERNS =
|
|||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of 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
|
# 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.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|||||||
+43
-43
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
/* locally defined global variables, used externally */
|
/* locally defined global variables, used externally */
|
||||||
/* head of l-list of fighting chars */
|
/* head of l-list of fighting chars */
|
||||||
struct char_data *combat_list = NULL;
|
char_data *combat_list = NULL;
|
||||||
/* Weapon attack texts */
|
/* Weapon attack texts */
|
||||||
struct attack_hit_type attack_hit_text[] =
|
struct attack_hit_type attack_hit_text[] =
|
||||||
{
|
{
|
||||||
@@ -51,23 +51,23 @@ struct attack_hit_type attack_hit_text[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* local (file scope only) variables */
|
/* 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 */
|
/* local file scope utility functions */
|
||||||
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);
|
||||||
static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type);
|
static void dam_message(int dam, char_data *ch, char_data *victim, int w_type);
|
||||||
static void make_corpse(struct char_data *ch);
|
static void make_corpse(char_data *ch);
|
||||||
static void change_alignment(struct char_data *ch, struct char_data *victim);
|
static void change_alignment(char_data *ch, char_data *victim);
|
||||||
static void group_gain(struct char_data *ch, struct char_data *victim);
|
static void group_gain(char_data *ch, char_data *victim);
|
||||||
static void solo_gain(struct char_data *ch, struct char_data *victim);
|
static void solo_gain(char_data *ch, char_data *victim);
|
||||||
/** @todo refactor this function name */
|
/** @todo refactor this function name */
|
||||||
static char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural);
|
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))
|
#define IS_WEAPON(type) (((type) >= TYPE_HIT) && ((type) < TYPE_SUFFERING))
|
||||||
/* The Fight related routines */
|
/* The Fight related routines */
|
||||||
void appear(struct char_data *ch)
|
void appear(char_data *ch)
|
||||||
{
|
{
|
||||||
if (affected_by_spell(ch, SPELL_INVISIBLE))
|
if (affected_by_spell(ch, SPELL_INVISIBLE))
|
||||||
affect_from_char(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);
|
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);
|
int armorclass = GET_AC(ch);
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ int compute_armor_class(struct char_data *ch)
|
|||||||
return (MAX(-100, armorclass)); /* -100 is lowest */
|
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))
|
if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))
|
||||||
return;
|
return;
|
||||||
@@ -108,7 +108,7 @@ void update_pos(struct char_data *victim)
|
|||||||
GET_POS(victim) = POS_STUNNED;
|
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))
|
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF))
|
||||||
return;
|
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... ) */
|
/* 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)
|
if (ch == vict)
|
||||||
return;
|
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 */
|
/* 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)
|
if (ch == next_combat_list)
|
||||||
next_combat_list = ch->next_fighting;
|
next_combat_list = ch->next_fighting;
|
||||||
@@ -161,11 +161,11 @@ void stop_fighting(struct char_data *ch)
|
|||||||
update_pos(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];
|
char buf2[MAX_NAME_LENGTH + 64];
|
||||||
struct obj_data *corpse, *o;
|
obj_data *corpse, *o;
|
||||||
struct obj_data *money;
|
obj_data *money;
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
|
|
||||||
corpse = create_obj();
|
corpse = create_obj();
|
||||||
@@ -232,14 +232,14 @@ static void make_corpse(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* When ch kills victim */
|
/* 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,
|
/* 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. */
|
* you move 1/16th of the way to having alignment -A. Simple and fast. */
|
||||||
GET_ALIGNMENT(ch) += (-GET_ALIGNMENT(victim) - GET_ALIGNMENT(ch)) / 16;
|
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;
|
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");
|
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))
|
if (FIGHTING(ch))
|
||||||
stop_fighting(ch);
|
stop_fighting(ch);
|
||||||
@@ -271,7 +271,7 @@ struct char_data *i;
|
|||||||
|
|
||||||
if (killer) {
|
if (killer) {
|
||||||
if (killer->group) {
|
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))
|
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);
|
autoquest_trigger_check(i, ch, NULL, AQ_MOB_KILL);
|
||||||
} else
|
} 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));
|
gain_exp(ch, -(GET_EXP(ch) / 2));
|
||||||
if (!IS_NPC(ch)) {
|
if (!IS_NPC(ch)) {
|
||||||
@@ -303,8 +303,8 @@ void die(struct char_data * ch, struct char_data * killer)
|
|||||||
raw_kill(ch, killer);
|
raw_kill(ch, killer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void perform_group_gain(struct char_data *ch, int base,
|
static void perform_group_gain(char_data *ch, int base,
|
||||||
struct char_data *victim)
|
char_data *victim)
|
||||||
{
|
{
|
||||||
int share, hap_share;
|
int share, hap_share;
|
||||||
|
|
||||||
@@ -325,12 +325,12 @@ static void perform_group_gain(struct char_data *ch, int base,
|
|||||||
change_alignment(ch, victim);
|
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;
|
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))
|
if (IN_ROOM(ch) == IN_ROOM(k))
|
||||||
tot_members++;
|
tot_members++;
|
||||||
|
|
||||||
@@ -346,12 +346,12 @@ static void group_gain(struct char_data *ch, struct char_data *victim)
|
|||||||
else
|
else
|
||||||
base = 0;
|
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))
|
if (IN_ROOM(k) == IN_ROOM(ch))
|
||||||
perform_group_gain(k, base, victim);
|
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;
|
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 */
|
/* 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)
|
int w_type)
|
||||||
{
|
{
|
||||||
char *buf;
|
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
|
/* message for doing damage with a spell or skill. Also used for weapon
|
||||||
* damage on miss and death blows. */
|
* 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 attacktype)
|
||||||
{
|
{
|
||||||
int i, j, nr;
|
int i, j, nr;
|
||||||
struct message_type *msg;
|
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
|
/* @todo restructure the messages library to a pointer based system as
|
||||||
* opposed to the current cyclic location system. */
|
* 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 Victim died.
|
||||||
* = 0 No damage.
|
* = 0 No damage.
|
||||||
* > 0 How much damage done. */
|
* > 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;
|
long local_gold = 0, happy_gold = 0;
|
||||||
char local_buf[256];
|
char local_buf[256];
|
||||||
struct char_data *tmp_char;
|
char_data *tmp_char;
|
||||||
struct obj_data *corpse_obj;
|
obj_data *corpse_obj;
|
||||||
|
|
||||||
if (GET_POS(victim) <= POS_DEAD) {
|
if (GET_POS(victim) <= POS_DEAD) {
|
||||||
/* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */
|
/* 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
|
/* 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
|
* could use it for special cases like weapons that hit evil creatures easier
|
||||||
* or a weapon that always misses attacking an animal. */
|
* 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;
|
int calc_thaco;
|
||||||
|
|
||||||
@@ -807,9 +807,9 @@ static int compute_thaco(struct char_data *ch, struct char_data *victim)
|
|||||||
return calc_thaco;
|
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;
|
int w_type, victim_ac, calc_thaco, dam, diceroll;
|
||||||
|
|
||||||
/* Check that the attacker and victim exist */
|
/* 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. */
|
/* control the fights going on. Called every 2 seconds from comm.c. */
|
||||||
void perform_violence(void)
|
void perform_violence(void)
|
||||||
{
|
{
|
||||||
struct char_data *ch, *tch;
|
char_data *ch, *tch;
|
||||||
|
|
||||||
for (ch = combat_list; ch; ch = next_combat_list) {
|
for (ch = combat_list; ch; ch = next_combat_list) {
|
||||||
next_combat_list = ch->next_fighting;
|
next_combat_list = ch->next_fighting;
|
||||||
@@ -940,7 +940,7 @@ void perform_violence(void)
|
|||||||
if (GROUP(ch) && GROUP(ch)->members && GROUP(ch)->members->iSize) {
|
if (GROUP(ch) && GROUP(ch)->members && GROUP(ch)->members->iSize) {
|
||||||
struct iterator_data Iterator;
|
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)) {
|
for (; tch ; tch = next_in_list(&Iterator)) {
|
||||||
if (tch == ch)
|
if (tch == ch)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+12
-13
@@ -21,23 +21,22 @@ struct attack_hit_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Functions available in fight.c */
|
/* Functions available in fight.c */
|
||||||
void appear(struct char_data *ch);
|
void appear(char_data *ch);
|
||||||
void check_killer(struct char_data *ch, struct char_data *vict);
|
void check_killer(char_data *ch, char_data *vict);
|
||||||
int compute_armor_class(struct char_data *ch);
|
int compute_armor_class(char_data *ch);
|
||||||
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);
|
||||||
void death_cry(struct char_data *ch);
|
void death_cry(char_data *ch);
|
||||||
void die(struct char_data * ch, struct char_data * killer);
|
void die(char_data * ch, char_data * killer);
|
||||||
void hit(struct char_data *ch, struct char_data *victim, int type);
|
void hit(char_data *ch, char_data *victim, int type);
|
||||||
void perform_violence(void);
|
void perform_violence(void);
|
||||||
void raw_kill(struct char_data * ch, struct char_data * killer);
|
void raw_kill(char_data * ch, char_data * killer);
|
||||||
void set_fighting(struct char_data *ch, struct char_data *victim);
|
void set_fighting(char_data *ch, char_data *victim);
|
||||||
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 attacktype);
|
void stop_fighting(char_data *ch);
|
||||||
void stop_fighting(struct char_data *ch);
|
|
||||||
|
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
extern struct attack_hit_type attack_hit_text[];
|
extern struct attack_hit_type attack_hit_text[];
|
||||||
extern struct char_data *combat_list;
|
extern char_data *combat_list;
|
||||||
|
|
||||||
#endif /* _FIGHT_H_*/
|
#endif /* _FIGHT_H_*/
|
||||||
|
|||||||
+15
-15
@@ -21,11 +21,11 @@
|
|||||||
/* local functions */
|
/* local functions */
|
||||||
static void extract_mobile_all(mob_vnum vnum);
|
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;
|
int rnum, i, found = FALSE, shop, cmd_no;
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
struct char_data *live_mob;
|
char_data *live_mob;
|
||||||
|
|
||||||
if ((rnum = real_mobile(vnum)) != NOBODY) {
|
if ((rnum = real_mobile(vnum)) != NOBODY) {
|
||||||
/* Copy over the mobile and free() the old strings. */
|
/* 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;
|
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);
|
RECREATE(mob_index, struct index_data, top_of_mobt + 2);
|
||||||
top_of_mobt++;
|
top_of_mobt++;
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ int add_mobile(struct char_data *mob, mob_vnum vnum)
|
|||||||
return found;
|
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);
|
free_mobile_strings(to);
|
||||||
*to = *from;
|
*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)
|
static void extract_mobile_all(mob_vnum vnum)
|
||||||
{
|
{
|
||||||
struct char_data *next, *ch;
|
char_data *next, *ch;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (ch = character_list; ch; ch = next) {
|
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)
|
int delete_mobile(mob_rnum refpt)
|
||||||
{
|
{
|
||||||
struct char_data *live_mob;
|
char_data *live_mob;
|
||||||
struct char_data *proto;
|
char_data *proto;
|
||||||
int counter, cmd_no;
|
int counter, cmd_no;
|
||||||
mob_vnum vnum;
|
mob_vnum vnum;
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
@@ -169,7 +169,7 @@ int delete_mobile(mob_rnum refpt)
|
|||||||
|
|
||||||
top_of_mobt--;
|
top_of_mobt--;
|
||||||
RECREATE(mob_index, struct index_data, top_of_mobt + 1);
|
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. */
|
/* Update live mobile rnums. */
|
||||||
for (live_mob = character_list; live_mob; live_mob = live_mob->next)
|
for (live_mob = character_list; live_mob; live_mob = live_mob->next)
|
||||||
@@ -195,7 +195,7 @@ int delete_mobile(mob_rnum refpt)
|
|||||||
return 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)
|
if (f->player.name)
|
||||||
t->player.name = strdup(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;
|
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)
|
if (f->player.name)
|
||||||
t->player.name = 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int free_mobile_strings(struct char_data *mob)
|
int free_mobile_strings(char_data *mob)
|
||||||
{
|
{
|
||||||
if (mob->player.name)
|
if (mob->player.name)
|
||||||
free(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
|
/* Free a mobile structure that has been edited. Take care of existing mobiles
|
||||||
* and their mob_proto! */
|
* and their mob_proto! */
|
||||||
int free_mobile(struct char_data *mob)
|
int free_mobile(char_data *mob)
|
||||||
{
|
{
|
||||||
mob_rnum i;
|
mob_rnum i;
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ int save_mobiles(zone_rnum rznum)
|
|||||||
return written;
|
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)
|
if (GET_ATTACK(mob) != 0)
|
||||||
fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob));
|
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;
|
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 ldesc[MAX_STRING_LENGTH];
|
||||||
char ddesc[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;
|
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;
|
mob_vnum mvnum = mob_index[mob->nr].vnum;
|
||||||
check_mobile_string(mvnum, &GET_LDESC(mob), "long description");
|
check_mobile_string(mvnum, &GET_LDESC(mob), "long description");
|
||||||
|
|||||||
+12
-12
@@ -13,21 +13,21 @@
|
|||||||
#define _GENMOB_H_
|
#define _GENMOB_H_
|
||||||
|
|
||||||
int delete_mobile(mob_rnum);
|
int delete_mobile(mob_rnum);
|
||||||
int copy_mobile(struct char_data *to, struct char_data *from);
|
int copy_mobile(char_data *to, char_data *from);
|
||||||
int add_mobile(struct char_data *, mob_vnum);
|
int add_mobile(char_data *, mob_vnum);
|
||||||
int copy_mob_strings(struct char_data *to, struct char_data *from);
|
int copy_mob_strings(char_data *to, char_data *from);
|
||||||
int free_mob_strings(struct char_data *);
|
int free_mob_strings(char_data *);
|
||||||
int free_mobile(struct char_data *mob);
|
int free_mobile(char_data *mob);
|
||||||
int save_mobiles(zone_rnum rznum);
|
int save_mobiles(zone_rnum rznum);
|
||||||
int update_mobile_strings(struct char_data *t, struct char_data *f);
|
int update_mobile_strings(char_data *t, char_data *f);
|
||||||
void check_mobile_strings(struct char_data *mob);
|
void check_mobile_strings(char_data *mob);
|
||||||
void check_mobile_string(mob_vnum i, char **string, const char *desc);
|
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_record(mob_vnum mvnum, char_data *mob, FILE *fd);
|
||||||
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);
|
||||||
int free_mobile_strings(struct char_data *mob);
|
int free_mobile_strings(char_data *mob);
|
||||||
int copy_mobile_strings(struct char_data *t, struct char_data *f);
|
int copy_mobile_strings(char_data *t, char_data *f);
|
||||||
#if CONFIG_GENOLC_MOBPROG
|
#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
|
#endif
|
||||||
|
|
||||||
/* Handy macros. */
|
/* Handy macros. */
|
||||||
|
|||||||
+23
-23
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static int update_all_objects(struct obj_data *obj);
|
static int update_all_objects(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);
|
||||||
|
|
||||||
obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum)
|
obj_rnum add_object(obj_data *newobj, obj_vnum ovnum)
|
||||||
{
|
{
|
||||||
int found = NOTHING;
|
int found = NOTHING;
|
||||||
zone_rnum rznum = real_zone_by_thing(ovnum);
|
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
|
* 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
|
* this prototype. If object is pointing to this prototype, then we need to
|
||||||
* replace it with the new one. */
|
* 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;
|
int count = 0;
|
||||||
|
|
||||||
for (obj = object_list; obj; obj = obj->next) {
|
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)
|
obj_rnum adjust_objects(obj_rnum refpt)
|
||||||
{
|
{
|
||||||
int shop, i, zone, cmd_no;
|
int shop, i, zone, cmd_no;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
#if CIRCLE_UNSIGNED_INDEX
|
#if CIRCLE_UNSIGNED_INDEX
|
||||||
if (refpt == NOTHING || refpt > top_of_objt)
|
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.
|
/* Function handle the insertion of an object within the prototype framework.
|
||||||
* Note that this does not adjust internal values of other objects, use
|
* Note that this does not adjust internal values of other objects, use
|
||||||
* add_object() for that. */
|
* 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;
|
obj_rnum i;
|
||||||
|
|
||||||
top_of_objt++;
|
top_of_objt++;
|
||||||
RECREATE(obj_index, struct index_data, top_of_objt + 1);
|
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. */
|
/* Start counting through both tables. */
|
||||||
for (i = top_of_objt; i > 0; i--) {
|
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);
|
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 CIRCLE_UNSIGNED_INDEX
|
||||||
if (obj == NULL || ornum == NOTHING || ornum > top_of_objt)
|
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];
|
char pbuf1[MAX_STRING_LENGTH], pbuf2[MAX_STRING_LENGTH], pbuf3[MAX_STRING_LENGTH], pbuf4[MAX_STRING_LENGTH];
|
||||||
int counter, counter2, realcounter;
|
int counter, counter2, realcounter;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
struct extra_descr_data *ex_desc;
|
struct extra_descr_data *ex_desc;
|
||||||
|
|
||||||
#if CIRCLE_UNSIGNED_INDEX
|
#if CIRCLE_UNSIGNED_INDEX
|
||||||
@@ -299,7 +299,7 @@ int save_objects(zone_rnum zone_num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free all, unconditionally. */
|
/* Free all, unconditionally. */
|
||||||
void free_object_strings(struct obj_data *obj)
|
void free_object_strings(obj_data *obj)
|
||||||
{
|
{
|
||||||
if (obj->name)
|
if (obj->name)
|
||||||
free(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. */
|
/* 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);
|
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->name = from->name ? strdup(from->name) : NULL;
|
||||||
to->description = from->description ? strdup(from->description) : 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;
|
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);
|
free_object_strings(to);
|
||||||
return copy_object_main(to, from, TRUE);
|
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);
|
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;
|
*to = *from;
|
||||||
copy_object_strings(to, from);
|
copy_object_strings(to, from);
|
||||||
@@ -384,7 +384,7 @@ int delete_object(obj_rnum rnum)
|
|||||||
{
|
{
|
||||||
obj_rnum i;
|
obj_rnum i;
|
||||||
zone_rnum zrnum;
|
zone_rnum zrnum;
|
||||||
struct obj_data *obj, *tmp, *next_obj;
|
obj_data *obj, *tmp, *next_obj;
|
||||||
int shop, j, zone, cmd_no;
|
int shop, j, zone, cmd_no;
|
||||||
|
|
||||||
if (rnum == NOTHING || rnum > top_of_objt)
|
if (rnum == NOTHING || rnum > top_of_objt)
|
||||||
@@ -404,7 +404,7 @@ int delete_object(obj_rnum rnum)
|
|||||||
|
|
||||||
/* extract_obj() will just axe contents. */
|
/* extract_obj() will just axe contents. */
|
||||||
if (tmp->contains) {
|
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) {
|
for (this_content = tmp->contains; this_content; this_content = next_content) {
|
||||||
next_content = this_content->next_content;
|
next_content = this_content->next_content;
|
||||||
if (IN_ROOM(tmp)) {
|
if (IN_ROOM(tmp)) {
|
||||||
@@ -442,7 +442,7 @@ int delete_object(obj_rnum rnum)
|
|||||||
|
|
||||||
top_of_objt--;
|
top_of_objt--;
|
||||||
RECREATE(obj_index, struct index_data, top_of_objt + 1);
|
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. */
|
/* Renumber notice boards. */
|
||||||
for (j = 0; j < NUM_OF_BOARDS; j++)
|
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 */
|
/* 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;
|
static size_t max_len = 64;
|
||||||
int i = GET_OBJ_RNUM(obj);
|
int i = GET_OBJ_RNUM(obj);
|
||||||
@@ -505,7 +505,7 @@ bool oset_alias(struct obj_data *obj, char * argument)
|
|||||||
return TRUE;
|
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;
|
int i = 0, apply = -1, location = -1, mod = 0, empty = -1, value;
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
@@ -558,7 +558,7 @@ bool oset_apply(struct obj_data *obj, char * argument)
|
|||||||
return TRUE;
|
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;
|
static size_t max_len = 64;
|
||||||
int i = GET_OBJ_RNUM(obj);
|
int i = GET_OBJ_RNUM(obj);
|
||||||
@@ -576,7 +576,7 @@ bool oset_short_description(struct obj_data *obj, char * argument)
|
|||||||
return TRUE;
|
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;
|
static size_t max_len = 128;
|
||||||
int i = GET_OBJ_RNUM(obj);
|
int i = GET_OBJ_RNUM(obj);
|
||||||
|
|||||||
+12
-12
@@ -12,20 +12,20 @@
|
|||||||
#ifndef _GENOBJ_H_
|
#ifndef _GENOBJ_H_
|
||||||
#define _GENOBJ_H_
|
#define _GENOBJ_H_
|
||||||
|
|
||||||
void free_object_strings_proto(struct obj_data *obj);
|
void free_object_strings_proto(obj_data *obj);
|
||||||
void free_object_strings(struct obj_data *obj);
|
void free_object_strings(obj_data *obj);
|
||||||
int copy_object(struct obj_data *to, struct obj_data *from);
|
int copy_object(obj_data *to, obj_data *from);
|
||||||
int copy_object_preserve(struct obj_data *to, struct obj_data *from);
|
int copy_object_preserve(obj_data *to, obj_data *from);
|
||||||
int save_objects(zone_rnum vznum);
|
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 adjust_objects(obj_rnum refpt);
|
||||||
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);
|
||||||
obj_rnum add_object(struct obj_data *, obj_vnum ovnum);
|
obj_rnum add_object(obj_data *, obj_vnum ovnum);
|
||||||
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);
|
||||||
int delete_object(obj_rnum);
|
int delete_object(obj_rnum);
|
||||||
bool oset_alias(struct obj_data *obj, char * argument);
|
bool oset_alias(obj_data *obj, char * argument);
|
||||||
bool oset_apply(struct obj_data *obj, char * argument);
|
bool oset_apply(obj_data *obj, char * argument);
|
||||||
bool oset_short_description(struct obj_data *obj, char * argument);
|
bool oset_short_description(obj_data *obj, char * argument);
|
||||||
bool oset_long_description(struct obj_data *obj, char * argument);
|
bool oset_long_description(obj_data *obj, char * argument);
|
||||||
|
|
||||||
#endif /* _GENOBJ_H_ */
|
#endif /* _GENOBJ_H_ */
|
||||||
|
|||||||
+7
-7
@@ -60,11 +60,11 @@ static int export_save_zone(zone_rnum zrnum);
|
|||||||
static int export_save_objects(zone_rnum zrnum);
|
static int export_save_objects(zone_rnum zrnum);
|
||||||
static int export_save_rooms(zone_rnum zrnum);
|
static int export_save_rooms(zone_rnum zrnum);
|
||||||
static int export_save_triggers(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 void export_script_save_to_disk(FILE *fp, void *item, int type);
|
||||||
static int export_info_file(zone_rnum zrnum);
|
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);
|
smash_tilde(arg);
|
||||||
parse_at(arg);
|
parse_at(arg);
|
||||||
@@ -330,7 +330,7 @@ ACMD(do_export_zone)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zvnum = atoi(argument);
|
zvnum = atoidx(argument);
|
||||||
zrnum = real_zone(zvnum);
|
zrnum = real_zone(zvnum);
|
||||||
|
|
||||||
if (zrnum == NOWHERE) {
|
if (zrnum == NOWHERE) {
|
||||||
@@ -589,7 +589,7 @@ static int export_save_mobiles(zone_rnum rznum)
|
|||||||
return TRUE;
|
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];
|
char ldesc[MAX_STRING_LENGTH];
|
||||||
@@ -774,7 +774,7 @@ static int export_save_objects(zone_rnum zrnum)
|
|||||||
obj_vnum ovnum;
|
obj_vnum ovnum;
|
||||||
int i;
|
int i;
|
||||||
FILE *obj_file;
|
FILE *obj_file;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
struct extra_descr_data *ex_desc;
|
struct extra_descr_data *ex_desc;
|
||||||
|
|
||||||
if (!(obj_file = fopen("world/export/qq.obj", "w"))) {
|
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;
|
struct trig_proto_list *t;
|
||||||
|
|
||||||
if (type==MOB_TRIGGER)
|
if (type==MOB_TRIGGER)
|
||||||
t = ((struct char_data *)item)->proto_script;
|
t = ((char_data *)item)->proto_script;
|
||||||
else if (type==OBJ_TRIGGER)
|
else if (type==OBJ_TRIGGER)
|
||||||
t = ((struct obj_data *)item)->proto_script;
|
t = ((obj_data *)item)->proto_script;
|
||||||
else if (type==WLD_TRIGGER)
|
else if (type==WLD_TRIGGER)
|
||||||
t = ((struct room_data *)item)->proto_script;
|
t = ((struct room_data *)item)->proto_script;
|
||||||
else {
|
else {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
#define STRING_TERMINATOR '~'
|
#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 remove_from_save_list(zone_vnum, int type);
|
||||||
int add_to_save_list(zone_vnum, int type);
|
int add_to_save_list(zone_vnum, int type);
|
||||||
int in_save_list(zone_vnum, int type);
|
int in_save_list(zone_vnum, int type);
|
||||||
|
|||||||
+4
-4
@@ -24,8 +24,8 @@
|
|||||||
* the description, title, and such. */
|
* the description, title, and such. */
|
||||||
room_rnum add_room(struct room_data *room)
|
room_rnum add_room(struct room_data *room)
|
||||||
{
|
{
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
struct obj_data *tobj;
|
obj_data *tobj;
|
||||||
int j, found = FALSE;
|
int j, found = FALSE;
|
||||||
room_rnum i;
|
room_rnum i;
|
||||||
|
|
||||||
@@ -123,8 +123,8 @@ int delete_room(room_rnum rnum)
|
|||||||
{
|
{
|
||||||
room_rnum i;
|
room_rnum i;
|
||||||
int j;
|
int j;
|
||||||
struct char_data *ppl, *next_ppl;
|
char_data *ppl, *next_ppl;
|
||||||
struct obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
struct room_data *room;
|
struct room_data *room;
|
||||||
|
|
||||||
if (rnum <= 0 || rnum > top_of_world) /* Can't delete void yet. */
|
if (rnum <= 0 || rnum > top_of_world) /* Can't delete void yet. */
|
||||||
|
|||||||
+3
-3
@@ -141,7 +141,7 @@ static int find_first_step(room_rnum src, room_rnum target)
|
|||||||
ACMD(do_track)
|
ACMD(do_track)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
/* The character must have the track skill. */
|
/* 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;
|
int dir;
|
||||||
byte found;
|
byte found;
|
||||||
struct char_data *tmp;
|
char_data *tmp;
|
||||||
|
|
||||||
if (!ch || !HUNTING(ch) || FIGHTING(ch))
|
if (!ch || !HUNTING(ch) || FIGHTING(ch))
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -15,6 +15,6 @@
|
|||||||
#define _GRAPH_H_
|
#define _GRAPH_H_
|
||||||
|
|
||||||
ACMD(do_track);
|
ACMD(do_track);
|
||||||
void hunt_victim(struct char_data *ch);
|
void hunt_victim(char_data *ch);
|
||||||
|
|
||||||
#endif /* _GRAPH_H_*/
|
#endif /* _GRAPH_H_*/
|
||||||
|
|||||||
+76
-76
@@ -29,9 +29,9 @@
|
|||||||
static int extractions_pending = 0;
|
static int extractions_pending = 0;
|
||||||
|
|
||||||
/* local file scope functions */
|
/* local file scope functions */
|
||||||
static int apply_ac(struct char_data *ch, int eq_pos);
|
static int apply_ac(char_data *ch, int eq_pos);
|
||||||
static void update_object(struct obj_data *obj, int use);
|
static void update_object(obj_data *obj, int use);
|
||||||
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);
|
||||||
|
|
||||||
char *fname(const char *namelist)
|
char *fname(const char *namelist)
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,7 @@ int isname(const char *str, const char *namelist)
|
|||||||
return 0;
|
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) {
|
switch (loc) {
|
||||||
case APPLY_NONE:
|
case APPLY_NONE:
|
||||||
@@ -205,7 +205,7 @@ static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *ms
|
|||||||
} /* switch */
|
} /* 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;
|
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
|
/* This updates a character by subtracting everything he is affected by
|
||||||
* restoring original abilities, and then affecting all again. */
|
* 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;
|
struct affected_type *af;
|
||||||
int i, j;
|
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
|
/* Insert an affect_type in a char_data structure. Automatically sets
|
||||||
* apropriate bits and apply's */
|
* 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;
|
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
|
/* Remove an affected_type structure from a char (called when duration reaches
|
||||||
* zero). Pointer *af must never be NIL! Frees mem and calls
|
* zero). Pointer *af must never be NIL! Frees mem and calls
|
||||||
* affect_location_apply */
|
* 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;
|
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" */
|
/* 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;
|
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
|
/* Return TRUE if a char is affected by a spell (SPELL_XXX), FALSE indicates
|
||||||
* not affected. */
|
* 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;
|
struct affected_type *hjp;
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ bool affected_by_spell(struct char_data *ch, int type)
|
|||||||
return (FALSE);
|
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)
|
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod)
|
||||||
{
|
{
|
||||||
struct affected_type *hjp, *next;
|
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 */
|
/* 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) {
|
if (ch == NULL || IN_ROOM(ch) == NOWHERE) {
|
||||||
log("SYSERR: NULL character or NOWHERE in %s, char_from_room", __FILE__);
|
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 */
|
/* 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)
|
if (ch == NULL || room == NOWHERE || room > top_of_world)
|
||||||
log("SYSERR: Illegal value(s) passed to char_to_room. (Room: %d/%d Ch: %p",
|
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. */
|
/* 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) {
|
if (object && ch) {
|
||||||
object->next_content = ch->carrying;
|
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 */
|
/* 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) {
|
if (object == NULL) {
|
||||||
log("SYSERR: NULL object passed to obj_from_char.");
|
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 */
|
/* 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;
|
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));
|
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))
|
if (OBJ_FLAGGED(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -500,7 +500,7 @@ int invalid_align(struct char_data *ch, struct obj_data *obj)
|
|||||||
return FALSE;
|
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;
|
int j;
|
||||||
|
|
||||||
@@ -552,10 +552,10 @@ void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
|
|||||||
affect_total(ch);
|
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;
|
int j;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) {
|
if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) {
|
||||||
core_dump();
|
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 */
|
/* 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)
|
for (i = list; i; i = i->next_content)
|
||||||
if (GET_OBJ_RNUM(i) == num)
|
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 */
|
/* 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)
|
for (i = object_list; i; i = i->next)
|
||||||
if (GET_OBJ_RNUM(i) == nr)
|
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.. */
|
/* 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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
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 */
|
/* 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)
|
for (i = character_list; i; i = i->next)
|
||||||
if (GET_MOB_RNUM(i) == nr)
|
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 */
|
/* 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){
|
if (!object || room == NOWHERE || room > top_of_world){
|
||||||
log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)",
|
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
|
world[room].contents = object; // add object to list
|
||||||
}
|
}
|
||||||
else {
|
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
|
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
|
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 */
|
/* 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;
|
obj_data *temp;
|
||||||
struct char_data *t, *tempch;
|
char_data *t, *tempch;
|
||||||
|
|
||||||
if (!object || IN_ROOM(object) == NOWHERE) {
|
if (!object || IN_ROOM(object) == NOWHERE) {
|
||||||
log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room",
|
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) */
|
/* 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) {
|
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.",
|
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 */
|
/* 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) {
|
if (obj->in_obj == NULL) {
|
||||||
log("SYSERR: (%s): trying to illegally extract obj from obj.", __FILE__);
|
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 */
|
/* 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) {
|
if (list) {
|
||||||
object_list_new_owner(list->contains, ch);
|
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 */
|
/* 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;
|
char_data *ch, *next = NULL;
|
||||||
struct obj_data *temp;
|
obj_data *temp;
|
||||||
|
|
||||||
if (obj->worn_by != NULL)
|
if (obj->worn_by != NULL)
|
||||||
if (unequip_char(obj->worn_by, obj->worn_on) != obj)
|
if (unequip_char(obj->worn_by, obj->worn_on) != obj)
|
||||||
@@ -840,7 +840,7 @@ void extract_obj(struct obj_data *obj)
|
|||||||
free_obj(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 */
|
/* dont update objects with a timer trigger */
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_TIMER) && (GET_OBJ_TIMER(obj) > 0))
|
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);
|
update_object(obj->next_content, use);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_char_objects(struct char_data *ch)
|
void update_char_objects(char_data *ch)
|
||||||
{
|
{
|
||||||
int i;
|
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 */
|
/* 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;
|
char_data *k, *temp;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (IN_ROOM(ch) == NOWHERE) {
|
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
|
* 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
|
* 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);
|
char_from_furniture(ch);
|
||||||
clear_char_event_list(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. */
|
* confusing some code. -gg This doesn't handle recursive extractions. */
|
||||||
void extract_pending_chars(void)
|
void extract_pending_chars(void)
|
||||||
{
|
{
|
||||||
struct char_data *vict, *next_vict, *prev_vict;
|
char_data *vict, *next_vict, *prev_vict;
|
||||||
|
|
||||||
if (extractions_pending < 0)
|
if (extractions_pending < 0)
|
||||||
log("SYSERR: Negative (%d) extractions pending.", extractions_pending);
|
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
|
/* Here follows high-level versions of some earlier routines, ie functions
|
||||||
* which incorporate the actual player-data */
|
* 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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
if (!number) {
|
||||||
@@ -1084,9 +1084,9 @@ struct char_data *get_player_vis(struct char_data *ch, char *name, int *number,
|
|||||||
return (NULL);
|
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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
if (!number) {
|
||||||
@@ -1111,9 +1111,9 @@ struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *numbe
|
|||||||
return (NULL);
|
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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
if (!number) {
|
||||||
@@ -1142,7 +1142,7 @@ struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *numb
|
|||||||
return (NULL);
|
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)
|
if (where == FIND_CHAR_ROOM)
|
||||||
return get_char_room_vis(ch, name, number);
|
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);
|
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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
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 */
|
/* 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;
|
int num;
|
||||||
|
|
||||||
if (!number) {
|
if (!number) {
|
||||||
@@ -1206,7 +1206,7 @@ struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *number)
|
|||||||
return (NULL);
|
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;
|
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);
|
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;
|
int j, num;
|
||||||
|
|
||||||
@@ -1282,9 +1282,9 @@ const char *money_desc(int amount)
|
|||||||
return ("an absolutely colossal mountain of gold coins");
|
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;
|
struct extra_descr_data *new_descr;
|
||||||
char buf[200];
|
char buf[200];
|
||||||
int y;
|
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
|
* 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
|
* like the one_argument routine), but now it returns an integer that
|
||||||
* describes what it filled in. */
|
* describes what it filled in. */
|
||||||
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
|
int generic_find(char *arg, bitvector_t bitvector, char_data *ch,
|
||||||
struct char_data **tar_ch, struct obj_data **tar_obj)
|
char_data **tar_ch, obj_data **tar_obj)
|
||||||
{
|
{
|
||||||
int i, found, number;
|
int i, found, number;
|
||||||
char name_val[MAX_INPUT_LENGTH];
|
char name_val[MAX_INPUT_LENGTH];
|
||||||
@@ -1418,7 +1418,7 @@ int find_all_dots(char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Group Handlers */
|
/* Group Handlers */
|
||||||
struct group_data * create_group(struct char_data * leader)
|
struct group_data * create_group(char_data * leader)
|
||||||
{
|
{
|
||||||
struct group_data * new_group;
|
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)
|
void free_group(struct group_data * group)
|
||||||
{
|
{
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
struct iterator_data Iterator;
|
struct iterator_data Iterator;
|
||||||
|
|
||||||
if (group->members->iSize) {
|
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;
|
||||||
tch = next_in_list(&Iterator))
|
tch = next_in_list(&Iterator))
|
||||||
leave_group(tch);
|
leave_group(tch);
|
||||||
@@ -1462,10 +1462,10 @@ void free_group(struct group_data * group)
|
|||||||
free(group);
|
free(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void leave_group(struct char_data *ch)
|
void leave_group(char_data *ch)
|
||||||
{
|
{
|
||||||
struct group_data *group;
|
struct group_data *group;
|
||||||
struct char_data *tch;
|
char_data *tch;
|
||||||
struct iterator_data Iterator;
|
struct iterator_data Iterator;
|
||||||
bool found_pc = FALSE;
|
bool found_pc = FALSE;
|
||||||
|
|
||||||
@@ -1478,7 +1478,7 @@ void leave_group(struct char_data *ch)
|
|||||||
ch->group = NULL;
|
ch->group = NULL;
|
||||||
|
|
||||||
if (group->members->iSize) {
|
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))
|
tch; tch = next_in_list(&Iterator))
|
||||||
if (!IS_NPC(tch))
|
if (!IS_NPC(tch))
|
||||||
found_pc = TRUE;
|
found_pc = TRUE;
|
||||||
@@ -1490,13 +1490,13 @@ void leave_group(struct char_data *ch)
|
|||||||
SET_BIT(GROUP_FLAGS(group), GROUP_NPC);
|
SET_BIT(GROUP_FLAGS(group), GROUP_NPC);
|
||||||
|
|
||||||
if (GROUP_LEADER(group) == ch && group->members->iSize) {
|
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)));
|
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)
|
} else if (group->members->iSize == 0)
|
||||||
free_group(group);
|
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);
|
add_to_list(ch, group->members);
|
||||||
|
|
||||||
|
|||||||
+43
-45
@@ -13,62 +13,61 @@
|
|||||||
#define _HANDLER_H_
|
#define _HANDLER_H_
|
||||||
|
|
||||||
/* handling the affected-structures */
|
/* handling the affected-structures */
|
||||||
void affect_total(struct char_data *ch);
|
void affect_total(char_data *ch);
|
||||||
void affect_to_char(struct char_data *ch, struct affected_type *af);
|
void affect_to_char(char_data *ch, struct affected_type *af);
|
||||||
void affect_remove(struct char_data *ch, struct affected_type *af);
|
void affect_remove(char_data *ch, struct affected_type *af);
|
||||||
void affect_from_char(struct char_data *ch, int type);
|
void affect_from_char(char_data *ch, int type);
|
||||||
bool affected_by_spell(struct char_data *ch, int type);
|
bool affected_by_spell(char_data *ch, int type);
|
||||||
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);
|
||||||
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod);
|
|
||||||
|
|
||||||
/* utility */
|
/* utility */
|
||||||
const char *money_desc(int amount);
|
const char *money_desc(int amount);
|
||||||
struct obj_data *create_money(int amount);
|
obj_data *create_money(int amount);
|
||||||
int isname(const char *str, const char *namelist);
|
int isname(const char *str, const char *namelist);
|
||||||
int is_name(const char *str, const char *namelist);
|
int is_name(const char *str, const char *namelist);
|
||||||
char *fname(const char *namelist);
|
char *fname(const char *namelist);
|
||||||
int get_number(char **name);
|
int get_number(char **name);
|
||||||
|
|
||||||
/* objects */
|
/* objects */
|
||||||
void obj_to_char(struct obj_data *object, struct char_data *ch);
|
void obj_to_char(obj_data *object, char_data *ch);
|
||||||
void obj_from_char(struct obj_data *object);
|
void obj_from_char(obj_data *object);
|
||||||
|
|
||||||
void equip_char(struct char_data *ch, struct obj_data *obj, int pos);
|
void equip_char(char_data *ch, obj_data *obj, int pos);
|
||||||
struct obj_data *unequip_char(struct char_data *ch, int pos);
|
obj_data *unequip_char(char_data *ch, int pos);
|
||||||
int invalid_align(struct char_data *ch, struct obj_data *obj);
|
int invalid_align(char_data *ch, obj_data *obj);
|
||||||
|
|
||||||
void obj_to_room(struct obj_data *object, room_rnum room);
|
void obj_to_room(obj_data *object, room_rnum room);
|
||||||
void obj_from_room(struct obj_data *object);
|
void obj_from_room(obj_data *object);
|
||||||
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to);
|
void obj_to_obj(obj_data *obj, obj_data *obj_to);
|
||||||
void obj_from_obj(struct obj_data *obj);
|
void obj_from_obj(obj_data *obj);
|
||||||
void object_list_new_owner(struct obj_data *list, struct char_data *ch);
|
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*/
|
/* characters*/
|
||||||
struct char_data *get_char_room(char *name, int *num, room_rnum room);
|
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_num(mob_rnum nr);
|
||||||
|
|
||||||
void char_from_room(struct char_data *ch);
|
void char_from_room(char_data *ch);
|
||||||
void char_to_room(struct char_data *ch, room_rnum room);
|
void char_to_room(char_data *ch, room_rnum room);
|
||||||
void extract_char(struct char_data *ch);
|
void extract_char(char_data *ch);
|
||||||
void extract_char_final(struct char_data *ch);
|
void extract_char_final(char_data *ch);
|
||||||
void extract_pending_chars(void);
|
void extract_pending_chars(void);
|
||||||
|
|
||||||
/* find if character can see */
|
/* find if character can see */
|
||||||
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 *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);
|
||||||
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 *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 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 *get_obj_num(obj_rnum nr);
|
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);
|
obj_data *get_obj_in_list_vis(char_data *ch, char *name, int *number, obj_data *list);
|
||||||
struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *num);
|
obj_data *get_obj_vis(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[]);
|
obj_data *get_obj_in_equip_vis(char_data *ch, char *arg, int *number, obj_data *equipment[]);
|
||||||
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]);
|
int get_obj_pos_in_equip_vis(char_data *ch, char *arg, int *num, obj_data *equipment[]);
|
||||||
|
|
||||||
/* find all dots */
|
/* find all dots */
|
||||||
int find_all_dots(char *arg);
|
int find_all_dots(char *arg);
|
||||||
@@ -78,14 +77,13 @@ int find_all_dots(char *arg);
|
|||||||
#define FIND_ALLDOT 2
|
#define FIND_ALLDOT 2
|
||||||
|
|
||||||
/* group */
|
/* 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 free_group(struct group_data * group);
|
||||||
void leave_group(struct char_data *ch);
|
void leave_group(char_data *ch);
|
||||||
void join_group(struct char_data *ch, struct group_data *group);
|
void join_group(char_data *ch, struct group_data *group);
|
||||||
|
|
||||||
/* Generic Find */
|
/* Generic Find */
|
||||||
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
|
int generic_find(char *arg, bitvector_t bitvector, char_data *ch, char_data **tar_ch, obj_data **tar_obj);
|
||||||
struct char_data **tar_ch, struct obj_data **tar_obj);
|
|
||||||
|
|
||||||
#define FIND_CHAR_ROOM (1 << 0)
|
#define FIND_CHAR_ROOM (1 << 0)
|
||||||
#define FIND_CHAR_WORLD (1 << 1)
|
#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 */
|
/* prototypes from mobact.c */
|
||||||
void forget(struct char_data *ch, struct char_data *victim);
|
void forget(char_data *ch, char_data *victim);
|
||||||
void remember(struct char_data *ch, struct char_data *victim);
|
void remember(char_data *ch, char_data *victim);
|
||||||
void mobile_activity(void);
|
void mobile_activity(void);
|
||||||
void clearMemory(struct char_data *ch);
|
void clearMemory(char_data *ch);
|
||||||
|
|
||||||
|
|
||||||
/* For new last command: */
|
/* For new last command: */
|
||||||
@@ -127,7 +125,7 @@ struct last_entry {
|
|||||||
int punique;
|
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);
|
struct last_entry *find_llog_entry(int punique, long idnum);
|
||||||
|
|
||||||
#endif /* _HANDLER_H_ */
|
#endif /* _HANDLER_H_ */
|
||||||
|
|||||||
+13
-13
@@ -26,17 +26,17 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void hedit_disp_menu(struct descriptor_data *);
|
static void hedit_disp_menu(descriptor_data *);
|
||||||
static void hedit_setup_new(struct descriptor_data *);
|
static void hedit_setup_new(descriptor_data *);
|
||||||
static void hedit_setup_existing(struct descriptor_data *, int);
|
static void hedit_setup_existing(descriptor_data *, int);
|
||||||
static void hedit_save_to_disk(struct descriptor_data *);
|
static void hedit_save_to_disk(descriptor_data *);
|
||||||
static void hedit_save_internally(struct descriptor_data *);
|
static void hedit_save_internally(descriptor_data *);
|
||||||
|
|
||||||
|
|
||||||
ACMD(do_oasis_hedit)
|
ACMD(do_oasis_hedit)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* 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));
|
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);
|
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);
|
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);
|
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);
|
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;
|
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);
|
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;
|
FILE *fp;
|
||||||
char buf1[MAX_STRING_LENGTH], index_name[READ_SIZE];
|
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. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ static void hedit_disp_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = HEDIT_MAIN_MENU;
|
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 buf[MAX_STRING_LENGTH];
|
||||||
char *oldtext = "";
|
char *oldtext = "";
|
||||||
@@ -357,7 +357,7 @@ void hedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
hedit_disp_menu(d);
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case HEDIT_ENTRY:
|
case HEDIT_ENTRY:
|
||||||
|
|||||||
+2
-2
@@ -19,8 +19,8 @@
|
|||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
/*
|
/*
|
||||||
* All the following functions are declared in oasis.h
|
* All the following functions are declared in oasis.h
|
||||||
void hedit_parse(struct descriptor_data *, char *);
|
void hedit_parse(descriptor_data *, char *);
|
||||||
void hedit_string_cleanup(struct descriptor_data *, int);
|
void hedit_string_cleanup(descriptor_data *, int);
|
||||||
ACMD(do_oasis_hedit);
|
ACMD(do_oasis_hedit);
|
||||||
*/
|
*/
|
||||||
/* Action fuctions */
|
/* Action fuctions */
|
||||||
|
|||||||
+29
-29
@@ -27,18 +27,18 @@ static int num_of_houses = 0;
|
|||||||
/* local functions */
|
/* local functions */
|
||||||
static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen);
|
static int House_get_filename(room_vnum vnum, char *filename, size_t maxlen);
|
||||||
static int House_load(room_vnum vnum);
|
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 void House_delete_file(room_vnum vnum);
|
||||||
static int find_house(room_vnum vnum);
|
static int find_house(room_vnum vnum);
|
||||||
static void House_save_control(void);
|
static void House_save_control(void);
|
||||||
static void hcontrol_build_house(struct char_data *ch, char *arg);
|
static void hcontrol_build_house(char_data *ch, char *arg);
|
||||||
static void hcontrol_destroy_house(struct char_data *ch, char *arg);
|
static void hcontrol_destroy_house(char_data *ch, char *arg);
|
||||||
static void hcontrol_pay_house(struct char_data *ch, char *arg);
|
static void hcontrol_pay_house(char_data *ch, char *arg);
|
||||||
static void House_listrent(struct char_data *ch, room_vnum vnum);
|
static void House_listrent(char_data *ch, room_vnum vnum);
|
||||||
/* CONVERSION code starts here -- see comment below. */
|
/* CONVERSION code starts here -- see comment below. */
|
||||||
static int ascii_convert_house(struct char_data *ch, obj_vnum vnum);
|
static int ascii_convert_house(char_data *ch, obj_vnum vnum);
|
||||||
static void hcontrol_convert_houses(struct char_data *ch);
|
static void hcontrol_convert_houses(char_data *ch);
|
||||||
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);
|
||||||
/* CONVERSION code ends here -- see comment below. */
|
/* CONVERSION code ends here -- see comment below. */
|
||||||
|
|
||||||
/* First, the basics: finding the filename; loading/saving objects */
|
/* 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
|
/* Save all objects for a house (recursive; initial call must be followed by a
|
||||||
* call to House_restore_weight) Assumes file is open already. */
|
* 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;
|
int result;
|
||||||
|
|
||||||
if (obj) {
|
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 */
|
/* 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) {
|
if (obj) {
|
||||||
House_restore_weight(obj->contains);
|
House_restore_weight(obj->contains);
|
||||||
@@ -160,7 +160,7 @@ static void House_delete_file(room_vnum vnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* List all objects in a house file */
|
/* 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;
|
FILE *fl;
|
||||||
char filename[MAX_STRING_LENGTH];
|
char filename[MAX_STRING_LENGTH];
|
||||||
@@ -288,7 +288,7 @@ static const char *HCONTROL_FORMAT =
|
|||||||
" hcontrol pay <house vnum>\r\n"
|
" hcontrol pay <house vnum>\r\n"
|
||||||
" hcontrol show [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;
|
int i;
|
||||||
char *temp;
|
char *temp;
|
||||||
@@ -300,7 +300,7 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
|
|||||||
if (*arg == '.')
|
if (*arg == '.')
|
||||||
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
|
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
|
||||||
else
|
else
|
||||||
toshow = atoi(arg);
|
toshow = atoidx(arg);
|
||||||
|
|
||||||
if ((i = find_house(toshow)) == NOWHERE) {
|
if ((i = find_house(toshow)) == NOWHERE) {
|
||||||
send_to_char(ch, "Unknown house, \"%s\".\r\n", arg);
|
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];
|
char arg1[MAX_INPUT_LENGTH];
|
||||||
struct house_control_rec temp_house;
|
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);
|
send_to_char(ch, "%s", HCONTROL_FORMAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
virt_house = atoi(arg1);
|
virt_house = atoidx(arg1);
|
||||||
if ((real_house = real_room(virt_house)) == NOWHERE) {
|
if ((real_house = real_room(virt_house)) == NOWHERE) {
|
||||||
send_to_char(ch, "No such room exists.\r\n");
|
send_to_char(ch, "No such room exists.\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -427,7 +427,7 @@ static void hcontrol_build_house(struct char_data *ch, char *arg)
|
|||||||
House_save_control();
|
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;
|
int i, j;
|
||||||
room_rnum real_atrium, real_house;
|
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);
|
send_to_char(ch, "%s", HCONTROL_FORMAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((i = find_house(atoi(arg))) == NOWHERE) {
|
if ((i = find_house(atoidx(arg))) == NOWHERE) {
|
||||||
send_to_char(ch, "Unknown house.\r\n");
|
send_to_char(ch, "Unknown house.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((real_atrium = real_room(house_control[i].atrium)) == NOWHERE)
|
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
|
else
|
||||||
REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
|
REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
|
||||||
|
|
||||||
if ((real_house = real_room(house_control[i].vnum)) == NOWHERE)
|
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 {
|
else {
|
||||||
REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
|
REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
|
||||||
REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);
|
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);
|
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;
|
int i;
|
||||||
|
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
send_to_char(ch, "%s", HCONTROL_FORMAT);
|
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");
|
send_to_char(ch, "Unknown house.\r\n");
|
||||||
else {
|
else {
|
||||||
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "Payment for house %s collected by %s.", arg, GET_NAME(ch));
|
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. */
|
/* 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;
|
int i, j;
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ int House_can_enter(struct char_data *ch, room_vnum house)
|
|||||||
return (0);
|
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;
|
int j, num_printed;
|
||||||
char *temp;
|
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 *
|
* will let your house files load on the next bootup. -Welcor *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
/* Code for conversion to ascii house rent files. */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
@@ -656,11 +656,11 @@ static void hcontrol_convert_houses(struct char_data *ch)
|
|||||||
send_to_char(ch, "All done.\r\n");
|
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;
|
FILE *in, *out;
|
||||||
char infile[MAX_INPUT_LENGTH], *outfile;
|
char infile[MAX_INPUT_LENGTH], *outfile;
|
||||||
struct obj_data *tmp;
|
obj_data *tmp;
|
||||||
int i, j=0;
|
int i, j=0;
|
||||||
|
|
||||||
House_get_filename(vnum, infile, sizeof(infile));
|
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. */
|
/* 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;
|
obj_rnum itemnum;
|
||||||
int j, taeller;
|
int j, taeller;
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -37,18 +37,17 @@ struct house_control_rec {
|
|||||||
long spare7;
|
long spare7;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TOROOM(room, dir) (world[room].dir_option[dir] ? \
|
#define TOROOM(room, dir) (world[room].dir_option[dir] ? world[room].dir_option[dir]->to_room : NOWHERE)
|
||||||
world[room].dir_option[dir]->to_room : NOWHERE)
|
|
||||||
|
|
||||||
/* Functions in house.c made externally available */
|
/* Functions in house.c made externally available */
|
||||||
/* Utility Functions */
|
/* Utility Functions */
|
||||||
void House_boot(void);
|
void House_boot(void);
|
||||||
void House_save_all(void);
|
void House_save_all(void);
|
||||||
int House_can_enter(struct char_data *ch, room_vnum house);
|
int House_can_enter(char_data *ch, room_vnum house);
|
||||||
void House_crashsave(room_vnum vnum);
|
void House_crashsave(room_vnum vnum);
|
||||||
void House_list_guests(struct char_data *ch, int i, int quiet);
|
void House_list_guests(char_data *ch, int i, int quiet);
|
||||||
int House_save(struct obj_data *obj, FILE *fp);
|
int House_save(obj_data *obj, FILE *fp);
|
||||||
void hcontrol_list_houses(struct char_data *ch, char *arg);
|
void hcontrol_list_houses(char_data *ch, char *arg);
|
||||||
/* In game Commands */
|
/* In game Commands */
|
||||||
ACMD(do_hcontrol);
|
ACMD(do_hcontrol);
|
||||||
ACMD(do_house);
|
ACMD(do_house);
|
||||||
|
|||||||
@@ -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 *read_ibt(char *filename, FILE *fp);
|
||||||
static IBT_DATA *get_first_ibt(int mode);
|
static IBT_DATA *get_first_ibt(int mode);
|
||||||
static IBT_DATA *get_last_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 */
|
/* Internal (static) OLC functions */
|
||||||
static void ibtedit_setup(struct descriptor_data *d);
|
static void ibtedit_setup(descriptor_data *d);
|
||||||
static void ibtedit_save(struct descriptor_data *d);
|
static void ibtedit_save(descriptor_data *d);
|
||||||
static void ibtedit_disp_main_menu(struct descriptor_data *d);
|
static void ibtedit_disp_main_menu(descriptor_data *d);
|
||||||
static void ibtedit_disp_flags(struct descriptor_data *d);
|
static void ibtedit_disp_flags(descriptor_data *d);
|
||||||
|
|
||||||
static IBT_DATA *new_ibt(void)
|
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 */
|
/* 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 ) {
|
if ( ch && !IS_NPC(ch) && ibtData ) {
|
||||||
|
|
||||||
@@ -773,7 +773,7 @@ ACMD(do_ibt)
|
|||||||
ACMD(do_oasis_ibtedit)
|
ACMD(do_oasis_ibtedit)
|
||||||
{
|
{
|
||||||
int number = NOTHING;
|
int number = NOTHING;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
/* No editing as a mob or while being forced. */
|
/* No editing as a mob or while being forced. */
|
||||||
@@ -845,7 +845,7 @@ ACMD(do_oasis_ibtedit)
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/* Copy IBT data into the OLC structure */
|
/* 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;
|
IBT_DATA *ibtData;
|
||||||
int i;
|
int i;
|
||||||
@@ -877,7 +877,7 @@ static void ibtedit_setup(struct descriptor_data *d)
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/* Copy IBT data back to the correct list */
|
/* 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;
|
IBT_DATA *ibtData;
|
||||||
int i;
|
int i;
|
||||||
@@ -944,9 +944,9 @@ void free_olc_ibt(IBT_DATA *toFree) {
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/* main ibtedit menu function... */
|
/* 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];
|
char flg_text[MAX_STRING_LENGTH];
|
||||||
room_rnum rr;
|
room_rnum rr;
|
||||||
|
|
||||||
@@ -978,7 +978,7 @@ static void ibtedit_disp_main_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/* Display IBT-flags menu. */
|
/* 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];
|
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. */
|
/* 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;
|
int i;
|
||||||
char *oldtext = NULL;
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ typedef struct ibt_data IBT_DATA;
|
|||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ibt_data
|
struct ibt_data {
|
||||||
{
|
|
||||||
IBT_DATA *next; /**< Pointer to next IBT in the list */
|
IBT_DATA *next; /**< Pointer to next IBT in the list */
|
||||||
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
|
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
|
||||||
char *text; /**< Header Text for this IBT */
|
char *text; /**< Header Text for this IBT */
|
||||||
@@ -96,8 +95,8 @@ ACMD(do_ibt);
|
|||||||
ACMD(do_oasis_ibtedit);
|
ACMD(do_oasis_ibtedit);
|
||||||
void save_ibt_file(int mode);
|
void save_ibt_file(int mode);
|
||||||
void load_ibt_file(int mode);
|
void load_ibt_file(int mode);
|
||||||
void ibtedit_parse(struct descriptor_data *d, char *arg);
|
void ibtedit_parse(descriptor_data *d, char *arg);
|
||||||
void ibtedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void ibtedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
void free_ibt_lists(void);
|
void free_ibt_lists(void);
|
||||||
void free_olc_ibt(IBT_DATA *toFree);
|
void free_olc_ibt(IBT_DATA *toFree);
|
||||||
void clean_ibt_list(int mode);
|
void clean_ibt_list(int mode);
|
||||||
|
|||||||
+4
-4
@@ -15,7 +15,7 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
|
|
||||||
void send_editor_help(struct descriptor_data *d)
|
void send_editor_help(descriptor_data *d)
|
||||||
{
|
{
|
||||||
if (using_improved_editor)
|
if (using_improved_editor)
|
||||||
write_to_output(d, "Instructions: /s to save, /h for more options.\r\n");
|
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
|
#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];
|
char actions[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ int improved_editor_execute(struct descriptor_data *d, char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle some editor commands. */
|
/* 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;
|
int indent = 0, rep_all = 0, flags = 0, replaced, i, line_low, line_high, j = 0;
|
||||||
unsigned int total_len;
|
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)
|
/* Re-formats message type formatted char *. (for strings edited with d->str)
|
||||||
* (mostly olc and mail). */
|
* (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;
|
int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
|
||||||
char *flow, *start = NULL, temp;
|
char *flow, *start = NULL, temp;
|
||||||
|
|||||||
+4
-4
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#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);
|
void parse_edit_action(int command, char *string, descriptor_data *d);
|
||||||
int improved_editor_execute(struct descriptor_data *d, char *string);
|
int improved_editor_execute(descriptor_data *d, char *string);
|
||||||
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 replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size);
|
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(). */
|
/* Action modes for parse_edit_action(). */
|
||||||
#define PARSE_FORMAT 0
|
#define PARSE_FORMAT 0
|
||||||
|
|||||||
+45
-44
@@ -39,11 +39,11 @@
|
|||||||
#include "mud_event.h"
|
#include "mud_event.h"
|
||||||
|
|
||||||
/* local (file scope) functions */
|
/* local (file scope) functions */
|
||||||
static int perform_dupe_check(struct descriptor_data *d);
|
static int perform_dupe_check(descriptor_data *d);
|
||||||
static struct alias_data *find_alias(struct alias_data *alias_list, char *str);
|
static struct alias_data *find_alias(struct alias_data *alias_list, char *str);
|
||||||
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a);
|
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a);
|
||||||
static int _parse_name(char *arg, char *name);
|
static int _parse_name(char *arg, char *name);
|
||||||
static bool perform_new_char_dupe_check(struct descriptor_data *d);
|
static bool perform_new_char_dupe_check(descriptor_data *d);
|
||||||
/* sort_commands utility */
|
/* sort_commands utility */
|
||||||
static int sort_commands_helper(const void *a, const void *b);
|
static int sort_commands_helper(const void *a, const void *b);
|
||||||
|
|
||||||
@@ -364,7 +364,8 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||||||
{ "zcheck", "zcheck", POS_DEAD, do_zcheck, LVL_BUILDER, 0 },
|
{ "zcheck", "zcheck", POS_DEAD, do_zcheck, LVL_BUILDER, 0 },
|
||||||
{ "zpurge", "zpurge", POS_DEAD, do_zpurge, LVL_BUILDER, 0 },
|
{ "zpurge", "zpurge", POS_DEAD, do_zpurge, LVL_BUILDER, 0 },
|
||||||
|
|
||||||
{ "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */
|
{ "\n", "zzzzzzz", 0, 0, 0, 0 }
|
||||||
|
}; /* this must be last */
|
||||||
|
|
||||||
|
|
||||||
/* Thanks to Melzaren for this change to allow DG Scripts to be attachable
|
/* Thanks to Melzaren for this change to allow DG Scripts to be attachable
|
||||||
@@ -394,9 +395,11 @@ static const struct mob_script_command_t mob_script_commands[] = {
|
|||||||
{ "mzoneecho", do_mzoneecho, 0 },
|
{ "mzoneecho", do_mzoneecho, 0 },
|
||||||
{ "mfollow", do_mfollow, 0 },
|
{ "mfollow", do_mfollow, 0 },
|
||||||
{ "mlog", do_mlog, 0 },
|
{ "mlog", do_mlog, 0 },
|
||||||
{ "\n" , do_not_here , 0 } };
|
{ "\n", do_not_here, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
int script_command_interpreter(struct char_data *ch, char *arg) {
|
int script_command_interpreter(char_data *ch, char *arg)
|
||||||
|
{
|
||||||
/* DG trigger commands */
|
/* DG trigger commands */
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -422,8 +425,7 @@ int script_command_interpreter(struct char_data *ch, char *arg) {
|
|||||||
return 1; // We took care of execution. Let caller know.
|
return 1; // We took care of execution. Let caller know.
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *fill[] =
|
static const char *fill[] = {
|
||||||
{
|
|
||||||
"in",
|
"in",
|
||||||
"from",
|
"from",
|
||||||
"with",
|
"with",
|
||||||
@@ -434,8 +436,7 @@ static const char *fill[] =
|
|||||||
"\n"
|
"\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *reserved[] =
|
static const char *reserved[] = {
|
||||||
{
|
|
||||||
"a",
|
"a",
|
||||||
"an",
|
"an",
|
||||||
"self",
|
"self",
|
||||||
@@ -474,7 +475,7 @@ void sort_commands(void)
|
|||||||
/* This is the actual command interpreter called from game_loop() in comm.c
|
/* This is the actual command interpreter called from game_loop() in comm.c
|
||||||
* It makes sure you are the proper level and position to execute the command,
|
* It makes sure you are the proper level and position to execute the command,
|
||||||
* then calls the appropriate function. */
|
* then calls the appropriate function. */
|
||||||
void command_interpreter(struct char_data *ch, char *argument)
|
void command_interpreter(char_data *ch, char *argument)
|
||||||
{
|
{
|
||||||
int cmd, length;
|
int cmd, length;
|
||||||
char *line;
|
char *line;
|
||||||
@@ -532,25 +533,21 @@ void command_interpreter(struct char_data *ch, char *argument)
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
send_to_char(ch, "%s", CONFIG_HUH);
|
send_to_char(ch, "%s", CONFIG_HUH);
|
||||||
|
|
||||||
for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++)
|
for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) {
|
||||||
{
|
|
||||||
if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch))
|
if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Only apply levenshtein counts if the command is not a trigger command. */
|
/* Only apply levenshtein counts if the command is not a trigger command. */
|
||||||
if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) &&
|
if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) &&
|
||||||
(cmd_info[cmd].minimum_level >= 0) )
|
(cmd_info[cmd].minimum_level >= 0) ) {
|
||||||
{
|
if (!found) {
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
send_to_char(ch, "\r\nDid you mean:\r\n");
|
send_to_char(ch, "\r\nDid you mean:\r\n");
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
send_to_char(ch, " %s\r\n", cmd_info[cmd].command);
|
send_to_char(ch, " %s\r\n", cmd_info[cmd].command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL)
|
||||||
else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL)
|
|
||||||
send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n");
|
send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n");
|
||||||
else if (complete_cmd_info[cmd].command_pointer == NULL)
|
else if (complete_cmd_info[cmd].command_pointer == NULL)
|
||||||
send_to_char(ch, "Sorry, that command hasn't been implemented yet.\r\n");
|
send_to_char(ch, "Sorry, that command hasn't been implemented yet.\r\n");
|
||||||
@@ -727,7 +724,7 @@ static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alia
|
|||||||
* 0: String was modified in place; call command_interpreter immediately.
|
* 0: String was modified in place; call command_interpreter immediately.
|
||||||
* 1: String was _not_ modified in place; rather, the expanded aliases
|
* 1: String was _not_ modified in place; rather, the expanded aliases
|
||||||
* have been placed at the front of the character's input queue. */
|
* have been placed at the front of the character's input queue. */
|
||||||
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen)
|
int perform_alias(descriptor_data *d, char *orig, size_t maxlen)
|
||||||
{
|
{
|
||||||
char first_arg[MAX_INPUT_LENGTH], *ptr;
|
char first_arg[MAX_INPUT_LENGTH], *ptr;
|
||||||
struct alias_data *a, *tmp;
|
struct alias_data *a, *tmp;
|
||||||
@@ -970,10 +967,10 @@ int find_command(const char *command)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int special(struct char_data *ch, int cmd, char *arg)
|
int special(char_data *ch, int cmd, char *arg)
|
||||||
{
|
{
|
||||||
struct obj_data *i;
|
obj_data *i;
|
||||||
struct char_data *k;
|
char_data *k;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
/* special in room? */
|
/* special in room? */
|
||||||
@@ -1030,10 +1027,10 @@ static int _parse_name(char *arg, char *name)
|
|||||||
#define UNSWITCH 3
|
#define UNSWITCH 3
|
||||||
|
|
||||||
/* This function seems a bit over-extended. */
|
/* This function seems a bit over-extended. */
|
||||||
static int perform_dupe_check(struct descriptor_data *d)
|
static int perform_dupe_check(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct descriptor_data *k, *next_k;
|
descriptor_data *k, *next_k;
|
||||||
struct char_data *target = NULL, *ch, *next_ch;
|
char_data *target = NULL, *ch, *next_ch;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int pref_temp = 0; /* for "last" log */
|
int pref_temp = 0; /* for "last" log */
|
||||||
int id = GET_IDNUM(d->character);
|
int id = GET_IDNUM(d->character);
|
||||||
@@ -1149,7 +1146,8 @@ static int perform_dupe_check(struct descriptor_data *d)
|
|||||||
case RECON:
|
case RECON:
|
||||||
write_to_output(d, "Reconnecting.\r\n");
|
write_to_output(d, "Reconnecting.\r\n");
|
||||||
act("$n has reconnected.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n has reconnected.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host);
|
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character),
|
||||||
|
d->host);
|
||||||
if (has_mail(GET_IDNUM(d->character)))
|
if (has_mail(GET_IDNUM(d->character)))
|
||||||
write_to_output(d, "You have mail waiting.\r\n");
|
write_to_output(d, "You have mail waiting.\r\n");
|
||||||
break;
|
break;
|
||||||
@@ -1163,7 +1161,8 @@ static int perform_dupe_check(struct descriptor_data *d)
|
|||||||
break;
|
break;
|
||||||
case UNSWITCH:
|
case UNSWITCH:
|
||||||
write_to_output(d, "Reconnecting to unswitched char.");
|
write_to_output(d, "Reconnecting to unswitched char.");
|
||||||
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character), d->host);
|
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s [%s] has reconnected.", GET_NAME(d->character),
|
||||||
|
d->host);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,9 +1170,9 @@ static int perform_dupe_check(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* New Char dupe-check called at the start of character creation */
|
/* New Char dupe-check called at the start of character creation */
|
||||||
static bool perform_new_char_dupe_check(struct descriptor_data *d)
|
static bool perform_new_char_dupe_check(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct descriptor_data *k, *next_k;
|
descriptor_data *k, *next_k;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
|
|
||||||
/* Now that this descriptor has successfully logged in, disconnect all
|
/* Now that this descriptor has successfully logged in, disconnect all
|
||||||
@@ -1227,7 +1226,7 @@ static bool perform_new_char_dupe_check(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* load the player, put them in the right room - used by copyover_recover too */
|
/* load the player, put them in the right room - used by copyover_recover too */
|
||||||
int enter_player_game (struct descriptor_data *d)
|
int enter_player_game (descriptor_data *d)
|
||||||
{
|
{
|
||||||
int load_result;
|
int load_result;
|
||||||
room_vnum load_room;
|
room_vnum load_room;
|
||||||
@@ -1281,7 +1280,7 @@ int enter_player_game (struct descriptor_data *d)
|
|||||||
|
|
||||||
EVENTFUNC(get_protocols)
|
EVENTFUNC(get_protocols)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
struct mud_event_data *pMudEvent;
|
struct mud_event_data *pMudEvent;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -1290,12 +1289,13 @@ EVENTFUNC(get_protocols)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pMudEvent = (struct mud_event_data *) event_obj;
|
pMudEvent = (struct mud_event_data *) event_obj;
|
||||||
d = (struct descriptor_data *) pMudEvent->pStruct;
|
d = (descriptor_data *) pMudEvent->pStruct;
|
||||||
|
|
||||||
/* Clear extra white space from the "protocol scroll" */
|
/* Clear extra white space from the "protocol scroll" */
|
||||||
write_to_output(d, "[H[J");
|
write_to_output(d, "[H[J");
|
||||||
|
|
||||||
len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ", d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString);
|
len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ",
|
||||||
|
d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString);
|
||||||
|
|
||||||
if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt)
|
if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt)
|
||||||
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | ");
|
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | ");
|
||||||
@@ -1305,7 +1305,8 @@ EVENTFUNC(get_protocols)
|
|||||||
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | ");
|
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | ");
|
||||||
|
|
||||||
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No");
|
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No");
|
||||||
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ", d->pProtocol->bMSDP ? "Yes" : "No");
|
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ",
|
||||||
|
d->pProtocol->bMSDP ? "Yes" : "No");
|
||||||
snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No");
|
snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No");
|
||||||
|
|
||||||
write_to_output(d, buf, 0);
|
write_to_output(d, buf, 0);
|
||||||
@@ -1316,7 +1317,7 @@ EVENTFUNC(get_protocols)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* deal with newcomers and other non-playing sockets */
|
/* deal with newcomers and other non-playing sockets */
|
||||||
void nanny(struct descriptor_data *d, char *arg)
|
void nanny(descriptor_data *d, char *arg)
|
||||||
{
|
{
|
||||||
int load_result; /* Overloaded variable */
|
int load_result; /* Overloaded variable */
|
||||||
int player_i;
|
int player_i;
|
||||||
@@ -1324,7 +1325,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
/* OasisOLC states */
|
/* OasisOLC states */
|
||||||
struct {
|
struct {
|
||||||
int state;
|
int state;
|
||||||
void (*func)(struct descriptor_data *, char *);
|
void (*func)(descriptor_data *, char *);
|
||||||
} olc_functions[] = {
|
} olc_functions[] = {
|
||||||
{ CON_OEDIT, oedit_parse },
|
{ CON_OEDIT, oedit_parse },
|
||||||
{ CON_ZEDIT, zedit_parse },
|
{ CON_ZEDIT, zedit_parse },
|
||||||
@@ -1358,7 +1359,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
return;
|
return;
|
||||||
case CON_GET_NAME: /* wait for input of name */
|
case CON_GET_NAME: /* wait for input of name */
|
||||||
if (d->character == NULL) {
|
if (d->character == NULL) {
|
||||||
CREATE(d->character, struct char_data, 1);
|
CREATE(d->character, char_data, 1);
|
||||||
clear_char(d->character);
|
clear_char(d->character);
|
||||||
CREATE(d->character->player_specials, struct player_special_data, 1);
|
CREATE(d->character->player_specials, struct player_special_data, 1);
|
||||||
|
|
||||||
@@ -1395,7 +1396,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d, "Invalid name, please try another.\r\nName: ");
|
write_to_output(d, "Invalid name, please try another.\r\nName: ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CREATE(d->character, struct char_data, 1);
|
CREATE(d->character, char_data, 1);
|
||||||
clear_char(d->character);
|
clear_char(d->character);
|
||||||
CREATE(d->character->player_specials, struct player_special_data, 1);
|
CREATE(d->character->player_specials, struct player_special_data, 1);
|
||||||
|
|
||||||
@@ -1525,13 +1526,13 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d, "%s", motd);
|
write_to_output(d, "%s", motd);
|
||||||
|
|
||||||
if (GET_INVIS_LEV(d->character))
|
if (GET_INVIS_LEV(d->character))
|
||||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character), GET_INVIS_LEV(d->character));
|
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "%s has connected. (invis %d)", GET_NAME(d->character),
|
||||||
|
GET_INVIS_LEV(d->character));
|
||||||
else
|
else
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character));
|
mudlog(BRF, LVL_IMMORT, TRUE, "%s has connected.", GET_NAME(d->character));
|
||||||
|
|
||||||
/* Add to the list of 'recent' players (since last reboot) */
|
/* Add to the list of 'recent' players (since last reboot) */
|
||||||
if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, FALSE) == FALSE)
|
if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, FALSE) == FALSE) {
|
||||||
{
|
|
||||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1554,7 +1555,8 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
write_to_output(d, "\r\nIllegal password.\r\nPassword: ");
|
write_to_output(d, "\r\nIllegal password.\r\nPassword: ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strncpy(GET_PASSWD(d->character), CRYPT(arg, GET_PC_NAME(d->character)), MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH+1) */
|
strncpy(GET_PASSWD(d->character), CRYPT(arg, GET_PC_NAME(d->character)),
|
||||||
|
MAX_PWD_LENGTH); /* strncpy: OK (G_P:MAX_PWD_LENGTH+1) */
|
||||||
*(GET_PASSWD(d->character) + MAX_PWD_LENGTH) = '\0';
|
*(GET_PASSWD(d->character) + MAX_PWD_LENGTH) = '\0';
|
||||||
|
|
||||||
write_to_output(d, "\r\nPlease retype password: ");
|
write_to_output(d, "\r\nPlease retype password: ");
|
||||||
@@ -1634,8 +1636,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||||||
mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host);
|
mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host);
|
||||||
|
|
||||||
/* Add to the list of 'recent' players (since last reboot) */
|
/* Add to the list of 'recent' players (since last reboot) */
|
||||||
if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE)
|
if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE) {
|
||||||
{
|
|
||||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+7
-7
@@ -21,7 +21,7 @@
|
|||||||
#define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move)
|
#define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move)
|
||||||
|
|
||||||
void sort_commands(void);
|
void sort_commands(void);
|
||||||
void command_interpreter(struct char_data *ch, char *argument);
|
void command_interpreter(char_data *ch, char *argument);
|
||||||
int search_block(char *arg, const char **list, int exact);
|
int search_block(char *arg, const char **list, int exact);
|
||||||
char *one_argument(char *argument, char *first_arg);
|
char *one_argument(char *argument, char *first_arg);
|
||||||
char *one_word(char *argument, char *first_arg);
|
char *one_word(char *argument, char *first_arg);
|
||||||
@@ -30,16 +30,16 @@ char *two_arguments(char *argument, char *first_arg, char *second_arg);
|
|||||||
int fill_word(char *argument);
|
int fill_word(char *argument);
|
||||||
int reserved_word(char *argument);
|
int reserved_word(char *argument);
|
||||||
void half_chop(char *string, char *arg1, char *arg2);
|
void half_chop(char *string, char *arg1, char *arg2);
|
||||||
void nanny(struct descriptor_data *d, char *arg);
|
void nanny(descriptor_data *d, char *arg);
|
||||||
int is_abbrev(const char *arg1, const char *arg2);
|
int is_abbrev(const char *arg1, const char *arg2);
|
||||||
int is_number(const char *str);
|
int is_number(const char *str);
|
||||||
int find_command(const char *command);
|
int find_command(const char *command);
|
||||||
void skip_spaces(char **string);
|
void skip_spaces(char **string);
|
||||||
char *delete_doubledollar(char *string);
|
char *delete_doubledollar(char *string);
|
||||||
int special(struct char_data *ch, int cmd, char *arg);
|
int special(char_data *ch, int cmd, char *arg);
|
||||||
void free_alias(struct alias_data *a);
|
void free_alias(struct alias_data *a);
|
||||||
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
|
int perform_alias(descriptor_data *d, char *orig, size_t maxlen);
|
||||||
int enter_player_game (struct descriptor_data *d);
|
int enter_player_game (descriptor_data *d);
|
||||||
/* ACMDs available through interpreter.c */
|
/* ACMDs available through interpreter.c */
|
||||||
ACMD(do_alias);
|
ACMD(do_alias);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ struct command_info {
|
|||||||
const char *sort_as;
|
const char *sort_as;
|
||||||
byte minimum_position;
|
byte minimum_position;
|
||||||
void (*command_pointer)
|
void (*command_pointer)
|
||||||
(struct char_data *ch, char *argument, int cmd, int subcmd);
|
(char_data *ch, char *argument, int cmd, int subcmd);
|
||||||
sh_int minimum_level;
|
sh_int minimum_level;
|
||||||
int subcmd;
|
int subcmd;
|
||||||
};
|
};
|
||||||
@@ -66,7 +66,7 @@ struct command_info {
|
|||||||
struct mob_script_command_t {
|
struct mob_script_command_t {
|
||||||
const char *command_name;
|
const char *command_name;
|
||||||
void (*command_pointer)
|
void (*command_pointer)
|
||||||
(struct char_data *ch, char *argument, int cmd, int subcmd);
|
(char_data *ch, char *argument, int cmd, int subcmd);
|
||||||
int subcmd;
|
int subcmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/* local file scope function prototypes */
|
/* 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 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
|
/* 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_
|
* that a character's age will now only affect the HMV gain per tick, and _not_
|
||||||
* the HMV maximums. */
|
* the HMV maximums. */
|
||||||
/* manapoint gain pr. game hour */
|
/* manapoint gain pr. game hour */
|
||||||
int mana_gain(struct char_data *ch)
|
int mana_gain(char_data *ch)
|
||||||
{
|
{
|
||||||
int gain;
|
int gain;
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ int mana_gain(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Hitpoint gain pr. game hour */
|
/* Hitpoint gain pr. game hour */
|
||||||
int hit_gain(struct char_data *ch)
|
int hit_gain(char_data *ch)
|
||||||
{
|
{
|
||||||
int gain;
|
int gain;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ int hit_gain(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move gain pr. game hour */
|
/* move gain pr. game hour */
|
||||||
int move_gain(struct char_data *ch)
|
int move_gain(char_data *ch)
|
||||||
{
|
{
|
||||||
int gain;
|
int gain;
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ int move_gain(struct char_data *ch)
|
|||||||
return (gain);
|
return (gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_title(struct char_data *ch, char *title)
|
void set_title(char_data *ch, char *title)
|
||||||
{
|
{
|
||||||
if (GET_TITLE(ch) != NULL)
|
if (GET_TITLE(ch) != NULL)
|
||||||
free(GET_TITLE(ch));
|
free(GET_TITLE(ch));
|
||||||
@@ -220,7 +220,7 @@ void run_autowiz(void)
|
|||||||
#endif /* CIRCLE_UNIX || CIRCLE_WINDOWS */
|
#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 is_altered = FALSE;
|
||||||
int num_levels = 0;
|
int num_levels = 0;
|
||||||
@@ -267,7 +267,7 @@ void gain_exp(struct char_data *ch, int gain)
|
|||||||
run_autowiz();
|
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 is_altered = FALSE;
|
||||||
int num_levels = 0;
|
int num_levels = 0;
|
||||||
@@ -302,7 +302,7 @@ void gain_exp_regardless(struct char_data *ch, int gain)
|
|||||||
run_autowiz();
|
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;
|
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 (ch->char_specials.timer > CONFIG_IDLE_VOID) {
|
||||||
if (GET_WAS_IN(ch) == NOWHERE && IN_ROOM(ch) != NOWHERE) {
|
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 */
|
/* Update PCs, NPCs, and objects */
|
||||||
void point_update(void)
|
void point_update(void)
|
||||||
{
|
{
|
||||||
struct char_data *i, *next_char;
|
char_data *i, *next_char;
|
||||||
struct obj_data *j, *next_thing, *jj, *next_thing2;
|
obj_data *j, *next_thing, *jj, *next_thing2;
|
||||||
|
|
||||||
/* characters */
|
/* characters */
|
||||||
for (i = character_list; i; i = next_char) {
|
for (i = character_list; i; i = next_char) {
|
||||||
@@ -471,7 +471,7 @@ void point_update(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Note: amt may be negative */
|
/* 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;
|
int curr_gold;
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ int increase_gold(struct char_data *ch, int amt)
|
|||||||
return (GET_GOLD(ch));
|
return (GET_GOLD(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
int decrease_gold(struct char_data *ch, int deduction)
|
int decrease_gold(char_data *ch, int deduction)
|
||||||
{
|
{
|
||||||
int amt;
|
int amt;
|
||||||
amt = (deduction * -1);
|
amt = (deduction * -1);
|
||||||
@@ -500,7 +500,7 @@ int decrease_gold(struct char_data *ch, int deduction)
|
|||||||
return (GET_GOLD(ch));
|
return (GET_GOLD(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
int increase_bank(struct char_data *ch, int amt)
|
int increase_bank(char_data *ch, int amt)
|
||||||
{
|
{
|
||||||
int curr_bank;
|
int curr_bank;
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ int increase_bank(struct char_data *ch, int amt)
|
|||||||
return (GET_BANK_GOLD(ch));
|
return (GET_BANK_GOLD(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
int decrease_bank(struct char_data *ch, int deduction)
|
int decrease_bank(char_data *ch, int deduction)
|
||||||
{
|
{
|
||||||
int amt;
|
int amt;
|
||||||
amt = (deduction * -1);
|
amt = (deduction * -1);
|
||||||
|
|||||||
+27
-27
@@ -25,15 +25,15 @@
|
|||||||
|
|
||||||
|
|
||||||
/* local file scope function prototypes */
|
/* local file scope function prototypes */
|
||||||
static int mag_materials(struct char_data *ch, IDXTYPE item0, IDXTYPE item1, IDXTYPE item2, int extract, int verbose);
|
static int mag_materials(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 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 apply_saving_throw[] values make saving throws better! So do
|
||||||
* negative modifiers. Though people may be used to the reverse of that.
|
* 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
|
* It's due to the code modifying the target saving throw instead of the
|
||||||
* random number of the character as in some other systems. */
|
* 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 */
|
/* NPCs use warrior tables according to some book */
|
||||||
int class_sav = CLASS_WARRIOR;
|
int class_sav = CLASS_WARRIOR;
|
||||||
@@ -58,7 +58,7 @@ int mag_savingthrow(struct char_data *ch, int type, int modifier)
|
|||||||
void affect_update(void)
|
void affect_update(void)
|
||||||
{
|
{
|
||||||
struct affected_type *af, *next;
|
struct affected_type *af, *next;
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
|
|
||||||
for (i = character_list; i; i = i->next)
|
for (i = character_list; i; i = i->next)
|
||||||
for (af = i->affected; af; af = 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.
|
* 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.
|
* @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)
|
IDXTYPE item1, IDXTYPE item2, int extract, int verbose)
|
||||||
{
|
{
|
||||||
/* Begin Local variable definitions. */
|
/* Begin Local variable definitions. */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Used for object searches. */
|
/* Used for object searches. */
|
||||||
struct obj_data *tobj = NULL;
|
obj_data *tobj = NULL;
|
||||||
/* Points to found reagents. */
|
/* 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. */
|
/* 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
|
/* 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
|
* 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. */
|
* 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 spellnum, int savetype)
|
||||||
{
|
{
|
||||||
int dam = 0;
|
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) */
|
* affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod) */
|
||||||
#define MAX_SPELL_AFFECTS 5 /* change if more needed */
|
#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)
|
int spellnum, int savetype)
|
||||||
{
|
{
|
||||||
struct affected_type af[MAX_SPELL_AFFECTS];
|
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
|
/* This function is used to provide services to mag_groups. This function is
|
||||||
* the one you should change to add new group spells. */
|
* the one you should change to add new group spells. */
|
||||||
static void perform_mag_groups(int level, struct char_data *ch,
|
static void perform_mag_groups(int level, char_data *ch,
|
||||||
struct char_data *tch, int spellnum, int savetype)
|
char_data *tch, int spellnum, int savetype)
|
||||||
{
|
{
|
||||||
switch (spellnum) {
|
switch (spellnum) {
|
||||||
case SPELL_GROUP_HEAL:
|
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
|
* 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.
|
* add new group spells, you shouldn't have to change anything in mag_groups.
|
||||||
* Just add a new case to perform_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)
|
if (ch == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -583,7 +583,7 @@ void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
|
|||||||
if (!GROUP(ch))
|
if (!GROUP(ch))
|
||||||
return;
|
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))
|
if (IN_ROOM(tch) != IN_ROOM(ch))
|
||||||
continue;
|
continue;
|
||||||
if (tch == ch)
|
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
|
/* Mass spells affect every creature in the room except the caster. No spells
|
||||||
* of this class currently implemented. */
|
* 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) {
|
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch_next) {
|
||||||
tch_next = tch->next_in_room;
|
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.
|
* 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
|
* 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. */
|
* 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;
|
const char *to_char = NULL, *to_room = NULL;
|
||||||
|
|
||||||
if (ch == NULL)
|
if (ch == NULL)
|
||||||
@@ -702,11 +702,11 @@ static const char *mag_summon_fail_msgs[] = {
|
|||||||
#define OBJ_CLONE 161 /**< vnum for clone material. */
|
#define OBJ_CLONE 161 /**< vnum for clone material. */
|
||||||
#define MOB_ZOMBIE 11 /**< vnum for the zombie mob. */
|
#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)
|
int spellnum, int savetype)
|
||||||
{
|
{
|
||||||
struct char_data *mob = NULL;
|
char_data *mob = NULL;
|
||||||
struct obj_data *tobj, *next_obj;
|
obj_data *tobj, *next_obj;
|
||||||
int pfail = 0, msg = 0, fmsg = 0, num = 1, handle_corpse = FALSE, i;
|
int pfail = 0, msg = 0, fmsg = 0, num = 1, handle_corpse = FALSE, i;
|
||||||
mob_vnum mob_num;
|
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 spellnum, int savetype)
|
||||||
{
|
{
|
||||||
int healing = 0, move = 0;
|
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);
|
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 spellnum, int type)
|
||||||
{
|
{
|
||||||
int spell = 0, msg_not_affected = TRUE;
|
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);
|
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)
|
int spellnum, int savetype)
|
||||||
{
|
{
|
||||||
const char *to_char = NULL, *to_room = NULL;
|
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);
|
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;
|
obj_vnum z;
|
||||||
|
|
||||||
if (ch == NULL)
|
if (ch == NULL)
|
||||||
@@ -969,7 +969,7 @@ void mag_creations(int level, struct char_data *ch, int spellnum)
|
|||||||
load_otrigger(tobj);
|
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;
|
room_rnum rnum;
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
|
|||||||
+12
-12
@@ -21,9 +21,9 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
/* local (file scope) function prototypes */
|
/* 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_send_mail(char_data *ch, 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_check_mail(char_data *ch, 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_receive_mail(char_data *ch, char_data *mailman, int cmd, char *arg);
|
||||||
static int mail_recip_ok(const char *name);
|
static int mail_recip_ok(const char *name);
|
||||||
static void write_mail_record(FILE *mail_file, struct mail_t *record);
|
static void write_mail_record(FILE *mail_file, struct mail_t *record);
|
||||||
static void free_mail_record(struct mail_t *record);
|
static void free_mail_record(struct mail_t *record);
|
||||||
@@ -257,19 +257,19 @@ SPECIAL(postmaster)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_IS("mail")) {
|
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);
|
return (1);
|
||||||
} else if (CMD_IS("check")) {
|
} 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);
|
return (1);
|
||||||
} else if (CMD_IS("receive")) {
|
} 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);
|
return (1);
|
||||||
} else
|
} else
|
||||||
return (0);
|
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)
|
int cmd, char *arg)
|
||||||
{
|
{
|
||||||
long recipient;
|
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);
|
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)
|
int cmd, char *arg)
|
||||||
{
|
{
|
||||||
if (has_mail(GET_IDNUM(ch)))
|
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);
|
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)
|
int cmd, char *arg)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if (!has_mail(GET_IDNUM(ch))) {
|
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)
|
for (d = descriptor_list; d; d = d->next)
|
||||||
if ((IS_PLAYING(d)) && (GET_IDNUM(d->character) == recipient_id) && (has_mail(GET_IDNUM(d->character))))
|
if ((IS_PLAYING(d)) && (GET_IDNUM(d->character) == recipient_id) && (has_mail(GET_IDNUM(d->character))))
|
||||||
|
|||||||
+2
-3
@@ -41,7 +41,7 @@ int scan_file(void);
|
|||||||
int has_mail(long recipient);
|
int has_mail(long recipient);
|
||||||
void store_mail(long to, long from, char *message_pointer);
|
void store_mail(long to, long from, char *message_pointer);
|
||||||
char *read_delete(long recipient);
|
char *read_delete(long recipient);
|
||||||
void notify_if_playing(struct char_data *from, int recipient_id);
|
void notify_if_playing(char_data *from, int recipient_id);
|
||||||
|
|
||||||
struct mail_t {
|
struct mail_t {
|
||||||
long recipient;
|
long recipient;
|
||||||
@@ -66,8 +66,7 @@ struct header_data_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* size of the data part of a header block */
|
/* size of the data part of a header block */
|
||||||
#define HEADER_BLOCK_DATASIZE \
|
#define HEADER_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
|
||||||
(BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
|
|
||||||
|
|
||||||
/* size of the data part of a data block */
|
/* size of the data part of a data block */
|
||||||
#define DATA_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(char))
|
#define DATA_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(char))
|
||||||
|
|||||||
+31
-31
@@ -28,23 +28,23 @@
|
|||||||
#include "modify.h" /* for smash_tilde */
|
#include "modify.h" /* for smash_tilde */
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void medit_setup_new(struct descriptor_data *d);
|
static void medit_setup_new(descriptor_data *d);
|
||||||
static void init_mobile(struct char_data *mob);
|
static void init_mobile(char_data *mob);
|
||||||
static void medit_save_to_disk(zone_vnum zone_num);
|
static void medit_save_to_disk(zone_vnum zone_num);
|
||||||
static void medit_disp_positions(struct descriptor_data *d);
|
static void medit_disp_positions(descriptor_data *d);
|
||||||
static void medit_disp_sex(struct descriptor_data *d);
|
static void medit_disp_sex(descriptor_data *d);
|
||||||
static void medit_disp_attack_types(struct descriptor_data *d);
|
static void medit_disp_attack_types(descriptor_data *d);
|
||||||
static bool medit_illegal_mob_flag(int fl);
|
static bool medit_illegal_mob_flag(int fl);
|
||||||
static int medit_get_mob_flag_by_number(int num);
|
static int medit_get_mob_flag_by_number(int num);
|
||||||
static void medit_disp_mob_flags(struct descriptor_data *d);
|
static void medit_disp_mob_flags(descriptor_data *d);
|
||||||
static void medit_disp_aff_flags(struct descriptor_data *d);
|
static void medit_disp_aff_flags(descriptor_data *d);
|
||||||
static void medit_disp_menu(struct descriptor_data *d);
|
static void medit_disp_menu(descriptor_data *d);
|
||||||
|
|
||||||
/* utility functions */
|
/* utility functions */
|
||||||
ACMD(do_oasis_medit)
|
ACMD(do_oasis_medit)
|
||||||
{
|
{
|
||||||
int number = NOBODY, save = 0, real_num;
|
int number = NOBODY, save = 0, real_num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[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));
|
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. */
|
/* Allocate a scratch mobile structure. */
|
||||||
CREATE(mob, struct char_data, 1);
|
CREATE(mob, char_data, 1);
|
||||||
|
|
||||||
init_mobile(mob);
|
init_mobile(mob);
|
||||||
|
|
||||||
@@ -199,12 +199,12 @@ static void medit_setup_new(struct descriptor_data *d)
|
|||||||
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
|
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. */
|
/* Allocate a scratch mobile structure. */
|
||||||
CREATE(mob, struct char_data, 1);
|
CREATE(mob, char_data, 1);
|
||||||
|
|
||||||
copy_mobile(mob, mob_proto + rmob_num);
|
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. */
|
/* 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);
|
clear_char(mob);
|
||||||
|
|
||||||
@@ -245,12 +245,12 @@ static void init_mobile(struct char_data *mob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Save new/edited mob to memory. */
|
/* Save new/edited mob to memory. */
|
||||||
void medit_save_internally(struct descriptor_data *d)
|
void medit_save_internally(descriptor_data *d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
mob_rnum new_rnum;
|
mob_rnum new_rnum;
|
||||||
struct descriptor_data *dsc;
|
descriptor_data *dsc;
|
||||||
struct char_data *mob;
|
char_data *mob;
|
||||||
|
|
||||||
i = (real_mobile(OLC_NUM(d)) == NOBODY);
|
i = (real_mobile(OLC_NUM(d)) == NOBODY);
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ void medit_save_internally(struct descriptor_data *d)
|
|||||||
|
|
||||||
/* Menu functions
|
/* Menu functions
|
||||||
Display positions. (sitting, standing, etc) */
|
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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -312,7 +312,7 @@ static void medit_disp_positions(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display the gender of the mobile. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -321,7 +321,7 @@ static void medit_disp_sex(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display attack types menu. */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ static int medit_get_mob_flag_by_number(int num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display mob-flags menu. */
|
/* 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;
|
int i, count = 0, columns = 0;
|
||||||
char flags[MAX_STRING_LENGTH];
|
char flags[MAX_STRING_LENGTH];
|
||||||
@@ -390,7 +390,7 @@ static void medit_disp_mob_flags(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display affection flags menu. */
|
/* 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];
|
char flags[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -404,9 +404,9 @@ static void medit_disp_aff_flags(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display main menu. */
|
/* 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];
|
char flags[MAX_STRING_LENGTH], flag2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
mob = OLC_MOB(d);
|
mob = OLC_MOB(d);
|
||||||
@@ -459,9 +459,9 @@ static void medit_disp_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display main menu. */
|
/* 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];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
mob = OLC_MOB(d);
|
mob = OLC_MOB(d);
|
||||||
@@ -525,7 +525,7 @@ static void medit_disp_stats_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = MEDIT_STATS_MENU;
|
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;
|
int i = -1, j;
|
||||||
char *oldtext = NULL;
|
char *oldtext = NULL;
|
||||||
@@ -1103,7 +1103,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
|||||||
medit_disp_menu(d);
|
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)) {
|
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;
|
int mob_lev;
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/* local file scope only function prototypes */
|
/* 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)
|
void mobile_activity(void)
|
||||||
{
|
{
|
||||||
struct char_data *ch, *next_ch, *vict;
|
char_data *ch, *next_ch, *vict;
|
||||||
struct obj_data *obj, *best_obj;
|
obj_data *obj, *best_obj;
|
||||||
int door, found, max;
|
int door, found, max;
|
||||||
memory_rec *names;
|
memory_rec *names;
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ void mobile_activity(void)
|
|||||||
|
|
||||||
/* Mob Memory Routines */
|
/* Mob Memory Routines */
|
||||||
/* make ch remember victim */
|
/* 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;
|
memory_rec *tmp;
|
||||||
bool present = FALSE;
|
bool present = FALSE;
|
||||||
@@ -195,7 +195,7 @@ void remember(struct char_data *ch, struct char_data *victim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make ch forget 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;
|
memory_rec *curr, *prev = NULL;
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ void forget(struct char_data *ch, struct char_data *victim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* erase ch's memory */
|
/* erase ch's memory */
|
||||||
void clearMemory(struct char_data *ch)
|
void clearMemory(char_data *ch)
|
||||||
{
|
{
|
||||||
memory_rec *curr, *next;
|
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
|
/* 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
|
* influence of mind altering PC, then see if their master can talk them out
|
||||||
* of it, eye them down, or otherwise intimidate the slave. */
|
* 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;
|
static int snarl_cmd;
|
||||||
int dieroll;
|
int dieroll;
|
||||||
|
|||||||
+15
-15
@@ -28,10 +28,10 @@
|
|||||||
#include "ibt.h"
|
#include "ibt.h"
|
||||||
|
|
||||||
/* local (file scope) function prototpyes */
|
/* local (file scope) function prototpyes */
|
||||||
static char *next_page(char *str, struct char_data *ch);
|
static char *next_page(char *str, char_data *ch);
|
||||||
static int count_pages(char *str, struct char_data *ch);
|
static int count_pages(char *str, char_data *ch);
|
||||||
static void playing_string_cleanup(struct descriptor_data *d, int action);
|
static void playing_string_cleanup(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);
|
||||||
|
|
||||||
/* Local (file scope) global variables */
|
/* Local (file scope) global variables */
|
||||||
/* @deprecated string_fields appears to be no longer be used.
|
/* @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
|
* 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
|
* editor patch when updated could use it to pass the old text buffer, for
|
||||||
* instance. */
|
* 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))
|
if (d->character && !IS_NPC(d->character))
|
||||||
SET_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
|
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
|
/* Add user input to the 'current' string (as defined by d->str). This is still
|
||||||
* overly complex. */
|
* overly complex. */
|
||||||
void string_add(struct descriptor_data *d, char *str)
|
void string_add(descriptor_data *d, char *str)
|
||||||
{
|
{
|
||||||
int action;
|
int action;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ void string_add(struct descriptor_data *d, char *str)
|
|||||||
int i;
|
int i;
|
||||||
struct {
|
struct {
|
||||||
int mode;
|
int mode;
|
||||||
void (*func)(struct descriptor_data *d, int action);
|
void (*func)(descriptor_data *d, int action);
|
||||||
} cleanup_modes[] = {
|
} cleanup_modes[] = {
|
||||||
{ CON_CEDIT , cedit_string_cleanup },
|
{ CON_CEDIT , cedit_string_cleanup },
|
||||||
{ CON_MEDIT , medit_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");
|
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 (PLR_FLAGGED(d->character, PLR_MAILING)) {
|
||||||
if (action == STRINGADD_SAVE && *d->str) {
|
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)
|
if (action == STRINGADD_ABORT)
|
||||||
write_to_output(d, "Description aborted.\r\n");
|
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. */
|
/* Modification of character skills. */
|
||||||
ACMD(do_skillset)
|
ACMD(do_skillset)
|
||||||
{
|
{
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
char name[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH];
|
||||||
char buf[MAX_INPUT_LENGTH], helpbuf[MAX_STRING_LENGTH];
|
char buf[MAX_INPUT_LENGTH], helpbuf[MAX_STRING_LENGTH];
|
||||||
int skill, value, i, qend, pc, pl;
|
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
|
/* 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. */
|
* 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;
|
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. */
|
/* 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;
|
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
|
/* This function assigns all the pointers for showstr_vector for the
|
||||||
* page_string function, after showstr_vector has been allocated and
|
* page_string function, after showstr_vector has been allocated and
|
||||||
* showstr_count set. */
|
* showstr_count set. */
|
||||||
void paginate_string(char *str, struct descriptor_data *d)
|
void paginate_string(char *str, descriptor_data *d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -468,7 +468,7 @@ void paginate_string(char *str, struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The call that gets the paging ball rolling... */
|
/* 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] = "";
|
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. */
|
/* 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];
|
char buffer[MAX_STRING_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||||
int diff;
|
int diff;
|
||||||
|
|||||||
+5
-5
@@ -20,17 +20,17 @@
|
|||||||
#define _MODIFY_H_
|
#define _MODIFY_H_
|
||||||
|
|
||||||
/* Public functions */
|
/* 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 smash_tilde(char *str);
|
||||||
void parse_at(char *str);
|
void parse_at(char *str);
|
||||||
void parse_tab(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? */
|
/** @todo should this really be in modify.c? */
|
||||||
ACMD(do_skillset);
|
ACMD(do_skillset);
|
||||||
/* Following function prototypes moved here from comm.h */
|
/* 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_write(descriptor_data *d, char **txt, size_t len, long mailto, void *data);
|
||||||
void string_add(struct descriptor_data *d, char *str);
|
void string_add(descriptor_data *d, char *str);
|
||||||
void page_string(struct descriptor_data *d, char *str, int keep_internal);
|
void page_string(descriptor_data *d, char *str, int keep_internal);
|
||||||
/* page string function & defines */
|
/* page string function & defines */
|
||||||
#define PAGE_LENGTH 22
|
#define PAGE_LENGTH 22
|
||||||
#define PAGE_WIDTH 80
|
#define PAGE_WIDTH 80
|
||||||
|
|||||||
+6
-6
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/* Statics */
|
/* Statics */
|
||||||
static void free_messages_type(struct msg_type *msg);
|
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_strings(struct message_type *tmsg, struct message_type * fmsg);
|
||||||
static void copy_message_list(struct message_list *to, struct message_list *from);
|
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);
|
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;
|
int i, half = MAX_MESSAGES / 2, count = 0;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
@@ -227,7 +227,7 @@ void save_messages_to_disk(void)
|
|||||||
fclose(fp);
|
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);
|
CREATE(OLC_MSG_LIST(d), struct message_list, 1);
|
||||||
OLC_MSG_LIST(d)->msg = NULL;
|
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)
|
ACMD(do_msgedit)
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
show_messages(ch);
|
show_messages(ch);
|
||||||
@@ -352,7 +352,7 @@ ACMD(do_msgedit)
|
|||||||
GET_NAME(ch), OLC_NUM(d));
|
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);
|
get_char_colors(d->character);
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ static void msgedit_main_menu(struct descriptor_data * d)
|
|||||||
OLC_MODE(d) = MSGEDIT_MAIN_MENU;
|
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;
|
struct message_type * temp;
|
||||||
static bool quit = FALSE;
|
static bool quit = FALSE;
|
||||||
|
|||||||
+10
-10
@@ -93,8 +93,8 @@ EVENTFUNC(event_countdown)
|
|||||||
void attach_mud_event(struct mud_event_data *pMudEvent, long time)
|
void attach_mud_event(struct mud_event_data *pMudEvent, long time)
|
||||||
{
|
{
|
||||||
struct event * pEvent;
|
struct event * pEvent;
|
||||||
struct descriptor_data * d;
|
descriptor_data * d;
|
||||||
struct char_data * ch;
|
char_data * ch;
|
||||||
struct room_data * room;
|
struct room_data * room;
|
||||||
|
|
||||||
pEvent = event_create(mud_event_index[pMudEvent->iId].func, pMudEvent, time);
|
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);
|
add_to_list(pEvent, world_events);
|
||||||
break;
|
break;
|
||||||
case EVENT_DESC:
|
case EVENT_DESC:
|
||||||
d = (struct descriptor_data *) pMudEvent->pStruct;
|
d = (descriptor_data *) pMudEvent->pStruct;
|
||||||
add_to_list(pEvent, d->events);
|
add_to_list(pEvent, d->events);
|
||||||
break;
|
break;
|
||||||
case EVENT_CHAR:
|
case EVENT_CHAR:
|
||||||
ch = (struct char_data *) pMudEvent->pStruct;
|
ch = (char_data *) pMudEvent->pStruct;
|
||||||
|
|
||||||
if (ch->events == NULL)
|
if (ch->events == NULL)
|
||||||
ch->events = create_list();
|
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)
|
void free_mud_event(struct mud_event_data *pMudEvent)
|
||||||
{
|
{
|
||||||
struct descriptor_data * d;
|
descriptor_data * d;
|
||||||
struct char_data * ch;
|
char_data * ch;
|
||||||
struct room_data * room;
|
struct room_data * room;
|
||||||
|
|
||||||
switch (mud_event_index[pMudEvent->iId].iEvent_Type) {
|
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);
|
remove_from_list(pMudEvent->pEvent, world_events);
|
||||||
break;
|
break;
|
||||||
case EVENT_DESC:
|
case EVENT_DESC:
|
||||||
d = (struct descriptor_data *) pMudEvent->pStruct;
|
d = (descriptor_data *) pMudEvent->pStruct;
|
||||||
remove_from_list(pMudEvent->pEvent, d->events);
|
remove_from_list(pMudEvent->pEvent, d->events);
|
||||||
break;
|
break;
|
||||||
case EVENT_CHAR:
|
case EVENT_CHAR:
|
||||||
ch = (struct char_data *) pMudEvent->pStruct;
|
ch = (char_data *) pMudEvent->pStruct;
|
||||||
remove_from_list(pMudEvent->pEvent, ch->events);
|
remove_from_list(pMudEvent->pEvent, ch->events);
|
||||||
|
|
||||||
if (ch->events->iSize == 0) {
|
if (ch->events->iSize == 0) {
|
||||||
@@ -185,7 +185,7 @@ void free_mud_event(struct mud_event_data *pMudEvent)
|
|||||||
free(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 event * pEvent;
|
||||||
struct mud_event_data * pMudEvent = NULL;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_char_event_list(struct char_data * ch)
|
void clear_char_event_list(char_data * ch)
|
||||||
{
|
{
|
||||||
struct event * pEvent;
|
struct event * pEvent;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -50,8 +50,8 @@ void init_events(void);
|
|||||||
struct mud_event_data *new_mud_event(event_id iId, void *pStruct, char *sVariables);
|
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 attach_mud_event(struct mud_event_data *pMudEvent, long time);
|
||||||
void free_mud_event(struct mud_event_data *pMudEvent);
|
void free_mud_event(struct mud_event_data *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);
|
||||||
void clear_char_event_list(struct char_data * ch);
|
void clear_char_event_list(char_data * ch);
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
EVENTFUNC(event_countdown);
|
EVENTFUNC(event_countdown);
|
||||||
|
|||||||
+5
-5
@@ -35,7 +35,7 @@ const char *nrm, *grn, *cyn, *yel;
|
|||||||
static void free_config(struct config_data *data);
|
static void free_config(struct config_data *data);
|
||||||
|
|
||||||
/* Only player characters should be using OLC anyway. */
|
/* Only player characters should be using OLC anyway. */
|
||||||
void clear_screen(struct descriptor_data *d)
|
void clear_screen(descriptor_data *d)
|
||||||
{
|
{
|
||||||
if (PRF_FLAGGED(d->character, PRF_CLS))
|
if (PRF_FLAGGED(d->character, PRF_CLS))
|
||||||
write_to_output(d, "[H[J");
|
write_to_output(d, "[H[J");
|
||||||
@@ -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
|
/* 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
|
* level NRM. Changing the entries here will change the colour scheme
|
||||||
* throughout the OLC. */
|
* throughout the OLC. */
|
||||||
void get_char_colors(struct char_data *ch)
|
void get_char_colors(char_data *ch)
|
||||||
{
|
{
|
||||||
nrm = CCNRM(ch, C_NRM);
|
nrm = CCNRM(ch, C_NRM);
|
||||||
grn = CCGRN(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
|
/* This procedure frees up the strings and/or the structures attatched to a
|
||||||
* descriptor, sets all flags back to how they should be. */
|
* 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? */
|
/* Clean up WHAT? */
|
||||||
if (d->olc == NULL)
|
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
|
* 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
|
* attempted to be modified. Returns TRUE if the builder has access, otherwisei
|
||||||
* FALSE. */
|
* 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 */
|
/* no access if called with bad arguments */
|
||||||
if (!ch->desc || IS_NPC(ch) || rnum == NOWHERE)
|
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);
|
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];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
|
|||||||
+34
-34
@@ -75,10 +75,10 @@
|
|||||||
#define OASIS_CFG 5
|
#define OASIS_CFG 5
|
||||||
|
|
||||||
/* Utilities exported from oasis.c. */
|
/* Utilities exported from oasis.c. */
|
||||||
void cleanup_olc(struct descriptor_data *d, byte cleanup_type);
|
void cleanup_olc(descriptor_data *d, byte cleanup_type);
|
||||||
void get_char_colors(struct char_data *ch);
|
void get_char_colors(char_data *ch);
|
||||||
void split_argument(char *argument, char *tag);
|
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. */
|
/* OLC structures. */
|
||||||
/* NO and YES are defined in utils.h. Removed from here. */
|
/* NO and YES are defined in utils.h. Removed from here. */
|
||||||
@@ -89,9 +89,9 @@ struct oasis_olc_data {
|
|||||||
room_vnum number; /* vnum of subject */
|
room_vnum number; /* vnum of subject */
|
||||||
int value; /* mostly 'has changed' flag*/
|
int value; /* mostly 'has changed' flag*/
|
||||||
char *storage; /* used for 'tedit' */
|
char *storage; /* used for 'tedit' */
|
||||||
struct char_data *mob; /* used for 'medit' */
|
char_data *mob; /* used for 'medit' */
|
||||||
struct room_data *room; /* used for 'redit' */
|
struct room_data *room; /* used for 'redit' */
|
||||||
struct obj_data *obj; /* used for 'oedit' */
|
obj_data *obj; /* used for 'oedit' */
|
||||||
struct zone_data *zone; /* used for 'zedit' */
|
struct zone_data *zone; /* used for 'zedit' */
|
||||||
struct shop_data *shop; /* used for 'sedit' */
|
struct shop_data *shop; /* used for 'sedit' */
|
||||||
struct config_data *config; /* used for 'cedit' */
|
struct config_data *config; /* used for 'cedit' */
|
||||||
@@ -393,67 +393,67 @@ extern const char *nrm, *grn, *cyn, *yel;
|
|||||||
int save_config( IDXTYPE nowhere );
|
int save_config( IDXTYPE nowhere );
|
||||||
|
|
||||||
/* Prototypes to keep. */
|
/* Prototypes to keep. */
|
||||||
void clear_screen(struct descriptor_data *);
|
void clear_screen(descriptor_data *);
|
||||||
int can_edit_zone(struct char_data *ch, zone_rnum rnum);
|
int can_edit_zone(char_data *ch, zone_rnum rnum);
|
||||||
ACMD(do_oasis);
|
ACMD(do_oasis);
|
||||||
|
|
||||||
/* public functions from medit.c */
|
/* public functions from medit.c */
|
||||||
void medit_setup_existing(struct descriptor_data *d, int rnum);
|
void medit_setup_existing(descriptor_data *d, int rnum);
|
||||||
void medit_save_internally(struct descriptor_data *d);
|
void medit_save_internally(descriptor_data *d);
|
||||||
void medit_parse(struct descriptor_data *d, char *arg);
|
void medit_parse(descriptor_data *d, char *arg);
|
||||||
void medit_string_cleanup(struct descriptor_data *d, int terminator);
|
void medit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
ACMD(do_oasis_medit);
|
ACMD(do_oasis_medit);
|
||||||
void medit_autoroll_stats(struct descriptor_data *d);
|
void medit_autoroll_stats(descriptor_data *d);
|
||||||
|
|
||||||
/* public functions from oedit.c */
|
/* public functions from oedit.c */
|
||||||
void oedit_setup_existing(struct descriptor_data *d, int rnum);
|
void oedit_setup_existing(descriptor_data *d, int rnum);
|
||||||
void oedit_save_internally(struct descriptor_data *d);
|
void oedit_save_internally(descriptor_data *d);
|
||||||
void oedit_parse(struct descriptor_data *d, char *arg);
|
void oedit_parse(descriptor_data *d, char *arg);
|
||||||
void oedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void oedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
ACMD(do_oasis_oedit);
|
ACMD(do_oasis_oedit);
|
||||||
|
|
||||||
/* public functions from redit.c */
|
/* public functions from redit.c */
|
||||||
void redit_setup_existing(struct descriptor_data *d, int rnum);
|
void redit_setup_existing(descriptor_data *d, int rnum);
|
||||||
void redit_string_cleanup(struct descriptor_data *d, int terminator);
|
void redit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
void redit_save_internally(struct descriptor_data *d);
|
void redit_save_internally(descriptor_data *d);
|
||||||
void redit_save_to_disk(zone_vnum zone_num);
|
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);
|
void free_room(struct room_data *room);
|
||||||
ACMD(do_oasis_redit);
|
ACMD(do_oasis_redit);
|
||||||
|
|
||||||
/* public functions from sedit.c */
|
/* public functions from sedit.c */
|
||||||
void sedit_setup_existing(struct descriptor_data *d, int rnum);
|
void sedit_setup_existing(descriptor_data *d, int rnum);
|
||||||
void sedit_save_internally(struct descriptor_data *d);
|
void sedit_save_internally(descriptor_data *d);
|
||||||
void sedit_parse(struct descriptor_data *d, char *arg);
|
void sedit_parse(descriptor_data *d, char *arg);
|
||||||
ACMD(do_oasis_sedit);
|
ACMD(do_oasis_sedit);
|
||||||
|
|
||||||
/* public functions from zedit.c */
|
/* 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);
|
ACMD(do_oasis_zedit);
|
||||||
|
|
||||||
/* public functions from cedit.c */
|
/* public functions from cedit.c */
|
||||||
void cedit_save_to_disk( void );
|
void cedit_save_to_disk( void );
|
||||||
void cedit_parse(struct descriptor_data *d, char *arg);
|
void cedit_parse(descriptor_data *d, char *arg);
|
||||||
void cedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void cedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
ACMD(do_oasis_cedit);
|
ACMD(do_oasis_cedit);
|
||||||
|
|
||||||
/* public functions from dg_olc.c */
|
/* 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);
|
ACMD(do_oasis_trigedit);
|
||||||
|
|
||||||
/* public functions from from aedit.c */
|
/* 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_oasis_aedit);
|
||||||
ACMD(do_astat);
|
ACMD(do_astat);
|
||||||
|
|
||||||
/* public functions from hedit.c */
|
/* public functions from hedit.c */
|
||||||
void hedit_parse(struct descriptor_data *d, char *arg);
|
void hedit_parse(descriptor_data *d, char *arg);
|
||||||
void hedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void hedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
void free_help(struct help_index_element *help);
|
void free_help(struct help_index_element *help);
|
||||||
ACMD(do_oasis_hedit);
|
ACMD(do_oasis_hedit);
|
||||||
|
|
||||||
/* public functions from tedit.c */
|
/* 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);
|
ACMD(do_tedit);
|
||||||
|
|
||||||
/* public functions from qedit.c */
|
/* public functions from qedit.c */
|
||||||
@@ -461,10 +461,10 @@ ACMD(do_oasis_qedit);
|
|||||||
|
|
||||||
/* public functions from msgedit.c */
|
/* public functions from msgedit.c */
|
||||||
ACMD(do_msgedit);
|
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 */
|
/* 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_dig);
|
||||||
ACMD(do_oasis_copy);
|
ACMD(do_oasis_copy);
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ ACMD(do_oasis_copy);
|
|||||||
int free_strings(void *data, int type);
|
int free_strings(void *data, int type);
|
||||||
|
|
||||||
/* public functions from oasis_list.c */
|
/* 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? */
|
/** @deprecated is do_oasis_links intentionally dead code? */
|
||||||
ACMD(do_oasis_links);
|
ACMD(do_oasis_links);
|
||||||
ACMD(do_oasis_list);
|
ACMD(do_oasis_list);
|
||||||
|
|||||||
+11
-9
@@ -37,16 +37,18 @@ static room_vnum redit_find_new_vnum(zone_rnum zone);
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
ACMD(do_oasis_copy)
|
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 buf1[MAX_INPUT_LENGTH];
|
||||||
char buf2[MAX_INPUT_LENGTH];
|
char buf2[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int con_type;
|
int con_type;
|
||||||
IDXTYPE (*binary_search)(IDXTYPE vnum);
|
IDXTYPE (*binary_search)(IDXTYPE vnum);
|
||||||
void (*save_func)(struct descriptor_data *d);
|
void (*save_func)(descriptor_data *d);
|
||||||
void (*setup_existing)(struct descriptor_data *d, int rnum);
|
void (*setup_existing)(descriptor_data *d, int rnum);
|
||||||
const char *command;
|
const char *command;
|
||||||
const char *text;
|
const char *text;
|
||||||
} oasis_copy_info[] = {
|
} oasis_copy_info[] = {
|
||||||
@@ -82,7 +84,7 @@ ACMD(do_oasis_copy)
|
|||||||
/* We can't copy non-existing data. */
|
/* We can't copy non-existing data. */
|
||||||
/* Note: the source data can be in any zone. It's not restricted */
|
/* Note: the source data can be in any zone. It's not restricted */
|
||||||
/* to the builder's designated OLC zone. */
|
/* 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);
|
src_rnum = (*oasis_copy_info[i].binary_search)(src_vnum);
|
||||||
if (src_rnum == NOWHERE) {
|
if (src_rnum == NOWHERE) {
|
||||||
send_to_char(ch, "The source %s (#%d) does not exist.\r\n", oasis_copy_info[i].text, src_vnum);
|
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. */
|
/* 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);
|
dst_rnum = (*oasis_copy_info[i].binary_search)(dst_vnum);
|
||||||
if (dst_rnum != NOWHERE) {
|
if (dst_rnum != NOWHERE) {
|
||||||
send_to_char(ch, "The target %s (#%d) already exists.\r\n", oasis_copy_info[i].text, dst_vnum);
|
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;
|
room_rnum rrnum = NOWHERE;
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
int dir = 0, rawvnum;
|
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). */
|
/* Grab the room's name (if available). */
|
||||||
new_room_name = two_arguments(argument, sdir, sroom);
|
new_room_name = two_arguments(argument, sdir, sroom);
|
||||||
@@ -308,7 +310,7 @@ static room_vnum redit_find_new_vnum(zone_rnum zone)
|
|||||||
return(vnum);
|
return(vnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
int buildwalk(struct char_data *ch, int dir)
|
int buildwalk(char_data *ch, int dir)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
room_vnum vnum;
|
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) {
|
} 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");
|
send_to_char(ch, "No free vnums are available in this zone!\r\n");
|
||||||
} else {
|
} else {
|
||||||
struct descriptor_data *d = ch->desc;
|
descriptor_data *d = ch->desc;
|
||||||
/* Give the descriptor an olc struct. This way we can let
|
/* Give the descriptor an olc struct. This way we can let
|
||||||
* redit_save_internally handle the room adding. */
|
* redit_save_internally handle the room adding. */
|
||||||
if (d->olc) {
|
if (d->olc) {
|
||||||
|
|||||||
+22
-22
@@ -32,18 +32,18 @@ struct obj_list_item {
|
|||||||
int val;
|
int val;
|
||||||
};
|
};
|
||||||
/* local functions */
|
/* local functions */
|
||||||
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);
|
||||||
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);
|
||||||
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 );
|
||||||
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 );
|
||||||
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);
|
||||||
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);
|
||||||
|
|
||||||
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;
|
int num, mob_flag, found = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct char_data *mob;
|
char_data *mob;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
mob_flag = atoi(arg);
|
mob_flag = atoi(arg);
|
||||||
@@ -76,11 +76,11 @@ static void perform_mob_flag_list(struct char_data * ch, char *arg)
|
|||||||
return;
|
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;
|
int num, mob_level, found = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct char_data *mob;
|
char_data *mob;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
mob_level = atoi(arg);
|
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;
|
int num, itemtype, v1, v2, found = 0;
|
||||||
size_t len = 0, tmp_len = 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);
|
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;
|
int num, i, apply, v1 = 0, found = 0;
|
||||||
size_t len = 0, tmp_len = 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);
|
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;
|
int num, found = 0;
|
||||||
size_t len = 0, tmp_len = 0;
|
size_t len = 0, tmp_len = 0;
|
||||||
@@ -375,7 +375,7 @@ ACMD(do_oasis_list)
|
|||||||
if (!*smin || *smin == '.') {
|
if (!*smin || *smin == '.') {
|
||||||
rzone = world[IN_ROOM(ch)].zone;
|
rzone = world[IN_ROOM(ch)].zone;
|
||||||
} else if (!*smax) {
|
} else if (!*smax) {
|
||||||
rzone = real_zone(atoi(smin));
|
rzone = real_zone(atoidx(smin));
|
||||||
|
|
||||||
if ((rzone == NOWHERE || rzone == 0) && subcmd == SCMD_OASIS_ZLIST && !isdigit(*smin)) {
|
if ((rzone == NOWHERE || rzone == 0) && subcmd == SCMD_OASIS_ZLIST && !isdigit(*smin)) {
|
||||||
/* Must be zlist, with builder name as arg */
|
/* Must be zlist, with builder name as arg */
|
||||||
@@ -521,7 +521,7 @@ ACMD(do_oasis_links)
|
|||||||
zrnum = world[IN_ROOM(ch)].zone;
|
zrnum = world[IN_ROOM(ch)].zone;
|
||||||
zvnum = zone_table[zrnum].number;
|
zvnum = zone_table[zrnum].number;
|
||||||
} else {
|
} else {
|
||||||
zvnum = atoi(arg);
|
zvnum = atoidx(arg);
|
||||||
zrnum = real_zone(zvnum);
|
zrnum = real_zone(zvnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +552,7 @@ ACMD(do_oasis_links)
|
|||||||
|
|
||||||
/* Helper Functions */
|
/* Helper Functions */
|
||||||
/* List all rooms in a zone. */
|
/* 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_rnum i;
|
||||||
room_vnum bottom, top;
|
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. */
|
/* 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_rnum i;
|
||||||
mob_vnum bottom, top;
|
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. */
|
/* 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_rnum i;
|
||||||
obj_vnum bottom, top;
|
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. */
|
/* 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_rnum i;
|
||||||
shop_vnum bottom, top;
|
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'). */
|
/* 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;
|
int counter = 0;
|
||||||
size_t len = 0, tmp_len = 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. */
|
/* 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;
|
zone_rnum rnum;
|
||||||
int size_rooms, size_objects, size_mobiles, size_quests, size_shops, size_trigs, i, largest_table;
|
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. */
|
/* 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;
|
int i, bottom, top, counter = 0;
|
||||||
char trgtypes[256];
|
char trgtypes[256];
|
||||||
|
|||||||
+53
-53
@@ -31,32 +31,32 @@
|
|||||||
#define MAX_BAG_ROWS 5
|
#define MAX_BAG_ROWS 5
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static int Crash_save(struct obj_data *obj, FILE *fp, int location);
|
static int Crash_save(obj_data *obj, FILE *fp, int location);
|
||||||
static void Crash_extract_norent_eq(struct char_data *ch);
|
static void Crash_extract_norent_eq(char_data *ch);
|
||||||
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);
|
||||||
static int Crash_offer_rent(struct char_data *ch, struct char_data *receptionist, int display, int factor);
|
static int Crash_offer_rent(char_data *ch, 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 int Crash_report_unrentables(char_data *ch, char_data *recep, 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 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(struct char_data *ch, struct char_data *recep, int cmd, char *arg, int mode);
|
static int gen_receptionist(char_data *ch, 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_rent_deadline(char_data *ch, char_data *recep, long cost);
|
||||||
static void Crash_restore_weight(struct obj_data *obj);
|
static void Crash_restore_weight(obj_data *obj);
|
||||||
static void Crash_extract_objs(struct obj_data *obj);
|
static void Crash_extract_objs(obj_data *obj);
|
||||||
static int Crash_is_unrentable(struct obj_data *obj);
|
static int Crash_is_unrentable(obj_data *obj);
|
||||||
static void Crash_extract_norents(struct obj_data *obj);
|
static void Crash_extract_norents(obj_data *obj);
|
||||||
static void Crash_extract_expensive(struct obj_data *obj);
|
static void Crash_extract_expensive(obj_data *obj);
|
||||||
static void Crash_calculate_rent(struct obj_data *obj, int *cost);
|
static void Crash_calculate_rent(obj_data *obj, int *cost);
|
||||||
static void Crash_cryosave(struct char_data *ch, int cost);
|
static void Crash_cryosave(char_data *ch, int cost);
|
||||||
static int Crash_load_objs(struct char_data *ch);
|
static int Crash_load_objs(char_data *ch);
|
||||||
static int handle_obj(struct obj_data *obj, struct char_data *ch, int locate, struct obj_data **cont_rows);
|
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, struct char_data *ch);
|
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() */
|
/* 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;
|
int counter2;
|
||||||
struct extra_descr_data *ex_desc;
|
struct extra_descr_data *ex_desc;
|
||||||
char buf1[MAX_STRING_LENGTH +1];
|
char buf1[MAX_STRING_LENGTH +1];
|
||||||
struct obj_data *temp = NULL;
|
obj_data *temp = NULL;
|
||||||
|
|
||||||
if (GET_OBJ_VNUM(obj) != NOTHING)
|
if (GET_OBJ_VNUM(obj) != NOTHING)
|
||||||
temp=read_object(GET_OBJ_VNUM(obj), VIRTUAL);
|
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
|
#undef TEST_OBJN
|
||||||
|
|
||||||
/* AutoEQ by Burkhard Knopf. */
|
/* 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;
|
int j;
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ int Crash_delete_file(char *name)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Crash_delete_crashfile(struct char_data *ch)
|
int Crash_delete_crashfile(char_data *ch)
|
||||||
{
|
{
|
||||||
char filename[MAX_INPUT_LENGTH];
|
char filename[MAX_INPUT_LENGTH];
|
||||||
int numread;
|
int numread;
|
||||||
@@ -376,7 +376,7 @@ void update_obj_file(void)
|
|||||||
Crash_clean_file(player_table[i].name);
|
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;
|
FILE *fl;
|
||||||
char filename[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], line[READ_SIZE];
|
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.
|
* 0 - successful load, keep char in rent room.
|
||||||
* 1 - load failure or load of crash items -- put char in temple.
|
* 1 - load failure or load of crash items -- put char in temple.
|
||||||
* 2 - rented equipment lost (no $) */
|
* 2 - rented equipment lost (no $) */
|
||||||
int Crash_load(struct char_data *ch)
|
int Crash_load(char_data *ch)
|
||||||
{
|
{
|
||||||
return (Crash_load_objs(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;
|
int result;
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
@@ -472,7 +472,7 @@ static int Crash_save(struct obj_data *obj, FILE *fp, int location)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Crash_restore_weight(struct obj_data *obj)
|
static void Crash_restore_weight(obj_data *obj)
|
||||||
{
|
{
|
||||||
if (obj) {
|
if (obj) {
|
||||||
Crash_restore_weight(obj->contains);
|
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
|
/* Get !RENT items from equipment to inventory and extract !RENT out of worn
|
||||||
* containers. */
|
* containers. */
|
||||||
static void Crash_extract_norent_eq(struct char_data *ch)
|
static void Crash_extract_norent_eq(char_data *ch)
|
||||||
{
|
{
|
||||||
int j;
|
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) {
|
if (obj) {
|
||||||
Crash_extract_objs(obj->contains);
|
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)
|
if (!obj)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -524,7 +524,7 @@ static int Crash_is_unrentable(struct obj_data *obj)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Crash_extract_norents(struct obj_data *obj)
|
static void Crash_extract_norents(obj_data *obj)
|
||||||
{
|
{
|
||||||
if (obj) {
|
if (obj) {
|
||||||
Crash_extract_norents(obj->contains);
|
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;
|
max = obj;
|
||||||
for (tobj = obj; tobj; tobj = tobj->next_content)
|
for (tobj = obj; tobj; tobj = tobj->next_content)
|
||||||
@@ -545,7 +545,7 @@ static void Crash_extract_expensive(struct obj_data *obj)
|
|||||||
extract_obj(max);
|
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) {
|
if (obj) {
|
||||||
*cost += MAX(0, GET_OBJ_RENT(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];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int j;
|
int j;
|
||||||
@@ -592,7 +592,7 @@ void Crash_crashsave(struct char_data *ch)
|
|||||||
REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_CRASH);
|
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];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int j;
|
int j;
|
||||||
@@ -666,7 +666,7 @@ void Crash_idlesave(struct char_data *ch)
|
|||||||
Crash_extract_objs(ch->carrying);
|
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];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int j;
|
int j;
|
||||||
@@ -707,7 +707,7 @@ void Crash_rentsave(struct char_data *ch, int cost)
|
|||||||
Crash_extract_objs(ch->carrying);
|
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",
|
if (fprintf(fl, "%d %ld %d %d %d %d\r\n",
|
||||||
rentcode,
|
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];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int j;
|
int j;
|
||||||
@@ -769,7 +769,7 @@ static void Crash_cryosave(struct char_data *ch, int cost)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Routines used for the receptionist. */
|
/* 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 cost)
|
||||||
{
|
{
|
||||||
long rent_deadline;
|
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);
|
act(buf, FALSE, recep, 0, ch, TO_VICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Crash_report_unrentables(struct char_data *ch, struct char_data *recep,
|
static int Crash_report_unrentables(char_data *ch, char_data *recep,
|
||||||
struct obj_data *obj)
|
obj_data *obj)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int has_norents = 0;
|
int has_norents = 0;
|
||||||
@@ -802,7 +802,7 @@ static int Crash_report_unrentables(struct char_data *ch, struct char_data *rece
|
|||||||
return (has_norents);
|
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)
|
obj_data *obj, long *cost, long *nitems, int display, int factor)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
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)
|
int display, int factor)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
@@ -871,7 +871,7 @@ static int Crash_offer_rent(struct char_data *ch, struct char_data *recep,
|
|||||||
return (totalcost);
|
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)
|
char *arg, int mode)
|
||||||
{
|
{
|
||||||
int cost;
|
int cost;
|
||||||
@@ -952,17 +952,17 @@ static int gen_receptionist(struct char_data *ch, struct char_data *recep, int c
|
|||||||
|
|
||||||
SPECIAL(receptionist)
|
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)
|
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)
|
void Crash_save_all(void)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
for (d = descriptor_list; d; d = d->next) {
|
for (d = descriptor_list; d; d = d->next) {
|
||||||
if ((STATE(d) == CON_PLAYING) && !IS_NPC(d->character)) {
|
if ((STATE(d) == CON_PLAYING) && !IS_NPC(d->character)) {
|
||||||
if (PLR_FLAGGED(d->character, PLR_CRASH)) {
|
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;
|
obj_save_data *head, *current, *tempsave;
|
||||||
char f1[128], f2[128], f3[128], f4[128], line[READ_SIZE];
|
char f1[128], f2[128], f3[128], f4[128], line[READ_SIZE];
|
||||||
int t[4],i, nr;
|
int t[4],i, nr;
|
||||||
struct obj_data *temp;
|
obj_data *temp;
|
||||||
|
|
||||||
CREATE(current, obj_save_data, 1);
|
CREATE(current, obj_save_data, 1);
|
||||||
head = current;
|
head = current;
|
||||||
@@ -1175,7 +1175,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Crash_load_objs(struct char_data *ch) {
|
static int Crash_load_objs(char_data *ch) {
|
||||||
FILE *fl;
|
FILE *fl;
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
char line[READ_SIZE];
|
char line[READ_SIZE];
|
||||||
@@ -1183,7 +1183,7 @@ static int Crash_load_objs(struct char_data *ch) {
|
|||||||
char str[64];
|
char str[64];
|
||||||
int i, num_of_days, orig_rent_code, num_objs=0;
|
int i, num_of_days, orig_rent_code, num_objs=0;
|
||||||
unsigned long cost;
|
unsigned long cost;
|
||||||
struct obj_data *cont_row[MAX_BAG_ROWS];
|
obj_data *cont_row[MAX_BAG_ROWS];
|
||||||
int rentcode = RENT_UNDEF;
|
int rentcode = RENT_UNDEF;
|
||||||
int timed=0,netcost=0,gold,account,nitems;
|
int timed=0,netcost=0,gold,account,nitems;
|
||||||
obj_save_data *loaded, *current;
|
obj_save_data *loaded, *current;
|
||||||
@@ -1276,10 +1276,10 @@ static int Crash_load_objs(struct char_data *ch) {
|
|||||||
return 1;
|
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;
|
int j;
|
||||||
struct obj_data *obj1;
|
obj_data *obj1;
|
||||||
|
|
||||||
if (!temp) /* this should never happen, but.... */
|
if (!temp) /* this should never happen, but.... */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
+49
-47
@@ -26,23 +26,23 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void oedit_setup_new(struct descriptor_data *d);
|
static void oedit_setup_new(descriptor_data *d);
|
||||||
static void oedit_disp_container_flags_menu(struct descriptor_data *d);
|
static void oedit_disp_container_flags_menu(descriptor_data *d);
|
||||||
static void oedit_disp_extradesc_menu(struct descriptor_data *d);
|
static void oedit_disp_extradesc_menu(descriptor_data *d);
|
||||||
static void oedit_disp_prompt_apply_menu(struct descriptor_data *d);
|
static void oedit_disp_prompt_apply_menu(descriptor_data *d);
|
||||||
static void oedit_liquid_type(struct descriptor_data *d);
|
static void oedit_liquid_type(descriptor_data *d);
|
||||||
static void oedit_disp_apply_menu(struct descriptor_data *d);
|
static void oedit_disp_apply_menu(descriptor_data *d);
|
||||||
static void oedit_disp_weapon_menu(struct descriptor_data *d);
|
static void oedit_disp_weapon_menu(descriptor_data *d);
|
||||||
static void oedit_disp_spells_menu(struct descriptor_data *d);
|
static void oedit_disp_spells_menu(descriptor_data *d);
|
||||||
static void oedit_disp_val1_menu(struct descriptor_data *d);
|
static void oedit_disp_val1_menu(descriptor_data *d);
|
||||||
static void oedit_disp_val2_menu(struct descriptor_data *d);
|
static void oedit_disp_val2_menu(descriptor_data *d);
|
||||||
static void oedit_disp_val3_menu(struct descriptor_data *d);
|
static void oedit_disp_val3_menu(descriptor_data *d);
|
||||||
static void oedit_disp_val4_menu(struct descriptor_data *d);
|
static void oedit_disp_val4_menu(descriptor_data *d);
|
||||||
static void oedit_disp_type_menu(struct descriptor_data *d);
|
static void oedit_disp_type_menu(descriptor_data *d);
|
||||||
static void oedit_disp_extra_menu(struct descriptor_data *d);
|
static void oedit_disp_extra_menu(descriptor_data *d);
|
||||||
static void oedit_disp_wear_menu(struct descriptor_data *d);
|
static void oedit_disp_wear_menu(descriptor_data *d);
|
||||||
static void oedit_disp_menu(struct descriptor_data *d);
|
static void oedit_disp_menu(descriptor_data *d);
|
||||||
static void oedit_disp_perm_menu(struct descriptor_data *d);
|
static void oedit_disp_perm_menu(descriptor_data *d);
|
||||||
static void oedit_save_to_disk(int zone_num);
|
static void oedit_save_to_disk(int zone_num);
|
||||||
|
|
||||||
/* handy macro */
|
/* handy macro */
|
||||||
@@ -51,8 +51,10 @@ static void oedit_save_to_disk(int zone_num);
|
|||||||
/* Utility and exported functions */
|
/* Utility and exported functions */
|
||||||
ACMD(do_oasis_oedit)
|
ACMD(do_oasis_oedit)
|
||||||
{
|
{
|
||||||
int number = NOWHERE, save = 0, real_num;
|
int save = 0;
|
||||||
struct descriptor_data *d;
|
zone_vnum number = NOWHERE;
|
||||||
|
zone_rnum real_num;
|
||||||
|
descriptor_data *d;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ ACMD(do_oasis_oedit)
|
|||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoidx(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ ACMD(do_oasis_oedit)
|
|||||||
|
|
||||||
/* If a numeric argument was given, get it. */
|
/* If a numeric argument was given, get it. */
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoidx(buf1);
|
||||||
|
|
||||||
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
||||||
send_to_char(ch, "That object VNUM can't exist.\r\n");
|
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));
|
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);
|
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;
|
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. */
|
/* Allocate object in memory. */
|
||||||
CREATE(obj, struct obj_data, 1);
|
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;
|
OLC_OBJ(d)->proto_script = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void oedit_save_internally(struct descriptor_data *d)
|
void oedit_save_internally(descriptor_data *d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
obj_rnum robj_num;
|
obj_rnum robj_num;
|
||||||
struct descriptor_data *dsc;
|
descriptor_data *dsc;
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
i = (real_object(OLC_NUM(d)) == NOTHING);
|
i = (real_object(OLC_NUM(d)) == NOTHING);
|
||||||
|
|
||||||
@@ -290,7 +292,7 @@ static void oedit_save_to_disk(int zone_num)
|
|||||||
|
|
||||||
/* Menu functions */
|
/* Menu functions */
|
||||||
/* For container flags. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
get_char_colors(d->character);
|
get_char_colors(d->character);
|
||||||
@@ -308,7 +310,7 @@ static void oedit_disp_container_flags_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For extra descriptions. */
|
/* 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);
|
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. */
|
/* 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];
|
char apply_buf[MAX_STRING_LENGTH];
|
||||||
int counter;
|
int counter;
|
||||||
@@ -351,7 +353,7 @@ static void oedit_disp_prompt_apply_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ask for liquid type. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -361,7 +363,7 @@ static void oedit_liquid_type(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The actual apply to set. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
@@ -371,7 +373,7 @@ static void oedit_disp_apply_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Weapon type. */
|
/* 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;
|
int counter, columns = 0;
|
||||||
|
|
||||||
@@ -387,7 +389,7 @@ static void oedit_disp_weapon_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Spell type. */
|
/* 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;
|
int counter, columns = 0;
|
||||||
|
|
||||||
@@ -402,7 +404,7 @@ static void oedit_disp_spells_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object value #1 */
|
/* 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;
|
OLC_MODE(d) = OEDIT_VALUE_1;
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
@@ -458,7 +460,7 @@ static void oedit_disp_val1_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object value #2 */
|
/* 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;
|
OLC_MODE(d) = OEDIT_VALUE_2;
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
@@ -491,7 +493,7 @@ static void oedit_disp_val2_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object value #3 */
|
/* 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;
|
OLC_MODE(d) = OEDIT_VALUE_3;
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
@@ -522,7 +524,7 @@ static void oedit_disp_val3_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object value #4 */
|
/* 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;
|
OLC_MODE(d) = OEDIT_VALUE_4;
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
@@ -546,7 +548,7 @@ static void oedit_disp_val4_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object type. */
|
/* 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;
|
int counter, columns = 0;
|
||||||
|
|
||||||
@@ -561,7 +563,7 @@ static void oedit_disp_type_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object extra flags. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
int counter, columns = 0;
|
int counter, columns = 0;
|
||||||
@@ -580,7 +582,7 @@ static void oedit_disp_extra_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object perm flags. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
int counter, columns = 0;
|
int counter, columns = 0;
|
||||||
@@ -597,7 +599,7 @@ static void oedit_disp_perm_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Object wear flags. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
int counter, columns = 0;
|
int counter, columns = 0;
|
||||||
@@ -615,11 +617,11 @@ static void oedit_disp_wear_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display main menu. */
|
/* 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 buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
obj = OLC_OBJ(d);
|
obj = OLC_OBJ(d);
|
||||||
get_char_colors(d->character);
|
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. */
|
/* 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;
|
int number, max_val, min_val;
|
||||||
char *oldtext = NULL;
|
char *oldtext = NULL;
|
||||||
@@ -1182,7 +1184,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OEDIT_COPY:
|
case OEDIT_COPY:
|
||||||
if ((number = real_object(atoi(arg))) != NOTHING) {
|
if ((number = real_object(atoidx(arg))) != NOTHING) {
|
||||||
oedit_setup_existing(d, number);
|
oedit_setup_existing(d, number);
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "That object does not exist.\r\n");
|
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);
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case OEDIT_ACTDESC:
|
case OEDIT_ACTDESC:
|
||||||
|
|||||||
+18
-18
@@ -35,12 +35,12 @@
|
|||||||
#define PT_LLAST(i) (player_table[(i)].last)
|
#define PT_LLAST(i) (player_table[(i)].last)
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void load_affects(FILE *fl, struct char_data *ch);
|
static void load_affects(FILE *fl, char_data *ch);
|
||||||
static void load_skills(FILE *fl, struct char_data *ch);
|
static void load_skills(FILE *fl, char_data *ch);
|
||||||
static void load_quests(FILE *fl, struct char_data *ch);
|
static void load_quests(FILE *fl, char_data *ch);
|
||||||
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);
|
||||||
static void write_aliases_ascii(FILE *file, struct char_data *ch);
|
static void write_aliases_ascii(FILE *file, char_data *ch);
|
||||||
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);
|
||||||
|
|
||||||
/* New version to build player index for ASCII Player Files. Generate index
|
/* New version to build player index for ASCII Player Files. Generate index
|
||||||
* table for the player file. */
|
* table for the player file. */
|
||||||
@@ -225,7 +225,7 @@ char *get_name_by_id(long id)
|
|||||||
/* Stuff related to the save/load player system. */
|
/* Stuff related to the save/load player system. */
|
||||||
/* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE
|
/* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE
|
||||||
* if not. */
|
* if not. */
|
||||||
int load_char(const char *name, struct char_data *ch)
|
int load_char(const char *name, char_data *ch)
|
||||||
{
|
{
|
||||||
int id, i;
|
int id, i;
|
||||||
FILE *fl;
|
FILE *fl;
|
||||||
@@ -400,7 +400,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
if (!strcmp(tag, "Olc ")) GET_OLC_ZONE(ch) = atoi(line);
|
if (!strcmp(tag, "Olc ")) GET_OLC_ZONE(ch) = atoidx(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
@@ -429,7 +429,7 @@ int load_char(const char *name, struct char_data *ch)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
if (!strcmp(tag, "Room")) GET_LOADROOM(ch) = atoi(line);
|
if (!strcmp(tag, "Room")) GET_LOADROOM(ch) = atoidx(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
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, "Thr5")) GET_SAVE(ch, 4) = atoi(line);
|
||||||
else if (!strcmp(tag, "Titl")) GET_TITLE(ch) = strdup(line);
|
else if (!strcmp(tag, "Titl")) GET_TITLE(ch) = strdup(line);
|
||||||
else if (!strcmp(tag, "Trig") && CONFIG_SCRIPT_PLAYERS) {
|
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);
|
t = read_trigger(t_rnum);
|
||||||
if (!SCRIPT(ch))
|
if (!SCRIPT(ch))
|
||||||
CREATE(SCRIPT(ch), struct script_data, 1);
|
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. */
|
/* Write the vital data of a player to the player file. */
|
||||||
/* This is the ASCII Player Files save routine. */
|
/* This is the ASCII Player Files save routine. */
|
||||||
void save_char(struct char_data * ch)
|
void save_char(char_data * ch)
|
||||||
{
|
{
|
||||||
FILE *fl;
|
FILE *fl;
|
||||||
char filename[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127];
|
char filename[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127];
|
||||||
int i, j, id, save_index = FALSE;
|
int i, j, id, save_index = FALSE;
|
||||||
struct affected_type *aff, tmp_aff[MAX_AFFECT];
|
struct affected_type *aff, tmp_aff[MAX_AFFECT];
|
||||||
struct obj_data *char_eq[NUM_WEARS];
|
obj_data *char_eq[NUM_WEARS];
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
|
|
||||||
if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0)
|
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
|
/* load_affects function now handles both 32-bit and
|
||||||
128-bit affect bitvectors for backward compatibility */
|
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;
|
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];
|
char line[MAX_INPUT_LENGTH + 1];
|
||||||
@@ -858,7 +858,7 @@ static void load_affects(FILE *fl, struct char_data *ch)
|
|||||||
} while (num != 0);
|
} 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;
|
int num = 0, num2 = 0;
|
||||||
char line[MAX_INPUT_LENGTH + 1];
|
char line[MAX_INPUT_LENGTH + 1];
|
||||||
@@ -871,7 +871,7 @@ static void load_skills(FILE *fl, struct char_data *ch)
|
|||||||
} while (num != 0);
|
} while (num != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_quests(FILE *fl, struct char_data *ch)
|
void load_quests(FILE *fl, char_data *ch)
|
||||||
{
|
{
|
||||||
int num = NOTHING;
|
int num = NOTHING;
|
||||||
char line[MAX_INPUT_LENGTH + 1];
|
char line[MAX_INPUT_LENGTH + 1];
|
||||||
@@ -884,7 +884,7 @@ void load_quests(FILE *fl, struct char_data *ch)
|
|||||||
} while (num != NOTHING);
|
} 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;
|
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;
|
struct alias_data *temp;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -936,7 +936,7 @@ static void write_aliases_ascii(FILE *file, struct char_data *ch)
|
|||||||
temp->type);
|
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;
|
int i;
|
||||||
|
|
||||||
|
|||||||
+21
-21
@@ -22,17 +22,17 @@
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
/* Internal (static) functions */
|
/* Internal (static) functions */
|
||||||
static void prefedit_setup(struct descriptor_data *d, struct char_data *vict);
|
static void prefedit_setup(descriptor_data *d, char_data *vict);
|
||||||
static void prefedit_save_to_char(struct descriptor_data *d);
|
static void prefedit_save_to_char(descriptor_data *d);
|
||||||
static void prefedit_disp_main_menu(struct descriptor_data *d);
|
static void prefedit_disp_main_menu(descriptor_data *d);
|
||||||
static void prefedit_disp_toggles_menu(struct descriptor_data *d);
|
static void prefedit_disp_toggles_menu(descriptor_data *d);
|
||||||
static void prefedit_disp_prompt_menu(struct descriptor_data *d);
|
static void prefedit_disp_prompt_menu(descriptor_data *d);
|
||||||
static void prefedit_disp_color_menu(struct descriptor_data *d);
|
static void prefedit_disp_color_menu(descriptor_data *d);
|
||||||
static void prefedit_disp_syslog_menu(struct 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 */
|
/* Note: there is no setup_new, as you can ONLY edit an existing player */
|
||||||
/* vict is normally = d->character, except when imps edit players */
|
/* 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;
|
int i;
|
||||||
struct prefs_data *toggles;
|
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);
|
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;
|
int i;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
vict = PREFEDIT_GET_CHAR;
|
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];
|
char prompt_string[10], color_string[10], syslog_string[10];
|
||||||
const char *multi_types[] = { "Off", "Brief", "Normal", "Complete", "\n" };
|
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;
|
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 */
|
/* Set up the required variables and strings */
|
||||||
vict = OLC_PREFS(d)->ch;
|
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;
|
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];
|
char prompt_string[7];
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ static void prefedit_disp_prompt_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = PREFEDIT_PROMPT;
|
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"
|
send_to_char(d->character, "%sColor level\r\n"
|
||||||
"%s1%s) Off %s(do not display any color - monochrome)%s\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;
|
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"
|
send_to_char(d->character, "%sSyslog level\r\n"
|
||||||
"%s1%s) Off %s(do not display any logs or error messages)%s\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;
|
OLC_MODE(d) = PREFEDIT_SYSLOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prefedit_parse(struct descriptor_data * d, char *arg)
|
void prefedit_parse(descriptor_data * d, char *arg)
|
||||||
{
|
{
|
||||||
int number;
|
int number;
|
||||||
|
|
||||||
@@ -780,7 +780,7 @@ void prefedit_parse(struct descriptor_data * d, char *arg)
|
|||||||
prefedit_disp_main_menu(d);
|
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 */
|
/* Let's do toggles one at a time */
|
||||||
/* PRF_BRIEF - Off */
|
/* PRF_BRIEF - Off */
|
||||||
@@ -931,8 +931,8 @@ void prefedit_Restore_Defaults(struct descriptor_data *d)
|
|||||||
|
|
||||||
ACMD(do_oasis_prefedit)
|
ACMD(do_oasis_prefedit)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|||||||
Executable → Regular
+4
-5
@@ -10,9 +10,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/* Toggle structure held for OLC purposes */
|
/* Toggle structure held for OLC purposes */
|
||||||
struct prefs_data
|
struct prefs_data {
|
||||||
{
|
char_data *ch; /* Pointer to char being edited */
|
||||||
struct char_data *ch; /* Pointer to char being edited */
|
|
||||||
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
|
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
|
||||||
int wimp_level; /* Copy of player's wimp level */
|
int wimp_level; /* Copy of player's wimp level */
|
||||||
int page_length; /* Copy of player's pagelength */
|
int page_length; /* Copy of player's pagelength */
|
||||||
@@ -54,7 +53,7 @@ struct prefs_data
|
|||||||
#define PREFEDIT_TOGGLE_MENU 8
|
#define PREFEDIT_TOGGLE_MENU 8
|
||||||
|
|
||||||
/* External Functions in prefedit.c */
|
/* External Functions in prefedit.c */
|
||||||
void prefedit_Restore_Defaults(struct descriptor_data *d);
|
void prefedit_Restore_Defaults(descriptor_data *d);
|
||||||
void prefedit_parse(struct descriptor_data * d, char *arg);
|
void prefedit_parse(descriptor_data * d, char *arg);
|
||||||
ACMD(do_oasis_prefedit);
|
ACMD(do_oasis_prefedit);
|
||||||
|
|
||||||
|
|||||||
+30
-36
@@ -22,19 +22,12 @@
|
|||||||
The following section is for Diku/Merc derivatives. Replace as needed.
|
The following section is for Diku/Merc derivatives. Replace as needed.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "conf.h"
|
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "interpreter.h"
|
|
||||||
#include "handler.h"
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "improved-edit.h"
|
|
||||||
#include "dg_scripts.h"
|
|
||||||
#include "act.h"
|
|
||||||
#include "modify.h"
|
|
||||||
|
|
||||||
/* Globals */
|
/* Globals */
|
||||||
const char * RGBone = "F022";
|
const char * RGBone = "F022";
|
||||||
@@ -214,7 +207,7 @@ static time_t s_Uptime = 0;
|
|||||||
|
|
||||||
static void Negotiate ( descriptor_t *apDescriptor );
|
static void Negotiate ( descriptor_t *apDescriptor );
|
||||||
static void PerformHandshake ( descriptor_t *apDescriptor, char aCmd, char aProtocol );
|
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 ParseMSDP ( descriptor_t *apDescriptor, const char *apData );
|
||||||
static void ExecuteMSDPPair ( descriptor_t *apDescriptor, const char *apVariable, const char *apValue );
|
static void ExecuteMSDPPair ( descriptor_t *apDescriptor, const char *apVariable, const char *apValue );
|
||||||
@@ -358,7 +351,7 @@ void ProtocolDestroy( protocol_t *apProtocol )
|
|||||||
free(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 CmdBuf[MAX_PROTOCOL_BUFFER+1];
|
||||||
static char IacBuf[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;
|
pProtocol->bIACMode = false;
|
||||||
IacBuf[IacIndex] = '\0';
|
IacBuf[IacIndex] = '\0';
|
||||||
if ( IacIndex >= 2 )
|
if ( IacIndex >= 2 )
|
||||||
PerformSubnegotiation( apDescriptor, IacBuf[0], &IacBuf[1], IacIndex-1 );
|
PerformSubnegotiation( apDescriptor, IacBuf[0], &IacBuf[1]);
|
||||||
IacIndex = 0;
|
IacIndex = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -405,7 +398,7 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
|
|||||||
isdigit(apData[Index+2]) && apData[Index+3] == 'z' )
|
isdigit(apData[Index+2]) && apData[Index+3] == 'z' )
|
||||||
{
|
{
|
||||||
char MXPBuffer [1024];
|
char MXPBuffer [1024];
|
||||||
char *pMXPTag = NULL;
|
const char *pMXPTag = NULL;
|
||||||
int i = 0; /* Loop counter */
|
int i = 0; /* Loop counter */
|
||||||
|
|
||||||
Index += 4; /* Skip to the start of the MXP sequence. */
|
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);
|
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];
|
static char Result[MAX_OUTPUT_BUFFER+1];
|
||||||
const char Tab[] = "\t";
|
const char Tab[] = "\t";
|
||||||
@@ -1068,13 +1061,13 @@ void MSDPSend( descriptor_t *apDescriptor, variable_t aMSDP )
|
|||||||
if ( VariableNameTable[aMSDP].bString )
|
if ( VariableNameTable[aMSDP].bString )
|
||||||
{
|
{
|
||||||
/* Should really be replaced with a dynamic buffer */
|
/* 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;
|
strlen(pProtocol->pVariables[aMSDP]->pValueString) + 12;
|
||||||
|
|
||||||
if ( RequiredBuffer >= MAX_VARIABLE_LENGTH )
|
if ( RequiredBuffer >= MAX_VARIABLE_LENGTH )
|
||||||
{
|
{
|
||||||
sprintf( MSDPBuffer,
|
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,
|
VariableNameTable[aMSDP].pName, RequiredBuffer,
|
||||||
MAX_VARIABLE_LENGTH );
|
MAX_VARIABLE_LENGTH );
|
||||||
ReportBug( MSDPBuffer );
|
ReportBug( MSDPBuffer );
|
||||||
@@ -1128,20 +1121,20 @@ void MSDPSendPair( descriptor_t *apDescriptor, const char *apVariable, const cha
|
|||||||
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
|
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
|
||||||
|
|
||||||
/* Should really be replaced with a dynamic buffer */
|
/* 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 >= MAX_VARIABLE_LENGTH )
|
||||||
{
|
{
|
||||||
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
|
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
|
||||||
{
|
{
|
||||||
sprintf( MSDPBuffer,
|
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 );
|
apVariable, RequiredBuffer, MAX_VARIABLE_LENGTH );
|
||||||
}
|
}
|
||||||
else /* The variable name itself is too long */
|
else /* The variable name itself is too long */
|
||||||
{
|
{
|
||||||
sprintf( MSDPBuffer,
|
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 );
|
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;
|
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
|
||||||
|
|
||||||
/* Should really be replaced with a dynamic buffer */
|
/* 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 >= MAX_VARIABLE_LENGTH )
|
||||||
{
|
{
|
||||||
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
|
if ( RequiredBuffer - strlen(apValue) < MAX_VARIABLE_LENGTH )
|
||||||
{
|
{
|
||||||
sprintf( MSDPBuffer,
|
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 );
|
apVariable, RequiredBuffer, MAX_VARIABLE_LENGTH );
|
||||||
}
|
}
|
||||||
else /* The variable name itself is too long */
|
else /* The variable name itself is too long */
|
||||||
{
|
{
|
||||||
sprintf( MSDPBuffer,
|
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 );
|
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;
|
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;
|
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 ( VariableNameTable[aMSDP].bString )
|
||||||
{
|
{
|
||||||
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, apValue) )
|
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, apValue) != 0 )
|
||||||
{
|
{
|
||||||
free(pProtocol->pVariables[aMSDP]->pValueString);
|
free(pProtocol->pVariables[aMSDP]->pValueString);
|
||||||
pProtocol->pVariables[aMSDP]->pValueString = AllocString(apValue);
|
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;
|
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, apValue);
|
||||||
strcat(pTable, MsdpTableStop);
|
strcat(pTable, MsdpTableStop);
|
||||||
|
|
||||||
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pTable) )
|
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pTable) != 0 )
|
||||||
{
|
{
|
||||||
free(pProtocol->pVariables[aMSDP]->pValueString);
|
free(pProtocol->pVariables[aMSDP]->pValueString);
|
||||||
pProtocol->pVariables[aMSDP]->pValueString = pTable;
|
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;
|
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, apValue);
|
||||||
strcat(pArray, MsdpArrayStop);
|
strcat(pArray, MsdpArrayStop);
|
||||||
|
|
||||||
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pArray) )
|
if ( strcmp(pProtocol->pVariables[aMSDP]->pValueString, pArray) != 0 )
|
||||||
{
|
{
|
||||||
free(pProtocol->pVariables[aMSDP]->pValueString);
|
free(pProtocol->pVariables[aMSDP]->pValueString);
|
||||||
pProtocol->pVariables[aMSDP]->pValueString = pArray;
|
pProtocol->pVariables[aMSDP]->pValueString = pArray;
|
||||||
@@ -1344,7 +1337,7 @@ void MSSPSetPlayers( int aPlayers )
|
|||||||
MXP global functions.
|
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;
|
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
|
||||||
|
|
||||||
@@ -1408,7 +1401,7 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger )
|
|||||||
Colour global functions.
|
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;
|
protocol_t *pProtocol = apDescriptor ? apDescriptor->pProtocol : NULL;
|
||||||
bool charHasColor = TRUE;
|
bool charHasColor = TRUE;
|
||||||
@@ -1599,6 +1592,7 @@ static void PerformHandshake( descriptor_t *apDescriptor, char aCmd, char aProto
|
|||||||
if ( aCmd == (char)DO )
|
if ( aCmd == (char)DO )
|
||||||
SendMSSP( apDescriptor );
|
SendMSSP( apDescriptor );
|
||||||
else if ( aCmd == (char)DONT )
|
else if ( aCmd == (char)DONT )
|
||||||
|
//NOLINTNEXTLINE(*-suspicious-semicolon)
|
||||||
; /* Do nothing. */
|
; /* Do nothing. */
|
||||||
break;
|
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;
|
protocol_t *pProtocol = apDescriptor->pProtocol;
|
||||||
|
|
||||||
@@ -1742,8 +1736,8 @@ static void PerformSubnegotiation( descriptor_t *apDescriptor, char aCmd, char *
|
|||||||
* free to remove the second strcmp ;)
|
* free to remove the second strcmp ;)
|
||||||
*/
|
*/
|
||||||
if ( pProtocol->pLastTTYPE == NULL ||
|
if ( pProtocol->pLastTTYPE == NULL ||
|
||||||
(strcmp(pProtocol->pLastTTYPE, pClientName) &&
|
(strcmp(pProtocol->pLastTTYPE, pClientName) != 0 &&
|
||||||
strcmp(pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString, pClientName)) )
|
strcmp(pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString, pClientName) != 0) )
|
||||||
{
|
{
|
||||||
char RequestTTYPE [] = { (char)IAC, (char)SB, TELOPT_TTYPE, SEND, (char)IAC, (char)SE, '\0' };
|
char RequestTTYPE [] = { (char)IAC, (char)SB, TELOPT_TTYPE, SEND, (char)IAC, (char)SE, '\0' };
|
||||||
const char *pStartPos = strstr( pClientName, "-" );
|
const char *pStartPos = strstr( pClientName, "-" );
|
||||||
@@ -2127,7 +2121,7 @@ static void ExecuteMSDPPair( descriptor_t *apDescriptor, const char *apVariable,
|
|||||||
|
|
||||||
if ( *apValue != '\0' && IsNumber(apValue) )
|
if ( *apValue != '\0' && IsNumber(apValue) )
|
||||||
{
|
{
|
||||||
int Value = atoi(apValue);
|
const int Value = atoi(apValue);
|
||||||
if ( Value >= VariableNameTable[i].Min &&
|
if ( Value >= VariableNameTable[i].Min &&
|
||||||
Value <= VariableNameTable[i].Max )
|
Value <= VariableNameTable[i].Max )
|
||||||
{
|
{
|
||||||
@@ -2247,7 +2241,7 @@ static void SendMSSP( descriptor_t *apDescriptor )
|
|||||||
{
|
{
|
||||||
char MSSPBuffer[MAX_MSSP_BUFFER];
|
char MSSPBuffer[MAX_MSSP_BUFFER];
|
||||||
char MSSPPair[128];
|
char MSSPPair[128];
|
||||||
int SizeBuffer = 3; /* IAC SB MSSP */
|
size_t SizeBuffer = 3; /* IAC SB MSSP */
|
||||||
int i; /* Loop counter */
|
int i; /* Loop counter */
|
||||||
|
|
||||||
/* Before updating the following table, please read the MSSP specification:
|
/* 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 )
|
for ( i = 0; MSSPTable[i].pName != NULL; ++i )
|
||||||
{
|
{
|
||||||
int SizePair;
|
size_t SizePair;
|
||||||
|
|
||||||
/* Retrieve the next MSSP variable/value pair */
|
/* Retrieve the next MSSP variable/value pair */
|
||||||
sprintf( MSSPPair, "%c%s%c%s", MSSP_VAR, MSSPTable[i].pName, MSSP_VAL,
|
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 )
|
if ( apString != NULL )
|
||||||
{
|
{
|
||||||
int Size = strlen(apString);
|
const size_t Size = strlen(apString);
|
||||||
pResult = (char *) malloc(Size+1);
|
pResult = (char *) malloc(Size+1);
|
||||||
if ( pResult != NULL )
|
if ( pResult != NULL )
|
||||||
strcpy( pResult, apString );
|
strcpy( pResult, apString );
|
||||||
|
|||||||
+15
-22
@@ -71,22 +71,19 @@ typedef struct descriptor_data descriptor_t;
|
|||||||
Types.
|
Types.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
} bool_t;
|
} bool_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
eUNKNOWN,
|
eUNKNOWN,
|
||||||
eNO,
|
eNO,
|
||||||
eSOMETIMES,
|
eSOMETIMES,
|
||||||
eYES
|
eYES
|
||||||
} support_t;
|
} support_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
eMSDP_NONE = -1, /* This must always be first. */
|
eMSDP_NONE = -1, /* This must always be first. */
|
||||||
|
|
||||||
/* General */
|
/* General */
|
||||||
@@ -165,8 +162,7 @@ typedef enum
|
|||||||
eMSDP_MAX /* This must always be last */
|
eMSDP_MAX /* This must always be last */
|
||||||
} variable_t;
|
} variable_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
variable_t Variable; /* The enum type of this variable */
|
variable_t Variable; /* The enum type of this variable */
|
||||||
const char *pName; /* The string name 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 bString; /* Is this variable a string or a number? */
|
||||||
@@ -179,23 +175,20 @@ typedef struct
|
|||||||
const char *pDefault; /* The default value for a string */
|
const char *pDefault; /* The default value for a string */
|
||||||
} variable_name_t;
|
} variable_name_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
bool_t bReport; /* Is this variable being reported? */
|
bool_t bReport; /* Is this variable being reported? */
|
||||||
bool_t bDirty; /* Does this variable need to be sent again? */
|
bool_t bDirty; /* Does this variable need to be sent again? */
|
||||||
int ValueInt; /* The numeric value of the variable */
|
int ValueInt; /* The numeric value of the variable */
|
||||||
char *pValueString; /* The string value of the variable */
|
char *pValueString; /* The string value of the variable */
|
||||||
} MSDP_t;
|
} MSDP_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
const char *pName; /* The name of the MSSP variable */
|
const char *pName; /* The name of the MSSP variable */
|
||||||
const char *pValue; /* The value of the MSSP variable */
|
const char *pValue; /* The value of the MSSP variable */
|
||||||
const char *(*pFunction)(void); /* Optional function to return the value */
|
const char *(*pFunction)(void); /* Optional function to return the value */
|
||||||
} MSSP_t;
|
} MSSP_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int WriteOOB; /* Used internally to indicate OOB data */
|
int WriteOOB; /* Used internally to indicate OOB data */
|
||||||
bool_t bIACMode; /* Current mode - deals with broken packets */
|
bool_t bIACMode; /* Current mode - deals with broken packets */
|
||||||
bool_t bNegotiated; /* Indicates client successfully negotiated */
|
bool_t bNegotiated; /* Indicates client successfully negotiated */
|
||||||
@@ -256,7 +249,7 @@ extern const char * RGBone;
|
|||||||
extern const char * RGBtwo;
|
extern const char * RGBtwo;
|
||||||
extern const char * RGBthree;
|
extern const char * RGBthree;
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
/* Function: ProtocolOutput
|
/* Function: ProtocolOutput
|
||||||
*
|
*
|
||||||
@@ -317,7 +310,7 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
|
|||||||
* 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.
|
* 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.
|
Copyover save/load functions.
|
||||||
@@ -401,7 +394,7 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha
|
|||||||
*
|
*
|
||||||
* You can also this function for bools, chars, enums, short ints, etc.
|
* 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
|
/* Function: MSDPSetString
|
||||||
*
|
*
|
||||||
@@ -410,7 +403,7 @@ void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue );
|
|||||||
* this is what the snippet does by default), but if the variable is only
|
* 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.
|
* 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
|
/* 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 );
|
* sprintf( Buffer, "%c%s%c%s", (char)MSDP_VAR, Name, (char)MSDP_VAL, Value );
|
||||||
* MSDPSetTable( d, eMSDP_TEST, Buffer );
|
* 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
|
/* 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 );
|
* sprintf( Buffer, "%c%s%c%s", (char)MSDP_VAL, Val1, (char)MSDP_VAL, Val2 );
|
||||||
* MSDPSetArray( d, eMSDP_TEST, Buffer );
|
* 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.
|
MSSP functions.
|
||||||
@@ -457,7 +450,7 @@ void MSSPSetPlayers( int aPlayers );
|
|||||||
* provide a different sequence for other users, or better yet just embed MXP
|
* provide a different sequence for other users, or better yet just embed MXP
|
||||||
* tags for the ProtocolOutput() function.
|
* 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
|
/* Function: MXPSendTag
|
||||||
*
|
*
|
||||||
@@ -497,7 +490,7 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger );
|
|||||||
*
|
*
|
||||||
* If you wish to embed colours in strings, use ProtocolOutput().
|
* 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.
|
Unicode (UTF-8 conversion) functions.
|
||||||
|
|||||||
+15
-15
@@ -28,15 +28,15 @@
|
|||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/*. Function prototypes . */
|
/*. Function prototypes . */
|
||||||
|
|
||||||
static void qedit_setup_new(struct descriptor_data *d);
|
static void qedit_setup_new(descriptor_data *d);
|
||||||
static void qedit_setup_existing(struct descriptor_data *d, qst_rnum rnum);
|
static void qedit_setup_existing(descriptor_data *d, qst_rnum rnum);
|
||||||
static void qedit_disp_menu(struct descriptor_data *d);
|
static void qedit_disp_menu(descriptor_data *d);
|
||||||
static void qedit_save_internally(struct descriptor_data *d);
|
static void qedit_save_internally(descriptor_data *d);
|
||||||
static void qedit_save_to_disk(int num);
|
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));
|
add_quest(OLC_QUEST(d));
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ ACMD(do_oasis_qedit)
|
|||||||
{
|
{
|
||||||
int number = NOWHERE, save = 0;
|
int number = NOWHERE, save = 0;
|
||||||
qst_rnum real_num;
|
qst_rnum real_num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
char buf1[MAX_INPUT_LENGTH];
|
char buf1[MAX_INPUT_LENGTH];
|
||||||
char buf2[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));
|
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;
|
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 . */
|
/*. Alloc some quest shaped space . */
|
||||||
CREATE(OLC_QUEST(d), struct aq_data, 1);
|
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 . */
|
/*. Display main menu . */
|
||||||
|
|
||||||
static void qedit_disp_menu(struct descriptor_data *d)
|
static void qedit_disp_menu(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct aq_data *quest;
|
struct aq_data *quest;
|
||||||
char quest_flags[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
|
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;
|
OLC_MODE(d) = QEDIT_MAIN_MENU;
|
||||||
}
|
}
|
||||||
/* For quest type. */
|
/* 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);
|
clear_screen(d);
|
||||||
column_list(d->character, 0, quest_types, NUM_AQ_TYPES, TRUE);
|
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;
|
OLC_MODE(d) = QEDIT_TYPES;
|
||||||
}
|
}
|
||||||
/* For quest flags. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ static void qedit_disp_flag_menu(struct descriptor_data *d)
|
|||||||
The GARGANTUAN event handler
|
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);
|
int number = atoi(arg);
|
||||||
char *oldtext = NULL;
|
char *oldtext = NULL;
|
||||||
@@ -692,7 +692,7 @@ void qedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OLC_QUEST(d)->next_quest = (number == -1 ? NOTHING : atoi(arg));
|
OLC_QUEST(d)->next_quest = (number == -1 ? NOTHING : atoidx(arg));
|
||||||
break;
|
break;
|
||||||
case QEDIT_PREVQUEST:
|
case QEDIT_PREVQUEST:
|
||||||
if ((number = atoi(arg)) != -1) {
|
if ((number = atoi(arg)) != -1) {
|
||||||
@@ -701,7 +701,7 @@ void qedit_parse(struct descriptor_data *d, char *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OLC_QUEST(d)->prev_quest = (number == -1 ? NOTHING : atoi(arg));
|
OLC_QUEST(d)->prev_quest = (number == -1 ? NOTHING : atoidx(arg));
|
||||||
break;
|
break;
|
||||||
case QEDIT_GOLD:
|
case QEDIT_GOLD:
|
||||||
OLC_QUEST(d)->gold_reward = LIMIT(number, 0, 99999);
|
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);
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case QEDIT_INFO:
|
case QEDIT_INFO:
|
||||||
|
|||||||
+76
-82
@@ -47,7 +47,8 @@ const char *aq_flags[] = {
|
|||||||
static int cmd_tell;
|
static int cmd_tell;
|
||||||
|
|
||||||
static const char *quest_cmd[] = {
|
static const char *quest_cmd[] = {
|
||||||
"list", "history", "join", "leave", "progress", "status", "\n"};
|
"list", "history", "join", "leave", "progress", "status", "\n"
|
||||||
|
};
|
||||||
|
|
||||||
static const char *quest_mort_usage =
|
static const char *quest_mort_usage =
|
||||||
"Usage: quest list | history | progress | join <nn> | leave";
|
"Usage: quest list | history | progress | join <nn> | leave";
|
||||||
@@ -69,7 +70,7 @@ qst_rnum real_quest(qst_vnum vnum)
|
|||||||
return (NOTHING);
|
return (NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_complete(struct char_data *ch, qst_vnum vnum)
|
int is_complete(const char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ int is_complete(struct char_data *ch, qst_vnum vnum)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_vnum qm, int num)
|
qst_vnum find_quest_by_qmnum(char_data *ch, mob_vnum qm, int num)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
@@ -108,8 +109,6 @@ void destroy_quests(void)
|
|||||||
free(aquest_table);
|
free(aquest_table);
|
||||||
aquest_table = NULL;
|
aquest_table = NULL;
|
||||||
total_quests = 0;
|
total_quests = 0;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_quests(qst_vnum low, qst_vnum high)
|
int count_quests(qst_vnum low, qst_vnum high)
|
||||||
@@ -200,8 +199,7 @@ void parse_quest(FILE *quest_f, int nr)
|
|||||||
log("Format error in %s\n", line);
|
log("Format error in %s\n", line);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
switch(*line) {
|
if (*line == 'S') {
|
||||||
case 'S':
|
|
||||||
total_quests = ++i;
|
total_quests = ++i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -234,63 +232,61 @@ void assign_the_quests(void)
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Quest Completion Functions */
|
/* Quest Completion Functions */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
void set_quest(struct char_data *ch, qst_rnum rnum)
|
void set_quest(const char_data *ch, qst_rnum rnum)
|
||||||
{
|
{
|
||||||
GET_QUEST(ch) = QST_NUM(rnum);
|
GET_QUEST(ch) = QST_NUM(rnum);
|
||||||
GET_QUEST_TIME(ch) = QST_TIME(rnum);
|
GET_QUEST_TIME(ch) = QST_TIME(rnum);
|
||||||
GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum);
|
GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum);
|
||||||
SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_quest(struct char_data *ch)
|
void clear_quest(const char_data *ch)
|
||||||
{
|
{
|
||||||
GET_QUEST(ch) = NOTHING;
|
GET_QUEST(ch) = NOTHING;
|
||||||
GET_QUEST_TIME(ch) = -1;
|
GET_QUEST_TIME(ch) = -1;
|
||||||
GET_QUEST_COUNTER(ch) = 0;
|
GET_QUEST_COUNTER(ch) = 0;
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_completed_quest(struct char_data *ch, qst_vnum vnum)
|
void add_completed_quest(const char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
qst_vnum *temp;
|
qst_vnum *temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1);
|
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1);
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
||||||
temp[i] = ch->player_specials->saved.completed_quests[i];
|
temp[i] = GET_COMPLETED_QUEST(ch, i);
|
||||||
|
|
||||||
temp[GET_NUM_QUESTS(ch)] = vnum;
|
temp[GET_NUM_QUESTS(ch)] = vnum;
|
||||||
GET_NUM_QUESTS(ch)++;
|
GET_NUM_QUESTS(ch)++;
|
||||||
|
|
||||||
if (ch->player_specials->saved.completed_quests)
|
if (GET_COMPLETED_QUESTS(ch) != NULL)
|
||||||
free(ch->player_specials->saved.completed_quests);
|
free(GET_COMPLETED_QUESTS(ch));
|
||||||
ch->player_specials->saved.completed_quests = temp;
|
GET_COMPLETED_QUESTS(ch) = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_completed_quest(struct char_data *ch, qst_vnum vnum)
|
void remove_completed_quest(const char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
qst_vnum *temp;
|
qst_vnum *temp;
|
||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
|
|
||||||
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch));
|
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch));
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
||||||
if (ch->player_specials->saved.completed_quests[i] != vnum)
|
if (GET_COMPLETED_QUEST(ch, i) != vnum)
|
||||||
temp[j++] = ch->player_specials->saved.completed_quests[i];
|
temp[j++] = GET_COMPLETED_QUEST(ch, i);
|
||||||
|
|
||||||
GET_NUM_QUESTS(ch)--;
|
GET_NUM_QUESTS(ch)--;
|
||||||
|
|
||||||
if (ch->player_specials->saved.completed_quests)
|
if (GET_COMPLETED_QUESTS(ch) != NULL)
|
||||||
free(ch->player_specials->saved.completed_quests);
|
free(GET_COMPLETED_QUESTS(ch));
|
||||||
ch->player_specials->saved.completed_quests = temp;
|
GET_COMPLETED_QUESTS(ch) = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generic_complete_quest(struct char_data *ch)
|
void generic_complete_quest(char_data *ch)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
qst_vnum vnum = GET_QUEST(ch);
|
qst_vnum vnum = GET_QUEST(ch);
|
||||||
struct obj_data *new_obj;
|
obj_data *new_obj;
|
||||||
int happy_qp, happy_gold, happy_exp;
|
int happy_qp, happy_gold, happy_exp;
|
||||||
|
|
||||||
if (--GET_QUEST_COUNTER(ch) <= 0) {
|
if (--GET_QUEST_COUNTER(ch) <= 0) {
|
||||||
@@ -362,10 +358,10 @@ void generic_complete_quest(struct char_data *ch)
|
|||||||
save_char(ch);
|
save_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
void autoquest_trigger_check(char_data *ch, const char_data *vict,
|
||||||
struct obj_data *object, int type)
|
const obj_data *object, int type)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
int found = TRUE;
|
int found = TRUE;
|
||||||
|
|
||||||
@@ -401,7 +397,7 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
|||||||
if (ch == vict)
|
if (ch == vict)
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
||||||
if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
if (IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
||||||
if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) &&
|
if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) &&
|
||||||
!AFF_FLAGGED(i, AFF_CHARM))
|
!AFF_FLAGGED(i, AFF_CHARM))
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
@@ -416,7 +412,7 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
|||||||
case AQ_ROOM_CLEAR:
|
case AQ_ROOM_CLEAR:
|
||||||
if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) {
|
if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) {
|
||||||
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
||||||
if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
if (IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
if (found)
|
if (found)
|
||||||
generic_complete_quest(ch);
|
generic_complete_quest(ch);
|
||||||
@@ -428,7 +424,7 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void quest_timeout(struct char_data *ch)
|
void quest_timeout(char_data *ch)
|
||||||
{
|
{
|
||||||
if ((GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) {
|
if ((GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) {
|
||||||
clear_quest(ch);
|
clear_quest(ch);
|
||||||
@@ -438,7 +434,7 @@ void quest_timeout(struct char_data *ch)
|
|||||||
|
|
||||||
void check_timed_quests(void)
|
void check_timed_quests(void)
|
||||||
{
|
{
|
||||||
struct char_data *ch;
|
char_data *ch;
|
||||||
|
|
||||||
for (ch = character_list; ch; ch = ch->next)
|
for (ch = character_list; ch; ch = ch->next)
|
||||||
if (!IS_NPC(ch) && (GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1))
|
if (!IS_NPC(ch) && (GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1))
|
||||||
@@ -450,7 +446,7 @@ void check_timed_quests(void)
|
|||||||
/* Quest Command Helper Functions */
|
/* Quest Command Helper Functions */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax)
|
void list_quests(char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
qst_vnum bottom, top;
|
qst_vnum bottom, top;
|
||||||
@@ -476,7 +472,7 @@ void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum v
|
|||||||
send_to_char(ch, "None found.\r\n");
|
send_to_char(ch, "None found.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_hist(struct char_data *ch)
|
static void quest_hist(char_data *ch)
|
||||||
{
|
{
|
||||||
int i = 0, counter = 0;
|
int i = 0, counter = 0;
|
||||||
qst_rnum rnum = NOTHING;
|
qst_rnum rnum = NOTHING;
|
||||||
@@ -485,9 +481,12 @@ static void quest_hist(struct char_data *ch)
|
|||||||
"Index Description Questmaster\r\n"
|
"Index Description Questmaster\r\n"
|
||||||
"----- ---------------------------------------------------- -----------\r\n");
|
"----- ---------------------------------------------------- -----------\r\n");
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++) {
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++) {
|
||||||
if ((rnum = real_quest(ch->player_specials->saved.completed_quests[i])) != NOTHING)
|
if ((rnum = real_quest(GET_COMPLETED_QUEST(ch, i))) != NOTHING)
|
||||||
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n",
|
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n",
|
||||||
++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY) ? "Unknown" : GET_NAME(&mob_proto[(real_mobile(QST_MASTER(rnum)))]));
|
++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY)
|
||||||
|
? "Unknown"
|
||||||
|
: GET_NAME(&mob_proto[(real_mobile(
|
||||||
|
QST_MASTER(rnum)))]));
|
||||||
else
|
else
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"\tg%4d\tn) \tcUnknown Quest (it no longer exists)\tn\r\n", ++counter);
|
"\tg%4d\tn) \tcUnknown Quest (it no longer exists)\tn\r\n", ++counter);
|
||||||
@@ -496,7 +495,7 @@ static void quest_hist(struct char_data *ch)
|
|||||||
send_to_char(ch, "You haven't completed any quests yet.\r\n");
|
send_to_char(ch, "You haven't completed any quests yet.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
|
static void quest_join(char_data *ch, char_data *qm, char argument[MAX_INPUT_LENGTH])
|
||||||
{
|
{
|
||||||
qst_vnum vnum;
|
qst_vnum vnum;
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
@@ -508,10 +507,8 @@ static void quest_join(struct char_data *ch, struct char_data *qm, char argument
|
|||||||
else if (GET_QUEST(ch) != NOTHING)
|
else if (GET_QUEST(ch) != NOTHING)
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"%s But you are already part of a quest!", GET_NAME(ch));
|
"%s But you are already part of a quest!", GET_NAME(ch));
|
||||||
else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
|
else if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING
|
||||||
snprintf(buf, sizeof(buf),
|
|| (rnum = real_quest(vnum)) == NOTHING)
|
||||||
"%s I don't know of such a quest!", GET_NAME(ch));
|
|
||||||
else if ((rnum = real_quest(vnum)) == NOTHING)
|
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"%s I don't know of such a quest!", GET_NAME(ch));
|
"%s I don't know of such a quest!", GET_NAME(ch));
|
||||||
else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
|
else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
|
||||||
@@ -554,14 +551,13 @@ static void quest_join(struct char_data *ch, struct char_data *qm, char argument
|
|||||||
save_char(ch);
|
save_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
|
void quest_list(char_data *ch, char_data *qm, char argument[MAX_INPUT_LENGTH])
|
||||||
{
|
{
|
||||||
qst_vnum vnum;
|
qst_vnum vnum;
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
|
|
||||||
if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
|
if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING
|
||||||
send_to_char(ch, "That is not a valid quest!\r\n");
|
|| (rnum = real_quest(vnum)) == NOTHING)
|
||||||
else if ((rnum = real_quest(vnum)) == NOTHING)
|
|
||||||
send_to_char(ch, "That is not a valid quest!\r\n");
|
send_to_char(ch, "That is not a valid quest!\r\n");
|
||||||
else if (QST_INFO(rnum)) {
|
else if (QST_INFO(rnum)) {
|
||||||
send_to_char(ch, "Complete Details on Quest %d \tc%s\tn:\r\n%s",
|
send_to_char(ch, "Complete Details on Quest %d \tc%s\tn:\r\n%s",
|
||||||
@@ -580,7 +576,7 @@ void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_IN
|
|||||||
send_to_char(ch, "There is no further information on that quest.\r\n");
|
send_to_char(ch, "There is no further information on that quest.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_quit(struct char_data *ch)
|
static void quest_quit(char_data *ch)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
|
|
||||||
@@ -606,7 +602,7 @@ static void quest_quit(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_progress(struct char_data *ch)
|
static void quest_progress(char_data *ch)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
|
|
||||||
@@ -630,7 +626,7 @@ static void quest_progress(struct char_data *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_show(struct char_data *ch, mob_vnum qm)
|
static void quest_show(char_data *ch, mob_vnum qm)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
@@ -648,7 +644,7 @@ static void quest_show(struct char_data *ch, mob_vnum qm)
|
|||||||
send_to_char(ch, "There are no quests available here at the moment.\r\n");
|
send_to_char(ch, "There are no quests available here at the moment.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
static void quest_stat(char_data *ch, char argument[MAX_INPUT_LENGTH])
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
mob_rnum qmrnum;
|
mob_rnum qmrnum;
|
||||||
@@ -657,7 +653,7 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
|
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
send_to_char(ch, "%s\r\n", quest_imm_usage);
|
send_to_char(ch, "%s\r\n", quest_imm_usage);
|
||||||
else if ((rnum = real_quest(atoi(argument))) == NOTHING )
|
else if ((rnum = real_quest(atoidx(argument))) == NOTHING)
|
||||||
send_to_char(ch, "That quest does not exist.\r\n");
|
send_to_char(ch, "That quest does not exist.\r\n");
|
||||||
else {
|
else {
|
||||||
sprintbit(QST_FLAGS(rnum), aq_flags, buf, sizeof(buf));
|
sprintbit(QST_FLAGS(rnum), aq_flags, buf, sizeof(buf));
|
||||||
@@ -665,24 +661,24 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
case AQ_OBJ_FIND:
|
case AQ_OBJ_FIND:
|
||||||
case AQ_OBJ_RETURN:
|
case AQ_OBJ_RETURN:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_object(QST_TARGET(rnum)) == NOTHING ?
|
real_object(QST_TARGET(rnum)) == NOTHING
|
||||||
"An unknown object" :
|
? "An unknown object"
|
||||||
obj_proto[real_object(QST_TARGET(rnum))].short_description);
|
: obj_proto[real_object(QST_TARGET(rnum))].short_description);
|
||||||
break;
|
break;
|
||||||
case AQ_ROOM_FIND:
|
case AQ_ROOM_FIND:
|
||||||
case AQ_ROOM_CLEAR:
|
case AQ_ROOM_CLEAR:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_room(QST_TARGET(rnum)) == NOWHERE ?
|
real_room(QST_TARGET(rnum)) == NOWHERE
|
||||||
"An unknown room" :
|
? "An unknown room"
|
||||||
world[real_room(QST_TARGET(rnum))].name);
|
: world[real_room(QST_TARGET(rnum))].name);
|
||||||
break;
|
break;
|
||||||
case AQ_MOB_FIND:
|
case AQ_MOB_FIND:
|
||||||
case AQ_MOB_KILL:
|
case AQ_MOB_KILL:
|
||||||
case AQ_MOB_SAVE:
|
case AQ_MOB_SAVE:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_mobile(QST_TARGET(rnum)) == NOBODY ?
|
real_mobile(QST_TARGET(rnum)) == NOBODY
|
||||||
"An unknown mobile" :
|
? "An unknown mobile"
|
||||||
GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))]));
|
: GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(targetname, sizeof(targetname), "Unknown");
|
snprintf(targetname, sizeof(targetname), "Unknown");
|
||||||
@@ -707,7 +703,8 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
QST_INFO(rnum), QST_DONE(rnum),
|
QST_INFO(rnum), QST_DONE(rnum),
|
||||||
(QST_QUIT(rnum) &&
|
(QST_QUIT(rnum) &&
|
||||||
(str_cmp(QST_QUIT(rnum), "undefined") != 0)
|
(str_cmp(QST_QUIT(rnum), "undefined") != 0)
|
||||||
? QST_QUIT(rnum) : "Nothing\r\n"),
|
? QST_QUIT(rnum)
|
||||||
|
: "Nothing\r\n"),
|
||||||
quest_types[QST_TYPE(rnum)],
|
quest_types[QST_TYPE(rnum)],
|
||||||
QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum),
|
QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum),
|
||||||
targetname,
|
targetname,
|
||||||
@@ -717,14 +714,17 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
if (QST_PREREQ(rnum) != NOTHING)
|
if (QST_PREREQ(rnum) != NOTHING)
|
||||||
send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n",
|
send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n",
|
||||||
QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum),
|
QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum),
|
||||||
QST_PREREQ(rnum) == NOTHING ? "" :
|
QST_PREREQ(rnum) == NOTHING
|
||||||
real_object(QST_PREREQ(rnum)) == NOTHING ? "an unknown object" :
|
? ""
|
||||||
obj_proto[real_object(QST_PREREQ(rnum))].short_description);
|
: real_object(QST_PREREQ(rnum)) == NOTHING
|
||||||
|
? "an unknown object"
|
||||||
|
: obj_proto[real_object(QST_PREREQ(rnum))].short_description);
|
||||||
if (QST_TYPE(rnum) == AQ_OBJ_RETURN)
|
if (QST_TYPE(rnum) == AQ_OBJ_RETURN)
|
||||||
send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n",
|
send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n",
|
||||||
QST_RETURNMOB(rnum),
|
QST_RETURNMOB(rnum),
|
||||||
real_mobile(QST_RETURNMOB(rnum)) == NOBODY ? "an unknown mob" :
|
real_mobile(QST_RETURNMOB(rnum)) == NOBODY
|
||||||
mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr);
|
? "an unknown mob"
|
||||||
|
: mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr);
|
||||||
if (QST_TIME(rnum) != -1)
|
if (QST_TIME(rnum) != -1)
|
||||||
send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n",
|
send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n",
|
||||||
QST_TIME(rnum),
|
QST_TIME(rnum),
|
||||||
@@ -756,12 +756,8 @@ ACMD(do_quest)
|
|||||||
int tp;
|
int tp;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if (!*arg1)
|
if (!*arg1 || (tp = search_block(arg1, quest_cmd, FALSE)) == -1)
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? quest_mort_usage : quest_imm_usage);
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1))
|
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
else {
|
else {
|
||||||
switch (tp) {
|
switch (tp) {
|
||||||
case SCMD_QUEST_LIST:
|
case SCMD_QUEST_LIST:
|
||||||
@@ -785,8 +781,7 @@ ACMD(do_quest)
|
|||||||
quest_stat(ch, arg2);
|
quest_stat(ch, arg2);
|
||||||
break;
|
break;
|
||||||
default: /* Whe should never get here, but... */
|
default: /* Whe should never get here, but... */
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? quest_mort_usage : quest_imm_usage);
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
break;
|
break;
|
||||||
} /* switch on subcmd number */
|
} /* switch on subcmd number */
|
||||||
}
|
}
|
||||||
@@ -794,25 +789,25 @@ ACMD(do_quest)
|
|||||||
|
|
||||||
SPECIAL(questmaster)
|
SPECIAL(questmaster)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum = 0;
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int tp;
|
int tp;
|
||||||
struct char_data *qm = (struct char_data *)me;
|
char_data *qm = (char_data *)me;
|
||||||
|
|
||||||
/* check that qm mob has quests assigned */
|
/* check that qm mob has quests assigned */
|
||||||
for (rnum = 0; (rnum < total_quests &&
|
while (rnum < total_quests && QST_MASTER(rnum) != GET_MOB_VNUM(qm))
|
||||||
QST_MASTER(rnum) != GET_MOB_VNUM(qm)) ; rnum ++);
|
rnum++;
|
||||||
if (rnum >= total_quests)
|
if (rnum >= total_quests)
|
||||||
return FALSE; /* No quests for this mob */
|
return FALSE; /* No quests for this mob */
|
||||||
else if (QST_FUNC(rnum) && (QST_FUNC(rnum) (ch, me, cmd, argument)))
|
if (QST_FUNC(rnum) && QST_FUNC(rnum)(ch, me, cmd, argument))
|
||||||
return TRUE; /* The secondary spec proc handled this command */
|
return TRUE; /* The secondary spec proc handled this command */
|
||||||
else if (CMD_IS("quest")) {
|
if (CMD_IS("quest")) {
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if (!*arg1)
|
if (!*arg1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1))
|
if ((tp = search_block(arg1, quest_cmd, FALSE)) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else {
|
|
||||||
switch (tp) {
|
switch (tp) {
|
||||||
case SCMD_QUEST_LIST:
|
case SCMD_QUEST_LIST:
|
||||||
if (!*arg2)
|
if (!*arg2)
|
||||||
@@ -827,8 +822,7 @@ SPECIAL(questmaster)
|
|||||||
return FALSE; /* fall through to the do_quest command processor */
|
return FALSE; /* fall through to the do_quest command processor */
|
||||||
} /* switch on subcmd number */
|
} /* switch on subcmd number */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return FALSE; /* not a questmaster command */
|
return FALSE; /* not a questmaster command */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
+17
-14
@@ -34,15 +34,17 @@
|
|||||||
/* AQ Flags (much room for expansion) ********************************* */
|
/* AQ Flags (much room for expansion) ********************************* */
|
||||||
#define AQ_REPEATABLE (1 << 0) /* Quest can be repeated */
|
#define AQ_REPEATABLE (1 << 0) /* Quest can be repeated */
|
||||||
#define NUM_AQ_FLAGS 1
|
#define NUM_AQ_FLAGS 1
|
||||||
|
|
||||||
/* Main quest struct ************************************************** */
|
/* Main quest struct ************************************************** */
|
||||||
struct aq_data {
|
struct aq_data
|
||||||
|
{
|
||||||
qst_vnum vnum; /* Virtual nr of the quest */
|
qst_vnum vnum; /* Virtual nr of the quest */
|
||||||
char *name; /* For qlist and the sort */
|
char *name; /* For qlist and the sort */
|
||||||
char *desc; /* Description of the quest */
|
char *desc; /* Description of the quest */
|
||||||
char *info; /* Message displayed when accepted */
|
char *info; /* Message displayed when accepted */
|
||||||
char *done; /* Message displayed when completed */
|
char *done; /* Message displayed when completed */
|
||||||
char *quit; /* Message displayed when quit quest */
|
char *quit; /* Message displayed when quit quest */
|
||||||
long flags; /* Flags (repeatable, etc */
|
bitvector_t flags; /* Flags (repeatable, etc */
|
||||||
int type; /* Quest type */
|
int type; /* Quest type */
|
||||||
mob_vnum qm; /* questmaster offering quest */
|
mob_vnum qm; /* questmaster offering quest */
|
||||||
int target; /* Target value */
|
int target; /* Target value */
|
||||||
@@ -55,6 +57,7 @@ struct aq_data {
|
|||||||
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
|
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
|
||||||
SPECIAL(*func); /* secondary spec_proc for the QM */
|
SPECIAL(*func); /* secondary spec_proc for the QM */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QST_NUM(i) (aquest_table[i].vnum)
|
#define QST_NUM(i) (aquest_table[i].vnum)
|
||||||
#define QST_NAME(i) (aquest_table[i].name)
|
#define QST_NAME(i) (aquest_table[i].name)
|
||||||
#define QST_DESC(i) (aquest_table[i].desc)
|
#define QST_DESC(i) (aquest_table[i].desc)
|
||||||
@@ -86,23 +89,23 @@ void destroy_quests(void);
|
|||||||
void assign_the_quests(void);
|
void assign_the_quests(void);
|
||||||
void parse_quest(FILE *quest_f, int nr);
|
void parse_quest(FILE *quest_f, int nr);
|
||||||
int count_quests(qst_vnum low, qst_vnum high);
|
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 list_quests(char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax);
|
||||||
void set_quest(struct char_data *ch, qst_rnum rnum);
|
void set_quest(const char_data *ch, qst_rnum rnum);
|
||||||
void clear_quest(struct char_data *ch);
|
void clear_quest(const char_data *ch);
|
||||||
void generic_complete_quest(struct char_data *ch);
|
void generic_complete_quest(char_data *ch);
|
||||||
void autoquest_trigger_check(struct char_data *ch, struct char_data *vict, struct obj_data *object, int type);
|
void autoquest_trigger_check(char_data *ch, const char_data *vict, const obj_data *object, int type);
|
||||||
qst_rnum real_quest(qst_vnum vnum);
|
qst_rnum real_quest(qst_vnum vnum);
|
||||||
int is_complete(struct char_data *ch, qst_vnum vnum);
|
int is_complete(const char_data *ch, qst_vnum vnum);
|
||||||
qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_rnum qm, int num);
|
qst_vnum find_quest_by_qmnum(char_data *ch, mob_rnum qm, int num);
|
||||||
void add_completed_quest(struct char_data *ch, qst_vnum vnum);
|
void add_completed_quest(const char_data *ch, qst_vnum vnum);
|
||||||
void remove_completed_quest(struct char_data *ch, qst_vnum vnum);
|
void remove_completed_quest(const char_data *ch, qst_vnum vnum);
|
||||||
void quest_timeout(struct char_data *ch);
|
void quest_timeout(char_data *ch);
|
||||||
void check_timed_quests(void);
|
void check_timed_quests(void);
|
||||||
SPECIAL(questmaster);
|
SPECIAL(questmaster);
|
||||||
ACMD(do_quest);
|
ACMD(do_quest);
|
||||||
/* Implemented in qedit.c */
|
/* Implemented in qedit.c */
|
||||||
void qedit_parse(struct descriptor_data *d, char *arg);
|
void qedit_parse(descriptor_data *d, char *arg);
|
||||||
void qedit_string_cleanup(struct descriptor_data *d, int terminator);
|
void qedit_string_cleanup(descriptor_data *d, int terminator);
|
||||||
/* Implemented in genqst.c */
|
/* Implemented in genqst.c */
|
||||||
int copy_quest_strings(struct aq_data *from, struct aq_data *to);
|
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);
|
int copy_quest(struct aq_data *from, struct aq_data *to, int free_old_strings);
|
||||||
|
|||||||
+24
-27
@@ -23,13 +23,13 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void redit_setup_new(struct descriptor_data *d);
|
static void redit_setup_new(descriptor_data *d);
|
||||||
static void redit_disp_extradesc_menu(struct descriptor_data *d);
|
static void redit_disp_extradesc_menu(descriptor_data *d);
|
||||||
static void redit_disp_exit_menu(struct descriptor_data *d);
|
static void redit_disp_exit_menu(descriptor_data *d);
|
||||||
static void redit_disp_exit_flag_menu(struct descriptor_data *d);
|
static void redit_disp_exit_flag_menu(descriptor_data *d);
|
||||||
static void redit_disp_flag_menu(struct descriptor_data *d);
|
static void redit_disp_flag_menu(descriptor_data *d);
|
||||||
static void redit_disp_sector_menu(struct descriptor_data *d);
|
static void redit_disp_sector_menu(descriptor_data *d);
|
||||||
static void redit_disp_menu(struct descriptor_data *d);
|
static void redit_disp_menu(descriptor_data *d);
|
||||||
|
|
||||||
/* Utils and exported functions. */
|
/* Utils and exported functions. */
|
||||||
ACMD(do_oasis_redit)
|
ACMD(do_oasis_redit)
|
||||||
@@ -37,7 +37,7 @@ ACMD(do_oasis_redit)
|
|||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
int number = NOWHERE, save = 0, real_num;
|
int number = NOWHERE, save = 0, real_num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* No building as a mob or while being forced. */
|
||||||
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
||||||
@@ -57,7 +57,7 @@ ACMD(do_oasis_redit)
|
|||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoidx(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) != NOWHERE) {
|
else if (GET_OLC_ZONE(ch) != NOWHERE) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ ACMD(do_oasis_redit)
|
|||||||
|
|
||||||
/* If a numeric argument was given (like a room number), get it. */
|
/* If a numeric argument was given (like a room number), get it. */
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoidx(buf1);
|
||||||
|
|
||||||
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
||||||
send_to_char(ch, "That room VNUM can't exist.\r\n");
|
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));
|
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);
|
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;
|
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;
|
struct room_data *room;
|
||||||
int counter;
|
int counter;
|
||||||
@@ -231,10 +231,10 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
|
|||||||
SCRIPT(room) = NULL;
|
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;
|
int j, room_num, new_room = FALSE;
|
||||||
struct descriptor_data *dsc;
|
descriptor_data *dsc;
|
||||||
|
|
||||||
if (OLC_ROOM(d)->number == NOWHERE)
|
if (OLC_ROOM(d)->number == NOWHERE)
|
||||||
new_room = TRUE;
|
new_room = TRUE;
|
||||||
@@ -312,7 +312,7 @@ void free_room(struct room_data *room)
|
|||||||
|
|
||||||
/* Menu functions */
|
/* Menu functions */
|
||||||
/* For extra descriptions. */
|
/* 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);
|
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. */
|
/* 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];
|
char door_buf[24];
|
||||||
/* if exit doesn't exist, alloc/create it */
|
/* 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. */
|
/* 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);
|
get_char_colors(d->character);
|
||||||
write_to_output(d, "%s0%s) No door\r\n"
|
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. */
|
/* 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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
@@ -404,7 +404,7 @@ static void redit_disp_flag_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For sector type. */
|
/* 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);
|
clear_screen(d);
|
||||||
column_list(d->character, 0, sector_types, NUM_ROOM_SECTORS, TRUE);
|
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. */
|
/* 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 buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
@@ -515,7 +515,7 @@ static void redit_disp_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The main loop*/
|
/* The main loop*/
|
||||||
void redit_parse(struct descriptor_data *d, char *arg)
|
void redit_parse(descriptor_data *d, char *arg)
|
||||||
{
|
{
|
||||||
int number;
|
int number;
|
||||||
char *oldtext = NULL;
|
char *oldtext = NULL;
|
||||||
@@ -799,10 +799,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case REDIT_EXIT_KEY:
|
case REDIT_EXIT_KEY:
|
||||||
number = atoi(arg);
|
number = atoidx(arg);
|
||||||
if (number < 0)
|
|
||||||
OLC_EXIT(d)->key = NOTHING;
|
|
||||||
else
|
|
||||||
OLC_EXIT(d)->key = number;
|
OLC_EXIT(d)->key = number;
|
||||||
redit_disp_exit_menu(d);
|
redit_disp_exit_menu(d);
|
||||||
return;
|
return;
|
||||||
@@ -886,7 +883,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case REDIT_COPY:
|
case REDIT_COPY:
|
||||||
if ((number = real_room(atoi(arg))) != NOWHERE) {
|
if ((number = real_room(atoidx(arg))) != NOWHERE) {
|
||||||
redit_setup_existing(d, number);
|
redit_setup_existing(d, number);
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "That room does not exist.\r\n");
|
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);
|
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)) {
|
switch (OLC_MODE(d)) {
|
||||||
case REDIT_DESC:
|
case REDIT_DESC:
|
||||||
|
|||||||
+24
-24
@@ -21,19 +21,19 @@
|
|||||||
#include "shop.h"
|
#include "shop.h"
|
||||||
|
|
||||||
/* local functions */
|
/* 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_save_to_disk(int zone_num);
|
||||||
static void sedit_products_menu(struct descriptor_data *d);
|
static void sedit_products_menu(descriptor_data *d);
|
||||||
static void sedit_compact_rooms_menu(struct descriptor_data *d);
|
static void sedit_compact_rooms_menu(descriptor_data *d);
|
||||||
static void sedit_rooms_menu(struct descriptor_data *d);
|
static void sedit_rooms_menu(descriptor_data *d);
|
||||||
static void sedit_namelist_menu(struct descriptor_data *d);
|
static void sedit_namelist_menu(descriptor_data *d);
|
||||||
static void sedit_shop_flags_menu(struct descriptor_data *d);
|
static void sedit_shop_flags_menu(descriptor_data *d);
|
||||||
static void sedit_no_trade_menu(struct descriptor_data *d);
|
static void sedit_no_trade_menu(descriptor_data *d);
|
||||||
static void sedit_types_menu(struct descriptor_data *d);
|
static void sedit_types_menu(descriptor_data *d);
|
||||||
static void sedit_disp_menu(struct 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);
|
OLC_SHOP(d)->vnum = OLC_NUM(d);
|
||||||
add_shop(OLC_SHOP(d));
|
add_shop(OLC_SHOP(d));
|
||||||
@@ -49,7 +49,7 @@ ACMD(do_oasis_sedit)
|
|||||||
{
|
{
|
||||||
int number = NOWHERE, save = 0;
|
int number = NOWHERE, save = 0;
|
||||||
shop_rnum real_num;
|
shop_rnum real_num;
|
||||||
struct descriptor_data *d;
|
descriptor_data *d;
|
||||||
char buf1[MAX_INPUT_LENGTH];
|
char buf1[MAX_INPUT_LENGTH];
|
||||||
char buf2[MAX_INPUT_LENGTH];
|
char buf2[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ ACMD(do_oasis_sedit)
|
|||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoidx(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ ACMD(do_oasis_sedit)
|
|||||||
|
|
||||||
/* If a numeric argument was given, get it. */
|
/* If a numeric argument was given, get it. */
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoidx(buf1);
|
||||||
|
|
||||||
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
if (number < IDXTYPE_MIN || number > IDXTYPE_MAX) {
|
||||||
send_to_char(ch, "That shop VNUM can't exist.\r\n");
|
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));
|
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;
|
struct shop_data *shop;
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ static void sedit_setup_new(struct descriptor_data *d)
|
|||||||
OLC_SHOP(d) = shop;
|
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 a scratch shop structure. */
|
||||||
CREATE(OLC_SHOP(d), struct shop_data, 1);
|
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 */
|
/* Menu functions */
|
||||||
static void sedit_products_menu(struct descriptor_data *d)
|
static void sedit_products_menu(descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct shop_data *shop;
|
struct shop_data *shop;
|
||||||
int i;
|
int i;
|
||||||
@@ -241,7 +241,7 @@ static void sedit_products_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_PRODUCTS_MENU;
|
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;
|
struct shop_data *shop;
|
||||||
int i;
|
int i;
|
||||||
@@ -267,7 +267,7 @@ static void sedit_compact_rooms_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_ROOMS_MENU;
|
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;
|
struct shop_data *shop;
|
||||||
int i;
|
int i;
|
||||||
@@ -298,7 +298,7 @@ static void sedit_rooms_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_ROOMS_MENU;
|
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;
|
struct shop_data *shop;
|
||||||
int i;
|
int i;
|
||||||
@@ -322,7 +322,7 @@ static void sedit_namelist_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_NAMELIST_MENU;
|
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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
@@ -339,7 +339,7 @@ static void sedit_shop_flags_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_SHOP_FLAGS;
|
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];
|
char bits[MAX_STRING_LENGTH];
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
@@ -356,7 +356,7 @@ static void sedit_no_trade_menu(struct descriptor_data *d)
|
|||||||
OLC_MODE(d) = SEDIT_NOTRADE;
|
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;
|
int i, count = 0;
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ static void sedit_types_menu(struct descriptor_data *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display main menu. */
|
/* 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 buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[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 */
|
/* The GARGANTUAN event handler */
|
||||||
void sedit_parse(struct descriptor_data *d, char *arg)
|
void sedit_parse(descriptor_data *d, char *arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
+64
-64
@@ -51,37 +51,37 @@ const char *shop_bits[] = {
|
|||||||
static void push(struct stack_data *stack, int pushval); /**< @todo Move to utils.c */
|
static void push(struct stack_data *stack, int pushval); /**< @todo Move to utils.c */
|
||||||
static int top(struct stack_data *stack); /**< @todo Move to utils.c */
|
static int top(struct stack_data *stack); /**< @todo Move to utils.c */
|
||||||
static int pop(struct stack_data *stack); /**< @todo Move to utils.c */
|
static int pop(struct stack_data *stack); /**< @todo Move to utils.c */
|
||||||
static char *list_object(struct obj_data *obj, int cnt, int oindex, int shop_nr, struct char_data *keeper, struct char_data *seller);
|
static char *list_object(obj_data *obj, int cnt, int oindex, int shop_nr, char_data *keeper, char_data *seller);
|
||||||
static void sort_keeper_objs(struct char_data *keeper, int shop_nr);
|
static void sort_keeper_objs(char_data *keeper, int shop_nr);
|
||||||
static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why);
|
static char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why);
|
||||||
static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max);
|
static int read_type_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max);
|
||||||
static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type);
|
static int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int max, int type);
|
||||||
static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
static void shopping_list(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||||
static bool shopping_identify(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
static bool shopping_identify(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||||
static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
static void shopping_value(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||||
static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
static void shopping_sell(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||||
static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg);
|
static obj_data *get_selling_obj(char_data *ch, char *name, char_data *keeper, int shop_nr, int msg);
|
||||||
static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr);
|
static obj_data *slide_obj(obj_data *obj, char_data *keeper, int shop_nr);
|
||||||
static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr);
|
static void shopping_buy(char *arg, char_data *ch, char_data *keeper, int shop_nr);
|
||||||
static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg);
|
static obj_data *get_purchase_obj(char_data *ch, char *arg, char_data *keeper, int shop_nr, int msg);
|
||||||
static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list);
|
static obj_data *get_hash_obj_vis(char_data *ch, char *name, obj_data *list);
|
||||||
static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list);
|
static obj_data *get_slide_obj_vis(char_data *ch, char *name, obj_data *list);
|
||||||
static char *customer_string(int shop_nr, int detailed);
|
static char *customer_string(int shop_nr, int detailed);
|
||||||
static void list_all_shops(struct char_data *ch);
|
static void list_all_shops(char_data *ch);
|
||||||
static void list_detailed_shop(struct char_data *ch, int shop_nr);
|
static void list_detailed_shop(char_data *ch, int shop_nr);
|
||||||
static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr);
|
static int is_ok_char(char_data *keeper, char_data *ch, int shop_nr);
|
||||||
static int is_open(struct char_data *keeper, int shop_nr, int msg);
|
static int is_open(char_data *keeper, int shop_nr, int msg);
|
||||||
static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr);
|
static int is_ok(char_data *keeper, char_data *ch, int shop_nr);
|
||||||
static void evaluate_operation(struct stack_data *ops, struct stack_data *vals);
|
static void evaluate_operation(struct stack_data *ops, struct stack_data *vals);
|
||||||
static int find_oper_num(char token);
|
static int find_oper_num(char token);
|
||||||
static int evaluate_expression(struct obj_data *obj, char *expr);
|
static int evaluate_expression(obj_data *obj, char *expr);
|
||||||
static int trade_with(struct obj_data *item, int shop_nr);
|
static int trade_with(obj_data *item, int shop_nr);
|
||||||
static int same_obj(struct obj_data *obj1, struct obj_data *obj2);
|
static int same_obj(obj_data *obj1, obj_data *obj2);
|
||||||
static int shop_producing(struct obj_data *item, int shop_nr);
|
static int shop_producing(obj_data *item, int shop_nr);
|
||||||
static int transaction_amt(char *arg);
|
static int transaction_amt(char *arg);
|
||||||
static char *times_message(struct obj_data *obj, char *name, int num);
|
static char *times_message(obj_data *obj, char *name, int num);
|
||||||
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer);
|
static int buy_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *buyer);
|
||||||
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller);
|
static int sell_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *seller);
|
||||||
static int ok_shop_room(int shop_nr, room_vnum room);
|
static int ok_shop_room(int shop_nr, room_vnum room);
|
||||||
static int add_to_shop_list(struct shop_buy_data *list, int type, int *len, int *val);
|
static int add_to_shop_list(struct shop_buy_data *list, int type, int *len, int *val);
|
||||||
static int end_read_list(struct shop_buy_data *list, int len, int error);
|
static int end_read_list(struct shop_buy_data *list, int len, int error);
|
||||||
@@ -104,7 +104,7 @@ static const char *operator_str[] = {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr)
|
static int is_ok_char(char_data *keeper, char_data *ch, int shop_nr)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ static int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_n
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_open(struct char_data *keeper, int shop_nr, int msg)
|
static int is_open(char_data *keeper, int shop_nr, int msg)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ static int is_open(struct char_data *keeper, int shop_nr, int msg)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr)
|
static int is_ok(char_data *keeper, char_data *ch, int shop_nr)
|
||||||
{
|
{
|
||||||
if (is_open(keeper, shop_nr, TRUE))
|
if (is_open(keeper, shop_nr, TRUE))
|
||||||
return (is_ok_char(keeper, ch, shop_nr));
|
return (is_ok_char(keeper, ch, shop_nr));
|
||||||
@@ -216,7 +216,7 @@ static int find_oper_num(char token)
|
|||||||
return (NOTHING);
|
return (NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int evaluate_expression(struct obj_data *obj, char *expr)
|
static int evaluate_expression(obj_data *obj, char *expr)
|
||||||
{
|
{
|
||||||
struct stack_data ops, vals;
|
struct stack_data ops, vals;
|
||||||
char *ptr, *end, name[MAX_STRING_LENGTH];
|
char *ptr, *end, name[MAX_STRING_LENGTH];
|
||||||
@@ -270,7 +270,7 @@ static int evaluate_expression(struct obj_data *obj, char *expr)
|
|||||||
return (temp);
|
return (temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trade_with(struct obj_data *item, int shop_nr)
|
static int trade_with(obj_data *item, int shop_nr)
|
||||||
{
|
{
|
||||||
int counter;
|
int counter;
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ static int trade_with(struct obj_data *item, int shop_nr)
|
|||||||
return (OBJECT_NOTOK);
|
return (OBJECT_NOTOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int same_obj(struct obj_data *obj1, struct obj_data *obj2)
|
static int same_obj(obj_data *obj1, obj_data *obj2)
|
||||||
{
|
{
|
||||||
int aindex;
|
int aindex;
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ static int same_obj(struct obj_data *obj1, struct obj_data *obj2)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shop_producing(struct obj_data *item, int shop_nr)
|
static int shop_producing(obj_data *item, int shop_nr)
|
||||||
{
|
{
|
||||||
int counter;
|
int counter;
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ static int transaction_amt(char *arg)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *times_message(struct obj_data *obj, char *name, int num)
|
static char *times_message(obj_data *obj, char *name, int num)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -364,9 +364,9 @@ static char *times_message(struct obj_data *obj, char *name, int num)
|
|||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
|
static obj_data *get_slide_obj_vis(char_data *ch, char *name, obj_data *list)
|
||||||
{
|
{
|
||||||
struct obj_data *i, *last_match = NULL;
|
obj_data *i, *last_match = NULL;
|
||||||
int j, number;
|
int j, number;
|
||||||
char tmpname[MAX_INPUT_LENGTH];
|
char tmpname[MAX_INPUT_LENGTH];
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@@ -387,9 +387,9 @@ static struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, stru
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
|
static obj_data *get_hash_obj_vis(char_data *ch, char *name, obj_data *list)
|
||||||
{
|
{
|
||||||
struct obj_data *loop, *last_obj = NULL;
|
obj_data *loop, *last_obj = NULL;
|
||||||
int qindex;
|
int qindex;
|
||||||
|
|
||||||
if (is_number(name))
|
if (is_number(name))
|
||||||
@@ -409,10 +409,10 @@ static struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struc
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg)
|
static obj_data *get_purchase_obj(char_data *ch, char *arg, char_data *keeper, int shop_nr, int msg)
|
||||||
{
|
{
|
||||||
char name[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
one_argument(arg, name);
|
one_argument(arg, name);
|
||||||
do {
|
do {
|
||||||
@@ -453,7 +453,7 @@ static struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct
|
|||||||
discount beyond the basic price. That assumes they put a lot of points
|
discount beyond the basic price. That assumes they put a lot of points
|
||||||
into charisma, because on the flip side they'd get 11% inflation by
|
into charisma, because on the flip side they'd get 11% inflation by
|
||||||
having a 3. */
|
having a 3. */
|
||||||
static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer)
|
static int buy_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *buyer)
|
||||||
{
|
{
|
||||||
return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr)
|
return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr)
|
||||||
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70));
|
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70));
|
||||||
@@ -461,7 +461,7 @@ static int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper
|
|||||||
|
|
||||||
/* When the shopkeeper is buying, we reverse the discount. Also make sure
|
/* When the shopkeeper is buying, we reverse the discount. Also make sure
|
||||||
we don't buy for more than we sell for, to prevent infinite money-making. */
|
we don't buy for more than we sell for, to prevent infinite money-making. */
|
||||||
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller)
|
static int sell_price(obj_data *obj, int shop_nr, char_data *keeper, char_data *seller)
|
||||||
{
|
{
|
||||||
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
||||||
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / 70.0);
|
||||||
@@ -472,10 +472,10 @@ static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keepe
|
|||||||
return (int) (GET_OBJ_COST(obj) * sell_cost_modifier);
|
return (int) (GET_OBJ_COST(obj) * sell_cost_modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
static void shopping_buy(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
char tempstr[MAX_INPUT_LENGTH - 10], tempbuf[MAX_INPUT_LENGTH];
|
char tempstr[MAX_INPUT_LENGTH - 10], tempbuf[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj, *last_obj = NULL;
|
obj_data *obj, *last_obj = NULL;
|
||||||
int goldamt = 0, buynum, bought = 0;
|
int goldamt = 0, buynum, bought = 0;
|
||||||
|
|
||||||
if (!is_ok(keeper, ch, shop_nr))
|
if (!is_ok(keeper, ch, shop_nr))
|
||||||
@@ -638,10 +638,10 @@ static void shopping_buy(char *arg, struct char_data *ch, struct char_data *keep
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg)
|
static obj_data *get_selling_obj(char_data *ch, char *name, char_data *keeper, int shop_nr, int msg)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!(obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying))) {
|
if (!(obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying))) {
|
||||||
@@ -684,9 +684,9 @@ static struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct
|
|||||||
* is put together, and manipulating the order of the objects on the list. (But
|
* is put together, and manipulating the order of the objects on the list. (But
|
||||||
* since most of DIKU is not encapsulated, and information hiding is almost
|
* since most of DIKU is not encapsulated, and information hiding is almost
|
||||||
* never used, it isn't that big a deal). -JF */
|
* never used, it isn't that big a deal). -JF */
|
||||||
static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr)
|
static obj_data *slide_obj(obj_data *obj, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
struct obj_data *loop;
|
obj_data *loop;
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
if (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper))
|
if (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper))
|
||||||
@@ -714,9 +714,9 @@ static struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper
|
|||||||
return (obj);
|
return (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort_keeper_objs(struct char_data *keeper, int shop_nr)
|
static void sort_keeper_objs(char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
struct obj_data *list = NULL, *temp;
|
obj_data *list = NULL, *temp;
|
||||||
|
|
||||||
while (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper)) {
|
while (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper)) {
|
||||||
temp = keeper->carrying;
|
temp = keeper->carrying;
|
||||||
@@ -737,10 +737,10 @@ static void sort_keeper_objs(struct char_data *keeper, int shop_nr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
static void shopping_sell(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
char tempstr[MAX_INPUT_LENGTH - 10], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; // - 10 to make room for constants in format
|
char tempstr[MAX_INPUT_LENGTH - 10], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; // - 10 to make room for constants in format
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int sellnum, sold = 0, goldamt = 0;
|
int sellnum, sold = 0, goldamt = 0;
|
||||||
|
|
||||||
if (!(is_ok(keeper, ch, shop_nr)))
|
if (!(is_ok(keeper, ch, shop_nr)))
|
||||||
@@ -814,10 +814,10 @@ static void shopping_sell(char *arg, struct char_data *ch, struct char_data *kee
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
static void shopping_value(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
if (!is_ok(keeper, ch, shop_nr))
|
if (!is_ok(keeper, ch, shop_nr))
|
||||||
return;
|
return;
|
||||||
@@ -835,7 +835,7 @@ static void shopping_value(char *arg, struct char_data *ch, struct char_data *ke
|
|||||||
do_tell(keeper, buf, cmd_tell, 0);
|
do_tell(keeper, buf, cmd_tell, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch)
|
static char *list_object(obj_data *obj, int cnt, int aindex, int shop_nr, char_data *keeper, char_data *ch)
|
||||||
{
|
{
|
||||||
static char result[256];
|
static char result[256];
|
||||||
char itemname[128],
|
char itemname[128],
|
||||||
@@ -873,10 +873,10 @@ static char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
static void shopping_list(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
|
||||||
struct obj_data *obj, *last_obj = NULL;
|
obj_data *obj, *last_obj = NULL;
|
||||||
int cnt = 0, lindex = 0, found = FALSE, has_quest = FALSE;
|
int cnt = 0, lindex = 0, found = FALSE, has_quest = FALSE;
|
||||||
size_t len;
|
size_t len;
|
||||||
/* cnt is the number of that particular object available */
|
/* cnt is the number of that particular object available */
|
||||||
@@ -942,7 +942,7 @@ static int ok_shop_room(int shop_nr, room_vnum room)
|
|||||||
|
|
||||||
SPECIAL(shop_keeper)
|
SPECIAL(shop_keeper)
|
||||||
{
|
{
|
||||||
struct char_data *keeper = (struct char_data *)me;
|
char_data *keeper = (char_data *)me;
|
||||||
int shop_nr;
|
int shop_nr;
|
||||||
|
|
||||||
for (shop_nr = 0; shop_nr <= top_shop; shop_nr++)
|
for (shop_nr = 0; shop_nr <= top_shop; shop_nr++)
|
||||||
@@ -995,7 +995,7 @@ SPECIAL(shop_keeper)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim)
|
int ok_damage_shopkeeper(char_data *ch, char_data *victim)
|
||||||
{
|
{
|
||||||
int sindex;
|
int sindex;
|
||||||
|
|
||||||
@@ -1302,7 +1302,7 @@ static char *customer_string(int shop_nr, int detailed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* END_OF inefficient */
|
/* END_OF inefficient */
|
||||||
static void list_all_shops(struct char_data *ch)
|
static void list_all_shops(char_data *ch)
|
||||||
{
|
{
|
||||||
const char *list_all_shops_header =
|
const char *list_all_shops_header =
|
||||||
" ## Virtual Where Keeper Buy Sell Customers\r\n"
|
" ## Virtual Where Keeper Buy Sell Customers\r\n"
|
||||||
@@ -1340,9 +1340,9 @@ static void list_all_shops(struct char_data *ch)
|
|||||||
page_string(ch->desc, buf, TRUE);
|
page_string(ch->desc, buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_detailed_shop(struct char_data *ch, int shop_nr)
|
static void list_detailed_shop(char_data *ch, int shop_nr)
|
||||||
{
|
{
|
||||||
struct char_data *k;
|
char_data *k;
|
||||||
int sindex, column, flag = 1, found = 0;
|
int sindex, column, flag = 1, found = 0;
|
||||||
/* char *ptrsave; */
|
/* char *ptrsave; */
|
||||||
|
|
||||||
@@ -1489,7 +1489,7 @@ static void list_detailed_shop(struct char_data *ch, int shop_nr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_shops(struct char_data *ch, char *arg)
|
void show_shops(char_data *ch, char *arg)
|
||||||
{
|
{
|
||||||
int shop_nr;
|
int shop_nr;
|
||||||
|
|
||||||
@@ -1506,7 +1506,7 @@ void show_shops(struct char_data *ch, char *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (is_number(arg))
|
} else if (is_number(arg))
|
||||||
shop_nr = real_shop(atoi(arg));
|
shop_nr = real_shop(atoidx(arg));
|
||||||
else
|
else
|
||||||
shop_nr = -1;
|
shop_nr = -1;
|
||||||
|
|
||||||
@@ -1558,10 +1558,10 @@ void destroy_shops(void)
|
|||||||
top_shop = -1;
|
top_shop = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shopping_identify(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
|
bool shopping_identify(char *arg, char_data *ch, char_data *keeper, int shop_nr)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
struct obj_data *obj;
|
obj_data *obj;
|
||||||
int i, found;
|
int i, found;
|
||||||
|
|
||||||
if (!is_ok(keeper, ch, shop_nr))
|
if (!is_ok(keeper, ch, shop_nr))
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@
|
|||||||
SPECIAL(shop_keeper);
|
SPECIAL(shop_keeper);
|
||||||
void boot_the_shops(FILE *shop_f, char *filename, int rec_count);
|
void boot_the_shops(FILE *shop_f, char *filename, int rec_count);
|
||||||
void assign_the_shopkeepers(void);
|
void assign_the_shopkeepers(void);
|
||||||
void show_shops(struct char_data *ch, char *arg);
|
void show_shops(char_data *ch, char *arg);
|
||||||
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim);
|
int ok_damage_shopkeeper(char_data *ch, char_data *victim);
|
||||||
void destroy_shops(void);
|
void destroy_shops(void);
|
||||||
|
|
||||||
struct shop_buy_data {
|
struct shop_buy_data {
|
||||||
|
|||||||
+11
-11
@@ -31,7 +31,7 @@
|
|||||||
/* locally defined functions of local (file) scope */
|
/* locally defined functions of local (file) scope */
|
||||||
static int compare_spells(const void *x, const void *y);
|
static int compare_spells(const void *x, const void *y);
|
||||||
static const char *how_good(int percent);
|
static const char *how_good(int percent);
|
||||||
static void npc_steal(struct char_data *ch, struct char_data *victim);
|
static void npc_steal(char_data *ch, char_data *victim);
|
||||||
|
|
||||||
/* Special procedures for mobiles. */
|
/* Special procedures for mobiles. */
|
||||||
static int spell_sort_info[MAX_SKILLS + 1];
|
static int spell_sort_info[MAX_SKILLS + 1];
|
||||||
@@ -96,7 +96,7 @@ static const char *prac_types[] = {
|
|||||||
#define MAXGAIN(ch) (prac_params[MAX_PER_PRAC][(int)GET_CLASS(ch)])
|
#define MAXGAIN(ch) (prac_params[MAX_PER_PRAC][(int)GET_CLASS(ch)])
|
||||||
#define SPLSKL(ch) (prac_types[prac_params[PRAC_TYPE][(int)GET_CLASS(ch)]])
|
#define SPLSKL(ch) (prac_types[prac_params[PRAC_TYPE][(int)GET_CLASS(ch)]])
|
||||||
|
|
||||||
void list_skills(struct char_data *ch)
|
void list_skills(char_data *ch)
|
||||||
{
|
{
|
||||||
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
||||||
int i, sortpos, ret;
|
int i, sortpos, ret;
|
||||||
@@ -167,7 +167,7 @@ SPECIAL(guild)
|
|||||||
|
|
||||||
SPECIAL(dump)
|
SPECIAL(dump)
|
||||||
{
|
{
|
||||||
struct obj_data *k;
|
obj_data *k;
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
for (k = world[IN_ROOM(ch)].contents; k; k = world[IN_ROOM(ch)].contents) {
|
for (k = world[IN_ROOM(ch)].contents; k; k = world[IN_ROOM(ch)].contents) {
|
||||||
@@ -293,7 +293,7 @@ SPECIAL(mayor)
|
|||||||
|
|
||||||
/* General special procedures for mobiles. */
|
/* General special procedures for mobiles. */
|
||||||
|
|
||||||
static void npc_steal(struct char_data *ch, struct char_data *victim)
|
static void npc_steal(char_data *ch, char_data *victim)
|
||||||
{
|
{
|
||||||
int gold;
|
int gold;
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ SPECIAL(snake)
|
|||||||
|
|
||||||
SPECIAL(thief)
|
SPECIAL(thief)
|
||||||
{
|
{
|
||||||
struct char_data *cons;
|
char_data *cons;
|
||||||
|
|
||||||
if (cmd || GET_POS(ch) != POS_STANDING)
|
if (cmd || GET_POS(ch) != POS_STANDING)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@@ -350,7 +350,7 @@ SPECIAL(thief)
|
|||||||
|
|
||||||
SPECIAL(magic_user)
|
SPECIAL(magic_user)
|
||||||
{
|
{
|
||||||
struct char_data *vict;
|
char_data *vict;
|
||||||
|
|
||||||
if (cmd || GET_POS(ch) != POS_FIGHTING)
|
if (cmd || GET_POS(ch) != POS_FIGHTING)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@@ -422,7 +422,7 @@ SPECIAL(magic_user)
|
|||||||
SPECIAL(guild_guard)
|
SPECIAL(guild_guard)
|
||||||
{
|
{
|
||||||
int i, direction;
|
int i, direction;
|
||||||
struct char_data *guard = (struct char_data *)me;
|
char_data *guard = (char_data *)me;
|
||||||
const char *buf = "The guard humiliates you, and blocks your way.\r\n";
|
const char *buf = "The guard humiliates you, and blocks your way.\r\n";
|
||||||
const char *buf2 = "The guard humiliates $n, and blocks $s way.";
|
const char *buf2 = "The guard humiliates $n, and blocks $s way.";
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ SPECIAL(puff)
|
|||||||
|
|
||||||
SPECIAL(fido)
|
SPECIAL(fido)
|
||||||
{
|
{
|
||||||
struct obj_data *i, *temp, *next_obj;
|
obj_data *i, *temp, *next_obj;
|
||||||
|
|
||||||
if (cmd || !AWAKE(ch))
|
if (cmd || !AWAKE(ch))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@@ -510,7 +510,7 @@ SPECIAL(fido)
|
|||||||
|
|
||||||
SPECIAL(janitor)
|
SPECIAL(janitor)
|
||||||
{
|
{
|
||||||
struct obj_data *i;
|
obj_data *i;
|
||||||
|
|
||||||
if (cmd || !AWAKE(ch))
|
if (cmd || !AWAKE(ch))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@@ -530,7 +530,7 @@ SPECIAL(janitor)
|
|||||||
|
|
||||||
SPECIAL(cityguard)
|
SPECIAL(cityguard)
|
||||||
{
|
{
|
||||||
struct char_data *tch, *evil, *spittle;
|
char_data *tch, *evil, *spittle;
|
||||||
int max_evil, min_cha;
|
int max_evil, min_cha;
|
||||||
|
|
||||||
if (cmd || !AWAKE(ch) || FIGHTING(ch))
|
if (cmd || !AWAKE(ch) || FIGHTING(ch))
|
||||||
@@ -595,7 +595,7 @@ SPECIAL(pet_shops)
|
|||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH], pet_name[256];
|
char buf[MAX_STRING_LENGTH], pet_name[256];
|
||||||
room_rnum pet_room;
|
room_rnum pet_room;
|
||||||
struct char_data *pet;
|
char_data *pet;
|
||||||
|
|
||||||
/* Gross. */
|
/* Gross. */
|
||||||
pet_room = IN_ROOM(ch) + 1;
|
pet_room = IN_ROOM(ch) + 1;
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ const char *get_spec_func_name(SPECIAL(*func));
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
void sort_spells(void);
|
void sort_spells(void);
|
||||||
void list_skills(struct char_data *ch);
|
void list_skills(char_data *ch);
|
||||||
|
|
||||||
/* Special functions */
|
/* Special functions */
|
||||||
SPECIAL(guild);
|
SPECIAL(guild);
|
||||||
|
|||||||
+16
-16
@@ -28,12 +28,12 @@ char cast_arg2[MAX_INPUT_LENGTH];
|
|||||||
const char *unused_spellname = "!UNUSED!"; /* So we can get &unused_spellname */
|
const char *unused_spellname = "!UNUSED!"; /* So we can get &unused_spellname */
|
||||||
|
|
||||||
/* Local (File Scope) Function Prototypes */
|
/* Local (File Scope) Function Prototypes */
|
||||||
static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch,
|
static void say_spell(char_data *ch, int spellnum, char_data *tch,
|
||||||
struct obj_data *tobj);
|
obj_data *tobj);
|
||||||
static void spello(int spl, const char *name, int max_mana, int min_mana,
|
static void spello(int spl, const char *name, int max_mana, int min_mana,
|
||||||
int mana_change, int minpos, int targets, int violent, int routines,
|
int mana_change, int minpos, int targets, int violent, int routines,
|
||||||
const char *wearoff);
|
const char *wearoff);
|
||||||
static int mag_manacost(struct char_data *ch, int spellnum);
|
static int mag_manacost(char_data *ch, int spellnum);
|
||||||
|
|
||||||
/* Local (File Scope) Variables */
|
/* Local (File Scope) Variables */
|
||||||
struct syllable {
|
struct syllable {
|
||||||
@@ -55,7 +55,7 @@ static struct syllable syls[] = { { " ", " " }, { "ar", "abra" },
|
|||||||
"t", "h" }, { "u", "e" }, { "v", "z" }, { "w", "x" }, { "x", "n" }, {
|
"t", "h" }, { "u", "e" }, { "v", "z" }, { "w", "x" }, { "x", "n" }, {
|
||||||
"y", "l" }, { "z", "k" }, { "", "" } };
|
"y", "l" }, { "z", "k" }, { "", "" } };
|
||||||
|
|
||||||
static int mag_manacost(struct char_data *ch, int spellnum) {
|
static int mag_manacost(char_data *ch, int spellnum) {
|
||||||
return MAX(SINFO.mana_max - (SINFO.mana_change *
|
return MAX(SINFO.mana_max - (SINFO.mana_change *
|
||||||
(GET_LEVEL(ch) - SINFO.min_level[(int) GET_CLASS(ch)])),
|
(GET_LEVEL(ch) - SINFO.min_level[(int) GET_CLASS(ch)])),
|
||||||
SINFO.mana_min);
|
SINFO.mana_min);
|
||||||
@@ -92,13 +92,13 @@ static char *obfuscate_spell(const char *unobfuscated) {
|
|||||||
return obfuscated;
|
return obfuscated;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void say_spell(struct char_data *ch, int spellnum, struct char_data *tch,
|
static void say_spell(char_data *ch, int spellnum, char_data *tch,
|
||||||
struct obj_data *tobj) {
|
obj_data *tobj) {
|
||||||
const char *format, *spell = skill_name(spellnum);
|
const char *format, *spell = skill_name(spellnum);
|
||||||
char act_buf_original[256], act_buf_obfuscated[256], *obfuscated = obfuscate_spell(spell);
|
char act_buf_original[256], act_buf_obfuscated[256], *obfuscated = obfuscate_spell(spell);
|
||||||
|
|
||||||
|
|
||||||
struct char_data *i;
|
char_data *i;
|
||||||
|
|
||||||
if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
|
if (tch != NULL && IN_ROOM(tch) == IN_ROOM(ch)) {
|
||||||
if (tch == ch)
|
if (tch == ch)
|
||||||
@@ -174,8 +174,8 @@ int find_skill_num(char *name) {
|
|||||||
* works -- all come through this function eventually. This is also the entry
|
* works -- all come through this function eventually. This is also the entry
|
||||||
* point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently
|
* point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently
|
||||||
* ignored here, to make callers simpler. */
|
* ignored here, to make callers simpler. */
|
||||||
int call_magic(struct char_data *caster, struct char_data *cvict,
|
int call_magic(char_data *caster, char_data *cvict,
|
||||||
struct obj_data *ovict, int spellnum, int level, int casttype) {
|
obj_data *ovict, int spellnum, int level, int casttype) {
|
||||||
int savetype;
|
int savetype;
|
||||||
|
|
||||||
if (spellnum < 1 || spellnum > TOP_SPELL_DEFINE)
|
if (spellnum < 1 || spellnum > TOP_SPELL_DEFINE)
|
||||||
@@ -304,11 +304,11 @@ int call_magic(struct char_data *caster, struct char_data *cvict,
|
|||||||
* potion - [0] level [1] spell num [2] spell num [3] spell num
|
* potion - [0] level [1] spell num [2] spell num [3] spell num
|
||||||
* Staves and wands will default to level 14 if the level is not specified; the
|
* Staves and wands will default to level 14 if the level is not specified; the
|
||||||
* DikuMUD format did not specify staff and wand levels in the world files */
|
* DikuMUD format did not specify staff and wand levels in the world files */
|
||||||
void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument) {
|
void mag_objectmagic(char_data *ch, obj_data *obj, char *argument) {
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
int i, k;
|
int i, k;
|
||||||
struct char_data *tch = NULL, *next_tch;
|
char_data *tch = NULL, *next_tch;
|
||||||
struct obj_data *tobj = NULL;
|
obj_data *tobj = NULL;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
@@ -448,8 +448,8 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument)
|
|||||||
* have the target char/obj and spell number. It checks all restrictions,
|
* have the target char/obj and spell number. It checks all restrictions,
|
||||||
* prints the words, etc. Entry point for NPC casts. Recommended entry point
|
* prints the words, etc. Entry point for NPC casts. Recommended entry point
|
||||||
* for spells cast by NPCs via specprocs. */
|
* for spells cast by NPCs via specprocs. */
|
||||||
int cast_spell(struct char_data *ch, struct char_data *tch,
|
int cast_spell(char_data *ch, char_data *tch,
|
||||||
struct obj_data *tobj, int spellnum) {
|
obj_data *tobj, int spellnum) {
|
||||||
if (spellnum < 0 || spellnum > TOP_SPELL_DEFINE) {
|
if (spellnum < 0 || spellnum > TOP_SPELL_DEFINE) {
|
||||||
log("SYSERR: cast_spell trying to call spellnum %d/%d.", spellnum,
|
log("SYSERR: cast_spell trying to call spellnum %d/%d.", spellnum,
|
||||||
TOP_SPELL_DEFINE);
|
TOP_SPELL_DEFINE);
|
||||||
@@ -503,8 +503,8 @@ int cast_spell(struct char_data *ch, struct char_data *tch,
|
|||||||
* the spell can be cast, checks for sufficient mana and subtracts it, and
|
* the spell can be cast, checks for sufficient mana and subtracts it, and
|
||||||
* passes control to cast_spell(). */
|
* passes control to cast_spell(). */
|
||||||
ACMD(do_cast) {
|
ACMD(do_cast) {
|
||||||
struct char_data *tch = NULL;
|
char_data *tch = NULL;
|
||||||
struct obj_data *tobj = NULL;
|
obj_data *tobj = NULL;
|
||||||
char *s, *t;
|
char *s, *t;
|
||||||
int number, mana, spellnum, i, target = 0;
|
int number, mana, spellnum, i, target = 0;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -210,7 +210,7 @@ static int isname_obj(char *search, char *list)
|
|||||||
|
|
||||||
ASPELL(spell_locate_object)
|
ASPELL(spell_locate_object)
|
||||||
{
|
{
|
||||||
struct obj_data *i;
|
obj_data *i;
|
||||||
char name[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
|||||||
+16
-27
@@ -212,9 +212,7 @@ struct spell_info_type {
|
|||||||
#define SPELL_TYPE_STAFF 3
|
#define SPELL_TYPE_STAFF 3
|
||||||
#define SPELL_TYPE_SCROLL 4
|
#define SPELL_TYPE_SCROLL 4
|
||||||
|
|
||||||
#define ASPELL(spellname) \
|
#define ASPELL(spellname) void spellname(int level, char_data *ch, char_data *victim, obj_data *obj)
|
||||||
void spellname(int level, struct char_data *ch, \
|
|
||||||
struct char_data *victim, struct obj_data *obj)
|
|
||||||
|
|
||||||
#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict);
|
#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict);
|
||||||
|
|
||||||
@@ -233,42 +231,33 @@ ASPELL(spell_detect_poison);
|
|||||||
|
|
||||||
int find_skill_num(char *name);
|
int find_skill_num(char *name);
|
||||||
|
|
||||||
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 spellnum, int savetype);
|
|
||||||
|
|
||||||
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);
|
||||||
int spellnum, int savetype);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
void mag_rooms(int level, struct char_data *ch, int spellnum);
|
void mag_rooms(int level, char_data *ch, int spellnum);
|
||||||
|
|
||||||
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);
|
||||||
int spellnum, int savetype);
|
|
||||||
|
|
||||||
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 spellnum, int savetype);
|
|
||||||
|
|
||||||
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 spellnum, int type);
|
|
||||||
|
|
||||||
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 type);
|
||||||
int spellnum, int type);
|
|
||||||
|
|
||||||
void mag_creations(int level, struct char_data *ch, int spellnum);
|
void mag_creations(int level, char_data *ch, int spellnum);
|
||||||
|
|
||||||
int call_magic(struct char_data *caster, struct char_data *cvict,
|
int call_magic(char_data *caster, char_data *cvict, obj_data *ovict, int spellnum, int level, int casttype);
|
||||||
struct obj_data *ovict, int spellnum, int level, int casttype);
|
|
||||||
|
|
||||||
void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
|
void mag_objectmagic(char_data *ch, obj_data *obj, char *argument);
|
||||||
char *argument);
|
|
||||||
|
|
||||||
int cast_spell(struct char_data *ch, struct char_data *tch,
|
int cast_spell(char_data *ch, char_data *tch, obj_data *tobj, int spellnum);
|
||||||
struct obj_data *tobj, int spellnum);
|
|
||||||
|
|
||||||
/* other prototypes */
|
/* other prototypes */
|
||||||
void spell_level(int spell, int chclass, int level);
|
void spell_level(int spell, int chclass, int level);
|
||||||
@@ -276,7 +265,7 @@ void init_spell_levels(void);
|
|||||||
const char *skill_name(int num);
|
const char *skill_name(int num);
|
||||||
|
|
||||||
/* From magic.c */
|
/* From magic.c */
|
||||||
int mag_savingthrow(struct char_data *ch, int type, int modifier);
|
int mag_savingthrow(char_data *ch, int type, int modifier);
|
||||||
void affect_update(void);
|
void affect_update(void);
|
||||||
|
|
||||||
/* from spell_parser.c */
|
/* from spell_parser.c */
|
||||||
|
|||||||
+58
-100
@@ -47,8 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Function macro for the mob, obj and room special functions */
|
/** Function macro for the mob, obj and room special functions */
|
||||||
#define SPECIAL(name) \
|
#define SPECIAL(name) int (name)(struct char_data *ch, void *me, int cmd, char *argument)
|
||||||
int (name)(struct char_data *ch, void *me, int cmd, char *argument)
|
|
||||||
|
|
||||||
/* room-related defines */
|
/* room-related defines */
|
||||||
/* The cardinal directions: used as index to room_data.dir_option[] */
|
/* The cardinal directions: used as index to room_data.dir_option[] */
|
||||||
@@ -660,8 +659,7 @@ typedef unsigned long int bitvector_t;
|
|||||||
* the mob, object or room.
|
* the mob, object or room.
|
||||||
* Multiple extra descriptions on the same object are implemented as a
|
* Multiple extra descriptions on the same object are implemented as a
|
||||||
* linked list. */
|
* linked list. */
|
||||||
struct extra_descr_data
|
struct extra_descr_data {
|
||||||
{
|
|
||||||
char *keyword; /**< Keyword for look/examine */
|
char *keyword; /**< Keyword for look/examine */
|
||||||
char *description; /**< What is shown when this keyword is 'seen' */
|
char *description; /**< What is shown when this keyword is 'seen' */
|
||||||
struct extra_descr_data *next; /**< Next description for this mob/obj/room */
|
struct extra_descr_data *next; /**< Next description for this mob/obj/room */
|
||||||
@@ -675,8 +673,7 @@ struct extra_descr_data
|
|||||||
|
|
||||||
/** object flags used in obj_data. These represent the instance values for
|
/** object flags used in obj_data. These represent the instance values for
|
||||||
* a real object, values that can change during gameplay. */
|
* a real object, values that can change during gameplay. */
|
||||||
struct obj_flag_data
|
struct obj_flag_data {
|
||||||
{
|
|
||||||
int value[NUM_OBJ_VAL_POSITIONS]; /**< Values of the item (see list) */
|
int value[NUM_OBJ_VAL_POSITIONS]; /**< Values of the item (see list) */
|
||||||
byte type_flag; /**< Type of item */
|
byte type_flag; /**< Type of item */
|
||||||
int level; /**< Minimum level to use object */
|
int level; /**< Minimum level to use object */
|
||||||
@@ -691,15 +688,13 @@ struct obj_flag_data
|
|||||||
|
|
||||||
/** Used in obj_file_elem. DO NOT CHANGE if you are using binary object files
|
/** Used in obj_file_elem. DO NOT CHANGE if you are using binary object files
|
||||||
* and already have a player base and don't want to do a player wipe. */
|
* and already have a player base and don't want to do a player wipe. */
|
||||||
struct obj_affected_type
|
struct obj_affected_type {
|
||||||
{
|
|
||||||
byte location; /**< Which ability to change (APPLY_XXX) */
|
byte location; /**< Which ability to change (APPLY_XXX) */
|
||||||
sbyte modifier; /**< How much it changes by */
|
sbyte modifier; /**< How much it changes by */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The Object structure. */
|
/** The Object structure. */
|
||||||
struct obj_data
|
struct obj_data {
|
||||||
{
|
|
||||||
obj_rnum item_number; /**< The unique id of this object instance. */
|
obj_rnum item_number; /**< The unique id of this object instance. */
|
||||||
room_rnum in_room; /**< What room is the object lying in, or -1? */
|
room_rnum in_room; /**< What room is the object lying in, or -1? */
|
||||||
|
|
||||||
@@ -732,8 +727,7 @@ struct obj_data
|
|||||||
/** Instance info for an object that gets saved to disk.
|
/** Instance info for an object that gets saved to disk.
|
||||||
* DO NOT CHANGE if you are using binary object files
|
* DO NOT CHANGE if you are using binary object files
|
||||||
* and already have a player base and don't want to do a player wipe. */
|
* and already have a player base and don't want to do a player wipe. */
|
||||||
struct obj_file_elem
|
struct obj_file_elem {
|
||||||
{
|
|
||||||
obj_vnum item_number; /**< The prototype, non-unique info for this object. */
|
obj_vnum item_number; /**< The prototype, non-unique info for this object. */
|
||||||
|
|
||||||
#if USE_AUTOEQ
|
#if USE_AUTOEQ
|
||||||
@@ -755,8 +749,7 @@ struct obj_file_elem
|
|||||||
* int datatype.
|
* int datatype.
|
||||||
* NOTE: This is *not* used with the ascii playerfiles.
|
* NOTE: This is *not* used with the ascii playerfiles.
|
||||||
* NOTE 2: This structure appears to be unused in this codebase? */
|
* NOTE 2: This structure appears to be unused in this codebase? */
|
||||||
struct rent_info
|
struct rent_info {
|
||||||
{
|
|
||||||
int time;
|
int time;
|
||||||
int rentcode; /**< How this character rented */
|
int rentcode; /**< How this character rented */
|
||||||
int net_cost_per_diem; /**< ? Appears to be unused ? */
|
int net_cost_per_diem; /**< ? Appears to be unused ? */
|
||||||
@@ -776,8 +769,7 @@ struct rent_info
|
|||||||
/* room-related structures */
|
/* room-related structures */
|
||||||
|
|
||||||
/** Direction (north, south, east...) information for rooms. */
|
/** Direction (north, south, east...) information for rooms. */
|
||||||
struct room_direction_data
|
struct room_direction_data {
|
||||||
{
|
|
||||||
char *general_description; /**< Show to char looking in this direction. */
|
char *general_description; /**< Show to char looking in this direction. */
|
||||||
|
|
||||||
char *keyword; /**< for interacting (open/close) this direction */
|
char *keyword; /**< for interacting (open/close) this direction */
|
||||||
@@ -788,8 +780,7 @@ struct room_direction_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** The Room Structure. */
|
/** The Room Structure. */
|
||||||
struct room_data
|
struct room_data {
|
||||||
{
|
|
||||||
room_vnum number; /**< Rooms number (vnum) */
|
room_vnum number; /**< Rooms number (vnum) */
|
||||||
zone_rnum zone; /**< Room zone (for resetting) */
|
zone_rnum zone; /**< Room zone (for resetting) */
|
||||||
int sector_type; /**< sector type (move/hide) */
|
int sector_type; /**< sector type (move/hide) */
|
||||||
@@ -810,8 +801,7 @@ struct room_data
|
|||||||
|
|
||||||
/* char-related structures */
|
/* char-related structures */
|
||||||
/** Memory structure used by NPCs to remember specific PCs. */
|
/** Memory structure used by NPCs to remember specific PCs. */
|
||||||
struct memory_rec_struct
|
struct memory_rec_struct {
|
||||||
{
|
|
||||||
long id; /**< The PC id to remember. */
|
long id; /**< The PC id to remember. */
|
||||||
struct memory_rec_struct *next; /**< Next PC to remember */
|
struct memory_rec_struct *next; /**< Next PC to remember */
|
||||||
};
|
};
|
||||||
@@ -821,8 +811,7 @@ typedef struct memory_rec_struct memory_rec;
|
|||||||
|
|
||||||
/** This structure is purely intended to be an easy way to transfer and return
|
/** This structure is purely intended to be an easy way to transfer and return
|
||||||
* information about time (real or mudwise). */
|
* information about time (real or mudwise). */
|
||||||
struct time_info_data
|
struct time_info_data {
|
||||||
{
|
|
||||||
int hours; /**< numeric hour */
|
int hours; /**< numeric hour */
|
||||||
int day; /**< numeric day */
|
int day; /**< numeric day */
|
||||||
int month; /**< numeric month */
|
int month; /**< numeric month */
|
||||||
@@ -830,16 +819,14 @@ struct time_info_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Player specific time information. */
|
/** Player specific time information. */
|
||||||
struct time_data
|
struct time_data {
|
||||||
{
|
|
||||||
time_t birth; /**< Represents the PCs birthday, used to calculate age. */
|
time_t birth; /**< Represents the PCs birthday, used to calculate age. */
|
||||||
time_t logon; /**< Time of the last logon, used to calculate time played */
|
time_t logon; /**< Time of the last logon, used to calculate time played */
|
||||||
int played; /**< This is the total accumulated time played in secs */
|
int played; /**< This is the total accumulated time played in secs */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Group Data Struct */
|
/* Group Data Struct */
|
||||||
struct group_data
|
struct group_data {
|
||||||
{
|
|
||||||
struct char_data * leader;
|
struct char_data * leader;
|
||||||
struct list_data * members;
|
struct list_data * members;
|
||||||
int group_flags;
|
int group_flags;
|
||||||
@@ -849,15 +836,13 @@ struct group_data
|
|||||||
/** The pclean_criteria_data is set up in config.c and used in db.c to determine
|
/** The pclean_criteria_data is set up in config.c and used in db.c to determine
|
||||||
* the conditions which will cause a player character to be deleted from disk
|
* the conditions which will cause a player character to be deleted from disk
|
||||||
* if the automagic pwipe system is enabled (see config.c). */
|
* if the automagic pwipe system is enabled (see config.c). */
|
||||||
struct pclean_criteria_data
|
struct pclean_criteria_data {
|
||||||
{
|
|
||||||
int level; /**< PC level and below to check for deletion */
|
int level; /**< PC level and below to check for deletion */
|
||||||
int days; /**< time limit in days, for this level of PC */
|
int days; /**< time limit in days, for this level of PC */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** General info used by PC's and NPC's. */
|
/** General info used by PC's and NPC's. */
|
||||||
struct char_player_data
|
struct char_player_data {
|
||||||
{
|
|
||||||
char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */
|
char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */
|
||||||
char *name; /**< PC / NPC name */
|
char *name; /**< PC / NPC name */
|
||||||
char *short_descr; /**< NPC 'actions' */
|
char *short_descr; /**< NPC 'actions' */
|
||||||
@@ -875,8 +860,7 @@ struct char_player_data
|
|||||||
/** Character abilities. Different instances of this structure are used for
|
/** Character abilities. Different instances of this structure are used for
|
||||||
* both inherent and current ability scores (like when poison affects the
|
* both inherent and current ability scores (like when poison affects the
|
||||||
* player strength). */
|
* player strength). */
|
||||||
struct char_ability_data
|
struct char_ability_data {
|
||||||
{
|
|
||||||
sbyte str; /**< Strength. */
|
sbyte str; /**< Strength. */
|
||||||
sbyte str_add; /**< Strength multiplier if str = 18. Usually from 0 to 100 */
|
sbyte str_add; /**< Strength multiplier if str = 18. Usually from 0 to 100 */
|
||||||
sbyte intel; /**< Intelligence */
|
sbyte intel; /**< Intelligence */
|
||||||
@@ -887,8 +871,7 @@ struct char_ability_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Character 'points', or health statistics. */
|
/** Character 'points', or health statistics. */
|
||||||
struct char_point_data
|
struct char_point_data {
|
||||||
{
|
|
||||||
sh_int mana; /**< Current mana level */
|
sh_int mana; /**< Current mana level */
|
||||||
sh_int max_mana; /**< Max mana level */
|
sh_int max_mana; /**< Max mana level */
|
||||||
sh_int hit; /**< Curent hit point, or health, level */
|
sh_int hit; /**< Curent hit point, or health, level */
|
||||||
@@ -912,8 +895,7 @@ struct char_point_data
|
|||||||
|
|
||||||
/** char_special_data_saved: specials which both a PC and an NPC have in
|
/** char_special_data_saved: specials which both a PC and an NPC have in
|
||||||
* common, but which must be saved to the players file for PC's. */
|
* common, but which must be saved to the players file for PC's. */
|
||||||
struct char_special_data_saved
|
struct char_special_data_saved {
|
||||||
{
|
|
||||||
int alignment; /**< -1000 (evil) to 1000 (good) range. */
|
int alignment; /**< -1000 (evil) to 1000 (good) range. */
|
||||||
long idnum; /**< PC's idnum; -1 for mobiles. */
|
long idnum; /**< PC's idnum; -1 for mobiles. */
|
||||||
int act[PM_ARRAY_MAX]; /**< act flags for NPC's; player flag for PC's */
|
int act[PM_ARRAY_MAX]; /**< act flags for NPC's; player flag for PC's */
|
||||||
@@ -922,8 +904,7 @@ struct char_special_data_saved
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Special playing constants shared by PCs and NPCs which aren't in pfile */
|
/** Special playing constants shared by PCs and NPCs which aren't in pfile */
|
||||||
struct char_special_data
|
struct char_special_data {
|
||||||
{
|
|
||||||
struct char_data *fighting; /**< Target of fight; else NULL */
|
struct char_data *fighting; /**< Target of fight; else NULL */
|
||||||
struct char_data *hunting; /**< Target of NPC hunt; else NULL */
|
struct char_data *hunting; /**< Target of NPC hunt; else NULL */
|
||||||
struct obj_data *furniture; /**< Object being sat on/in; else NULL */
|
struct obj_data *furniture; /**< Object being sat on/in; else NULL */
|
||||||
@@ -939,8 +920,7 @@ struct char_special_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Data only needed by PCs, and needs to be saved to disk. */
|
/** Data only needed by PCs, and needs to be saved to disk. */
|
||||||
struct player_special_data_saved
|
struct player_special_data_saved {
|
||||||
{
|
|
||||||
byte skills[MAX_SKILLS+1]; /**< Character skills. */
|
byte skills[MAX_SKILLS+1]; /**< Character skills. */
|
||||||
int wimp_level; /**< Below this # of hit points, flee! */
|
int wimp_level; /**< Below this # of hit points, flee! */
|
||||||
byte freeze_level; /**< Level of god who froze char, if any */
|
byte freeze_level; /**< Level of god who froze char, if any */
|
||||||
@@ -967,8 +947,7 @@ struct player_special_data_saved
|
|||||||
/** Specials needed only by PCs, not NPCs. Space for this structure is
|
/** Specials needed only by PCs, not NPCs. Space for this structure is
|
||||||
* not allocated in memory for NPCs, but it is for PCs and the portion
|
* not allocated in memory for NPCs, but it is for PCs and the portion
|
||||||
* of it labelled 'saved' is saved in the players file. */
|
* of it labelled 'saved' is saved in the players file. */
|
||||||
struct player_special_data
|
struct player_special_data {
|
||||||
{
|
|
||||||
struct player_special_data_saved saved; /**< Information to be saved. */
|
struct player_special_data_saved saved; /**< Information to be saved. */
|
||||||
|
|
||||||
char *poofin; /**< Description displayed to room on arrival of a god. */
|
char *poofin; /**< Description displayed to room on arrival of a god. */
|
||||||
@@ -982,8 +961,7 @@ struct player_special_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Special data used by NPCs, not PCs */
|
/** Special data used by NPCs, not PCs */
|
||||||
struct mob_special_data
|
struct mob_special_data {
|
||||||
{
|
|
||||||
memory_rec *memory; /**< List of PCs to remember */
|
memory_rec *memory; /**< List of PCs to remember */
|
||||||
byte attack_type; /**< The primary attack type (bite, sting, hit, etc.) */
|
byte attack_type; /**< The primary attack type (bite, sting, hit, etc.) */
|
||||||
byte default_pos; /**< Default position (standing, sleeping, etc.) */
|
byte default_pos; /**< Default position (standing, sleeping, etc.) */
|
||||||
@@ -992,8 +970,7 @@ struct mob_special_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** An affect structure. */
|
/** An affect structure. */
|
||||||
struct affected_type
|
struct affected_type {
|
||||||
{
|
|
||||||
sh_int spell; /**< The spell that caused this */
|
sh_int spell; /**< The spell that caused this */
|
||||||
sh_int duration; /**< For how long its effects will last */
|
sh_int duration; /**< For how long its effects will last */
|
||||||
sbyte modifier; /**< Added/subtracted to/from apropriate ability */
|
sbyte modifier; /**< Added/subtracted to/from apropriate ability */
|
||||||
@@ -1005,15 +982,13 @@ struct affected_type
|
|||||||
|
|
||||||
/** The list element that makes up a list of characters following this
|
/** The list element that makes up a list of characters following this
|
||||||
* character. */
|
* character. */
|
||||||
struct follow_type
|
struct follow_type {
|
||||||
{
|
|
||||||
struct char_data *follower; /**< Character directly following. */
|
struct char_data *follower; /**< Character directly following. */
|
||||||
struct follow_type *next; /**< Next character following. */
|
struct follow_type *next; /**< Next character following. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Master structure for PCs and NPCs. */
|
/** Master structure for PCs and NPCs. */
|
||||||
struct char_data
|
struct char_data {
|
||||||
{
|
|
||||||
int pfilepos; /**< PC playerfile pos and id number */
|
int pfilepos; /**< PC playerfile pos and id number */
|
||||||
mob_rnum nr; /**< NPC real instance number */
|
mob_rnum nr; /**< NPC real instance number */
|
||||||
room_rnum in_room; /**< Current location (real room number) */
|
room_rnum in_room; /**< Current location (real room number) */
|
||||||
@@ -1054,16 +1029,14 @@ struct char_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** descriptor-related structures */
|
/** descriptor-related structures */
|
||||||
struct txt_block
|
struct txt_block {
|
||||||
{
|
|
||||||
char *text; /**< ? */
|
char *text; /**< ? */
|
||||||
int aliased; /**< ? */
|
int aliased; /**< ? */
|
||||||
struct txt_block *next; /**< ? */
|
struct txt_block *next; /**< ? */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ? */
|
/** ? */
|
||||||
struct txt_q
|
struct txt_q {
|
||||||
{
|
|
||||||
struct txt_block *head; /**< ? */
|
struct txt_block *head; /**< ? */
|
||||||
struct txt_block *tail; /**< ? */
|
struct txt_block *tail; /**< ? */
|
||||||
};
|
};
|
||||||
@@ -1071,8 +1044,7 @@ struct txt_q
|
|||||||
/** Master structure players. Holds the real players connection to the mud.
|
/** Master structure players. Holds the real players connection to the mud.
|
||||||
* An analogy is the char_data is the body of the character, the descriptor_data
|
* An analogy is the char_data is the body of the character, the descriptor_data
|
||||||
* is the soul. */
|
* is the soul. */
|
||||||
struct descriptor_data
|
struct descriptor_data {
|
||||||
{
|
|
||||||
socket_t descriptor; /**< file descriptor for socket */
|
socket_t descriptor; /**< file descriptor for socket */
|
||||||
char host[HOST_LENGTH+1]; /**< hostname */
|
char host[HOST_LENGTH+1]; /**< hostname */
|
||||||
byte bad_pws; /**< number of bad pw attemps this login */
|
byte bad_pws; /**< number of bad pw attemps this login */
|
||||||
@@ -1095,8 +1067,8 @@ struct descriptor_data
|
|||||||
char *output; /**< ptr to the current output buffer */
|
char *output; /**< ptr to the current output buffer */
|
||||||
char **history; /**< History of commands, for ! mostly. */
|
char **history; /**< History of commands, for ! mostly. */
|
||||||
int history_pos; /**< Circular array position. */
|
int history_pos; /**< Circular array position. */
|
||||||
int bufptr; /**< ptr to end of current output */
|
ssize_t bufptr; /**< ptr to end of current output */
|
||||||
int bufspace; /**< space left in the output buffer */
|
ssize_t bufspace; /**< space left in the output buffer */
|
||||||
struct txt_block *large_outbuf; /**< ptr to large buffer, if we need it */
|
struct txt_block *large_outbuf; /**< ptr to large buffer, if we need it */
|
||||||
struct txt_q input; /**< q of unprocessed input */
|
struct txt_q input; /**< q of unprocessed input */
|
||||||
struct char_data *character; /**< linked to char */
|
struct char_data *character; /**< linked to char */
|
||||||
@@ -1110,19 +1082,24 @@ struct descriptor_data
|
|||||||
struct list_data * events;
|
struct list_data * events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
typedef struct descriptor_data descriptor_data;
|
||||||
|
|
||||||
/* other miscellaneous structures */
|
/* other miscellaneous structures */
|
||||||
/** Fight message display. This structure is used to hold the information to
|
/** Fight message display. This structure is used to hold the information to
|
||||||
* be displayed for every different violent hit type. */
|
* be displayed for every different violent hit type. */
|
||||||
struct msg_type
|
struct msg_type {
|
||||||
{
|
|
||||||
char *attacker_msg; /**< Message displayed to attecker. */
|
char *attacker_msg; /**< Message displayed to attecker. */
|
||||||
char *victim_msg; /**< Message displayed to victim. */
|
char *victim_msg; /**< Message displayed to victim. */
|
||||||
char *room_msg; /**< Message displayed to rest of players in room. */
|
char *room_msg; /**< Message displayed to rest of players in room. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** An entire message structure for a type of hit or spell or skill. */
|
/** An entire message structure for a type of hit or spell or skill. */
|
||||||
struct message_type
|
struct message_type {
|
||||||
{
|
|
||||||
struct msg_type die_msg; /**< Messages for death strikes. */
|
struct msg_type die_msg; /**< Messages for death strikes. */
|
||||||
struct msg_type miss_msg; /**< Messages for missed strikes. */
|
struct msg_type miss_msg; /**< Messages for missed strikes. */
|
||||||
struct msg_type hit_msg; /**< Messages for a succesful strike. */
|
struct msg_type hit_msg; /**< Messages for a succesful strike. */
|
||||||
@@ -1131,16 +1108,14 @@ struct message_type
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Head of list of messages for an attack type. */
|
/** Head of list of messages for an attack type. */
|
||||||
struct message_list
|
struct message_list {
|
||||||
{
|
|
||||||
int a_type; /**< The id of this attack type. */
|
int a_type; /**< The id of this attack type. */
|
||||||
int number_of_attacks; /**< How many attack messages to chose from. */
|
int number_of_attacks; /**< How many attack messages to chose from. */
|
||||||
struct message_type *msg; /**< List of messages. */
|
struct message_type *msg; /**< List of messages. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Social message data structure. */
|
/** Social message data structure. */
|
||||||
struct social_messg
|
struct social_messg {
|
||||||
{
|
|
||||||
int act_nr; /**< The social id. */
|
int act_nr; /**< The social id. */
|
||||||
char *command; /**< The command to activate (smile, wave, etc.) */
|
char *command; /**< The command to activate (smile, wave, etc.) */
|
||||||
char *sort_as; /**< Priority of social sorted by this. */
|
char *sort_as; /**< Priority of social sorted by this. */
|
||||||
@@ -1177,8 +1152,7 @@ struct social_messg
|
|||||||
|
|
||||||
/** Describes bonuses, or negatives, applied to thieves skills. In practice
|
/** Describes bonuses, or negatives, applied to thieves skills. In practice
|
||||||
* this list is tied to the character's dexterity attribute. */
|
* this list is tied to the character's dexterity attribute. */
|
||||||
struct dex_skill_type
|
struct dex_skill_type {
|
||||||
{
|
|
||||||
sh_int p_pocket; /**< Alters the success rate of pick pockets */
|
sh_int p_pocket; /**< Alters the success rate of pick pockets */
|
||||||
sh_int p_locks; /**< Alters the success of pick locks */
|
sh_int p_locks; /**< Alters the success of pick locks */
|
||||||
sh_int traps; /**< Historically alters the success of trap finding. */
|
sh_int traps; /**< Historically alters the success of trap finding. */
|
||||||
@@ -1188,8 +1162,7 @@ struct dex_skill_type
|
|||||||
|
|
||||||
/** Describes the bonuses applied for a specific value of a character's
|
/** Describes the bonuses applied for a specific value of a character's
|
||||||
* strength attribute. */
|
* strength attribute. */
|
||||||
struct dex_app_type
|
struct dex_app_type {
|
||||||
{
|
|
||||||
sh_int reaction; /**< Historically affects reaction savings throws. */
|
sh_int reaction; /**< Historically affects reaction savings throws. */
|
||||||
sh_int miss_att; /**< Historically affects missile attacks */
|
sh_int miss_att; /**< Historically affects missile attacks */
|
||||||
sh_int defensive; /**< Alters character's inherent armor class */
|
sh_int defensive; /**< Alters character's inherent armor class */
|
||||||
@@ -1197,8 +1170,7 @@ struct dex_app_type
|
|||||||
|
|
||||||
/** Describes the bonuses applied for a specific value of a character's
|
/** Describes the bonuses applied for a specific value of a character's
|
||||||
* strength attribute. */
|
* strength attribute. */
|
||||||
struct str_app_type
|
struct str_app_type {
|
||||||
{
|
|
||||||
sh_int tohit; /**< To Hit (THAC0) Bonus/Penalty */
|
sh_int tohit; /**< To Hit (THAC0) Bonus/Penalty */
|
||||||
sh_int todam; /**< Damage Bonus/Penalty */
|
sh_int todam; /**< Damage Bonus/Penalty */
|
||||||
sh_int carry_w; /**< Maximum weight that can be carrried */
|
sh_int carry_w; /**< Maximum weight that can be carrried */
|
||||||
@@ -1207,29 +1179,25 @@ struct str_app_type
|
|||||||
|
|
||||||
/** Describes the bonuses applied for a specific value of a character's
|
/** Describes the bonuses applied for a specific value of a character's
|
||||||
* wisdom attribute. */
|
* wisdom attribute. */
|
||||||
struct wis_app_type
|
struct wis_app_type {
|
||||||
{
|
|
||||||
byte bonus; /**< how many practices player gains per lev */
|
byte bonus; /**< how many practices player gains per lev */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Describes the bonuses applied for a specific value of a character's
|
/** Describes the bonuses applied for a specific value of a character's
|
||||||
* intelligence attribute. */
|
* intelligence attribute. */
|
||||||
struct int_app_type
|
struct int_app_type {
|
||||||
{
|
|
||||||
byte learn; /**< how many % a player learns a spell/skill */
|
byte learn; /**< how many % a player learns a spell/skill */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Describes the bonuses applied for a specific value of a
|
/** Describes the bonuses applied for a specific value of a
|
||||||
* character's constitution attribute. */
|
* character's constitution attribute. */
|
||||||
struct con_app_type
|
struct con_app_type {
|
||||||
{
|
|
||||||
sh_int hitp; /**< Added to a character's new MAXHP at each new level. */
|
sh_int hitp; /**< Added to a character's new MAXHP at each new level. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Stores, and used to deliver, the current weather information
|
/** Stores, and used to deliver, the current weather information
|
||||||
* in the mud world. */
|
* in the mud world. */
|
||||||
struct weather_data
|
struct weather_data {
|
||||||
{
|
|
||||||
int pressure; /**< How is the pressure ( Mb )? */
|
int pressure; /**< How is the pressure ( Mb )? */
|
||||||
int change; /**< How fast and what way does it change? */
|
int change; /**< How fast and what way does it change? */
|
||||||
int sky; /**< How is the sky? */
|
int sky; /**< How is the sky? */
|
||||||
@@ -1238,8 +1206,7 @@ struct weather_data
|
|||||||
|
|
||||||
/** Element in monster and object index-tables.
|
/** Element in monster and object index-tables.
|
||||||
NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */
|
NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */
|
||||||
struct index_data
|
struct index_data {
|
||||||
{
|
|
||||||
mob_vnum vnum; /**< virtual number of this mob/obj */
|
mob_vnum vnum; /**< virtual number of this mob/obj */
|
||||||
int number; /**< number of existing units of this mob/obj */
|
int number; /**< number of existing units of this mob/obj */
|
||||||
/** Point to any SPECIAL function assoicated with mob/obj.
|
/** Point to any SPECIAL function assoicated with mob/obj.
|
||||||
@@ -1252,14 +1219,12 @@ struct index_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Master linked list for the mob/object prototype trigger lists. */
|
/** Master linked list for the mob/object prototype trigger lists. */
|
||||||
struct trig_proto_list
|
struct trig_proto_list {
|
||||||
{
|
|
||||||
int vnum; /**< vnum of the trigger */
|
int vnum; /**< vnum of the trigger */
|
||||||
struct trig_proto_list *next; /**< next trigger */
|
struct trig_proto_list *next; /**< next trigger */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct guild_info_type
|
struct guild_info_type {
|
||||||
{
|
|
||||||
int pc_class;
|
int pc_class;
|
||||||
room_vnum guild_room;
|
room_vnum guild_room;
|
||||||
int direction;
|
int direction;
|
||||||
@@ -1274,8 +1239,7 @@ struct happyhour {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** structure for list of recent players (see 'recent' command) */
|
/** structure for list of recent players (see 'recent' command) */
|
||||||
struct recent_player
|
struct recent_player {
|
||||||
{
|
|
||||||
int vnum; /* The ID number for this instance */
|
int vnum; /* The ID number for this instance */
|
||||||
char name[MAX_NAME_LENGTH+1];/* The char name of the player */
|
char name[MAX_NAME_LENGTH+1];/* The char name of the player */
|
||||||
bool new_player; /* Is this a new player? */
|
bool new_player; /* Is this a new player? */
|
||||||
@@ -1289,8 +1253,7 @@ struct recent_player
|
|||||||
|
|
||||||
/** The game configuration structure used for configurating the game play
|
/** The game configuration structure used for configurating the game play
|
||||||
* variables. */
|
* variables. */
|
||||||
struct game_data
|
struct game_data {
|
||||||
{
|
|
||||||
int pk_allowed; /**< Is player killing allowed? */
|
int pk_allowed; /**< Is player killing allowed? */
|
||||||
int pt_allowed; /**< Is player thieving allowed? */
|
int pt_allowed; /**< Is player thieving allowed? */
|
||||||
int level_can_shout; /**< Level player must be to shout. */
|
int level_can_shout; /**< Level player must be to shout. */
|
||||||
@@ -1321,8 +1284,7 @@ struct game_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** The rent and crashsave options. */
|
/** The rent and crashsave options. */
|
||||||
struct crash_save_data
|
struct crash_save_data {
|
||||||
{
|
|
||||||
int free_rent; /**< Should the MUD allow rent for free? */
|
int free_rent; /**< Should the MUD allow rent for free? */
|
||||||
int max_obj_save; /**< Max items players can rent. */
|
int max_obj_save; /**< Max items players can rent. */
|
||||||
int min_rent_cost; /**< surcharge on top of item costs. */
|
int min_rent_cost; /**< surcharge on top of item costs. */
|
||||||
@@ -1334,8 +1296,7 @@ struct crash_save_data
|
|||||||
|
|
||||||
/** Important room numbers. This structure stores vnums, not real array
|
/** Important room numbers. This structure stores vnums, not real array
|
||||||
* numbers. */
|
* numbers. */
|
||||||
struct room_numbers
|
struct room_numbers {
|
||||||
{
|
|
||||||
room_vnum mortal_start_room; /**< vnum of room that mortals enter at. */
|
room_vnum mortal_start_room; /**< vnum of room that mortals enter at. */
|
||||||
room_vnum immort_start_room; /**< vnum of room that immorts enter at. */
|
room_vnum immort_start_room; /**< vnum of room that immorts enter at. */
|
||||||
room_vnum frozen_start_room; /**< vnum of room that frozen ppl enter. */
|
room_vnum frozen_start_room; /**< vnum of room that frozen ppl enter. */
|
||||||
@@ -1345,8 +1306,7 @@ struct room_numbers
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Operational game variables. */
|
/** Operational game variables. */
|
||||||
struct game_operation
|
struct game_operation {
|
||||||
{
|
|
||||||
ush_int DFLT_PORT; /**< The default port to run the game. */
|
ush_int DFLT_PORT; /**< The default port to run the game. */
|
||||||
char *DFLT_IP; /**< Bind to all interfaces. */
|
char *DFLT_IP; /**< Bind to all interfaces. */
|
||||||
char *DFLT_DIR; /**< The default directory (lib). */
|
char *DFLT_DIR; /**< The default directory (lib). */
|
||||||
@@ -1369,8 +1329,7 @@ struct game_operation
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** The Autowizard options. */
|
/** The Autowizard options. */
|
||||||
struct autowiz_data
|
struct autowiz_data {
|
||||||
{
|
|
||||||
int use_autowiz; /**< Use the autowiz feature? */
|
int use_autowiz; /**< Use the autowiz feature? */
|
||||||
int min_wizlist_lev; /**< Minimun level to show on wizlist. */
|
int min_wizlist_lev; /**< Minimun level to show on wizlist. */
|
||||||
};
|
};
|
||||||
@@ -1384,8 +1343,7 @@ struct autowiz_data
|
|||||||
If changes are made to values of the elements of this structure during game
|
If changes are made to values of the elements of this structure during game
|
||||||
play, the information will be saved to disk.
|
play, the information will be saved to disk.
|
||||||
*/
|
*/
|
||||||
struct config_data
|
struct config_data {
|
||||||
{
|
|
||||||
/** Path to on-disk file where the config_data structure gets written. */
|
/** Path to on-disk file where the config_data structure gets written. */
|
||||||
char *CONFFILE;
|
char *CONFFILE;
|
||||||
/** In-game specific global settings, such as allowing player killing. */
|
/** In-game specific global settings, such as allowing player killing. */
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
extern time_t motdmod;
|
extern time_t motdmod;
|
||||||
extern time_t newsmod;
|
extern time_t newsmod;
|
||||||
|
|
||||||
void tedit_string_cleanup(struct descriptor_data *d, int terminator)
|
void tedit_string_cleanup(descriptor_data *d, int terminator)
|
||||||
{
|
{
|
||||||
FILE *fl;
|
FILE *fl;
|
||||||
char *storage = OLC_STORAGE(d);
|
char *storage = OLC_STORAGE(d);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user