From 9f33134c93ecbadda70e8eefc50563e29b2eb7f2 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 5 Apr 2014 12:39:30 -0300 Subject: =?UTF-8?q?-Support=20for=20changing=20fonts=20-Detect=20when=20fr?= =?UTF-8?q?ee()=20might=20crash=20the=20project=20and=20throw=20error=20-f?= =?UTF-8?q?ixed=202D=20Bounce=20in=20physics=20(3d=20still=20broken)=20-re?= =?UTF-8?q?named=20=E2=80=9Con=5Ftop=E2=80=9D=20property=20to=20=E2=80=9Cb?= =?UTF-8?q?ehind=5Fparent=E2=80=9D,=20which=20makes=20more=20sense,=20old?= =?UTF-8?q?=20on=5Ftop=20remains=20there=20for=20compatibility=20but=20is?= =?UTF-8?q?=20invisible.=20-large=20amount=20of=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gdscript/gd_functions.cpp | 2 +- modules/gdscript/gd_script.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index c099c3f33c..f789493ae8 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -1095,7 +1095,7 @@ MethodInfo GDFunctions::get_info(Function p_func) { return mi; } break; case MATH_RAND: { - MethodInfo mi("rand"); + MethodInfo mi("randi"); mi.return_val.type=Variant::INT; return mi; } break; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 29857e6be6..75bb47ceab 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -635,6 +635,19 @@ Variant GDFunction::call(GDInstance *p_instance,const Variant **p_args, int p_ar err.argument-=1; } } + } if (methodstr=="free") { + + if (err.error==Variant::CallError::CALL_ERROR_INVALID_METHOD) { + + if (base->is_ref()) { + err_text="Attempted to free a reference."; + break; + } else if (base->get_type()==Variant::OBJECT) { + + err_text="Attempted to free a locked object (calling or emitting)."; + break; + } + } } err_text=_get_call_error(err,"function '"+methodstr+"' in base '"+basestr+"'",(const Variant**)argptrs); break; -- cgit v1.2.3