Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COV-0097: Enable immtalk in RealSpace #58

Merged
merged 1 commit into from Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 25 additions & 17 deletions src/act_comm.c
Expand Up @@ -337,6 +337,7 @@ void talk_channel(CHAR_DATA * ch, const char *argument, int channel, const char
char buf2[MAX_STRING_LENGTH];
DESCRIPTOR_DATA *d;
int position;

#ifndef SCRAMBLE
int speaking = -1, lang;

Expand All @@ -348,6 +349,15 @@ void talk_channel(CHAR_DATA * ch, const char *argument, int channel, const char
}
#endif

if (ch->in_room) {
if (xIS_SET(ch->in_room->room_flags, ROOM_SILENCE)
|| IS_SET(ch->in_room->area->flags, AFLAG_SILENCE))
{
send_to_char("You can't do that here.\r\n", ch);
return;
}
}

if (IS_NPC(ch) && channel == CHANNEL_CLAN)
{
send_to_char("Mobs can't be in clans.\r\n", ch);
Expand Down Expand Up @@ -378,12 +388,6 @@ void talk_channel(CHAR_DATA * ch, const char *argument, int channel, const char
return;
}

if (xIS_SET(ch->in_room->room_flags, ROOM_SILENCE) || IS_SET(ch->in_room->area->flags, AFLAG_SILENCE))
{
send_to_char("You can't do that here.\r\n", ch);
return;
}

if (channel == CHANNEL_GOSSIP && xIS_SET(ch->in_room->room_flags, ROOM_NOGOSSIP))
{
send_to_char("You can't do that here.\r\n", ch);
Expand Down Expand Up @@ -537,10 +541,11 @@ void talk_channel(CHAR_DATA * ch, const char *argument, int channel, const char
break;
}

if (xIS_SET(ch->in_room->room_flags, ROOM_LOGSPEECH))
{
snprintf(buf2, MAX_STRING_LENGTH, "%s: %s (%s)", IS_NPC(ch) ? ch->short_descr : ch->name, argument, verb);
append_to_file(LOG_FILE, buf2);
if (ch->in_room) {
if (xIS_SET(ch->in_room->room_flags, ROOM_LOGSPEECH)) {
snprintf(buf2, MAX_STRING_LENGTH, "%s: %s (%s)", IS_NPC(ch) ? ch->short_descr : ch->name, argument, verb);
append_to_file(LOG_FILE, buf2);
}
}

for (d = first_descriptor; d; d = d->next)
Expand Down Expand Up @@ -591,14 +596,17 @@ void talk_channel(CHAR_DATA * ch, const char *argument, int channel, const char
&& !(och->pcdata->council && !str_cmp(och->pcdata->council->name, "Newbie Council"))))
continue;

if (xIS_SET(vch->in_room->room_flags, ROOM_SILENCE) || IS_SET(vch->in_room->area->flags, AFLAG_SILENCE))
continue;
if (vch->in_room)
if (xIS_SET(vch->in_room->room_flags, ROOM_SILENCE) || IS_SET(vch->in_room->area->flags, AFLAG_SILENCE))
continue;

if (channel == CHANNEL_GOSSIP
&& (vch->in_room->area != ch->in_room->area || xIS_SET(vch->in_room->room_flags, ROOM_NOGOSSIP)
|| ((xIS_SET(vch->in_room->room_flags, ROOM_HOUSE) || xIS_SET(och->in_room->room_flags, ROOM_HOUSE))
&& !in_same_house(ch, vch))))
continue;
if (vch->in_room && ch->in_room) {
if (channel == CHANNEL_GOSSIP
&& (vch->in_room->area != ch->in_room->area || xIS_SET(vch->in_room->room_flags, ROOM_NOGOSSIP)
|| ((xIS_SET(vch->in_room->room_flags, ROOM_HOUSE) || xIS_SET(och->in_room->room_flags, ROOM_HOUSE))
&& !in_same_house(ch, vch))))
continue;
}

if (channel == CHANNEL_CLAN || channel == CHANNEL_ORDER || channel == CHANNEL_GUILD)
{
Expand Down
34 changes: 16 additions & 18 deletions src/comm.c
Expand Up @@ -3245,14 +3245,12 @@ void act(short AType, const char *format, CHAR_DATA * ch, const void *arg1, cons
OBJ_DATA *obj2 = (OBJ_DATA *) arg2;
int flags1 = ACTF_NONE, flags2 = ACTF_NONE;

/*
* Discard null and zero-length messages.
*/
/* Discard null and zero-length messages. */

if (!format || format[0] == '\0')
return;

if (!ch)
{
if (!ch) {
bug("%s: null ch. (%s)", __func__, format);
return;
}
Expand Down Expand Up @@ -3325,29 +3323,26 @@ void act(short AType, const char *format, CHAR_DATA * ch, const void *arg1, cons
obj2 = NULL;
}

if (!ch->in_room)
if ((!ch->in_room) && (!ch->in_hex))
to = NULL;
else if (type == TO_CHAR)
to = ch;
else
to = ch->in_room->first_person;
else
to = FIRST_PERSON(ch);

/* ACT_SECRETIVE handling */

/*
* ACT_SECRETIVE handling
*/
if (IS_NPC(ch) && xIS_SET(ch->act, ACT_SECRETIVE) && type != TO_CHAR)
return;

if (type == TO_VICT)
{
if (!vch)
{
if (!vch) {
bug("%s", "Act: null vch with TO_VICT.");
bug("%s (%s)", ch->name, format);
return;
}
if (!vch->in_room)
{
if ((!vch->in_room) && (!vch->in_hex)) {
bug("%s", "Act: vch in NULL room!");
bug("%s -> %s (%s)", ch->name, vch->name, format);
return;
Expand All @@ -3360,9 +3355,12 @@ void act(short AType, const char *format, CHAR_DATA * ch, const void *arg1, cons
OBJ_DATA *to_obj;

txt = act_string(format, NULL, ch, arg1, arg2, STRING_IMM);
if (HAS_PROG(to->in_room, ACT_PROG))
rprog_act_trigger(txt, to->in_room, ch, obj1, vch, obj2);
for (to_obj = to->in_room->first_content; to_obj; to_obj = to_obj->next_content)

if (to->in_room)
if (HAS_PROG(to->in_room, ACT_PROG))
rprog_act_trigger(txt, to->in_room, ch, obj1, vch, obj2);

for (to_obj = FIRST_CONTENT(to); to_obj; to_obj = to_obj->next_content)
if (HAS_PROG(to_obj->pIndexData, ACT_PROG))
oprog_act_trigger(txt, to_obj, ch, obj1, vch, obj2);
}
Expand Down