浏览代码

Migrated to AngelScript 2.21.0 WIP.

Lasse Öörni 14 年之前
父节点
当前提交
27661073e7

+ 1 - 1
Docs/Urho3D.dox

@@ -55,7 +55,7 @@ Urho3D is greatly inspired by OGRE (http://www.ogre3d.org/) and Horde3D (http://
 
 Urho3D uses the following third-party libraries:
 
-- AngelScript 2.20.3 WIP (http://www.angelcode.com/angelscript/)
+- AngelScript 2.21.0 WIP (http://www.angelcode.com/angelscript/)
 - ENet 1.3.1 (http://enet.bespin.org/)
 - FreeType 2.3.12 (http://www.freetype.org/)
 - Open Asset Import Library 2.0.863 (http://assimp.sourceforge.net/)

+ 5 - 1
Readme.txt

@@ -28,9 +28,13 @@ Urho3D is greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D
   http://gafferongames.com/game-physics/networked-physics/
 - Euler Angle Formulas by David Eberly
   http://www.geometrictools.com/Documentation/EulerAngles.pdf
+- Red Black Trees by Julienne Walker 
+  http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx
+- Comparison of several sorting algorithms by Juha Nieminen 
+  http://warp.povusers.org/SortComparison/
 
 Urho3D uses the following third-party libraries:
-- AngelScript 2.20.3 WIP (http://www.angelcode.com/angelscript/)
+- AngelScript 2.21.0 WIP (http://www.angelcode.com/angelscript/)
 - ENet 1.3.1 (http://enet.bespin.org/)
 - FreeType 2.3.12 (http://www.freetype.org/)
 - Open Asset Import Library 2.0.863 (http://assimp.sourceforge.net/)

+ 3 - 29
ThirdParty/AngelScript/include/angelscript.h

@@ -56,8 +56,8 @@ BEGIN_AS_NAMESPACE
 
 // AngelScript version
 
-#define ANGELSCRIPT_VERSION        22003
-#define ANGELSCRIPT_VERSION_STRING "2.20.3"
+#define ANGELSCRIPT_VERSION        22100
+#define ANGELSCRIPT_VERSION_STRING "2.21.0"
 
 // Data types
 
@@ -158,9 +158,6 @@ enum asEBehaviours
 	asBEHAVE_IMPLICIT_VALUE_CAST,
 	asBEHAVE_REF_CAST,
 	asBEHAVE_IMPLICIT_REF_CAST,
-#ifdef AS_DEPRECATED
-	asBEHAVE_INDEX,
-#endif
 	asBEHAVE_TEMPLATE_CALLBACK,
 
 	// Garbage collection behaviours
@@ -432,7 +429,7 @@ struct asSMessageInfo
 // ANGELSCRIPT_DLL_MANUAL_IMPORT is defined when manually loading the dll
 // Don't define anything when linking statically to the lib
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
   #if defined(ANGELSCRIPT_EXPORT)
     #define AS_API __declspec(dllexport)
   #elif defined(ANGELSCRIPT_DLL_LIBRARY_IMPORT)
@@ -647,11 +644,6 @@ public:
 	virtual int SaveByteCode(asIBinaryStream *out) const = 0;
 	virtual int LoadByteCode(asIBinaryStream *in) = 0;
 
-#ifdef AS_DEPRECATED
-	virtual const char *GetGlobalVarName(int index) const = 0;
-	virtual int         GetGlobalVarTypeId(int index, bool *isConst = 0) const = 0;
-#endif
-
 protected:
 	virtual ~asIScriptModule() {}
 };
@@ -723,12 +715,6 @@ public:
 	virtual void *SetUserData(void *data) = 0;
 	virtual void *GetUserData() const = 0;
 
-#ifdef AS_DEPRECATED
-	// Deprecated since 2.20.0
-	virtual int         GetCurrentLineNumber(int *column = 0, const char **sectionName = 0) = 0;
-	virtual int         GetCurrentFunction() = 0;
-#endif
-
 protected:
 	virtual ~asIScriptContext() {}
 };
@@ -842,13 +828,6 @@ public:
 	virtual int GetBehaviourCount() const = 0;
 	virtual int GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour) const = 0;
 
-#ifdef AS_DEPRECATED
-	virtual int         GetPropertyTypeId(asUINT prop) const = 0;
-	virtual const char *GetPropertyName(asUINT prop) const = 0;
-	virtual bool        IsPropertyPrivate(asUINT prop) const = 0;
-	virtual int         GetPropertyOffset(asUINT prop) const = 0;
-#endif
-
 protected:
 	virtual ~asIObjectType() {}
 };
@@ -890,11 +869,6 @@ public:
 	virtual void *SetUserData(void *userData) = 0;
 	virtual void *GetUserData() const = 0;
 
-#ifdef AS_DEPRECATED
-	virtual bool             IsClassMethod() const = 0;
-	virtual bool             IsInterfaceMethod() const = 0;
-#endif
-
 protected:
 	virtual ~asIScriptFunction() {};
 };

+ 3 - 3
ThirdParty/AngelScript/source/as_bytecode.cpp

@@ -1363,7 +1363,7 @@ void asCByteCode::CallPtr(asEBCInstr instr, int funcPtrVar, int pop)
 	last->op = instr;
 	last->size = asBCTypeSize[asBCInfo[instr].type];
 	last->stackInc = -pop;
-	last->wArg[0] = funcPtrVar;
+	last->wArg[0] = (short)funcPtrVar;
 
     // Add a JitEntry instruction after function calls so that JIT's can resume execution
     // TODO: Should this be done by the compiler?
@@ -1458,7 +1458,7 @@ void asCByteCode::ObjInfo(int offset, int info)
 	last->op                   = asBC_ObjInfo;
 	last->size                 = 0;
 	last->stackInc             = 0;
-	last->wArg[0]              = offset;
+	last->wArg[0]              = (short)offset;
 	*((int*)ARG_DW(last->arg)) = info;
 }
 
@@ -1791,7 +1791,7 @@ void asCByteCode::DebugOutput(const char *name, asCScriptEngine *engine, asCScri
 		bool found = false;
 		for( asUINT v = 0; v < func->variables.GetLength(); v++ )
 		{
-			if( func->variables[v]->stackOffset == offset )
+			if( func->variables[v]->stackOffset == (int)offset )
 			{
 				found = true;
 				break;

+ 2 - 4
ThirdParty/AngelScript/source/as_callfunc_ppc_64.cpp

@@ -750,13 +750,11 @@ asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr,
 		else
 			retQW = GetReturnedDouble();
 	}
-#if AS_PTR_SIZE == 1
-	else if( descr->returnType.IsReference() || descr->returnType.IsObjectHandle() )
+	else if( sysFunc->hostReturnSize == 1 )
 	{
-		// Move the pointer to the higher bits to compensate for the adjustment done outside
+		// Move the bits to the higher value to compensate for the adjustment that the caller does
 		retQW <<= 32;
 	}
-#endif
 
 	return retQW;
 }

+ 5 - 0
ThirdParty/AngelScript/source/as_callfunc_xenon.cpp

@@ -775,6 +775,11 @@ asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr,
 		else
 			retQW = GetReturnedDouble();
 	}
+	else if( sysFunc->hostReturnSize == 1 )
+	{
+		// Move the bits to the higher value to compensate for the adjustment that the caller does
+		retQW <<= 32;
+	}
 
 	return retQW;
 }

+ 36 - 186
ThirdParty/AngelScript/source/as_compiler.cpp

@@ -656,7 +656,7 @@ void asCCompiler::CallDestructor(asCDataType &type, int offset, bool isObjectOnH
 				if( type.GetBehaviour()->destruct )
 				{
 					// Call the destructor as a regular function
-					bc->InstrSHORT(asBC_PSF, offset);
+					bc->InstrSHORT(asBC_PSF, (short)offset);
 					asSExprContext ctx(engine);
 					PerformFunctionCall(type.GetBehaviour()->destruct, &ctx);
 					bc->AddCode(&ctx.bc);
@@ -1043,7 +1043,7 @@ void asCCompiler::FinalizeFunction()
 	outFunc->lineNumbers = byteCode.lineNumbers;
 }
 
-void asCCompiler::PrepareArgument(asCDataType *paramType, asSExprContext *ctx, asCScriptNode *node, bool isFunction, int refType, asCArray<int> *reservedVars, bool forceOnHeap)
+void asCCompiler::PrepareArgument(asCDataType *paramType, asSExprContext *ctx, asCScriptNode *node, bool isFunction, int refType, asCArray<int> *reservedVars, bool /* forceOnHeap */)
 {
 	asCDataType param = *paramType;
 	if( paramType->GetTokenType() == ttQuestion )
@@ -1480,8 +1480,12 @@ int asCCompiler::CompileDefaultArgs(asCScriptNode *node, asCArray<asSExprContext
 
 	// Compile the arguments in reverse order (as they will be pushed on the stack)
 	args.SetLength(func->parameterTypes.GetLength());
+	for( asUINT c = explicitArgs; c < args.GetLength(); c++ )
+		args[c] = 0;
 	for( int n = (int)func->parameterTypes.GetLength() - 1; n >= explicitArgs; n-- )
 	{
+		if( func->defaultArgs[n] == 0 ) { anyErrors = true; continue; }
+
 		// Parse the default arg string
 		asCParser parser(builder);
 		asCScriptCode code;
@@ -2021,29 +2025,7 @@ void asCCompiler::CompileInitList(asCTypeInfo *var, asCScriptNode *node, asCByte
 			break;
 		}
 	}
-#ifdef AS_DEPRECATED
-	// Since 2.20.0
-	if( funcId == 0 )
-	{
-		asSTypeBehaviour *beh = var->dataType.GetBehaviour();
-		for( asUINT n = 0; n < beh->operators.GetLength(); n += 2 )
-		{
-			if( asBEHAVE_INDEX == beh->operators[n] )
-			{
-				asCScriptFunction *desc = builder->GetFunctionDescription(beh->operators[n+1]);
-				if( !desc->isReadOnly &&
-					 desc->parameterTypes.GetLength() == 1 &&
-					 (desc->parameterTypes[0] == asCDataType::CreatePrimitive(ttUInt, false) ||
-					  desc->parameterTypes[0] == asCDataType::CreatePrimitive(ttInt,  false)) &&
-					 desc->returnType == retType )
-				{
-					funcId = beh->operators[n+1];
-					break;
-				}
-			}
-		}
-	}
-#endif
+
 	if( funcId == 0 )
 	{
 		Error(TXT_NO_APPROPRIATE_INDEX_OPERATOR, node);
@@ -3676,7 +3658,7 @@ void asCCompiler::PerformAssignment(asCTypeInfo *lvalue, asCTypeInfo *rvalue, as
 			}
 
 			// Copy larger data types from a reference
-			bc->InstrSHORT_DW(asBC_COPY, lvalue->dataType.GetSizeInMemoryDWords(), engine->GetTypeIdFromDataType(lvalue->dataType));
+			bc->InstrSHORT_DW(asBC_COPY, (short)lvalue->dataType.GetSizeInMemoryDWords(), engine->GetTypeIdFromDataType(lvalue->dataType));
 		}
 	}
 	else
@@ -3808,7 +3790,7 @@ bool asCCompiler::CompileRefCast(asSExprContext *ctx, const asCDataType &to, boo
 				DeallocateVariable(offset);
 #else
 				int offset = AllocateVariable(asCDataType::CreatePrimitive(ttUInt, false), true);
-				ctx->bc.InstrW_DW(asBC_SetV4, offset, 0);
+				ctx->bc.InstrW_DW(asBC_SetV4, (asWORD)offset, 0);
 				ctx->bc.InstrW_W(asBC_CMPi, ctx->type.stackOffset, offset);
 				DeallocateVariable(offset);
 #endif
@@ -4864,18 +4846,14 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 		if( from->type.dataType.IsFloatType() )
 		{
 			float fc = from->type.floatValue;
-			int uic = int(fc);
+			asUINT uic = asUINT(fc);
 
 			if( float(uic) != fc )
 			{
 				if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
 			}
-			else if( uic < 0 )
-			{
-				if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_CHANGE_SIGN, node);
-			}
 
-			from->type.dataType = asCDataType::CreatePrimitive(ttInt, true);
+			from->type.dataType = asCDataType::CreatePrimitive(ttUInt, true);
 			from->type.intValue = uic;
 
 			// Try once more, in case of a smaller type
@@ -4884,14 +4862,14 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 		else if( from->type.dataType.IsDoubleType() )
 		{
 			double fc = from->type.doubleValue;
-			int uic = int(fc);
+			asUINT uic = asUINT(fc);
 
 			if( double(uic) != fc )
 			{
 				if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
 			}
 
-			from->type.dataType = asCDataType::CreatePrimitive(ttInt, true);
+			from->type.dataType = asCDataType::CreatePrimitive(ttUInt, true);
 			from->type.intValue = uic;
 
 			// Try once more, in case of a smaller type
@@ -4967,11 +4945,13 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 			// Convert first to int64 then to uint64 to avoid negative float becoming 0 on gnuc base compilers
 			asQWORD uic = asQWORD(asINT64(fc));
 
-			// TODO: MSVC6 doesn't permit UINT64 to double
-			if( float((signed)uic) != fc )
+#if !defined(_MSC_VER) || _MSC_VER > 1200 // MSVC++ 6
+			// MSVC6 doesn't support this conversion
+			if( float(uic) != fc )
 			{
 				if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
 			}
+#endif
 
 			from->type.dataType = asCDataType::CreatePrimitive(ttUInt64, true);
 			from->type.qwordValue = uic;
@@ -4982,11 +4962,13 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 			// Convert first to int64 then to uint64 to avoid negative float becoming 0 on gnuc base compilers
 			asQWORD uic = asQWORD(asINT64(fc));
 
-			// TODO: MSVC6 doesn't permit UINT64 to double
-			if( double((signed)uic) != fc )
+#if !defined(_MSC_VER) || _MSC_VER > 1200 // MSVC++ 6
+			// MSVC6 doesn't support this conversion
+			if( double(uic) != fc )
 			{
 				if( convType != asIC_EXPLICIT_VAL_CAST && node ) Warning(TXT_NOT_EXACT, node);
 			}
+#endif
 
 			from->type.dataType = asCDataType::CreatePrimitive(ttUInt64, true);
 			from->type.qwordValue = uic;
@@ -5119,7 +5101,6 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 		}
 		else if( from->type.dataType.IsUnsignedType() && from->type.dataType.GetSizeInMemoryDWords() == 2 )
 		{
-			// TODO: MSVC6 doesn't permit UINT64 to double
 			float fc = float((signed)from->type.qwordValue);
 
 			if( asQWORD(fc) != from->type.qwordValue )
@@ -5215,7 +5196,6 @@ void asCCompiler::ImplicitConversionConstant(asSExprContext *from, const asCData
 		}
 		else if( from->type.dataType.IsUnsignedType() && from->type.dataType.GetSizeInMemoryDWords() == 2 )
 		{
-			// TODO: MSVC6 doesn't permit UINT64 to double
 			double fc = double((signed)from->type.qwordValue);
 
 			if( asQWORD(fc) != from->type.qwordValue )
@@ -5920,7 +5900,7 @@ int asCCompiler::CompileVariableAccess(const asCString &name, const asCString &s
 				
 				// TODO: This is the same as what is in CompileExpressionPostOp
 				// Put the offset on the stack
-				ctx->bc.InstrSHORT_DW(asBC_ADDSi, prop->byteOffset, engine->GetTypeIdFromDataType(dt));
+				ctx->bc.InstrSHORT_DW(asBC_ADDSi, (short)prop->byteOffset, engine->GetTypeIdFromDataType(dt));
 
 				if( prop->type.IsReference() )
 					ctx->bc.Instr(asBC_RDSPTR);
@@ -6497,16 +6477,16 @@ asUINT asCCompiler::ProcessStringConstant(asCString &cstr, asCScriptNode *node,
 				// Hexadecimal escape sequences produce exact value, even if it is not proper unicode chars
 				if( engine->ep.stringEncoding == 0 )
 				{
-					str.PushLast(val);
+					str.PushLast((asBYTE)val);
 				}
 				else
 				{
 #ifndef AS_BIG_ENDIAN
-					str.PushLast(val);
-					str.PushLast(val>>8);
+					str.PushLast((asBYTE)val);
+					str.PushLast((asBYTE)(val>>8));
 #else
-					str.PushLast(val>>8);
-					str.PushLast(val);
+					str.PushLast((asBYTE)(val>>8));
+					str.PushLast((asBYTE)val);
 #endif
 				}
 				if( charLiteral == -1 ) charLiteral = val;
@@ -6606,7 +6586,7 @@ asUINT asCCompiler::ProcessStringConstant(asCString &cstr, asCScriptNode *node,
 		else
 		{
 			// Do not convert ASCII characters
-			encodedValue[0] = val;
+			encodedValue[0] = (asBYTE)val;
 			len = 1;
 		}
 
@@ -7659,7 +7639,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
 		{
 			asCScriptFunction *f = engine->scriptFunctions[ot->methods[n]];
 			// TODO: The type of the parameter should match the argument (unless the arg is a dummy)
-			if( f->name == getName && f->parameterTypes.GetLength() == (arg?1:0) )
+			if( f->name == getName && (int)f->parameterTypes.GetLength() == (arg?1:0) )
 			{
 				if( getId == 0 )
 					getId = ot->methods[n];
@@ -7672,7 +7652,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
 				}
 			}
 			// TODO: getset: If the parameter is a reference, it must not be an out reference. Should we allow inout ref?
-			if( f->name == setName && f->parameterTypes.GetLength() == (arg?2:1) )
+			if( f->name == setName && (int)f->parameterTypes.GetLength() == (arg?2:1) )
 			{
 				if( setId == 0 )
 					setId = ot->methods[n];
@@ -7696,7 +7676,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
 		{
 			asCScriptFunction *f = engine->scriptFunctions[funcs[n]];
 			// TODO: The type of the parameter should match the argument (unless the arg is a dummy)
-			if( f->parameterTypes.GetLength() == (arg?1:0) )
+			if( (int)f->parameterTypes.GetLength() == (arg?1:0) )
 			{
 				if( getId == 0 )
 					getId = funcs[n];
@@ -7716,7 +7696,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
 		{
 			asCScriptFunction *f = engine->scriptFunctions[funcs[n]];
 			// TODO: getset: If the parameter is a reference, it must not be an out reference. Should we allow inout ref?
-			if( f->parameterTypes.GetLength() == (arg?2:1) )
+			if( (int)f->parameterTypes.GetLength() == (arg?2:1) )
 			{
 				if( setId == 0 )
 					setId = funcs[n];
@@ -7851,7 +7831,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx
 		int offset = ctx->type.stackOffset;
 		bool isTemp = ctx->type.isTemporary;
 		ctx->type.Set(dt);
-		ctx->type.stackOffset = offset;
+		ctx->type.stackOffset = (short)offset;
 		ctx->type.isTemporary = isTemp;
 		ctx->exprNode = node;
 
@@ -8241,7 +8221,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
 					}
 
 					// Put the offset on the stack
-					ctx->bc.InstrSHORT_DW(asBC_ADDSi, prop->byteOffset, engine->GetTypeIdFromDataType(asCDataType::CreateObject(ctx->type.dataType.GetObjectType(), false)));
+					ctx->bc.InstrSHORT_DW(asBC_ADDSi, (short)prop->byteOffset, engine->GetTypeIdFromDataType(asCDataType::CreateObject(ctx->type.dataType.GetObjectType(), false)));
 
 					if( prop->type.IsReference() )
 						ctx->bc.Instr(asBC_RDSPTR);
@@ -8336,7 +8316,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
 	else if( op == ttOpenBracket )
 	{
 		// If the property access takes an index arg, then we should use that instead of processing it now
-		// Urho3D: fix possible null pointer access
 		asCString propertyName;
 		if( (ctx->property_get && engine->scriptFunctions[ctx->property_get]->GetParamCount() == 1) ||
 			(ctx->property_set && engine->scriptFunctions[ctx->property_set]->GetParamCount() == 2) )
@@ -8378,10 +8357,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
 		}
 
 		Dereference(ctx, true);
-#ifdef AS_DEPRECATED
-		// Since 2.20.0
-		bool isConst = ctx->type.dataType.IsReadOnly();
-#endif
 
 		// Compile the expression
 		asSExprContext expr(engine);
@@ -8395,7 +8370,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
 			r = CompileOverloadedDualOperator2(node, "opIndex", &lctx, &expr, ctx);
 		if( r == 0 )
 		{	
-#ifndef AS_DEPRECATED
 			// Check for accessors methods for the opIndex
 			r = FindPropertyAccessor(propertyName == "" ? "opIndex" : propertyName.AddressOf(), &lctx, &expr, node);
 			if( r == 0 )
@@ -8409,130 +8383,6 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct
 				return -1;
 
 			MergeExprBytecodeAndType(ctx, &lctx);
-#else
-			// Deprecated since 2.20.0
-
-			MergeExprBytecodeAndType(ctx, &lctx);
-
-			if( ctx->type.dataType.IsObjectHandle() )
-			{
-				// Convert the handle to a normal object
-				asCDataType dt = ctx->type.dataType;
-				dt.MakeHandle(false);
-
-				ImplicitConversion(ctx, dt, node, asIC_IMPLICIT_CONV);
-			}
-
-			asCTypeInfo objType = ctx->type;
-			asSTypeBehaviour *beh = ctx->type.dataType.GetBehaviour();
-			if( beh == 0 )
-			{
-				asCString str;
-				str.Format(TXT_OBJECT_DOESNT_SUPPORT_INDEX_OP, ctx->type.dataType.Format().AddressOf());
-				Error(str.AddressOf(), node);
-				return -1;
-			}
-			else
-			{
-				// Now find a matching function for the object type and indexing type
-				asCArray<int> ops;
-				asUINT n;
-				if( isConst )
-				{
-					// Only list const behaviours
-					for( n = 0; n < beh->operators.GetLength(); n += 2 )
-					{
-						if( asBEHAVE_INDEX == beh->operators[n] && engine->scriptFunctions[beh->operators[n+1]]->isReadOnly )
-							ops.PushLast(beh->operators[n+1]);
-					}
-				}
-				else
-				{
-					// TODO: Prefer non-const over const
-					for( n = 0; n < beh->operators.GetLength(); n += 2 )
-					{
-						if( asBEHAVE_INDEX == beh->operators[n] )
-							ops.PushLast(beh->operators[n+1]);
-					}
-				}
-
-				asCArray<int> ops1;
-				MatchArgument(ops, ops1, &expr.type, 0);
-
-				if( !isConst )
-					FilterConst(ops1);
-
-				// Did we find a suitable function?
-				if( ops1.GetLength() == 1 )
-				{
-					asCScriptFunction *descr = engine->scriptFunctions[ops1[0]];
-
-					// Store the code for the object
-					asCByteCode objBC(engine);
-					objBC.AddCode(&ctx->bc);
-
-					// Add code for arguments
-
-					PrepareArgument(&descr->parameterTypes[0], &expr, node->firstChild, true, descr->inOutFlags[0]);
-					MergeExprBytecode(ctx, &expr);
-
-					if( descr->parameterTypes[0].IsReference() )
-					{
-						if( descr->parameterTypes[0].IsObject() && !descr->parameterTypes[0].IsObjectHandle() )
-							ctx->bc.InstrWORD(asBC_GETOBJREF, 0);
-						else
-							ctx->bc.InstrWORD(asBC_GETREF, 0);
-					}
-					else if( descr->parameterTypes[0].IsObject() )
-					{
-						ctx->bc.InstrWORD(asBC_GETOBJ, 0);
-
-						// The temporary variable must not be freed as it will no longer hold an object
-						DeallocateVariable(expr.type.stackOffset);
-						expr.type.isTemporary = false;
-					}
-
-					// Add the code for the object again
-					ctx->bc.AddCode(&objBC);
-
-					asCArray<asSExprContext*> args;
-					args.PushLast(&expr);
-					PerformFunctionCall(descr->id, ctx, false, &args);
-				}
-				else if( ops.GetLength() > 1 )
-				{
-					Error(TXT_MORE_THAN_ONE_MATCHING_OP, node);
-					PrintMatchingFuncs(ops, node);
-
-					return -1;
-				}
-				else
-				{
-					asCString str;
-					str.Format(TXT_NO_MATCHING_OP_FOUND_FOR_TYPE_s, expr.type.dataType.Format().AddressOf());
-					Error(str.AddressOf(), node);
-					return -1;
-				}
-			}
-
-			// If the method returned a reference, then we can't release the original  
-			// object yet, because the reference may be to a member of it
-			if( objType.isTemporary &&
-				(ctx->type.dataType.IsReference() || (ctx->type.dataType.IsObject() && !ctx->type.dataType.IsObjectHandle())) &&
-				!ctx->type.isVariable ) // If the resulting type is a variable, then the reference is not to a member
-			{
-				// Remember the object's variable, so that it can be released
-				// later on when the reference to its member goes out of scope
-				ctx->type.isTemporary = true;
-				ctx->type.stackOffset = objType.stackOffset;
-			}
-			else
-			{
-				// As the index operator didn't return a reference to a
-				// member we can release the original object now
-				ReleaseTemporaryVariable(objType, &ctx->bc);
-			}
-#endif
 		}
 	}
 
@@ -9024,7 +8874,7 @@ int asCCompiler::CompileOverloadedDualOperator2(asCScriptNode *node, const char
 	return 0;
 }
 
-void asCCompiler::MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectType *objectType, asCArray<asSExprContext*> &args, asCScriptNode *node, bool useVariable, int stackOffset, int funcPtrVar)
+void asCCompiler::MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectType *objectType, asCArray<asSExprContext*> &args, asCScriptNode * /*node*/, bool useVariable, int stackOffset, int funcPtrVar)
 {
 	if( objectType )
 	{
@@ -10521,7 +10371,7 @@ void asCCompiler::PerformFunctionCall(int funcId, asSExprContext *ctx, bool isCo
 		// In order to guarantee the lifetime of the reference, we must hold a local reference to the object.
 		// TODO: optimize: This can be avoided for local variables (non-handles) as they have a well defined life time
 		int tempRef = AllocateVariable(ctx->type.dataType, true);
-		ctx->bc.InstrSHORT(asBC_PSF, tempRef);
+		ctx->bc.InstrSHORT(asBC_PSF, (short)tempRef);
 		ctx->bc.InstrPTR(asBC_REFCPY, ctx->type.dataType.GetObjectType());
 
 		// Add the release of this reference, as a deferred expression

+ 1 - 32
ThirdParty/AngelScript/source/as_context.cpp

@@ -28,7 +28,6 @@
    [email protected]
 */
 
-// Modified by Lasse Öörni for Urho3D
 
 //
 // as_context.cpp
@@ -115,9 +114,7 @@ public:
 
 AS_API asIScriptContext *asGetActiveContext()
 {
-	// Urho3D: modified to allow querying for a context without having the engine instantiated
-	if (!threadManager)
-		return 0;
+	asASSERT(threadManager);
 	asCThreadLocalData *tld = threadManager->GetLocalData();
 	if( tld->activeContexts.GetLength() == 0 )
 		return 0;
@@ -3700,34 +3697,6 @@ int asCContext::GetExceptionFunction()
 	return exceptionFunction;
 }
 
-#ifdef AS_DEPRECATED
-// deprecated since 2.20.0
-// interface
-int asCContext::GetCurrentFunction()
-{
-	if( status == asEXECUTION_SUSPENDED || status == asEXECUTION_ACTIVE )
-		return currentFunction->id;
-
-	return -1;
-}
-
-// interface
-int asCContext::GetCurrentLineNumber(int *column, const char **sectionName)
-{
-	if( status == asEXECUTION_SUSPENDED || status == asEXECUTION_ACTIVE )
-	{
-		asDWORD line = currentFunction->GetLineNumber(int(regs.programPointer - currentFunction->byteCode.AddressOf()));
-		if( column ) *column = line >> 20;
-
-		if( sectionName ) *sectionName = currentFunction->GetScriptSectionName();
-
-		return line & 0xFFFFF;
-	}
-
-	return -1;
-}
-#endif
-
 // interface
 const char *asCContext::GetExceptionString()
 {

+ 0 - 6
ThirdParty/AngelScript/source/as_context.h

@@ -117,12 +117,6 @@ public:
 	void *SetUserData(void *data);
 	void *GetUserData() const;
 
-#ifdef AS_DEPRECATED
-	// Deprecated since 2.20.0
-	int  GetCurrentLineNumber(int *column, const char **sectionName);
-	int  GetCurrentFunction();
-#endif
-
 public:
 	// Internal public functions
 	asCContext(asCScriptEngine *engine, bool holdRef);

+ 0 - 26
ThirdParty/AngelScript/source/as_module.cpp

@@ -610,32 +610,6 @@ int asCModule::GetGlobalVar(asUINT index, const char **name, int *typeId, bool *
 	return asSUCCESS;
 }
 
-
-#ifdef AS_DEPRECATED
-// Since 2.20.0
-// interface
-const char *asCModule::GetGlobalVarName(int index) const
-{
-	if( index < 0 || index >= (int)scriptGlobals.GetLength() )
-		return 0;
-
-	return scriptGlobals[index]->name.AddressOf();
-}
-
-// interface
-// TODO: If the typeId ever encodes the const flag, then the isConst parameter should be removed
-int asCModule::GetGlobalVarTypeId(int index, bool *isConst) const
-{
-	if( index < 0 || index >= (int)scriptGlobals.GetLength() )
-		return asINVALID_ARG;
-
-	if( isConst )
-		*isConst = scriptGlobals[index]->type.IsReadOnly();
-
-	return engine->GetTypeIdFromDataType(scriptGlobals[index]->type);
-}
-#endif
-
 // interface
 int asCModule::GetObjectTypeCount() const
 {

+ 0 - 6
ThirdParty/AngelScript/source/as_module.h

@@ -152,12 +152,6 @@ public:
 	virtual int SaveByteCode(asIBinaryStream *out) const;
 	virtual int LoadByteCode(asIBinaryStream *in);
 
-#ifdef AS_DEPRECATED
-	// Since 2.20.0
-	virtual const char *GetGlobalVarName(int index) const;
-	virtual int         GetGlobalVarTypeId(int index, bool *isConst) const;
-#endif
-
 //-----------------------------------------------
 // Internal
 //-----------------------------------------------

+ 0 - 35
ThirdParty/AngelScript/source/as_objecttype.cpp

@@ -455,41 +455,6 @@ const char *asCObjectType::GetPropertyDeclaration(asUINT index) const
 	return tempString->AddressOf();
 }
 
-#ifdef AS_DEPRECATED
-// Since 2.20.0
-int asCObjectType::GetPropertyTypeId(asUINT prop) const
-{
-	if( prop >= properties.GetLength() )
-		return asINVALID_ARG;
-
-	return engine->GetTypeIdFromDataType(properties[prop]->type);
-}
-
-const char *asCObjectType::GetPropertyName(asUINT prop) const
-{
-	if( prop >= properties.GetLength() )
-		return 0;
-
-	return properties[prop]->name.AddressOf();
-}
-
-bool asCObjectType::IsPropertyPrivate(asUINT prop) const
-{
-	if( prop >= properties.GetLength() )
-		return false;
-
-	return properties[prop]->isPrivate;
-}
-
-int asCObjectType::GetPropertyOffset(asUINT prop) const
-{
-	if( prop >= properties.GetLength() )
-		return 0;
-
-	return properties[prop]->byteOffset;
-}
-#endif
-
 asIObjectType *asCObjectType::GetBaseType() const
 {
 	return derivedFrom; 

+ 0 - 8
ThirdParty/AngelScript/source/as_objecttype.h

@@ -175,14 +175,6 @@ public:
 	int GetBehaviourCount() const;
 	int GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour) const;
 
-#ifdef AS_DEPRECATED
-	// Since 2.20.0
-	int         GetPropertyTypeId(asUINT prop) const;
-	const char *GetPropertyName(asUINT prop) const;
-	bool        IsPropertyPrivate(asUINT prop) const;
-	int         GetPropertyOffset(asUINT prop) const;
-#endif
-
 //===========================================
 // Internal
 //===========================================

+ 17 - 15
ThirdParty/AngelScript/source/as_restore.cpp

@@ -362,7 +362,7 @@ int asCRestore::Restore()
 		info->boundFunctionId = -1;
 		module->bindInformations[i] = info;
 	}
-	
+
 	// usedTypes[]
 	count = ReadEncodedUInt();
 	usedTypes.Allocate(count, 0);
@@ -490,6 +490,7 @@ void asCRestore::ReadUsedFunctions()
 	asUINT count;
 	count = ReadEncodedUInt();
 	usedFunctions.SetLength(count);
+	memset(usedFunctions.AddressOf(), 0, sizeof(asCScriptFunction *)*count);
 
 	for( asUINT n = 0; n < usedFunctions.GetLength(); n++ )
 	{
@@ -1432,7 +1433,7 @@ void asCRestore::WriteObjectType(asCObjectType* ot)
 
 asCObjectType* asCRestore::ReadObjectType() 
 {
-	asCObjectType *ot;
+	asCObjectType *ot = 0;
 	char ch;
 	READ_NUM(ch);
 	if( ch == 'a' )
@@ -1512,6 +1513,7 @@ asCObjectType* asCRestore::ReadObjectType()
 		ReadString(&typeName);
 
 		// Find the template subtype
+		ot = 0;
 		for( asUINT n = 0; n < engine->templateSubTypes.GetLength(); n++ )
 		{
 			if( engine->templateSubTypes[n] && engine->templateSubTypes[n]->name == typeName )
@@ -1612,7 +1614,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length)
 			     c == asBC_LoadThisR )   // W_DW_ARG	 
 		{
 			// Translate property offsets into indices
-			*(((short*)tmp)+1) = FindObjectPropIndex(*(((short*)tmp)+1), *(int*)(tmp+1));
+			*(((short*)tmp)+1) = (short)FindObjectPropIndex(*(((short*)tmp)+1), *(int*)(tmp+1));
 
 			// Translate type ids into indices
 			*(int*)(tmp+1) = FindTypeIdIdx(*(int*)(tmp+1));
@@ -1621,7 +1623,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length)
 			     c == asBC_LoadVObjR )     // rW_W_DW_ARG
 		{
 			// Translate property offsets into indices
-			*(((short*)tmp)+2) = FindObjectPropIndex(*(((short*)tmp)+2), *(int*)(tmp+2));
+			*(((short*)tmp)+2) = (short)FindObjectPropIndex(*(((short*)tmp)+2), *(int*)(tmp+2));
 
 			// Translate type ids into indices
 			*(int*)(tmp+2) = FindTypeIdIdx(*(int*)(tmp+2));
@@ -1647,7 +1649,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length)
 		{
 			// Translate the string constant id
 			asWORD *arg = ((asWORD*)tmp)+1;
-			*arg = FindStringConstantIndex(*arg);
+			*arg = (asWORD)FindStringConstantIndex(*arg);
 		}
 		else if( c == asBC_CALLBND ) // DW_ARG
 		{
@@ -2291,7 +2293,7 @@ short asCRestore::FindObjectPropOffset(asWORD index)
 		return 0;
 	}
 
-	return usedObjectProperties[index].offset;
+	return (short)usedObjectProperties[index].offset;
 }
 
 int asCRestore::FindFunctionIndex(asCScriptFunction *func)
@@ -2374,7 +2376,7 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 				error = true;
 			}
 			else
-				asBC_SWORDARG0(&bc[n]) = dt->GetSizeInMemoryDWords();
+				asBC_SWORDARG0(&bc[n]) = (short)dt->GetSizeInMemoryDWords();
 		}
 		else if( c == asBC_CALL ||
 				 c == asBC_CALLINTF ||
@@ -2426,7 +2428,7 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 			asWORD *arg = ((asWORD*)&bc[n])+1;
 
 			if( *arg < usedStringConstants.GetLength() )	
-				*arg = usedStringConstants[*arg];
+				*arg = (asWORD)usedStringConstants[*arg];
 			else
 			{
 				// TODO: Write to message callback
@@ -2549,7 +2551,7 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG0(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG0(&bc[n]) += (short)adjustByPos[var];
 				}
 				break;
 
@@ -2561,13 +2563,13 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG0(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG0(&bc[n]) += (short)adjustByPos[var];
 
 					var = asBC_SWORDARG1(&bc[n]);
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG1(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG1(&bc[n]) += (short)adjustByPos[var];
 				}
 				break;
 
@@ -2577,19 +2579,19 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG0(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG0(&bc[n]) += (short)adjustByPos[var];
 
 					var = asBC_SWORDARG1(&bc[n]);
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG1(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG1(&bc[n]) += (short)adjustByPos[var];
 
 					var = asBC_SWORDARG2(&bc[n]);
 					if( var >= (int)adjustByPos.GetLength() ) 
 						error = true;
 					else if( var >= 0 ) 
-						asBC_SWORDARG2(&bc[n]) += adjustByPos[var];
+						asBC_SWORDARG2(&bc[n]) += (short)adjustByPos[var];
 				}
 				break;
 
@@ -2605,7 +2607,7 @@ void asCRestore::TranslateFunction(asCScriptFunction *func)
 				//       can immediately reserve the space
 
 				// PUSH is only used to reserve stack space for variables
-				asBC_WORDARG0(&bc[n]) += adjustByPos[adjustByPos.GetLength()-1];
+				asBC_WORDARG0(&bc[n]) += (asWORD)adjustByPos[adjustByPos.GetLength()-1];
 			}
 
 			n += asBCTypeSize[asBCInfo[c].type];

+ 1 - 25
ThirdParty/AngelScript/source/as_scriptengine.cpp

@@ -353,7 +353,6 @@ asPWORD asCScriptEngine::GetEngineProperty(asEEngineProp property) const
 asCScriptEngine::asCScriptEngine()
 {
 	// Instanciate the thread manager
-	// Urho3D: create the thread manager under critical section, so that it is not multi-instantiated
 	ENTERCRITICALSECTION(engineCritical);
 	if( threadManager == 0 )
 		threadManager = asNEW(asCThreadManager);
@@ -1704,29 +1703,6 @@ int asCScriptEngine::RegisterBehaviourToObjectType(asCObjectType *objectType, as
 
 		func.id = beh->templateCallback = AddBehaviourFunction(func, internal);
 	}
-#ifdef AS_DEPRECATED
-	// Since 2.20.0
-	else if( behaviour == asBEHAVE_INDEX )
-	{
-		// Verify that the var type is not used
-		if( VerifyVarTypeNotInFunction(&func) < 0 )
-			return ConfigError(asINVALID_DECLARATION);
-
-		// Verify that there is only one parameter
-		if( func.parameterTypes.GetLength() != 1 )
-			return ConfigError(asINVALID_DECLARATION);
-
-		// Verify that the return type is not void
-		if( func.returnType.GetTokenType() == ttVoid )
-			return ConfigError(asINVALID_DECLARATION);
-
-		// TODO: Verify that the operator hasn't been registered already
-
-		beh->operators.PushLast(behaviour);
-		func.id = AddBehaviourFunction(func, internal);
-		beh->operators.PushLast(func.id);
-	}
-#endif
 	else if( behaviour >= asBEHAVE_FIRST_GC &&
 		     behaviour <= asBEHAVE_LAST_GC )
 	{
@@ -3978,7 +3954,7 @@ int asCScriptEngine::RegisterEnumValue(const char *typeName, const char *valueNa
 
 	int tokenLen;
 	asETokenClass tokenClass = ParseToken(valueName, 0, &tokenLen);
-	if( tokenClass != asTC_IDENTIFIER || tokenLen != strlen(valueName) )
+	if( tokenClass != asTC_IDENTIFIER || tokenLen != (int)strlen(valueName) )
 		return ConfigError(asINVALID_NAME);
 
 	for( unsigned int n = 0; n < ot->enumValues.GetLength(); n++ )

+ 0 - 15
ThirdParty/AngelScript/source/as_scriptfunction.cpp

@@ -261,21 +261,6 @@ const char *asCScriptFunction::GetName() const
 	return name.AddressOf();
 }
 
-#ifdef AS_DEPRECATED
-// Since 2.20.0
-// interface
-bool asCScriptFunction::IsClassMethod() const
-{
-	return objectType && objectType->IsInterface() == false;
-}
-
-// interface
-bool asCScriptFunction::IsInterfaceMethod() const
-{
-	return objectType && objectType->IsInterface();
-}
-#endif
-
 // interface
 bool asCScriptFunction::IsReadOnly() const
 {

+ 0 - 6
ThirdParty/AngelScript/source/as_scriptfunction.h

@@ -125,12 +125,6 @@ public:
 	void                *SetUserData(void *userData);
 	void                *GetUserData() const;
 
-#ifdef AS_DEPRECATED
-	// Since 2.20.0
-	bool                 IsClassMethod() const;
-	bool                 IsInterfaceMethod() const;
-#endif
-
 public:
 	//-----------------------------------
 	// Internal methods