Browse Source

updated core to new GDNative interface

Karroffel 8 years ago
parent
commit
ebe9d9de6a
5 changed files with 12 additions and 12 deletions
  1. 1 1
      include/core/Defs.hpp
  2. 2 2
      src/core/Array.cpp
  3. 1 1
      src/core/PoolArrays.cpp
  4. 6 6
      src/core/String.cpp
  5. 2 2
      src/core/Variant.cpp

+ 1 - 1
include/core/Defs.hpp

@@ -87,7 +87,7 @@ typedef float real_t;
 
 
 
 
 #ifndef ERR_PRINT
 #ifndef ERR_PRINT
-#define ERR_PRINT(msg) fprintf(stderr, "ERROR: %ls\n", (msg).c_string())
+#define ERR_PRINT(msg) fprintf(stderr, "ERROR: %s\n", (msg).c_string())
 #endif
 #endif
 
 
 #ifndef ERR_FAIL_INDEX_V
 #ifndef ERR_FAIL_INDEX_V

+ 2 - 2
src/core/Array.cpp

@@ -52,7 +52,7 @@ Array::Array(const PoolColorArray& a)
 
 
 Variant& Array::operator [](const int idx)
 Variant& Array::operator [](const int idx)
 {
 {
-	godot_variant *v = godot_array_get(&_godot_array, idx);
+	godot_variant *v = godot_array_operator_index(&_godot_array, idx);
 	return *(Variant *) v;
 	return *(Variant *) v;
 }
 }
 
 
@@ -60,7 +60,7 @@ Variant Array::operator [](const int idx) const
 {
 {
 	// Yes, I'm casting away the const... you can hate me now.
 	// Yes, I'm casting away the const... you can hate me now.
 	// since the result is
 	// since the result is
-	godot_variant *v = godot_array_get((godot_array *) &_godot_array, idx);
+	godot_variant *v = godot_array_operator_index((godot_array *) &_godot_array, idx);
 	return *(Variant *) v;
 	return *(Variant *) v;
 }
 }
 
 

+ 1 - 1
src/core/PoolArrays.cpp

@@ -268,7 +268,7 @@ String PoolStringArray::operator [](const int idx)
 {
 {
 	String s;
 	String s;
 	godot_string str = godot_pool_string_array_get(&_godot_array, idx);
 	godot_string str = godot_pool_string_array_get(&_godot_array, idx);
-	godot_string_copy_string((godot_string *) &s, &str);
+	godot_string_new_copy((godot_string *) &s, &str);
 	godot_string_destroy(&str);
 	godot_string_destroy(&str);
 	return s;
 	return s;
 }
 }

+ 6 - 6
src/core/String.cpp

@@ -33,8 +33,7 @@ String::String(const wchar_t c)
 
 
 String::String(const String& other)
 String::String(const String& other)
 {
 {
-	godot_string_new(&_godot_string);
-	godot_string_copy_string(&_godot_string, &other._godot_string);
+	godot_string_new_copy(&_godot_string, &other._godot_string);
 }
 }
 
 
 String::~String()
 String::~String()
@@ -68,7 +67,8 @@ int String::length() const
 
 
 void String::operator =(const String &s)
 void String::operator =(const String &s)
 {
 {
-	godot_string_copy_string(&_godot_string, &s._godot_string);
+	godot_string_destroy(&_godot_string);
+	godot_string_new_copy(&_godot_string, &s._godot_string);
 }
 }
 
 
 bool String::operator ==(const String &s)
 bool String::operator ==(const String &s)
@@ -83,15 +83,15 @@ bool String::operator !=(const String &s)
 
 
 String String::operator +(const String &s)
 String String::operator +(const String &s)
 {
 {
-	String new_string;
-	godot_string_operator_plus(&new_string._godot_string, &_godot_string, &s._godot_string);
+	String new_string = *this;
+	godot_string_operator_plus(&new_string._godot_string, &s._godot_string);
 
 
 	return new_string;
 	return new_string;
 }
 }
 
 
 void String::operator +=(const String &s)
 void String::operator +=(const String &s)
 {
 {
-	godot_string_operator_plus(&_godot_string, &_godot_string, &s._godot_string);
+	godot_string_operator_plus(&_godot_string, &s._godot_string);
 }
 }
 
 
 void String::operator +=(const wchar_t c)
 void String::operator +=(const wchar_t c)

+ 2 - 2
src/core/Variant.cpp

@@ -17,7 +17,7 @@ Variant::Variant()
 
 
 Variant::Variant(const Variant& v)
 Variant::Variant(const Variant& v)
 {
 {
-	godot_variant_copy(&_godot_variant, &v._godot_variant);
+	godot_variant_new_copy(&_godot_variant, &v._godot_variant);
 }
 }
 
 
 Variant::Variant(bool p_bool)
 Variant::Variant(bool p_bool)
@@ -192,7 +192,7 @@ Variant::Variant(const PoolColorArray& p_color_array)
 
 
 Variant &Variant::operator =(const Variant& v)
 Variant &Variant::operator =(const Variant& v)
 {
 {
-	godot_variant_copy(&_godot_variant, &v._godot_variant);
+	godot_variant_new_copy(&_godot_variant, &v._godot_variant);
 	return *this;
 	return *this;
 }
 }