From b6d61b6247ec5409d71162f1b052b2b4d621941e Mon Sep 17 00:00:00 2001 From: ultramage Date: Fri, 2 Nov 2007 12:07:37 +0000 Subject: Fixed one wrong return value in buildin_getcharid (bugreport:33) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11638 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/map') diff --git a/src/map/script.c b/src/map/script.c index c9859de1a..0a308d3e6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5879,24 +5879,25 @@ BUILDIN_FUNC(getcharid) int num; TBL_PC *sd; - num=script_getnum(st,2); + num = script_getnum(st,2); if( script_hasdata(st,3) ) sd=map_nick2sd(script_getstr(st,3)); else - sd=script_rid2sd(st); - if(sd==NULL || num<0 || num>3){ + sd=script_rid2sd(st); + + if(sd==NULL){ script_pushint(st,0); //return 0, according docs return 0; } - switch (num) { + switch( num ) { case 0: script_pushint(st,sd->status.char_id); break; case 1: script_pushint(st,sd->status.party_id); break; case 2: script_pushint(st,sd->status.guild_id); break; case 3: script_pushint(st,sd->status.account_id); break; default: - ShowError("buildin_getcharid: invalid .\n"); - script_pushconststr(st,""); + ShowError("buildin_getcharid: invalid parameter (%d).\n", num); + script_pushint(st,0); break; } -- cgit v1.2.3-60-g2f50