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
+9 -9
View File
@@ -277,14 +277,14 @@ class MessageCtrl : public wxScrolledWindow {
// --------------------------------------------------- : Layout
static const int LIST_SPACING = 1;
static const int ICON_PADDING = 3;
static const int TEXT_PADDING_LEFT = ICON_PADDING + 16 + 4;
static const int TEXT_PADDING_RIGHT = 4;
static const int TEXT_PADDING_TOP = 4;
static const int TEXT_PADDING_BOTTOM = 2;
static const int TEXT_LINE_SPACING = 1;
static const int MIN_ITEM_HEIGHT = 16 + 2*ICON_PADDING;
static constexpr int LIST_SPACING = 1;
static constexpr int ICON_PADDING = 3;
static constexpr int TEXT_PADDING_LEFT = ICON_PADDING + 16 + 4;
static constexpr int TEXT_PADDING_RIGHT = 4;
static constexpr int TEXT_PADDING_TOP = 4;
static constexpr int TEXT_PADDING_BOTTOM = 2;
static constexpr int TEXT_LINE_SPACING = 1;
static constexpr int MIN_ITEM_HEIGHT = 16 + 2*ICON_PADDING;
/// Layout all messages, starting from number start
/// layout = determine their height
@@ -510,7 +510,7 @@ void ConsolePanel::exec(String const& command) {
message->bitmap = wxBitmap(image);
} else if (type == SCRIPT_COLOR) {
message->text = result->toCode();
Color color = (Color)*result;
Color color = result->operator Color();
wxImage image(30,20);
fill_image(image,color);
set_alpha(image, color.Alpha() / 255.0);
+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);
+1 -1
View File
@@ -44,7 +44,7 @@ SCRIPT_FUNCTION(new_card) {
} else if (PackageChoiceValue* pvalue = dynamic_cast<PackageChoiceValue*>(value)) {
pvalue->package_name = v->toString();
} else if (ColorValue* cvalue = dynamic_cast<ColorValue*>(value)) {
cvalue->value = (Color)*v;
cvalue->value = v->operator Color();
} else {
throw ScriptError(format_string(_("Can not set value '%s', it is not of the right type"),name));
}
+2 -2
View File
@@ -198,9 +198,9 @@ String name_to_caption(const String& str) {
String ret;
ret.reserve(str.size());
bool leading = true, first = true;
FOR_EACH_CONST(c, str) {
for (wxUniChar c : str) {
if ((c == _('_') || c == _(' '))) {
ret += leading ? c : _(' ');
ret += leading ? c : wxUniChar(_(' '));
} else if (first) {
// capitalize_sentence
ret += toUpper(c);