summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-25 09:56:18 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-25 09:56:18 +0000
commitfc135d64a1ad6b36d807e6b7ab9d804bffe95e48 (patch)
tree0c443f2942d07e145f1055d2301d215ebd317976 /src/map/clif.c
parentf257beaebc07d3a1d8acae247f10ab35a19d867c (diff)
downloadhercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.gz
hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.bz2
hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.tar.xz
hercules-fc135d64a1ad6b36d807e6b7ab9d804bffe95e48.zip
Added proper checks to adoption processing (followup to r12428).
Cleaned up some code / fixed some typos. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12432 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index ea2270024..e3809ded9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12065,16 +12065,21 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
void clif_parse_Adopt_reply(int fd, struct map_session_data *sd)
{
- struct map_session_data *p1_sd = map_id2sd(RFIFOL(fd,2)), *p2_sd = map_id2sd(RFIFOL(fd,6));
- int result = RFIFOL(fd,10), pid = sd->adopt_invite;
+ int p1_id = RFIFOL(fd,2);
+ int p2_id = RFIFOL(fd,6);
+ int result = RFIFOL(fd,10);
+ struct map_session_data* p1_sd = map_id2sd(p1_id);
+ struct map_session_data* p2_sd = map_id2sd(p2_id);
+ int pid = sd->adopt_invite;
sd->adopt_invite = 0;
- if( !p1_sd )
- return; // Parent is not online
-
- if( pid != p1_sd->status.account_id || !result )
- return; // Not the same sender | Reply No
+ if( p1_sd == NULL || p2_sd == NULL )
+ return; // Both players need to be online
+ if( pid != p1_sd->status.account_id || p2_id != p1_sd->status.partner_id )
+ return; // Incorrect values
+ if( result == 0 )
+ return; // Rejected
pc_adoption(p1_sd, p2_sd, sd);
}