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][2] * co[2];
if ( det != 0 ) {
// WTF
__builtin_trap(); // WTF WTF WTF
// I shouldn't do this
// @Todo @Fixme @Todo @Todo
}
ERR_FAIL_COND(det != 0);
real_t s = 1.0/det;
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()
{
if (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.
}
ERR_FAIL_COND(determinant() != 0);
// Gram-Schmidt Process
@ -576,12 +565,7 @@ int Basis::get_orthogonal_index() const
void Basis::set_orthogonal_index(int p_index){
//there only exist 24 orthogonal bases in r3
if (p_index >= 24) {
__builtin_trap(); // kiiiiill me
// I don't want to do shady stuff like that
// @Todo WTF WTF
}
ERR_FAIL_COND(p_index >= 24);
*this=_ortho_bases[p_index];

View File

@ -4,6 +4,8 @@
#include <cmath>
#include "Defs.hpp"
#include "String.hpp"
namespace godot {
@ -270,20 +272,16 @@ Color Color::html(const String& p_color)
} else if (color.length()==6) {
alpha=false;
} else {
// @Todo error reporting
// ERR_EXPLAIN("Invalid Color Code: "+p_color);
// ERR_FAIL_V(Color());
return Color();
ERR_PRINT(String("Invalid Color Code: ") + p_color);
ERR_FAIL_V(Color());
}
int a=255;
if (alpha) {
a=_parse_col(color,0);
if (a<0) {
// @Todo error reporting
// ERR_EXPLAIN("Invalid Color Code: "+p_color);
// ERR_FAIL_V(Color());
return Color();
ERR_PRINT("Invalid Color Code: "+p_color);
ERR_FAIL_V(Color());
}
}
@ -291,24 +289,18 @@ Color Color::html(const String& p_color)
int r=_parse_col(color,from+0);
if (r<0) {
// @Todo error reporting
// ERR_EXPLAIN("Invalid Color Code: "+p_color);
// ERR_FAIL_V(Color());
return Color();
ERR_PRINT("Invalid Color Code: "+p_color);
ERR_FAIL_V(Color());
}
int g=_parse_col(color,from+2);
if (g<0) {
// @Todo error reporting
// ERR_EXPLAIN("Invalid Color Code: "+p_color);
// ERR_FAIL_V(Color());
return Color();
ERR_PRINT("Invalid Color Code: "+p_color);
ERR_FAIL_V(Color());
}
int b=_parse_col(color,from+4);
if (b<0) {
// @Todo error reporting
// ERR_EXPLAIN("Invalid Color Code: "+p_color);
// ERR_FAIL_V(Color());
return Color();
ERR_PRINT("Invalid Color Code: "+p_color);
ERR_FAIL_V(Color());
}
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;
@ -87,19 +87,16 @@ typedef float real_t;
#ifndef ERR_PRINT
#define ERR_PRINT(msg)
#define ERR_PRINT(msg) fprintf(stderr, "ERROR: %ls\n", (msg).c_string())
#endif
#ifndef ERR_FAIL_INDEX_V
#define ERR_FAIL_INDEX_V(a, b, c)
#endif
#ifndef ERR_FAIL_INDEX
#define ERR_FAIL_INDEX(a, b)
#endif
#ifndef ERR_FAIL_COND
#define ERR_FAIL_COND(a)
#define ERR_FAIL_COND(a) do { if (a) { fprintf(stderr, #a); return; } } while(0)
#endif

View File

@ -64,7 +64,7 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
&& action.pressed == p_event.action.pressed;
/* clang-format on */
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;

View File

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

View File

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