Bläddra i källkod

Manual_Math.h: fix warnings

1vanK 3 år sedan
förälder
incheckning
0c2aed2d13
1 ändrade filer med 7 tillägg och 5 borttagningar
  1. 7 5
      Source/Urho3D/AngelScript/Manual_Math.h

+ 7 - 5
Source/Urho3D/AngelScript/Manual_Math.h

@@ -190,23 +190,25 @@ template <class T> Vector3 Frustum_GetVertex(unsigned index, T* ptr)
 // ========================================================================================
 
 // Vector<Vector<Vector3>> Polyhedron::faces_ | File: ../Math/Polyhedron.h
-template <class T> unsigned Polyhedron_GetNumFaces(T* ptr)
+template <class T> i32 Polyhedron_GetNumFaces(T* ptr)
 {
     return ptr->faces_.Size();
 }
 
 // Vector<Vector<Vector3>> Polyhedron::faces_ | File: ../Math/Polyhedron.h
-template <class T> CScriptArray* Polyhedron_GetFace(unsigned index, T* ptr)
+template <class T> CScriptArray* Polyhedron_GetFace(i32 index, T* ptr)
 {
     Vector<Vector3> face;
-    if (index < ptr->faces_.Size())
+
+    if (index >= 0 && index < ptr->faces_.Size())
         face = ptr->faces_[index];
+
     return VectorToArray<Vector3>(face, "Array<Vector3>");
 }
 
 #define REGISTER_MEMBERS_MANUAL_PART_Polyhedron() \
     /* Vector<Vector<Vector3>> Polyhedron::faces_ | File: ../Math/Polyhedron.h */ \
-    engine->RegisterObjectMethod(className, "uint get_numFaces() const", AS_FUNCTION_OBJLAST(Polyhedron_GetNumFaces<T>), AS_CALL_CDECL_OBJLAST); \
-    engine->RegisterObjectMethod(className, "Array<Vector3>@ get_face(uint) const", AS_FUNCTION_OBJLAST(Polyhedron_GetFace<T>), AS_CALL_CDECL_OBJLAST);
+    engine->RegisterObjectMethod(className, "int get_numFaces() const", AS_FUNCTION_OBJLAST(Polyhedron_GetNumFaces<T>), AS_CALL_CDECL_OBJLAST); \
+    engine->RegisterObjectMethod(className, "Array<Vector3>@ get_face(int) const", AS_FUNCTION_OBJLAST(Polyhedron_GetFace<T>), AS_CALL_CDECL_OBJLAST);
 
 }