mistakes were made. I undid them.

pull/7/head
Karroffel 2017-03-15 18:13:22 +01:00
parent b098147977
commit bce9ac109d
6 changed files with 24 additions and 50 deletions

View File

@ -63,13 +63,9 @@ void Basis::invert()
elements[0][1] * co[1]+ elements[0][1] * co[1]+
elements[0][2] * co[2]; elements[0][2] * co[2];
if ( det != 0 ) {
// WTF
__builtin_trap(); // WTF WTF WTF
// I shouldn't do this ERR_FAIL_COND(det != 0);
// @Todo @Fixme @Todo @Todo
}
real_t s = 1.0/det; real_t s = 1.0/det;
set( co[0]*s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, set( co[0]*s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s,
@ -407,14 +403,7 @@ Basis Basis::transpose_xform(const Basis& m) const
void Basis::orthonormalize() void Basis::orthonormalize()
{ {
if (determinant() != 0) { ERR_FAIL_COND(determinant() != 0);
// not this crap again
__builtin_trap(); // WTF WTF WTF
// somebody please complain some day
// so I can fix this
// need propert error reporting here.
}
// Gram-Schmidt Process // Gram-Schmidt Process
@ -576,12 +565,7 @@ int Basis::get_orthogonal_index() const
void Basis::set_orthogonal_index(int p_index){ void Basis::set_orthogonal_index(int p_index){
//there only exist 24 orthogonal bases in r3 //there only exist 24 orthogonal bases in r3
if (p_index >= 24) { ERR_FAIL_COND(p_index >= 24);
__builtin_trap(); // kiiiiill me
// I don't want to do shady stuff like that
// @Todo WTF WTF
}
*this=_ortho_bases[p_index]; *this=_ortho_bases[p_index];

View File

@ -4,6 +4,8 @@
#include <cmath> #include <cmath>
#include "Defs.hpp"
#include "String.hpp" #include "String.hpp"
namespace godot { namespace godot {
@ -270,20 +272,16 @@ Color Color::html(const String& p_color)
} else if (color.length()==6) { } else if (color.length()==6) {
alpha=false; alpha=false;
} else { } else {
// @Todo error reporting ERR_PRINT(String("Invalid Color Code: ") + p_color);
// ERR_EXPLAIN("Invalid Color Code: "+p_color); ERR_FAIL_V(Color());
// ERR_FAIL_V(Color());
return Color();
} }
int a=255; int a=255;
if (alpha) { if (alpha) {
a=_parse_col(color,0); a=_parse_col(color,0);
if (a<0) { if (a<0) {
// @Todo error reporting ERR_PRINT("Invalid Color Code: "+p_color);
// ERR_EXPLAIN("Invalid Color Code: "+p_color); ERR_FAIL_V(Color());
// ERR_FAIL_V(Color());
return Color();
} }
} }
@ -291,24 +289,18 @@ Color Color::html(const String& p_color)
int r=_parse_col(color,from+0); int r=_parse_col(color,from+0);
if (r<0) { if (r<0) {
// @Todo error reporting ERR_PRINT("Invalid Color Code: "+p_color);
// ERR_EXPLAIN("Invalid Color Code: "+p_color); ERR_FAIL_V(Color());
// ERR_FAIL_V(Color());
return Color();
} }
int g=_parse_col(color,from+2); int g=_parse_col(color,from+2);
if (g<0) { if (g<0) {
// @Todo error reporting ERR_PRINT("Invalid Color Code: "+p_color);
// ERR_EXPLAIN("Invalid Color Code: "+p_color); ERR_FAIL_V(Color());
// ERR_FAIL_V(Color());
return Color();
} }
int b=_parse_col(color,from+4); int b=_parse_col(color,from+4);
if (b<0) { if (b<0) {
// @Todo error reporting ERR_PRINT("Invalid Color Code: "+p_color);
// ERR_EXPLAIN("Invalid Color Code: "+p_color); ERR_FAIL_V(Color());
// ERR_FAIL_V(Color());
return Color();
} }
return Color(r/255.0,g/255.0,b/255.0,a/255.0); return Color(r/255.0,g/255.0,b/255.0,a/255.0);

View File

@ -60,7 +60,7 @@ enum Error {
} }
// @Todo error handling stuff here plz #include <stdio.h>
typedef float real_t; typedef float real_t;
@ -87,19 +87,16 @@ typedef float real_t;
#ifndef ERR_PRINT #ifndef ERR_PRINT
#define ERR_PRINT(msg) #define ERR_PRINT(msg) fprintf(stderr, "ERROR: %ls\n", (msg).c_string())
#endif #endif
#ifndef ERR_FAIL_INDEX_V #ifndef ERR_FAIL_INDEX_V
#define ERR_FAIL_INDEX_V(a, b, c) #define ERR_FAIL_INDEX_V(a, b, c)
#endif #endif
#ifndef ERR_FAIL_INDEX
#define ERR_FAIL_INDEX(a, b)
#endif
#ifndef ERR_FAIL_COND #ifndef ERR_FAIL_COND
#define ERR_FAIL_COND(a) #define ERR_FAIL_COND(a) do { if (a) { fprintf(stderr, #a); return; } } while(0)
#endif #endif

View File

@ -64,7 +64,7 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
&& action.pressed == p_event.action.pressed; && action.pressed == p_event.action.pressed;
/* clang-format on */ /* clang-format on */
default: default:
ERR_PRINT("No logic to compare InputEvents of this type, this shouldn't happen."); ERR_PRINT(String("No logic to compare InputEvents of this type, this shouldn't happen."));
} }
return false; return false;

View File

@ -114,7 +114,7 @@ bool String::operator >=(const String &s)
return !(*this < s); return !(*this < s);
} }
const wchar_t *String::c_string() const wchar_t *String::c_string() const
{ {
return godot_string_c_str(&_godot_string); return godot_string_c_str(&_godot_string);
} }

View File

@ -49,10 +49,11 @@ public:
bool operator >=(const String &s); bool operator >=(const String &s);
const wchar_t *c_string(); const wchar_t *c_string() const;
}; };
String operator +(const char *a, const String& b);
} }