Fix type conversion errors in GCC/wxGTK

This commit is contained in:
Twan van Laarhoven
2020-04-25 22:02:37 +02:00
parent 64ea1d7322
commit 0d42df1537
4 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -112,7 +112,7 @@ SCRIPT_FUNCTION(to_int) {
if (t == SCRIPT_BOOL) {
result = (bool)*input ? 1 : 0;
} else if (t == SCRIPT_COLOR) {
Color c = (Color)*input;
Color c = input->operator Color();
result = (c.Red() + c.Blue() + c.Green()) / 3;
} else if (t == SCRIPT_STRING) {
long l;
@@ -141,7 +141,7 @@ SCRIPT_FUNCTION(to_real) {
if (t == SCRIPT_BOOL) {
result = (bool)*input ? 1.0 : 0.0;
} else if (t == SCRIPT_COLOR) {
Color c = (Color)*input;
Color c = input->operator Color();
result = (c.Red() + c.Blue() + c.Green()) / 3.0;
} else if (t == SCRIPT_STRING) {
String str = input->toString();
@@ -166,7 +166,7 @@ SCRIPT_FUNCTION(to_number) {
if (t == SCRIPT_BOOL) {
SCRIPT_RETURN((bool)*input ? 1 : 0);
} else if (t == SCRIPT_COLOR) {
Color c = (Color)*input;
Color c = input->operator Color();
SCRIPT_RETURN( (c.Red() + c.Blue() + c.Green()) / 3 );
} else if (t == SCRIPT_DOUBLE) {
SCRIPT_RETURN((double)*input);