summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 01:19:16 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-18 01:19:16 +0000
commite724ddf7410dd02e37487921f59bb80828faafc3 (patch)
tree14b293e63d6d3ffbfeb3d35e829f9fc75e2c8427
parent1711d9e803b126c7863eef26691318592faafbf0 (diff)
downloadhercules-e724ddf7410dd02e37487921f59bb80828faafc3.tar.gz
hercules-e724ddf7410dd02e37487921f59bb80828faafc3.tar.bz2
hercules-e724ddf7410dd02e37487921f59bb80828faafc3.tar.xz
hercules-e724ddf7410dd02e37487921f59bb80828faafc3.zip
* Made the 'player not attached' script error also report the function it occured in, if available.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14602 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/script.c39
2 files changed, 40 insertions, 0 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index f69b31f35..09e663ba2 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/12/17
+ * Made the 'player not attached' script error also report the function it occured in, if available. [Ai4rei]
* Fixed a crash, when script command 'doevent' is called without an attached player (bugreport:3973). [Ai4rei]
* Fixed label definitions silently overwriting built-in script functions (bugreport:2806, follow up to r8027). [Ai4rei]
* Added temporary check to skill_delunitgroup to prevent crashes when 'group' is NULL and added some debug messages to track down the source of the crash (bugreport:3504). [Ai4rei]
diff --git a/src/map/script.c b/src/map/script.c
index 3da635bf5..db76e5ac1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -513,6 +513,44 @@ static void script_reportdata(struct script_data* data)
}
}
+
+/// Reports on the console information about the current built-in function.
+static void script_reportfunc(struct script_state* st)
+{
+ int i, params, id;
+ struct script_data* data;
+
+ if( !script_hasdata(st,0) )
+ {// no stack
+ return;
+ }
+
+ data = script_getdata(st,0);
+
+ if( !data_isreference(data) || str_data[reference_getid(data)].type != C_FUNC )
+ {// script currently not executing a built-in function or corrupt stack
+ return;
+ }
+
+ id = reference_getid(data);
+ params = script_lastdata(st)-1;
+
+ if( params > 0 )
+ {
+ ShowDebug("Function: %s (%d parameter%s):\n", get_str(id), params, ( params == 1 ) ? "" : "s");
+
+ for( i = 2; i <= script_lastdata(st); i++ )
+ {
+ script_reportdata(script_getdata(st,i));
+ }
+ }
+ else
+ {
+ ShowDebug("Function: %s (no parameters)\n", get_str(id));
+ }
+}
+
+
/*==========================================
* エラーメッセージ出力
*------------------------------------------*/
@@ -2118,6 +2156,7 @@ TBL_PC *script_rid2sd(struct script_state *st)
TBL_PC *sd=map_id2sd(st->rid);
if(!sd){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
+ script_reportfunc(st);
script_reportsrc(st);
st->state = END;
}