summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-14 22:45:33 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-14 22:45:33 +0000
commit71892967a5849e95d7ea964f1f46242d9222d54a (patch)
treef80c0d15d40e679631f5ae7ab7cd10dbf9347678 /src/map/clif.c
parent63601a1a0618861f8b987797a04e7e7c8e20bc7a (diff)
downloadhercules-71892967a5849e95d7ea964f1f46242d9222d54a.tar.gz
hercules-71892967a5849e95d7ea964f1f46242d9222d54a.tar.bz2
hercules-71892967a5849e95d7ea964f1f46242d9222d54a.tar.xz
hercules-71892967a5849e95d7ea964f1f46242d9222d54a.zip
Removing a friend will also remove you from your friends friendlist, bugreport:2977
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15119 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 101504944..8b6284a9c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12358,6 +12358,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd)
void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
{
// 0x203 </o> <ID to be removed W 4B>
+ struct map_session_data *f_sd = NULL;
int account_id, char_id;
int i, j;
@@ -12380,6 +12381,28 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
memset(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1]));
clif_displaymessage(fd, "Friend removed");
+ //remove from friends list
+ if( (f_sd = map_id2sd(account_id)) ) {
+ for (i = 0; i < MAX_FRIENDS &&
+ (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++);
+
+ if (i != MAX_FRIENDS) {
+ // move all chars down
+ for(j = i + 1; j < MAX_FRIENDS; j++)
+ memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0]));
+
+ memset(&f_sd->status.friends[MAX_FRIENDS-1], 0, sizeof(f_sd->status.friends[MAX_FRIENDS-1]));
+ //should the guy be notified of some message? we should add it here if so
+ WFIFOHEAD(f_sd->fd,packet_len(0x20a));
+ WFIFOW(f_sd->fd,0) = 0x20a;
+ WFIFOL(f_sd->fd,2) = sd->status.account_id;
+ WFIFOL(f_sd->fd,6) = sd->status.char_id;
+ WFIFOSET(f_sd->fd, packet_len(0x20a));
+ }
+
+ } else { //friend not online -- ask char server to delete from his friendlist
+ chrif_removefriend(char_id,sd->status.char_id);
+ }
WFIFOHEAD(fd,packet_len(0x20a));
WFIFOW(fd,0) = 0x20a;
WFIFOL(fd,2) = account_id;