From: nveid Date: Sun, 29 Oct 2006 10:12:49 +0000 (+0000) Subject: If someone is flagged Leave_behind and one of their followers leave the room X-Git-Tag: 0.73~220 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=a022a3c5e0f1127d3484653b3480700993fce183;p=cobramush.git If someone is flagged Leave_behind and one of their followers leave the room theyr'e in, they automatically unfollow them. --- diff --git a/game/txt/changes/0.73 b/game/txt/changes/0.73 index b67acc5..7fa4fab 100644 --- a/game/txt/changes/0.73 +++ b/game/txt/changes/0.73 @@ -4,6 +4,10 @@ CobraMUSH Version 0.73 interest to the user. (See 'changes entries' for a list of all versions.) + Flags: + * LEAVE_BEHIND - When a player leaves the location of + someone they're flowing with this flag it unfollows + the follower. Fixes: * All fixes from 0.72 stable development series diff --git a/hdrs/dbdefs.h b/hdrs/dbdefs.h index 015a805..20b1763 100644 --- a/hdrs/dbdefs.h +++ b/hdrs/dbdefs.h @@ -78,6 +78,9 @@ extern dbref first_free; /* pointer to free list */ #define GoodObject(x) ((x >= 0) && (x < db_top)) +/* Leave Followers Behind */ +#define Leave_Behind(x) has_flag_by_name(x, "LEAVE_BEHIND", TYPE_THING | TYPE_PLAYER) + /* Can guy talk? */ #define Mute(x) (has_flag_by_name(x, "MUTE", TYPE_THING | TYPE_PLAYER | TYPE_ROOM)) #define IsMuted(x,y) (Mute(x) || Mute(Location(x))) diff --git a/src/flags.c b/src/flags.c index c956d48..5a5dfe6 100644 --- a/src/flags.c +++ b/src/flags.c @@ -753,6 +753,7 @@ flag_add_additional(void) add_flag("BUILDER", '\0', TYPE_PLAYER, F_PRIVILEGE, F_PRIVILEGE); add_flag("AUTH_PARENT", '\0', NOTYPE, F_PRIVILEGE, F_PRIVILEGE); add_flag("MUTE", '\0', TYPE_PLAYER, F_PRIVILEGE, F_PRIVILEGE); + add_flag("LEAVE_BEHIND", '\0', TYPE_PLAYER | TYPE_THING, F_ANY, F_ANY); #ifdef RPMODE_SYS add_flag("RPMODE", '\0', TYPE_PLAYER, F_PRIVILEGE, F_PRIVILEGE); add_flag("BLIND", '\0', TYPE_PLAYER, F_PRIVILEGE, F_PRIVILEGE); diff --git a/src/move.c b/src/move.c index 97934f8..a51d450 100644 --- a/src/move.c +++ b/src/move.c @@ -1363,7 +1363,7 @@ clear_following(dbref follower, int noisy) static void follower_command(dbref leader, dbref loc, const char *com) { - dbref follower; + dbref cur_obj; ATTR *a; char *s, *sp; char tbuf1[BUFFER_LEN]; @@ -1372,21 +1372,38 @@ follower_command(dbref leader, dbref loc, const char *com) return; strcpy(combuf, com); a = atr_get_noparent(leader, "FOLLOWERS"); - if (!a) - return; /* No followers */ + if (!a) { + /* No-followers.. Check to see if they're following anyone.. And if that person they're following has + * the LEAVE_BEHIND flag.. then unfollow us + */ + a = atr_get(leader, "FOLLOWING"); + if(!a) /* Not following anyone either */ + return; + strcpy(tbuf1, atr_value(a)); + s = tbuf1; + while(s) { + sp = split_token(&s, ' '); + cur_obj = parse_dbref(sp); + if(GoodObject(cur_obj) && Location(cur_obj) == loc && Leave_Behind(cur_obj)) { + /* K.. we found someone we suppose to be following.. Trigger unfollow on them */ + do_unfollow(leader, unparse_dbref(cur_obj)); + } + } + return; + } strcpy(tbuf1, atr_value(a)); s = tbuf1; while (s) { sp = split_token(&s, ' '); - follower = parse_dbref(sp); - if (GoodObject(follower) && (Location(follower) == loc) - && (Connected(follower) || IsThing(follower)) + cur_obj = parse_dbref(sp); + if (GoodObject(cur_obj) && (Location(cur_obj) == loc) + && (Connected(cur_obj) || IsThing(cur_obj)) && (!(DarkLegal(leader) - || (Dark(Location(follower)) && !Light(leader))) - || CanSee(follower, leader))) { + || (Dark(Location(cur_obj)) && !Light(leader))) + || CanSee(cur_obj, leader))) { /* This is a follower who was in the room with the leader. Follow. */ - notify_format(follower, T("You follow %s."), Name(leader)); - process_command(follower, combuf, follower, follower, 0); + notify_format(cur_obj, T("You follow %s."), Name(leader)); + process_command(cur_obj, combuf, cur_obj, cur_obj, 0); } } }