-
From f699b62e03fbc72aab41e74c5b0401d255cdb349 Mon Sep 17 00:00:00 2001
From: Philip Taylor <philip@zaynar.co.uk>
Date: Tue, 20 Jan 2015 23:16:20 +0000
Subject: [PATCH 12/13] Convert wchar_t*/wstring arguments to UTF-8 strings in
CLogger messages.
---
source/graphics/MapGenerator.cpp | 4 +-
source/graphics/MapReader.cpp | 4 +-
source/graphics/ObjectEntry.cpp | 8 ++--
source/graphics/ObjectManager.cpp | 2 +-
source/graphics/TerrainProperties.cpp | 8 ++--
source/graphics/TerrainTextureEntry.cpp | 2 +-
source/gui/CGUI.cpp | 48 +++++++++++-----------
source/gui/GUIManager.cpp | 12 +++---
source/gui/GUIRenderer.cpp | 2 +-
source/gui/GUItext.cpp | 24 +++++------
source/network/NetClient.cpp | 2 +-
source/network/NetServer.cpp | 2 +-
source/network/NetTurnManager.cpp | 21 +++++++---
source/ps/ConfigDB.cpp | 8 ++--
source/ps/GameSetup/GameSetup.cpp | 6 +--
source/ps/XML/Xeromyces.cpp | 4 +-
source/scriptinterface/ScriptInterface.cpp | 8 ++--
source/simulation2/Simulation2.cpp | 2 +-
source/simulation2/components/CCmpAIManager.cpp | 10 ++---
.../components/CCmpProjectileManager.cpp | 2 +-
.../simulation2/serialization/BinarySerializer.cpp | 2 +-
source/simulation2/system/ComponentManager.cpp | 6 +--
source/simulation2/system/ParamNode.cpp | 2 +-
source/soundmanager/SoundManager.cpp | 2 +-
source/soundmanager/scripting/SoundGroup.cpp | 2 +-
25 files changed, 101 insertions(+), 92 deletions(-)
diff --git a/source/graphics/MapGenerator.cpp b/source/graphics/MapGenerator.cpp
index 91d26e9..ed9a8d0 100644
a
|
b
|
std::vector<std::string> CMapGeneratorWorker::GetCivData(ScriptInterface::CxPriv
|
222 | 222 | { |
223 | 223 | // Some error reading directory |
224 | 224 | wchar_t error[200]; |
225 | | LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error))); |
| 225 | LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error)))); |
226 | 226 | } |
227 | 227 | |
228 | 228 | return data; |
… |
… |
bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)
|
284 | 284 | { |
285 | 285 | // Some error reading directory |
286 | 286 | wchar_t error[200]; |
287 | | LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error))); |
| 287 | LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error)))); |
288 | 288 | return false; |
289 | 289 | } |
290 | 290 | |
-
diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp
index fd11ee5..9683323 100644
a
|
b
|
int CXMLReader::ReadEntities(XMBElement parent, double end_time)
|
1052 | 1052 | entity_id_t player = cmpPlayerManager->GetPlayerByID(PlayerID); |
1053 | 1053 | if (ent == INVALID_ENTITY || player == INVALID_ENTITY) |
1054 | 1054 | { // Don't add entities with invalid player IDs |
1055 | | LOGERROR("Failed to load entity template '%s'", TemplateName.c_str()); |
| 1055 | LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(TemplateName)); |
1056 | 1056 | } |
1057 | 1057 | else |
1058 | 1058 | { |
… |
… |
int CMapReader::ParseEntities()
|
1430 | 1430 | entity_id_t player = cmpPlayerManager->GetPlayerByID(currEnt.playerID); |
1431 | 1431 | if (ent == INVALID_ENTITY || player == INVALID_ENTITY) |
1432 | 1432 | { // Don't add entities with invalid player IDs |
1433 | | LOGERROR("Failed to load entity template '%s'", currEnt.templateName.c_str()); |
| 1433 | LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(currEnt.templateName)); |
1434 | 1434 | } |
1435 | 1435 | else |
1436 | 1436 | { |
-
diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp
index e4c26a0..fcd5113 100644
a
|
b
|
bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
|
73 | 73 | str << variation.color; |
74 | 74 | int r, g, b; |
75 | 75 | if (! (str >> r >> g >> b)) // Any trailing data is ignored |
76 | | LOGERROR("Actor '%s' has invalid RGB colour '%s'", m_Base->m_ShortName.c_str(), variation.color.c_str()); |
| 76 | LOGERROR("Actor '%s' has invalid RGB colour '%s'", utf8_from_wstring(m_Base->m_ShortName), variation.color); |
77 | 77 | else |
78 | 78 | m_Color = CColor(r/255.0f, g/255.0f, b/255.0f, 1.0f); |
79 | 79 | } |
… |
… |
bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
|
133 | 133 | |
134 | 134 | if (m_Samplers.size() == 0) |
135 | 135 | { |
136 | | LOGERROR("Actor '%s' has no textures.", m_Base->m_ShortName.c_str()); |
| 136 | LOGERROR("Actor '%s' has no textures.", utf8_from_wstring(m_Base->m_ShortName)); |
137 | 137 | } |
138 | 138 | |
139 | 139 | std::vector<CObjectBase::Samp>::iterator samp; |
… |
… |
bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
|
209 | 209 | CObjectEntry* oe = objectManager.FindObjectVariation(prop.m_ModelName.c_str(), selections); |
210 | 210 | if (!oe) |
211 | 211 | { |
212 | | LOGERROR("Failed to build prop model \"%s\" on actor \"%s\"", prop.m_ModelName.c_str(), m_Base->m_ShortName.c_str()); |
| 212 | LOGERROR("Failed to build prop model \"%s\" on actor \"%s\"", utf8_from_wstring(prop.m_ModelName), utf8_from_wstring(m_Base->m_ShortName)); |
213 | 213 | continue; |
214 | 214 | } |
215 | 215 | |
… |
… |
bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
|
240 | 240 | propmodel->ToCModel()->SetAnimation(oe->GetRandomAnimation("idle")); |
241 | 241 | } |
242 | 242 | else |
243 | | LOGERROR("Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", ppn.c_str(), m_ModelName.string8(), m_Base->m_ShortName.c_str()); |
| 243 | LOGERROR("Failed to find matching prop point called \"%s\" in model \"%s\" for actor \"%s\"", ppn, m_ModelName.string8(), utf8_from_wstring(m_Base->m_ShortName)); |
244 | 244 | } |
245 | 245 | |
246 | 246 | // setup flags |
-
diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp
index 5a0ab1a..9d23072 100644
a
|
b
|
CObjectBase* CObjectManager::FindObjectBase(const CStrW& objectname)
|
96 | 96 | else |
97 | 97 | delete obj; |
98 | 98 | |
99 | | LOGERROR("CObjectManager::FindObjectBase(): Cannot find object '%s'", objectname.c_str()); |
| 99 | LOGERROR("CObjectManager::FindObjectBase(): Cannot find object '%s'", utf8_from_wstring(objectname)); |
100 | 100 | |
101 | 101 | return 0; |
102 | 102 | } |
-
diff --git a/source/graphics/TerrainProperties.cpp b/source/graphics/TerrainProperties.cpp
index f5d7427..3be85b7 100644
a
|
b
|
CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p
|
56 | 56 | if (rootName != "Terrains") |
57 | 57 | { |
58 | 58 | LOGERROR("TerrainProperties: Loading %s: Root node is not terrains (found \"%s\")", |
59 | | pathname.string().c_str(), |
60 | | rootName.c_str()); |
| 59 | pathname.string8(), |
| 60 | rootName); |
61 | 61 | return CTerrainPropertiesPtr(); |
62 | 62 | } |
63 | 63 | |
… |
… |
CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p
|
80 | 80 | else |
81 | 81 | { |
82 | 82 | LOGWARNING("TerrainProperties: Loading %s: Unexpected node %s\n", |
83 | | pathname.string().c_str(), |
84 | | XeroFile.GetElementString(child.GetNodeName()).c_str()); |
| 83 | pathname.string8(), |
| 84 | XeroFile.GetElementString(child.GetNodeName())); |
85 | 85 | // Keep reading - typos shouldn't be showstoppers |
86 | 86 | } |
87 | 87 | } |
-
diff --git a/source/graphics/TerrainTextureEntry.cpp b/source/graphics/TerrainTextureEntry.cpp
index d1c8ce3..756fb2d 100644
a
|
b
|
void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype)
|
253 | 253 | if (textures[i] < 0) |
254 | 254 | { |
255 | 255 | g_TexMan.m_TerrainAlphas.erase(it); |
256 | | LOGERROR("Failed to load alphamap: %s", amtype.string()); |
| 256 | LOGERROR("Failed to load alphamap: %s", amtype.string8()); |
257 | 257 | |
258 | 258 | VfsPath standard("standard"); |
259 | 259 | if (path != standard) |
-
diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp
index cc88ff5..06e86d8 100644
a
|
b
|
void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
|
1185 | 1185 | // Try setting the value |
1186 | 1186 | if (object->SetSetting(pFile->GetAttributeString(attr.Name), attr.Value.FromUTF8(), true) != PSRETURN_OK) |
1187 | 1187 | { |
1188 | | LOGERROR("GUI: (object: %s) Can't set \"%s\" to \"%s\"", object->GetPresentableName().c_str(), pFile->GetAttributeString(attr.Name).c_str(), attr.Value.FromUTF8().c_str()); |
| 1188 | LOGERROR("GUI: (object: %s) Can't set \"%s\" to \"%s\"", object->GetPresentableName(), pFile->GetAttributeString(attr.Name), attr.Value); |
1189 | 1189 | |
1190 | 1190 | // This is not a fatal error |
1191 | 1191 | } |
… |
… |
void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
|
1248 | 1248 | CVFSFile scriptfile; |
1249 | 1249 | if (scriptfile.Load(g_VFS, filename) != PSRETURN_OK) |
1250 | 1250 | { |
1251 | | LOGERROR("Error opening GUI script action file '%s'", filename.c_str()); |
| 1251 | LOGERROR("Error opening GUI script action file '%s'", utf8_from_wstring(filename)); |
1252 | 1252 | throw PSERROR_GUI_JSOpenFailed(); |
1253 | 1253 | } |
1254 | 1254 | |
… |
… |
void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
|
1348 | 1348 | if (!filename.empty()) |
1349 | 1349 | { |
1350 | 1350 | if (!directory.empty()) |
1351 | | LOGWARNING("GUI: Include element found with file name (%s) and directory name (%s). Only the file will be processed.", filename.c_str(), directory.c_str()); |
| 1351 | LOGWARNING("GUI: Include element found with file name (%s) and directory name (%s). Only the file will be processed.", utf8_from_wstring(filename), utf8_from_wstring(directory)); |
1352 | 1352 | |
1353 | 1353 | Paths.insert(filename); |
1354 | 1354 | |
1355 | 1355 | CXeromyces XeroIncluded; |
1356 | 1356 | if (XeroIncluded.Load(g_VFS, filename) != PSRETURN_OK) |
1357 | 1357 | { |
1358 | | LOGERROR("GUI: Error reading included XML: '%s'", filename.c_str()); |
| 1358 | LOGERROR("GUI: Error reading included XML: '%s'", utf8_from_wstring(filename)); |
1359 | 1359 | continue; |
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | XMBElement node = XeroIncluded.GetRoot(); |
1363 | 1363 | if (node.GetNodeName() != XeroIncluded.GetElementID("object")) |
1364 | 1364 | { |
1365 | | LOGERROR("GUI: Error reading included XML: '%s', root element must have be of type 'object'.", filename.c_str()); |
| 1365 | LOGERROR("GUI: Error reading included XML: '%s', root element must have be of type 'object'.", utf8_from_wstring(filename)); |
1366 | 1366 | continue; |
1367 | 1367 | } |
1368 | 1368 | Xeromyces_ReadObject(node, &XeroIncluded, object, NameSubst, Paths, nesting_depth+1); |
… |
… |
void CGUI::Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile, boost::un
|
1491 | 1491 | } |
1492 | 1492 | catch (PSERROR_Scripting& e) |
1493 | 1493 | { |
1494 | | LOGERROR("GUI: Error executing script %s: %s", file.c_str(), e.what()); |
| 1494 | LOGERROR("GUI: Error executing script %s: %s", utf8_from_wstring(file), e.what()); |
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1636 | 1636 | { |
1637 | 1637 | CClientArea ca; |
1638 | 1638 | if (!GUI<CClientArea>::ParseString(attr_value, ca)) |
1639 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1639 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1640 | 1640 | else Image->m_Size = ca; |
1641 | 1641 | } |
1642 | 1642 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1644 | 1644 | { |
1645 | 1645 | CClientArea ca; |
1646 | 1646 | if (!GUI<CClientArea>::ParseString(attr_value, ca)) |
1647 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1647 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1648 | 1648 | else Image->m_TextureSize = ca; |
1649 | 1649 | } |
1650 | 1650 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1652 | 1652 | { |
1653 | 1653 | CRect rect; |
1654 | 1654 | if (!GUI<CRect>::ParseString(attr_value, rect)) |
1655 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1655 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1656 | 1656 | else Image->m_TexturePlacementInFile = rect; |
1657 | 1657 | } |
1658 | 1658 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1660 | 1660 | { |
1661 | 1661 | CSize size; |
1662 | 1662 | if (!GUI<CSize>::ParseString(attr_value, size)) |
1663 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1663 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1664 | 1664 | else Image->m_CellSize = size; |
1665 | 1665 | } |
1666 | 1666 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1668 | 1668 | { |
1669 | 1669 | float val; |
1670 | 1670 | if (!GUI<float>::ParseString(attr_value, val)) |
1671 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1671 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1672 | 1672 | else Image->m_FixedHAspectRatio = val; |
1673 | 1673 | } |
1674 | 1674 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1676 | 1676 | { |
1677 | 1677 | bool b; |
1678 | 1678 | if (!GUI<bool>::ParseString(attr_value, b)) |
1679 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1679 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1680 | 1680 | else Image->m_RoundCoordinates = b; |
1681 | 1681 | } |
1682 | 1682 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1689 | 1689 | else if (attr_value == L"clamp_to_edge") |
1690 | 1690 | Image->m_WrapMode = GL_CLAMP_TO_EDGE; |
1691 | 1691 | else |
1692 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1692 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1693 | 1693 | } |
1694 | 1694 | else |
1695 | 1695 | if (attr_name == "z_level") |
1696 | 1696 | { |
1697 | 1697 | float z_level; |
1698 | 1698 | if (!GUI<float>::ParseString(attr_value, z_level)) |
1699 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1699 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1700 | 1700 | else Image->m_DeltaZ = z_level/100.f; |
1701 | 1701 | } |
1702 | 1702 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1704 | 1704 | { |
1705 | 1705 | CColor color; |
1706 | 1706 | if (!GUI<CColor>::ParseString(attr_value, color)) |
1707 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1707 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1708 | 1708 | else Image->m_BackColor = color; |
1709 | 1709 | } |
1710 | 1710 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1712 | 1712 | { |
1713 | 1713 | CColor color; |
1714 | 1714 | if (!GUI<CColor>::ParseString(attr_value, color)) |
1715 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1715 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1716 | 1716 | else Image->m_BorderColor = color; |
1717 | 1717 | } |
1718 | 1718 | else |
… |
… |
void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
|
1720 | 1720 | { |
1721 | 1721 | bool b; |
1722 | 1722 | if (!GUI<bool>::ParseString(attr_value, b)) |
1723 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1723 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1724 | 1724 | else Image->m_Border = b; |
1725 | 1725 | } |
1726 | 1726 | else |
… |
… |
void CGUI::Xeromyces_ReadEffects(XMBElement Element, CXeromyces* pFile, SGUIImag
|
1773 | 1773 | { |
1774 | 1774 | CColor color; |
1775 | 1775 | if (!GUI<int>::ParseColor(attr_value, color, 0)) |
1776 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1776 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); |
1777 | 1777 | else effects.m_AddColor = color; |
1778 | 1778 | } |
1779 | 1779 | else if (attr_name == "grayscale") |
… |
… |
void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
1853 | 1853 | { |
1854 | 1854 | bool b; |
1855 | 1855 | if (!GUI<bool>::ParseString(attr_value.FromUTF8(), b)) |
1856 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1856 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value); |
1857 | 1857 | else |
1858 | 1858 | scrollbar.m_UseEdgeButtons = b; |
1859 | 1859 | } |
… |
… |
void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
1861 | 1861 | { |
1862 | 1862 | float f; |
1863 | 1863 | if (!GUI<float>::ParseString(attr_value.FromUTF8(), f)) |
1864 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1864 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value); |
1865 | 1865 | else |
1866 | 1866 | scrollbar.m_Width = f; |
1867 | 1867 | } |
… |
… |
void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
1870 | 1870 | { |
1871 | 1871 | float f; |
1872 | 1872 | if (!GUI<float>::ParseString(attr_value.FromUTF8(), f)) |
1873 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1873 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value); |
1874 | 1874 | else |
1875 | 1875 | scrollbar.m_MinimumBarSize = f; |
1876 | 1876 | } |
… |
… |
void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
|
1879 | 1879 | { |
1880 | 1880 | float f; |
1881 | 1881 | if (!GUI<float>::ParseString(attr_value.FromUTF8(), f)) |
1882 | | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); |
| 1882 | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value); |
1883 | 1883 | else |
1884 | 1884 | scrollbar.m_MaximumBarSize = f; |
1885 | 1885 | } |
… |
… |
void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
|
1952 | 1952 | { |
1953 | 1953 | CSize size; |
1954 | 1954 | if (!GUI<CSize>::ParseString(attr_value.FromUTF8(), size)) |
1955 | | LOGERROR("Error parsing '%s' (\"%s\") inside <icon>.", attr_name.c_str(), attr_value.c_str()); |
| 1955 | LOGERROR("Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value); |
1956 | 1956 | else |
1957 | 1957 | icon.m_Size = size; |
1958 | 1958 | } |
… |
… |
void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile)
|
1960 | 1960 | { |
1961 | 1961 | int cell_id; |
1962 | 1962 | if (!GUI<int>::ParseString(attr_value.FromUTF8(), cell_id)) |
1963 | | LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name.c_str(), attr_value.c_str()); |
| 1963 | LOGERROR("GUI: Error parsing '%s' (\"%s\") inside <icon>.", attr_name, attr_value); |
1964 | 1964 | else |
1965 | 1965 | icon.m_CellID = cell_id; |
1966 | 1966 | } |
-
diff --git a/source/gui/GUIManager.cpp b/source/gui/GUIManager.cpp
index 55db7d6..4656f37 100644
a
|
b
|
void CGUIManager::PopPageCB(shared_ptr<ScriptInterface::StructuredClone> args)
|
137 | 137 | JS::RootedValue global(cx, scriptInterface->GetGlobalObject()); |
138 | 138 | if (!scriptInterface->HasProperty(global, callback.c_str())) |
139 | 139 | { |
140 | | LOGERROR("The specified callback function %s does not exist in the page %s", callback.c_str(), m_PageStack.back().name.c_str()); |
| 140 | LOGERROR("The specified callback function %s does not exist in the page %s", callback, utf8_from_wstring(m_PageStack.back().name)); |
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
… |
… |
void CGUIManager::PopPageCB(shared_ptr<ScriptInterface::StructuredClone> args)
|
146 | 146 | scriptInterface->ReadStructuredClone(args, &argVal); |
147 | 147 | if (!scriptInterface->CallFunctionVoid(global, callback.c_str(), argVal)) |
148 | 148 | { |
149 | | LOGERROR("Failed to call the callback function %s in the page %s", callback.c_str(), m_PageStack.back().name.c_str()); |
| 149 | LOGERROR("Failed to call the callback function %s in the page %s", callback, utf8_from_wstring(m_PageStack.back().name)); |
150 | 150 | return; |
151 | 151 | } |
152 | 152 | } |
… |
… |
void CGUIManager::LoadPage(SGUIPage& page)
|
204 | 204 | |
205 | 205 | if (root.GetNodeName() != elmt_page) |
206 | 206 | { |
207 | | LOGERROR("GUI page '%s' must have root element <page>", page.name.c_str()); |
| 207 | LOGERROR("GUI page '%s' must have root element <page>", utf8_from_wstring(page.name)); |
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
… |
… |
void CGUIManager::LoadPage(SGUIPage& page)
|
212 | 212 | { |
213 | 213 | if (node.GetNodeName() != elmt_include) |
214 | 214 | { |
215 | | LOGERROR("GUI page '%s' must only have <include> elements inside <page>", page.name.c_str()); |
| 215 | LOGERROR("GUI page '%s' must only have <include> elements inside <page>", utf8_from_wstring(page.name)); |
216 | 216 | continue; |
217 | 217 | } |
218 | 218 | |
… |
… |
void CGUIManager::LoadPage(SGUIPage& page)
|
252 | 252 | hotloadDataVal) |
253 | 253 | ) |
254 | 254 | { |
255 | | LOGERROR("GUI page '%s': Failed to call init() function", page.name.c_str()); |
| 255 | LOGERROR("GUI page '%s': Failed to call init() function", utf8_from_wstring(page.name)); |
256 | 256 | } |
257 | 257 | |
258 | 258 | m_CurrentGUI = oldGUI; |
… |
… |
Status CGUIManager::ReloadChangedFile(const VfsPath& path)
|
264 | 264 | { |
265 | 265 | if (it->inputs.count(path)) |
266 | 266 | { |
267 | | LOGMESSAGE("GUI file '%s' changed - reloading page '%s'", path.string8(), it->name.c_str()); |
| 267 | LOGMESSAGE("GUI file '%s' changed - reloading page '%s'", path.string8(), utf8_from_wstring(it->name)); |
268 | 268 | LoadPage(*it); |
269 | 269 | // TODO: this can crash if LoadPage runs an init script which modifies the page stack and breaks our iterators |
270 | 270 | } |
-
diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp
index ec5087b..88f3115 100644
a
|
b
|
void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, const CStr& SpriteName,
|
144 | 144 | // Check colour is valid |
145 | 145 | if (!GUI<CColor>::ParseString(value, color)) |
146 | 146 | { |
147 | | LOGERROR("GUI: Error parsing sprite 'colour' (\"%s\")", value.c_str()); |
| 147 | LOGERROR("GUI: Error parsing sprite 'colour' (\"%s\")", utf8_from_wstring(value)); |
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
-
diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp
index 15ca677..783bb30 100644
a
|
b
|
void CGUIString::SetValue(const CStrW& str)
|
306 | 306 | closing = false; |
307 | 307 | if (++p == l) |
308 | 308 | { |
309 | | LOGERROR("Partial tag at end of string '%s'", str.c_str()); |
| 309 | LOGERROR("Partial tag at end of string '%s'", utf8_from_wstring(str)); |
310 | 310 | break; |
311 | 311 | } |
312 | 312 | if (str[p] == L'/') |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
314 | 314 | closing = true; |
315 | 315 | if (tags.empty()) |
316 | 316 | { |
317 | | LOGERROR("Encountered closing tag without having any open tags. At %d in '%s'", p, str.c_str()); |
| 317 | LOGERROR("Encountered closing tag without having any open tags. At %d in '%s'", p, utf8_from_wstring(str)); |
318 | 318 | break; |
319 | 319 | } |
320 | 320 | if (++p == l) |
321 | 321 | { |
322 | | LOGERROR("Partial closing tag at end of string '%s'", str.c_str()); |
| 322 | LOGERROR("Partial closing tag at end of string '%s'", utf8_from_wstring(str)); |
323 | 323 | break; |
324 | 324 | } |
325 | 325 | } |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
332 | 332 | { |
333 | 333 | case L' ': |
334 | 334 | if (closing) // We still parse them to make error handling cleaner |
335 | | LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, str.c_str()); |
| 335 | LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, utf8_from_wstring(str)); |
336 | 336 | |
337 | 337 | // parse something="something else" |
338 | 338 | for (++p; p < l && str[p] != L'='; ++p) |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
340 | 340 | |
341 | 341 | if (p == l) |
342 | 342 | { |
343 | | LOGERROR("Parameter without value at pos %d '%s'", p, str.c_str()); |
| 343 | LOGERROR("Parameter without value at pos %d '%s'", p, utf8_from_wstring(str)); |
344 | 344 | break; |
345 | 345 | } |
346 | 346 | // fall-through |
347 | 347 | case L'=': |
348 | 348 | // parse a quoted parameter |
349 | 349 | if (closing) // We still parse them to make error handling cleaner |
350 | | LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, str.c_str()); |
| 350 | LOGERROR("Closing tags do not support parameters (at pos %d '%s')", p, utf8_from_wstring(str)); |
351 | 351 | |
352 | 352 | if (++p == l) |
353 | 353 | { |
354 | | LOGERROR("Expected parameter, got end of string '%s'", str.c_str()); |
| 354 | LOGERROR("Expected parameter, got end of string '%s'", utf8_from_wstring(str)); |
355 | 355 | break; |
356 | 356 | } |
357 | 357 | if (str[p] != L'"') |
358 | 358 | { |
359 | | LOGERROR("Unquoted parameters are not supported (at pos %d '%s')", p, str.c_str()); |
| 359 | LOGERROR("Unquoted parameters are not supported (at pos %d '%s')", p, utf8_from_wstring(str)); |
360 | 360 | break; |
361 | 361 | } |
362 | 362 | for (++p; p < l && str[p] != L'"'; ++p) |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
366 | 366 | case L'\\': |
367 | 367 | if (++p == l) |
368 | 368 | { |
369 | | LOGERROR("Escape character at end of string '%s'", str.c_str()); |
| 369 | LOGERROR("Escape character at end of string '%s'", utf8_from_wstring(str)); |
370 | 370 | break; |
371 | 371 | } |
372 | 372 | // NOTE: We do not support \n in tag parameters |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
392 | 392 | |
393 | 393 | if (!tag_.SetTagType(tag)) |
394 | 394 | { |
395 | | LOGERROR("Invalid tag '%s' at %d in '%s'", tag.c_str(), p, str.c_str()); |
| 395 | LOGERROR("Invalid tag '%s' at %d in '%s'", utf8_from_wstring(tag), p, utf8_from_wstring(str)); |
396 | 396 | break; |
397 | 397 | } |
398 | 398 | if (!closing) |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
415 | 415 | { |
416 | 416 | if (tag != tags.back()) |
417 | 417 | { |
418 | | LOGERROR("Closing tag '%s' does not match last opened tag '%s' at %d in '%s'", tag.c_str(), tags.back().c_str(), p, str.c_str()); |
| 418 | LOGERROR("Closing tag '%s' does not match last opened tag '%s' at %d in '%s'", utf8_from_wstring(tag), utf8_from_wstring(tags.back()), p, utf8_from_wstring(str)); |
419 | 419 | break; |
420 | 420 | } |
421 | 421 | |
… |
… |
void CGUIString::SetValue(const CStrW& str)
|
426 | 426 | case L'\\': |
427 | 427 | if (++p == l) |
428 | 428 | { |
429 | | LOGERROR("Escape character at end of string '%s'", str.c_str()); |
| 429 | LOGERROR("Escape character at end of string '%s'", utf8_from_wstring(str)); |
430 | 430 | break; |
431 | 431 | } |
432 | 432 | if (str[p] == L'n') |
-
diff --git a/source/network/NetClient.cpp b/source/network/NetClient.cpp
index 68b253c..fec7a80 100644
a
|
b
|
bool CNetClient::OnAuthenticate(void* context, CFsmEvent* event)
|
428 | 428 | |
429 | 429 | CAuthenticateResultMessage* message = (CAuthenticateResultMessage*)event->GetParamRef(); |
430 | 430 | |
431 | | LOGMESSAGE("Net: Authentication result: host=%u, %s", message->m_HostID, message->m_Message.c_str()); |
| 431 | LOGMESSAGE("Net: Authentication result: host=%u, %s", message->m_HostID, utf8_from_wstring(message->m_Message)); |
432 | 432 | |
433 | 433 | bool isRejoining = (message->m_Code == ARC_OK_REJOINING); |
434 | 434 | |
-
diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp
index b3c14f3..1a8187a 100644
a
|
b
|
bool CNetServerWorker::OnAuthenticate(void* context, CFsmEvent* event)
|
810 | 810 | // Players who weren't already in the game are not allowed to join now that it's started |
811 | 811 | if (!isRejoining) |
812 | 812 | { |
813 | | LOGMESSAGE("Refused connection after game start from not-previously-known user \"%s\"", username.c_str()); |
| 813 | LOGMESSAGE("Refused connection after game start from not-previously-known user \"%s\"", utf8_from_wstring(username)); |
814 | 814 | session->Disconnect(NDR_SERVER_ALREADY_IN_GAME); |
815 | 815 | return true; |
816 | 816 | } |
-
diff --git a/source/network/NetTurnManager.cpp b/source/network/NetTurnManager.cpp
index 5a57470..575dca3 100644
a
|
b
|
static std::wstring Hexify(const std::string& s)
|
57 | 57 | return str.str(); |
58 | 58 | } |
59 | 59 | |
| 60 | static std::string Hexify8(const std::string& s) |
| 61 | { |
| 62 | std::stringstream str; |
| 63 | str << std::hex; |
| 64 | for (size_t i = 0; i < s.size(); ++i) |
| 65 | str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i]; |
| 66 | return str.str(); |
| 67 | } |
| 68 | |
60 | 69 | CNetTurnManager::CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) : |
61 | 70 | m_Simulation2(simulation), m_CurrentTurn(0), m_ReadyTurn(1), m_TurnLength(defaultTurnLength), m_DeltaSimTime(0), |
62 | 71 | m_PlayerId(-1), m_ClientId(clientId), m_HasSyncError(false), m_Replay(replay), |
… |
… |
void CNetTurnManager::OnSyncError(u32 turn, const std::string& expectedHash)
|
237 | 246 | m_Simulation2.DumpDebugState(file); |
238 | 247 | file.close(); |
239 | 248 | |
240 | | std::wstringstream msg; |
241 | | msg << L"Out of sync on turn " << turn << L": expected hash " << Hexify(expectedHash) << L"\n\n"; |
242 | | msg << L"Current state: turn " << m_CurrentTurn << L", hash " << Hexify(hash) << L"\n\n"; |
243 | | msg << L"Dumping current state to " << path; |
| 249 | std::stringstream msg; |
| 250 | msg << "Out of sync on turn " << turn << ": expected hash " << Hexify8(expectedHash) << "\n\n"; |
| 251 | msg << "Current state: turn " << m_CurrentTurn << ", hash " << Hexify8(hash) << "\n\n"; |
| 252 | msg << "Dumping current state to " << utf8_from_wstring(path.string()); |
244 | 253 | if (g_GUI) |
245 | | g_GUI->DisplayMessageBox(600, 350, L"Sync error", msg.str()); |
| 254 | g_GUI->DisplayMessageBox(600, 350, L"Sync error", wstring_from_utf8(msg.str())); |
246 | 255 | else |
247 | | LOGERROR("%s", msg.str().c_str()); |
| 256 | LOGERROR("%s", msg.str()); |
248 | 257 | } |
249 | 258 | |
250 | 259 | void CNetTurnManager::Interpolate(float simFrameLength, float realFrameLength) |
-
diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp
index 2c14e15..ab4dca3 100644
a
|
b
|
bool CConfigDB::Reload(EConfigNamespace ns)
|
337 | 337 | CStr key(header + name); |
338 | 338 | newMap[key] = values; |
339 | 339 | if (key == "lobby.password") |
340 | | LOGMESSAGE("Loaded config string \"%s\"", key.c_str()); |
| 340 | LOGMESSAGE("Loaded config string \"%s\"", key); |
341 | 341 | else |
342 | 342 | { |
343 | 343 | std::string vals; |
344 | 344 | for (size_t i = 0; i < newMap[key].size() - 1; ++i) |
345 | 345 | vals += "\"" + EscapeString(newMap[key][i]) + "\", "; |
346 | 346 | vals += "\"" + EscapeString(newMap[key][values.size()-1]) + "\""; |
347 | | LOGMESSAGE("Loaded config string \"%s\" = %s", key.c_str(), vals.c_str()); |
| 347 | LOGMESSAGE("Loaded config string \"%s\" = %s", key, vals); |
348 | 348 | } |
349 | 349 | } |
350 | 350 | else if (!name.empty()) |
351 | | LOGERROR("Encountered config setting '%s' without value while parsing '%s' on line %d", name.c_str(), m_ConfigFile[ns].string8(), line); |
| 351 | LOGERROR("Encountered config setting '%s' without value while parsing '%s' on line %d", name, m_ConfigFile[ns].string8(), line); |
352 | 352 | |
353 | 353 | name.clear(); |
354 | 354 | values.clear(); |
… |
… |
bool CConfigDB::Reload(EConfigNamespace ns)
|
356 | 356 | } |
357 | 357 | |
358 | 358 | if (!name.empty()) |
359 | | LOGERROR("Config file does not have a new line after the last config setting '%s'", name.c_str()); |
| 359 | LOGERROR("Config file does not have a new line after the last config setting '%s'", name); |
360 | 360 | |
361 | 361 | m_Map[ns].swap(newMap); |
362 | 362 | |
-
diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp
index d1fb63c..44b166e 100644
a
|
b
|
void Render()
|
293 | 293 | #warning TODO: cursors for Android |
294 | 294 | #else |
295 | 295 | if (cursor_draw(g_VFS, cursorName.c_str(), g_mouse_x, g_yres-g_mouse_y, forceGL) < 0) |
296 | | LOGWARNING("Failed to draw cursor '%s'", cursorName.c_str()); |
| 296 | LOGWARNING("Failed to draw cursor '%s'", utf8_from_wstring(cursorName)); |
297 | 297 | #endif |
298 | 298 | |
299 | 299 | #if CONFIG2_GLES |
… |
… |
bool Autostart(const CmdLineArgs& args)
|
1246 | 1246 | else |
1247 | 1247 | { |
1248 | 1248 | // Problem with JSON file |
1249 | | LOGERROR("Autostart: Error reading random map script '%s'", scriptPath.c_str()); |
| 1249 | LOGERROR("Autostart: Error reading random map script '%s'", utf8_from_wstring(scriptPath)); |
1250 | 1250 | throw PSERROR_Game_World_MapLoadFailed("Error reading random map script.\nCheck application log for details."); |
1251 | 1251 | } |
1252 | 1252 | |
… |
… |
bool Autostart(const CmdLineArgs& args)
|
1301 | 1301 | } |
1302 | 1302 | else |
1303 | 1303 | { |
1304 | | LOGERROR("Autostart: Unrecognized map type '%s'", mapDirectory.c_str()); |
| 1304 | LOGERROR("Autostart: Unrecognized map type '%s'", utf8_from_wstring(mapDirectory)); |
1305 | 1305 | throw PSERROR_Game_World_MapLoadFailed("Unrecognized map type.\nConsult readme.txt for the currently supported types."); |
1306 | 1306 | } |
1307 | 1307 | scriptInterface.SetProperty(attrs, "mapType", mapType); |
-
diff --git a/source/ps/XML/Xeromyces.cpp b/source/ps/XML/Xeromyces.cpp
index 9e2709e..68ba0c6 100644
a
|
b
|
static void errorHandler(void* UNUSED(userData), xmlErrorPtr error)
|
39 | 39 | message.erase(message.length()-1); |
40 | 40 | |
41 | 41 | LOGERROR("CXeromyces: Parse %s: %s:%d: %s", |
42 | | error->level == XML_ERR_WARNING ? L"warning" : L"error", |
43 | | error->file, error->line, message.c_str()); |
| 42 | error->level == XML_ERR_WARNING ? "warning" : "error", |
| 43 | error->file, error->line, message); |
44 | 44 | // TODO: The (non-fatal) warnings and errors don't get stored in the XMB, |
45 | 45 | // so the caching is less transparent than it should be |
46 | 46 | } |
-
diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp
index 975cde1..a86ab5d 100644
a
|
b
|
JSBool logmsg(JSContext* cx, uint argc, jsval* vp)
|
163 | 163 | std::wstring str; |
164 | 164 | if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str)) |
165 | 165 | return JS_FALSE; |
166 | | LOGMESSAGE("%s", str.c_str()); |
| 166 | LOGMESSAGE("%s", utf8_from_wstring(str)); |
167 | 167 | args.rval().setUndefined(); |
168 | 168 | return JS_TRUE; |
169 | 169 | } |
… |
… |
JSBool warn(JSContext* cx, uint argc, jsval* vp)
|
180 | 180 | std::wstring str; |
181 | 181 | if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str)) |
182 | 182 | return JS_FALSE; |
183 | | LOGWARNING("%s", str.c_str()); |
| 183 | LOGWARNING("%s", utf8_from_wstring(str)); |
184 | 184 | args.rval().setUndefined(); |
185 | 185 | return JS_TRUE; |
186 | 186 | } |
… |
… |
JSBool error(JSContext* cx, uint argc, jsval* vp)
|
197 | 197 | std::wstring str; |
198 | 198 | if (!ScriptInterface::FromJSVal(cx, args.handleAt(0), str)) |
199 | 199 | return JS_FALSE; |
200 | | LOGERROR("%s", str.c_str()); |
| 200 | LOGERROR("%s", utf8_from_wstring(str)); |
201 | 201 | args.rval().setUndefined(); |
202 | 202 | return JS_TRUE; |
203 | 203 | } |
… |
… |
bool ScriptInterface::ParseJSON(const std::string& string_utf8, JS::MutableHandl
|
946 | 946 | |
947 | 947 | std::wstring error; |
948 | 948 | ScriptInterface::FromJSVal(m->m_cx, rval, error); |
949 | | LOGERROR("%s", error.c_str()); |
| 949 | LOGERROR("%s", utf8_from_wstring(error)); |
950 | 950 | return false; |
951 | 951 | } |
952 | 952 | |
-
diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp
index fbb1664..ac70109 100644
a
|
b
|
static std::vector<std::string> GetJSONData(const VfsPath& path)
|
828 | 828 | { |
829 | 829 | // Some error reading directory |
830 | 830 | wchar_t error[200]; |
831 | | LOGERROR("Error reading directory '%s': %s", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error))); |
| 831 | LOGERROR("Error reading directory '%s': %s", path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error)))); |
832 | 832 | return std::vector<std::string>(); |
833 | 833 | } |
834 | 834 | |
-
diff --git a/source/simulation2/components/CCmpAIManager.cpp b/source/simulation2/components/CCmpAIManager.cpp
index ffe0fc4..e2a067a 100644
a
|
b
|
private:
|
124 | 124 | if (!m_ScriptInterface->GetProperty(global, moduleName.c_str(), &objectWithConstructor) |
125 | 125 | || objectWithConstructor.isUndefined()) |
126 | 126 | { |
127 | | LOGERROR("Failed to create AI player: %s: can't find the module that should contain the constructor: '%s'", path.string8(), moduleName.c_str()); |
| 127 | LOGERROR("Failed to create AI player: %s: can't find the module that should contain the constructor: '%s'", path.string8(), moduleName); |
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
… |
… |
private:
|
138 | 138 | if (!m_ScriptInterface->GetProperty(objectWithConstructor, constructor.c_str(), &ctor) |
139 | 139 | || ctor.isNull()) |
140 | 140 | { |
141 | | LOGERROR("Failed to create AI player: %s: can't find constructor '%s'", path.string8(), constructor.c_str()); |
| 141 | LOGERROR("Failed to create AI player: %s: can't find constructor '%s'", path.string8(), constructor); |
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | |
… |
… |
private:
|
160 | 160 | |
161 | 161 | if (obj.isNull()) |
162 | 162 | { |
163 | | LOGERROR("Failed to create AI player: %s: error calling constructor '%s'", path.string8(), constructor.c_str()); |
| 163 | LOGERROR("Failed to create AI player: %s: error calling constructor '%s'", path.string8(), constructor); |
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
… |
… |
public:
|
261 | 261 | VfsPaths pathnames; |
262 | 262 | if (vfs::GetPathnames(g_VFS, L"simulation/ai/" + moduleName + L"/", L"*.js", pathnames) < 0) |
263 | 263 | { |
264 | | LOGERROR("Failed to load AI scripts for module %s", moduleName.c_str()); |
| 264 | LOGERROR("Failed to load AI scripts for module %s", utf8_from_wstring(moduleName)); |
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | |
… |
… |
public:
|
748 | 748 | std::pair<std::map<JSObject*, std::wstring>::iterator, bool> ret1 = m_SerializablePrototypes.insert(std::make_pair(obj, name)); |
749 | 749 | std::pair<std::map<std::wstring, JSObject*>::iterator, bool> ret2 = m_DeserializablePrototypes.insert(std::make_pair(name, obj)); |
750 | 750 | if (!ret1.second || !ret2.second) |
751 | | LOGERROR("RegisterSerializablePrototype called with same prototype multiple times: p=%p n='%s'", obj, name.c_str()); |
| 751 | LOGERROR("RegisterSerializablePrototype called with same prototype multiple times: p=%p n='%s'", (void *)obj, utf8_from_wstring(name)); |
752 | 752 | } |
753 | 753 | |
754 | 754 | private: |
-
diff --git a/source/simulation2/components/CCmpProjectileManager.cpp b/source/simulation2/components/CCmpProjectileManager.cpp
index d8af231..8e0d5c3 100644
a
|
b
|
uint32_t CCmpProjectileManager::LaunchProjectile(entity_id_t source, CFixedVecto
|
175 | 175 | { |
176 | 176 | // If the actor was actually loaded, complain that it doesn't have a projectile |
177 | 177 | if (!cmpSourceVisual->GetActorShortName().empty()) |
178 | | LOGERROR("Unit with actor '%s' launched a projectile but has no actor on 'projectile' attachpoint", cmpSourceVisual->GetActorShortName().c_str()); |
| 178 | LOGERROR("Unit with actor '%s' launched a projectile but has no actor on 'projectile' attachpoint", utf8_from_wstring(cmpSourceVisual->GetActorShortName())); |
179 | 179 | return 0; |
180 | 180 | } |
181 | 181 | |
-
diff --git a/source/simulation2/serialization/BinarySerializer.cpp b/source/simulation2/serialization/BinarySerializer.cpp
index f6da94f..4878226 100644
a
|
b
|
void CBinarySerializerScriptImpl::HandleScriptVal(JS::HandleValue val)
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | | LOGERROR("Cannot serialise JS objects of type 'function': %s", funcname.c_str()); |
| 320 | LOGERROR("Cannot serialise JS objects of type 'function': %s", utf8_from_wstring(funcname)); |
321 | 321 | throw PSERROR_Serialize_InvalidScriptValue(); |
322 | 322 | } |
323 | 323 | case JSTYPE_STRING: |
-
diff --git a/source/simulation2/system/ComponentManager.cpp b/source/simulation2/system/ComponentManager.cpp
index 53e69ee..0ee90a0 100644
a
|
b
|
entity_id_t CComponentManager::AddEntity(const std::wstring& templateName, entit
|
887 | 887 | CComponentManager::ComponentTypeId cid = LookupCID(it->first); |
888 | 888 | if (cid == CID__Invalid) |
889 | 889 | { |
890 | | LOGERROR("Unrecognised component type name '%s' in entity template '%s'", it->first.c_str(), templateName.c_str()); |
| 890 | LOGERROR("Unrecognised component type name '%s' in entity template '%s'", it->first, utf8_from_wstring(templateName)); |
891 | 891 | return INVALID_ENTITY; |
892 | 892 | } |
893 | 893 | |
894 | 894 | if (!AddComponent(handle, cid, it->second)) |
895 | 895 | { |
896 | | LOGERROR("Failed to construct component type name '%s' in entity template '%s'", it->first.c_str(), templateName.c_str()); |
| 896 | LOGERROR("Failed to construct component type name '%s' in entity template '%s'", it->first, utf8_from_wstring(templateName)); |
897 | 897 | return INVALID_ENTITY; |
898 | 898 | } |
899 | 899 | // TODO: maybe we should delete already-constructed components if one of them fails? |
… |
… |
std::vector<std::string> CComponentManager::Script_FindJSONFiles(ScriptInterface
|
1226 | 1226 | { |
1227 | 1227 | // Some error reading directory |
1228 | 1228 | wchar_t error[200]; |
1229 | | LOGERROR("Error reading directory '%s': %s", cbData.path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error))); |
| 1229 | LOGERROR("Error reading directory '%s': %s", cbData.path.string8(), utf8_from_wstring(StatusDescription(ret, error, ARRAY_SIZE(error)))); |
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | return cbData.templates; |
-
diff --git a/source/simulation2/system/ParamNode.cpp b/source/simulation2/system/ParamNode.cpp
index 0e5dc41..2e4b172 100644
a
|
b
|
void CParamNode::ApplyLayer(const XMBFile& xmb, const XMBElement& element, const
|
124 | 124 | tokens.erase(tokenIt); |
125 | 125 | else |
126 | 126 | LOGWARNING("[ParamNode] Could not remove token '%s' from node '%s'%s; not present in list nor inherited (possible typo?)", |
127 | | newTokens[i].substr(1).c_str(), name.c_str(), sourceIdentifier ? (L" in '" + std::wstring(sourceIdentifier) + L"'").c_str() : L""); |
| 127 | utf8_from_wstring(newTokens[i].substr(1)), name, sourceIdentifier ? (" in '" + utf8_from_wstring(sourceIdentifier) + "'").c_str() : ""); |
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
-
diff --git a/source/soundmanager/SoundManager.cpp b/source/soundmanager/SoundManager.cpp
index 5bf843d..48d0917 100644
a
|
b
|
Status CSoundManager::AlcInit()
|
354 | 354 | debug_printf(L"Sound: AlcInit success, using %hs\n", dev_name); |
355 | 355 | else |
356 | 356 | { |
357 | | LOGERROR("Sound: AlcInit failed, m_Device=%p m_Context=%p dev_name=%s err=%x\n", m_Device, m_Context, dev_name, err); |
| 357 | LOGERROR("Sound: AlcInit failed, m_Device=%p m_Context=%p dev_name=%s err=%x\n", (void *)m_Device, (void *)m_Context, dev_name, err); |
358 | 358 | |
359 | 359 | // FIXME Hack to get around exclusive access to the sound device |
360 | 360 | #if OS_UNIX |
-
diff --git a/source/soundmanager/scripting/SoundGroup.cpp b/source/soundmanager/scripting/SoundGroup.cpp
index 2b7a4be..0dc524c 100644
a
|
b
|
static void HandleError(const CStrW& message, const VfsPath& pathname, Status er
|
227 | 227 | { |
228 | 228 | if (err == ERR::AGAIN) |
229 | 229 | return; // open failed because sound is disabled (don't log this) |
230 | | LOGERROR("%s: pathname=%s, error=%s", message.c_str(), pathname.string8(), ErrorString(err)); |
| 230 | LOGERROR("%s: pathname=%s, error=%s", utf8_from_wstring(message), pathname.string8(), utf8_from_wstring(ErrorString(err))); |
231 | 231 | } |
232 | 232 | |
233 | 233 | void CSoundGroup::PlayNext(const CVector3D& position, entity_id_t source) |