summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-02 12:07:37 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-02 12:07:37 +0000
commitb6d61b6247ec5409d71162f1b052b2b4d621941e (patch)
tree6621e64d05ad29aaf1ed061f204cd6a478612766
parent7a6a64ab45ec95ae8c547a7fd3cedd7e7546cdc8 (diff)
downloadhercules-b6d61b6247ec5409d71162f1b052b2b4d621941e.tar.gz
hercules-b6d61b6247ec5409d71162f1b052b2b4d621941e.tar.bz2
hercules-b6d61b6247ec5409d71162f1b052b2b4d621941e.tar.xz
hercules-b6d61b6247ec5409d71162f1b052b2b4d621941e.zip
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
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/script.c13
2 files changed, 8 insertions, 6 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index cf39c6e74..a386f3653 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/11/02
+ * Fixed one wrong return value in buildin_getcharid (bugreport:33)
* Removed the big list of BUILDIN_FUNC() declarations in script.c,
as they are not needed anymore and no code utilizes them
* Moved the BUILDIN_DEF() block to the end of script.c [ultramage]
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;
}