summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}