Fix unicode build for Atlas on OpenSuse.

Based on a patch by: @MatSharrow
Reviewed by: @wraitii
Differential Revision: https://code.wildfiregames.com/D4178
This was SVN commit r25815.
This commit is contained in:
Stan
2021-06-29 12:41:31 +00:00
parent 7871d74521
commit dddaa67abd
5 changed files with 16 additions and 18 deletions
@@ -167,6 +167,7 @@
{ "nick": "Markus" },
{ "nick": "Mate-86", "name": "Mate Kovacs" },
{ "nick": "Matei", "name": "Matei Zaharia" },
{ "nick": "MatSharrow" },
{ "nick": "MattDoerksen", "name": "Matt Doerksen" },
{ "nick": "mattlott", "name": "Matt Lott" },
{ "nick": "maveric", "name": "Anton Protko" },
@@ -131,7 +131,7 @@ AtObj ActorEditor::FreezeData()
actor.set("float", "");
if (m_Material->GetValue().length())
actor.set("material", m_Material->GetValue());
actor.set("material", m_Material->GetValue().utf8_str());
AtObj out;
out.set("actor", actor);
@@ -185,10 +185,10 @@ static AtObj ConvertToLatestFormat(AtObj in)
// new format doesn't store the entire path)
#define THING1(out,outname, in,inname, prefix) \
wxASSERT( wxString::FromUTF8(in["Object"][inname]).StartsWith(_T(prefix)) ); \
out.add(outname, wxString::FromUTF8(in["Object"][inname]).Mid(wxString(_T(prefix)).Length()))
out.add(outname, wxString::FromUTF8(in["Object"][inname]).Mid(wxString(_T(prefix)).Length()).utf8_str())
#define THING2(out,outname, in,inname, prefix) \
wxASSERT( wxString::FromUTF8(in[inname]).StartsWith(_T(prefix)) ); \
out.add(outname, wxString::FromUTF8(in[inname]).Mid(wxString(_T(prefix)).Length()))
out.add(outname, wxString::FromUTF8(in[inname]).Mid(wxString(_T(prefix)).Length()).utf8_str())
if (wxString::FromUTF8(in["Object"]["Material"]).Len())
{
@@ -350,7 +350,7 @@ AtObj ActorEditor::ExportData()
AtObj material = *m_Actor["material"];
actor.set("material", material);
if (m_Material->GetValue().length())
actor.set("material", m_Material->GetValue());
actor.set("material", m_Material->GetValue().utf8_str());
AtObj out;
out.set("actor", actor);
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -257,7 +257,7 @@ void EditableListCtrl::SetCellString(long item, long column, wxString& str)
{
wxCHECK(item >= 0 && column >= 0 && column < (int)m_ColumnTypes.size(), );
MakeSizeAtLeast(item+1);
m_ListData[item].set(m_ColumnTypes[column].key, str);
m_ListData[item].set(m_ColumnTypes[column].key, str.utf8_str());
}
void EditableListCtrl::SetCellObject(long item, long column, AtObj& obj)
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -187,7 +187,7 @@ void MapSettingsControl::CreateWidgets()
AtObj victoryCondition = AtlasObject::LoadFromJSON(victoryConditionJson);
long index = wxWindow::NewControlId();
wxString title = wxString::FromUTF8(victoryCondition["Data"]["Title"]);
std::string escapedTitle = wxString::FromUTF8(title).Lower().ToStdString();
std::string escapedTitle = title.Lower().ToStdString();
std::replace(escapedTitle.begin(), escapedTitle.end(), ' ', '_');
AtObj updateCondition = *(victoryCondition["Data"]["Title"]);
updateCondition.setString(escapedTitle.c_str());
@@ -858,7 +858,7 @@ AtObj PlayerSettingsControl::UpdateSettingsObject()
if (choice->IsEnabled() && choice->GetSelection() >= 0)
{
wxStringClientData* str = dynamic_cast<wxStringClientData*>(choice->GetClientObject(choice->GetSelection()));
player.set("Civ", str->GetData());
player.set("Civ", str->GetData().utf8_str());
}
else
player.unset("Civ");
@@ -876,17 +876,14 @@ AtObj PlayerSettingsControl::UpdateSettingsObject()
// player type
choice = controls.ai;
if (choice->IsEnabled())
if (choice->IsEnabled() && choice->GetSelection() > 0)
{
if (choice->GetSelection() > 0)
{
// ai - get id
wxStringClientData* str = dynamic_cast<wxStringClientData*>(choice->GetClientObject(choice->GetSelection()));
player.set("AI", str->GetData());
}
else // human
player.set("AI", _(""));
// ai - get id
wxStringClientData* str = dynamic_cast<wxStringClientData*>(choice->GetClientObject(choice->GetSelection()));
player.set("AI", str->GetData().utf8_str());
}
else // human
player.unset("AI");
// resources
AtObj resObj;