From c0be27e2bcc8f6dd1662348b28be21dd3a5ae381 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 22 Nov 2016 13:07:52 +0100 Subject: [PATCH] Changed: Convert CString and TCHAR* from/to std::string --- .../tools/3d/ligo/plugin_max/max_to_ligo.cpp | 2 +- .../tools/3d/object_viewer/editable_range.h | 10 ++--- .../3d/object_viewer/located_target_dlg.cpp | 8 ++-- code/nel/tools/3d/object_viewer/mesh_dlg.cpp | 2 +- .../tools/3d/object_viewer/multi_tex_dlg.cpp | 2 +- .../nel/tools/3d/object_viewer/pick_sound.cpp | 2 +- .../tools/3d/object_viewer/ps_mover_dlg.cpp | 4 +- .../3d/object_viewer/skeleton_scale_dlg.cpp | 8 ++-- .../tools/3d/object_viewer/vegetable_dlg.cpp | 28 ++++++------ .../3d/object_viewer/vegetable_edit_tools.cpp | 2 +- .../vegetable_noise_value_dlg.cpp | 6 +-- .../3d/object_viewer/vegetable_select_dlg.cpp | 2 +- .../3d/object_viewer/vegetable_wind_dlg.cpp | 20 +++------ .../3d/object_viewer/water_pool_editor.cpp | 21 +++++---- .../3d/plugin_max/nel_export/nel_export.cpp | 16 +++---- .../nel_export/nel_export_export.cpp | 2 +- .../nel_export/nel_export_node_properties.cpp | 12 ++--- .../plugin_max/nel_export/nel_export_view.cpp | 4 +- .../3d/plugin_max/nel_mesh_lib/calc_lm.cpp | 25 +++++------ .../3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp | 4 +- .../plugin_max/nel_mesh_lib/export_anim.cpp | 2 +- .../nel_mesh_lib/export_collision.cpp | 2 +- .../nel_mesh_lib/export_material.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_mesh.cpp | 11 +++-- .../nel_mesh_lib/export_mesh_interface.cpp | 8 ++-- .../plugin_max/nel_mesh_lib/export_misc.cpp | 30 ++++++------- .../3d/plugin_max/nel_mesh_lib/export_nel.h | 4 +- .../nel_mesh_lib/export_particle_system.cpp | 4 +- .../nel_mesh_lib/export_radial_normal.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_scene.cpp | 28 ++++-------- .../plugin_max/nel_mesh_lib/export_script.cpp | 2 +- .../nel_mesh_lib/export_skinning.cpp | 8 ++-- .../plugin_max/nel_patch_lib/nel_patch_mesh.h | 2 +- .../3d/plugin_max/nel_patch_lib/rpo2nel.cpp | 15 +++---- .../3d/plugin_max/nel_patch_paint/paint.cpp | 2 +- .../plugin_max/tile_utility/tile_utility.cpp | 16 +++---- code/nel/tools/3d/tile_edit/View.cpp | 5 +-- .../tools/3d/tile_edit/choose_veget_set.cpp | 4 +- .../leveldesign/georges_dll/dfn_dialog.cpp | 44 +++++++++---------- .../leveldesign/georges_dll/georges_edit.cpp | 4 +- .../mission_compiler_feDlg.cpp | 4 +- .../world_editor/builder_zone.cpp | 10 ++--- .../world_editor/file_dialog_ex.cpp | 26 +++++------ .../world_editor/world_editor/name_dlg.cpp | 6 +-- .../graph_plugin.cpp | 17 +++---- .../DialogFlags.cpp | 6 +-- .../memory_combo_box.cpp | 42 +++++++++--------- .../plugin.cpp | 12 ++--- .../world_editor_sound_plugin/DialogFlags.cpp | 15 ++++--- 49 files changed, 241 insertions(+), 272 deletions(-) diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp index 7de43f6b9..052eb04a0 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp @@ -139,7 +139,7 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di try { // Load the config file - config.readConfigFile (sModulePath, false); + config.readConfigFile (tStrToUtf8(sModulePath), false); // ok return true; diff --git a/code/nel/tools/3d/object_viewer/editable_range.h b/code/nel/tools/3d/object_viewer/editable_range.h index 05e52857b..65c633352 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.h +++ b/code/nel/tools/3d/object_viewer/editable_range.h @@ -317,7 +317,7 @@ inline void CEditableRangeT::value2CString(float value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, float &result) { - if (sscanf((LPCTSTR) value, "%f", &result) == 1) + if (NLMISC::fromString(tStrToUtf8(value), result)) { return NULL; } @@ -343,8 +343,8 @@ inline void CEditableRangeT::value2CString(uint32 value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, uint32 &result) { - uint32 tmp; - if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) + sint32 tmp; + if (NLMISC::fromString(tStrToUtf8(value), tmp)) { if (strchr((LPCTSTR) value, '-')) { @@ -379,8 +379,8 @@ inline void CEditableRangeT::value2CString(sint32 value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, sint32 &result) { - uint32 tmp; - if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) + sint32 tmp; + if (NLMISC::fromString(tStrToUtf8(value), tmp)) { result = tmp; return NULL; diff --git a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp index 7cb03426f..12c9de041 100644 --- a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp @@ -159,8 +159,8 @@ BOOL CLocatedTargetDlg::OnInitDialog() // fill the box thta tells us what the target are for(k = 0; k < nbTarg; ++k) { - m_Targets.AddString(_LBTarget->getTarget(k)->getName().c_str() ); - m_Targets.SetItemData(k, (DWORD) _LBTarget->getTarget(k) ); + m_Targets.AddString(utf8ToTStr(_LBTarget->getTarget(k)->getName())); + m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k)); targetSet.insert(_LBTarget->getTarget(k)); }; @@ -179,8 +179,8 @@ BOOL CLocatedTargetDlg::OnInitDialog() { if (targetSet.find(loc) == targetSet.end()) { - int l = m_AvailableTargets.AddString(loc->getName().c_str() ); - m_AvailableTargets.SetItemData(l, (DWORD) loc ); + int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); + m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); } } } diff --git a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp index de59b9c2a..991ae09f3 100644 --- a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp @@ -162,7 +162,7 @@ void CMeshDlg::updateForMorph() GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable); if (!enable) { - m_ShapeName = cm->getShape().c_str(); + m_ShapeName = utf8ToTStr(cm->getShape()); } else { diff --git a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp index fc0c294ca..58776b931 100644 --- a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp @@ -188,6 +188,7 @@ void CMultiTexDlg::readValues(bool alternate) } } + GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor()))); } @@ -206,7 +207,6 @@ void CMultiTexDlg::writeValues(bool alternate) TCHAR u1[10], u2[10], v1[10], v2[10]; NLMISC::CVector2f vs1, vs2; - if (!alternate) { GetDlgItem(IDC_U_SPEED_1)->GetWindowText(u1, 10); diff --git a/code/nel/tools/3d/object_viewer/pick_sound.cpp b/code/nel/tools/3d/object_viewer/pick_sound.cpp index 2f67147a8..0e6c175d0 100644 --- a/code/nel/tools/3d/object_viewer/pick_sound.cpp +++ b/code/nel/tools/3d/object_viewer/pick_sound.cpp @@ -159,7 +159,7 @@ void CPickSound::OnDblclkList() stopCurrSource(); CString sName; m_NameList.GetText(curSel, sName); - _CurrSource = CSoundSystem::create(std::string( (LPCTSTR) sName)); + _CurrSource = CSoundSystem::create(tStrToUtf8(sName)); } //======================================================================================== diff --git a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp index a916cee6f..cdd88ea70 100644 --- a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp @@ -178,8 +178,8 @@ BOOL CPSMoverDlg::OnInitDialog() { if (dynamic_cast(_EditedLocated->getBoundObject(k))) { - uint insertedLine = m_SubComponentCtrl.AddString(_EditedLocated->getBoundObject(k)->getName().c_str()); - m_SubComponentCtrl.SetItemData(insertedLine, (DWORD) _EditedLocated->getBoundObject(k)); + uint insertedLine = m_SubComponentCtrl.AddString(utf8ToTStr(_EditedLocated->getBoundObject(k)->getName())); + m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k)); ++nbCandidates; } } diff --git a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp index a7d2b022a..42839e933 100644 --- a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp @@ -843,13 +843,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() return; // choose the file - CFileDialog fd(FALSE, "skel", _SkeletonFileName.c_str(), OFN_OVERWRITEPROMPT, "SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||", this) ; - fd.m_ofn.lpstrTitle= "Save As Skeleton"; + CFileDialog fd(FALSE, _T("skel"), utf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this) ; + fd.m_ofn.lpstrTitle = _T("Save As Skeleton"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open((const char*)fd.GetPathName()) ) + if( f.open(tStrToUtf8(fd.GetPathName())) ) { if(saveCurrentInStream(f)) { @@ -859,7 +859,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() } // bkup the valid fileName (new file edited) - _SkeletonFileName= (const char*)fd.GetPathName(); + _SkeletonFileName= tStrToUtf8(fd.GetPathName()); _StaticFileName= _SkeletonFileName.c_str(); UpdateData(FALSE); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp index 7611b543b..09a2079e5 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp @@ -196,7 +196,7 @@ void CVegetableDlg::updateCurSelVegetableName() _Vegetables[id].updateVegetableName(); // replace name in the listBox: must delete, and re-insert VegetableList.DeleteString(id); - VegetableList.InsertString(id, _Vegetables[id].VegetableName.c_str()); + VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.SetCurSel(id); } } @@ -349,14 +349,14 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const ok= true; - if( f.open((const char*)fd.GetPathName()) ) + if( f.open(tStrToUtf8(fd.GetPathName()))) { try { // read the vegetable f.serial(vegetSet); // bkup fileName. - _LastVegetSetName= (const char*)fd.GetFileName(); + _LastVegetSetName = tStrToUtf8(fd.GetFileName()); } catch(const NLMISC::EStream &) { @@ -439,7 +439,7 @@ void CVegetableDlg::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet) _Vegetables[id].initVegetable(veget); // update view - VegetableList.AddString(_Vegetables[id].VegetableName.c_str()); + VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); } } } @@ -529,7 +529,7 @@ void CVegetableDlg::OnButtonVegetableAdd() _Vegetables[id].initDefaultVegetable(); // update view - VegetableList.AddString(_Vegetables[id].VegetableName.c_str()); + VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -559,7 +559,7 @@ void CVegetableDlg::OnButtonVegetableInsert() _Vegetables[id].initDefaultVegetable(); // update view - VegetableList.InsertString(id, _Vegetables[id].VegetableName.c_str()); + VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -611,7 +611,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() { NLMISC::CIFile f; - if( f.open((const char*)fd.GetPathName()) ) + if( f.open(tStrToUtf8(fd.GetPathName())) ) { NL3D::CVegetable veget; try @@ -624,7 +624,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() _Vegetables[id].initVegetable(veget); // update view - VegetableList.AddString(_Vegetables[id].VegetableName.c_str()); + VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -651,13 +651,13 @@ void CVegetableDlg::OnButtonVegetableSaveDesc() std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc"; - CFileDialog fd(FALSE, "vegetdesc", fileName.c_str(), OFN_OVERWRITEPROMPT, "VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||", this) ; - fd.m_ofn.lpstrTitle= "Save Vegetable Descriptor"; + CFileDialog fd(FALSE, _T("vegetdesc"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this) ; + fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open((const char*)fd.GetPathName()) ) + if( f.open(tStrToUtf8(fd.GetPathName())) ) { try { @@ -722,13 +722,13 @@ void CVegetableDlg::OnButtonVegetableSaveSet() buildVegetableSet(vegetSet); // Then try to save it. - CFileDialog fd(FALSE, "vegetset", _LastVegetSetName.c_str(), OFN_OVERWRITEPROMPT, "VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||", this) ; - fd.m_ofn.lpstrTitle= "Save Vegetable Set"; + CFileDialog fd(FALSE, _T("vegetset"), utf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this) ; + fd.m_ofn.lpstrTitle = _T("Save Vegetable Set"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open((const char*)fd.GetPathName()) ) + if( f.open(tStrToUtf8(fd.GetPathName())) ) { try { diff --git a/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp b/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp index 8d791a0fe..b0508cca9 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp @@ -33,7 +33,7 @@ void CDirectEditableRangeFloat::init(uint32 x, uint32 y, CWnd *pParent) CRect rect; rect.SetRect(x, y+10, x+dx, y+25); - _StaticText.Create(_Title.c_str(), WS_CHILD | WS_VISIBLE, rect, pParent); + _StaticText.Create(utf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent); _StaticText.SetFont(pParent->GetFont()); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp index fb9bf1a1e..12bfe4050 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp @@ -154,7 +154,7 @@ BOOL CVegetableNoiseValueDlg::OnInitDialog() // Set the name. - NoiseValueName.SetWindowText(_TitleName.c_str()); + NoiseValueName.SetWindowText(utf8ToTStr(_TitleName)); // if previously setuped, setup now the noiseValue. @@ -264,7 +264,5 @@ void CVegetableNoiseValueDlg::applyScaleSlider(sint scrollValue) _RandValue->updateValueFromReader(); // update marker text - char str[256]; - sprintf(str, "%d%%", (sint)(factor*100)); - StaticScaleMarker.SetWindowText(str); + StaticScaleMarker.SetWindowText(utf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100)))); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp index 51b4cdc5e..d7be7bcb3 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp @@ -63,7 +63,7 @@ BOOL CVegetableSelectDlg::OnInitDialog() uint num= _VegetableDlg->getNumVegetables(); for(uint i=0; igetVegetableName(i).c_str()); + VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); } return TRUE; // return TRUE unless you set the focus to a control diff --git a/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp index 5c6657167..0b2084863 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp @@ -70,26 +70,22 @@ END_MESSAGE_MAP() void CVegetableWindDlg::updateView() { float a; - char str[256]; // update Power. a= _ObjViewer->getVegetableWindPower(); - sprintf(str, "%.2f", a); - StaticPower.SetWindowText(str); + StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER); SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER)); // update BendStart. a= _ObjViewer->getVegetableWindBendStart(); - sprintf(str, "%.2f", a); - StaticBendStart.SetWindowText(str); + StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART); SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART)); // update Frequency. a= _ObjViewer->getVegetableWindFrequency(); - sprintf(str, "%.2f", a); - StaticFrequency.SetWindowText(str); + StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY); SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY)); @@ -129,28 +125,24 @@ void CVegetableWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBa && nSBCode==SB_THUMBPOSITION || nSBCode==SB_THUMBTRACK) { float a; - char str[256]; if(sliderCtrl == &SliderPower) { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindPower(a); - sprintf(str, "%.2f", a); - StaticPower.SetWindowText(str); + StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); } else if(sliderCtrl == &SliderBendStart) { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindBendStart(a); - sprintf(str, "%.2f", a); - StaticBendStart.SetWindowText(str); + StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); } else if(sliderCtrl == &SliderFrequency) { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindFrequency(a); - sprintf(str, "%.2f", a); - StaticFrequency.SetWindowText(str); + StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); } } else diff --git a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp index 3b68ae0e5..bf6f461bf 100644 --- a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp +++ b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp @@ -165,9 +165,8 @@ BOOL CWaterPoolEditor::OnInitDialog() int CWaterPoolEditor::addPool(uint32 ID) { - char poolId[128]; - sprintf(poolId, "%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str()); - int index = m_PoolList.AddString(poolId); + std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str()); + int index = m_PoolList.AddString(utf8ToTStr(poolId)); nlassert(index != LB_ERR); m_PoolList.SetItemData(index, ID); return index; @@ -358,7 +357,7 @@ void CWaterPoolEditor::OnLoadPool() { NLMISC::CIXml iXml; NLMISC::CIFile iF; - if (iF.open((LPCTSTR) fileDlg.GetPathName())) + if (iF.open(tStrToUtf8(fileDlg.GetPathName()))) { if (iXml.init (iF)) { @@ -370,17 +369,17 @@ void CWaterPoolEditor::OnLoadPool() else { iF.close(); - MessageBox (("Unable to init xml stream from file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } else { - MessageBox (("Unable to open file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } catch (const NLMISC::Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -396,7 +395,7 @@ void CWaterPoolEditor::OnSavePool() { NLMISC::COXml oXml; NLMISC::COFile oF; - if (oF.open((LPCTSTR) fileDlg.GetPathName())) + if (oF.open(tStrToUtf8(fileDlg.GetPathName()))) { if (oXml.init (&oF)) { @@ -407,17 +406,17 @@ void CWaterPoolEditor::OnSavePool() else { oF.close(); - MessageBox (("Unable to init xml stream from file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } else { - MessageBox (("Unable to open file : " + std::string((LPCTSTR) fileDlg.GetPathName())).c_str(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } catch (const NLMISC::Exception& e) { - MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); + MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 3a4722063..71bc61d0e 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -325,14 +325,14 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Name of the node char sNodeMsg[256]; - nlwarning (sNodeMsg, "Save %s model...", pNode->GetName()); + nlwarning (sNodeMsg, "Save %s model...", tStrToUtf8(pNode->GetName()).c_str()); // It is a zone ? if (RPO::isZone (*pNode, time)) { // Save path char sSavePath[256]; - strcpy (sSavePath, pNode->GetName()); + strcpy (sSavePath, tStrToUtf8(pNode->GetName()).c_str()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -342,24 +342,22 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportZone (sSavePath, *pNode, time)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting the zone %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath); + MessageBox (hWnd, utf8ToTStr(sErrorMsg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); } } } else if (CExportNel::isVegetable (*pNode, time)) { // Save path - char sSavePath[256]; - strcpy (sSavePath, pNode->GetName()); + std::string sSavePath = tStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) - if (theCNelExport.SelectFileForSave(hWnd, sNodeMsg, vegetableFilter, sSavePath)) + if (theCNelExport.SelectFileForSave(hWnd, sNodeMsg, vegetableFilter, sSavePath.c_str())) { // Export the mesh - if (!theCNelExport.exportVegetable (sSavePath, *pNode, time)) + if (!theCNelExport.exportVegetable (sSavePath.c_str(), *pNode, time)) { // Error message char sErrorMsg[512]; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp index b26464f3a..4fbdde584 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp @@ -99,7 +99,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) { // Open a file COFile file; - if (file.open(tempFileName)) + if (file.open(tStrToUtf8(tempFileName))) { try { diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index 0eeebfa52..e7a82c878 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -2338,24 +2338,24 @@ INT_PTR CALLBACK MiscDialogCallback ( currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0); TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512); - currentParam->LigoRotate = tmp; + currentParam->LigoRotate = tStrToUtf8(tmp); // SWT currentParam->SWT = SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), tmp, 512); - currentParam->SWTWeight = tmp; + currentParam->SWTWeight = tStrToUtf8(tmp); // Radial normals for (uint smoothGroup=0; smoothGroupRadialNormals[smoothGroup]=tmp; + currentParam->RadialNormals[smoothGroup] = tStrToUtf8(tmp); } // mesh interfaces GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512); - currentParam->InterfaceFileName=tmp; + currentParam->InterfaceFileName = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); if (strlen(tmp) != 0) currentParam->InterfaceThreshold = toFloatMax(tmp); @@ -2365,7 +2365,7 @@ INT_PTR CALLBACK MiscDialogCallback ( // Skeleton Scale currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512); - currentParam->ExportBoneScaleNameExt = wideToUtf8(tmp); + currentParam->ExportBoneScaleNameExt = tStrToUtf8(tmp); // remanence currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0); @@ -2373,7 +2373,7 @@ INT_PTR CALLBACK MiscDialogCallback ( GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512); uint rsn; - if (sscanf(tmp, "%d", &rsn) == 1) + if (NLMISC::fromString(tStrToUtf8(tmp), rsn)) { currentParam->RemanenceSliceNumber = rsn; } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp index 6a0587a22..3461f0e46 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp @@ -367,7 +367,7 @@ void CNelExport::viewMesh (TimeValue time) INode* pNode=_Ip->GetSelNode (nNode); string sTmp = "Object Name: "; - sTmp += pNode->GetName(); + sTmp += tStrToUtf8(pNode->GetName()); ProgBar.setLine (0, sTmp); sTmp.clear(); for (uint32 i = 1; i < 10; ++i) @@ -412,7 +412,7 @@ void CNelExport::viewMesh (TimeValue time) if (pShape) { // Add the shape in the view - uint instance = view->addMesh (pShape, pNode->GetName(), iteSkelShape->second.SkeletonInstance); + uint instance = view->addMesh (pShape, tStrToUtf8(pNode->GetName()).c_str(), iteSkelShape->second.SkeletonInstance); // Add tracks CAnimation *anim=new CAnimation; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index ef84390a1..21d63b626 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -128,7 +128,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) if (maxLight->EvalLightState(tvTime, valid, &ls)!=REF_SUCCEED) return; - this->Name = node->GetName(); + this->Name = tStrToUtf8(node->GetName()); // Retrieve the correct light Group Name this->AnimatedLight = CExportNel::getAnimatedLight (node); @@ -295,7 +295,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) INode *exclNode = exclusionList[i]; if (exclNode) // Crashfix // FIXME: Why is this NULL? { - string tmp = exclNode->GetName(); + string tmp = tStrToUtf8(exclNode->GetName()); this->setExclusion.insert(tmp); } } @@ -1930,7 +1930,7 @@ void supprLightNoInteractOne( vector &vLights, CMesh::CMeshBuild* p { bool bInteract = false; - if( vLights[i].setExclusion.find( node.GetName() ) != vLights[i].setExclusion.end() ) + if( vLights[i].setExclusion.find(tStrToUtf8(node.GetName()) ) != vLights[i].setExclusion.end() ) { bInteract = false; } @@ -2005,7 +2005,7 @@ void CExportNel::deleteLM(INode& ZeNode) string sSaveName; sSaveName = _Options.sExportLighting; if( sSaveName[sSaveName.size()-1] != '\\' ) sSaveName += "\\"; - sSaveName += ZeNode.GetName(); + sSaveName += tStrToUtf8(ZeNode.GetName()); char tmp[32]; sprintf( tmp, "%d", i ); sSaveName += tmp; @@ -2276,7 +2276,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { string thetext; thetext = "Warning "; - thetext += ZeNode.GetName(); + thetext += tStrToUtf8(ZeNode.GetName()); thetext = "have all faces NOT mapped (UV2)"; if (gOptions.FeedBack != NULL) { @@ -2325,11 +2325,11 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { // Make an error message string sTmp = "Warning : "; - sTmp += ZeNode.GetName(); + sTmp += tStrToUtf8(ZeNode.GetName()); sTmp += " has mapping problem"; // Script trace - mprintf ((sTmp+"\n").c_str()); + mprintf (utf8ToTStr((sTmp+"\n"))); // Feedback is here ? if (gOptions.FeedBack != NULL) @@ -2525,12 +2525,12 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB // Get the name of the max project char projectName[512]; - _splitpath (_Ip->GetCurFileName(), NULL, NULL, projectName, NULL); + _wsplitpath (_Ip->GetCurFileName(), NULL, NULL, utf8ToTStr(projectName), NULL); // Add lightmap information in the lightmap log COFile outputLog; if (outputLightmapLog) - createLightmapLog (outputLog, gOptions.sExportLighting.c_str(), projectName, ZeNode.GetName()); + createLightmapLog (outputLog, gOptions.sExportLighting.c_str(), projectName, tStrToUtf8(ZeNode.GetName()).c_str()); // Update UV coords to Texture space PutFaceUV1InTextureCoord( LightMap.w, LightMap.h, AllFaces.begin(), AllFaces.size() ); @@ -2559,7 +2559,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { CTextureFile *pLightMap = new CTextureFile(); //string sSaveName = AllMeshBuilds[nNode].second->GetName(); - string sSaveName = ZeNode.GetName(); + string sSaveName = tStrToUtf8(ZeNode.GetName()); char tmp[32]; sSaveName += "_"; sprintf( tmp, "%d", nLightMapNb ); @@ -2632,9 +2632,8 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { if (gOptions.FeedBack != NULL) { - char message[512]; - sprintf (message, "Can't write the file %s : %s", sSaveName, e.what()); - mprintf (message); + std::string message = toString("Can't write the file %s : %s", sSaveName.c_str(), e.what()); + mprintf (utf8ToTStr(message)); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp index a0e6139b2..789c37b23 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp @@ -113,7 +113,7 @@ void CRTWorld::build (vector &AllLights, CVector &trans, bool bExcl pLAP->create( 64 ); // width of each grid in number of square for( j = 0; j < vMB.size(); ++j ) { - if (rLight.setExclusion.find (vINode[j]->GetName()) != rLight.setExclusion.end()) + if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) continue; for (k = 0; k < vMB[j]->Faces.size(); ++k) @@ -142,7 +142,7 @@ void CRTWorld::build (vector &AllLights, CVector &trans, bool bExcl pLAD->create (64, rLight.rDirRadius/64.0f, rLight.Direction); for( j = 0; j < vMB.size(); ++j ) { - if (rLight.setExclusion.find (vINode[j]->GetName()) != rLight.setExclusion.end()) + if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) continue; for (k = 0; k < vMB[j]->Faces.size(); ++k) diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp index 1416d287f..30389d809 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp @@ -605,7 +605,7 @@ void CExportNel::addMorphTracks (NL3D::CAnimation& animation, INode& node, const if (pNode == NULL) continue; std::string name = parentName; - name += pNode->GetName(); + name += tStrToUtf8(pNode->GetName()); name += "MorphFactor"; IParamBlock *pb = (IParamBlock*)(pMorphMod->SubAnim (i+1)); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp index d7db650cb..d9657cd68 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp @@ -73,7 +73,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector & { // get the mesh name uint meshId = rootMeshNames.size(); - rootMeshNames.push_back(nodes[node]->GetName()); + rootMeshNames.push_back(tStrToUtf8(nodes[node]->GetName())); bool collision = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION, 0) != 0; bool exterior = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION_EXTERIOR, 0) != 0; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp index afe64907b..d39d00cf7 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp @@ -1271,7 +1271,7 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC else // standard texture { srcTex = new CTextureFile; - std::string mapName = pBitmap->GetMapName(); + std::string mapName = tStrToUtf8(pBitmap->GetMapName()); static_cast(srcTex)->setFileName (ConvertTexFileName(mapName, _AbsolutePath)); } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp index 0a0d8c522..5f8fd2811 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp @@ -266,7 +266,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP std::string nodeName=getScriptAppData (&node, NEL3D_APPDATA_LOD_NAME+lod, ""); // Get the node - INode *lodNode=_Ip->GetINodeByName(nodeName.c_str()); + INode *lodNode=_Ip->GetINodeByName(utf8ToTStr(nodeName)); if (lodNode) { // Index of the lod in the build structure @@ -611,7 +611,7 @@ void CExportNel::buildBaseMeshInterface (NL3D::CMeshBase::CMeshBaseBuild& buildM continue; // get factor here ! buildMesh.DefaultBSFactors.push_back(0.0f); - std::string sTemp = pNode->GetName(); + std::string sTemp = tStrToUtf8(pNode->GetName()); buildMesh.BSNames.push_back (sTemp); } @@ -1063,9 +1063,8 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes // Error code ? if (error!=NoError) { - char msg[512]; - sprintf (msg, "%s skin: %s", getName (node).c_str(), ErrorMessage[error]); - MessageBox (NULL, msg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string msg = toString("%s skin: %s", getName (node).c_str(), ErrorMessage[error]); + MessageBoxW (NULL, utf8ToTStr(msg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); } else { @@ -1493,7 +1492,7 @@ void CExportNel::buildMeshMorph (CMesh::CMeshBuild& buildMesh, INode &node, Time continue; } - bs.Name = pNode->GetName(); + bs.Name = tStrToUtf8(pNode->GetName()); bool bIsDeltaPos = false; bs.deltaPos.resize (nNbVertVB, CVector::Null); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp index 899c28a28..0a2e95242 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp @@ -316,7 +316,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des { if (delimiter.intersect(nodeBBox)) { - nldebug((std::string("Adding ") + node.GetName() + std::string(" to mesh interface quad grid")).c_str()); + nldebug("Adding %s to mesh interface quad grid", tStrToUtf8(node.GetName()).c_str()); // add this node tris ObjectState os = node.EvalWorldState(time); Object *obj = os.obj; @@ -581,7 +581,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName (); renameMap.insert (map::value_type (newName, originalName)); - (*lib)[i]->SetName (newName.c_str ()); + (*lib)[i]->SetName (utf8ToTStr(newName)); } // Merge the interface project @@ -614,7 +614,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName (); renameMap.insert (map::value_type (newName, originalName)); - (*lib)[i]->SetName (newName.c_str ()); + (*lib)[i]->SetName (utf8ToTStr(newName)); } } @@ -627,7 +627,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorSetName (ite->second.c_str ()); + (*lib)[i]->SetName (utf8ToTStr(ite->second)); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index a745970eb..87bc96be6 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -265,7 +265,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName) ParamDef& paramDef=param->GetParamDef(id); // Good name? - if (strcmp (paramDef.int_name, sName)==0) + if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) { // ok, return this subanim #if MAX_VERSION_MAJOR >= 14 @@ -332,7 +332,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName ParamDef& paramDef=param->GetParamDef(id); // Good name? - if (strcmp (paramDef.int_name, sName)==0) + if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) { // Check this value is good type ParamType2 paramType = param->GetParameterType(id); @@ -372,7 +372,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName break; case TYPE_FILENAME: case TYPE_STRING: - *(std::string*)pValue = param->GetStr (id, tvTime); + *(std::string*)pValue = tStrToUtf8(param->GetStr (id, tvTime)); bRes = TRUE; break; case TYPE_FILENAME_TAB: @@ -382,7 +382,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName uint total = param->Count (id); rTab.resize(total); for( uint i = 0; i < total; ++i ) - rTab[i] = param->GetStr (id, tvTime, i); + rTab[i] = tStrToUtf8(param->GetStr (id, tvTime, i)); bRes = TRUE; } break; @@ -511,8 +511,8 @@ std::string CExportNel::getName (MtlBase& mtl) std::string CExportNel::getName(INode& node) { // Return its name - MCHAR* name = node.GetName(); - return std::string(name); + const MCHAR* name = node.GetName(); + return tStrToUtf8(name); } // -------------------------------------------------- @@ -549,7 +549,7 @@ std::string CExportNel::getNelObjectName (INode& node) } else { - return node.GetName(); + return tStrToUtf8(node.GetName()); } } else @@ -571,19 +571,19 @@ std::string CExportNel::getNelObjectName (INode& node) } else { - return node.GetName(); + return tStrToUtf8(node.GetName()); } } else { // Extract the node name - return node.GetName(); + return tStrToUtf8(node.GetName()); } } else { // Extract the node name - return node.GetName(); + return tStrToUtf8(node.GetName()); } } } @@ -763,17 +763,17 @@ bool CExportNel::hasLightMap (INode& node, TimeValue time) // -------------------------------------------------- -void CExportNel::outputErrorMessage (const char *message) +void CExportNel::outputErrorMessage(const std::string &message) { if (_ErrorInDialog) { - MessageBox (_Ip->GetMAXHWnd(), message, _ErrorTitle.c_str(), MB_OK|MB_ICONEXCLAMATION); + MessageBoxW (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); } - mprintf (message); - mprintf ("\n"); + mprintf (utf8ToTStr(message)); + mprintf (_T("\n")); nlwarning ("Error in max file %s : ", _Ip->GetCurFilePath()); - nlwarning (message); + nlwarning (message.c_str()); } // -------------------------------------------------- diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h index 7421fad49..d9d8b6189 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h @@ -667,8 +667,8 @@ public: static void setScriptAppData (Animatable *node, uint32 id, NLMISC::CRGBA val); // Output error message - void outputErrorMessage (const char *message); - void outputWarningMessage (const char *message); + void outputErrorMessage (const std::string &message); + void outputWarningMessage(const std::string &message); // Get an appData VertexProgram WindTree (ensure same default values for all retrieve). diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp index b84eb738e..4b17b17d3 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp @@ -51,7 +51,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time) iF.serial(ss); if (!dynamic_cast(ss.getShapePointer())) { - mprintf("Error : Object shape %s isn't a particle system", shapeName.c_str()); + mprintf(_T("Error : Object shape %s isn't a particle system"), utf8ToTStr(shapeName)); return NULL; } @@ -78,7 +78,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time) } else { - mprintf("Error : Can't find %s while exporting a particle system \n", shapeName.c_str()); + mprintf(_T("Error : Can't find %s while exporting a particle system \n"), utf8ToTStr(shapeName)); return NULL; } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp index 541c0c152..d623b7269 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp @@ -62,7 +62,7 @@ void CRadialVertices::init (INode *node, Mesh *mesh, TimeValue time, Interface & _SmoothingGroupMask |= (1<& vectNode, v resultInstanceNode[nNumIG] = pNode; if (aIGArray[nNumIG].InstanceName == "") // no instance name was set, takes the node name instead { - aIGArray[nNumIG].InstanceName = pNode->GetName(); + aIGArray[nNumIG].InstanceName = tStrToUtf8(pNode->GetName()); } // Visible? always true, but if special flag for camera collision @@ -236,10 +236,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v pMB->Vertices[pMB->Faces[j].Corner[2].Vertex]) ) { // ERROR : The volume is not convex !!! - char tam[256]; - sprintf(tam,"ERROR: The cluster %s is not convex.",vectNode[i]->GetName()); - //MessageBox(NULL,tam,"Error",MB_OK|MB_ICONERROR); - nlwarning(tam); + nlwarning("ERROR: The cluster %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); } } @@ -247,7 +244,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v clusterTemp.VisibleFromFather = bVisibleFromFather; clusterTemp.FatherAudible = bFatherAudible; clusterTemp.AudibleFromFather = bAudibleFromFather; - clusterTemp.Name = pNode->GetName(); + clusterTemp.Name = tStrToUtf8(pNode->GetName()); vClusters.push_back (clusterTemp); delete pMB; pMB = NULL; @@ -336,10 +333,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (!portalTemp.setPoly (polyv)) { // ERROR : Poly not convex, or set of vertices not plane - char tam[256]; - sprintf(tam,"ERROR: The portal %s is not convex.",vectNode[i]->GetName()); - //MessageBox(NULL,tam,"Error",MB_OK|MB_ICONERROR); - nlwarning(tam); + nlwarning("ERROR: The portal %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); } if (nAccelType&16) // is dynamic portal ? @@ -348,7 +342,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (!InstanceName.empty()) portalTemp.setName (InstanceName); else - portalTemp.setName (string(pNode->GetName())); + portalTemp.setName (tStrToUtf8(pNode->GetName())); } // Check if portal has 2 cluster @@ -368,10 +362,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (nNbCluster != 2) { // ERROR - char tam[256]; - sprintf(tam,"ERROR: The portal %s has not 2 clusters but %d",vectNode[i]->GetName(), nNbCluster); - //MessageBox(NULL,tam,"Error",MB_OK|MB_ICONERROR); - nlwarning(tam); + nlwarning("ERROR: The portal %s has not 2 clusters but %d", tStrToUtf8(vectNode[i]->GetName()).c_str(), nNbCluster); } @@ -513,10 +504,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (vClusters.size() > 0) if (aIGArray[nNumIG].Clusters.size() == 0) { - char tam[256]; - sprintf(tam,"ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", pNode->GetName()); - //MessageBox(NULL, tam, "Warning", MB_OK); - nlwarning(tam); + nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", tStrToUtf8(pNode->GetName()).c_str()); } // debug purpose : to remove @@ -712,7 +700,7 @@ void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, I if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) ) { string sTmp = "Object Name: "; - sTmp += pNode->GetName(); + sTmp += tStrToUtf8(pNode->GetName()); if (progress) progress->setLine (0, sTmp); sTmp.clear(); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp index 3d99cee91..1e6304d18 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp @@ -36,7 +36,7 @@ bool CExportNel::scriptEvaluate (const char *script, void *out, TNelScriptValueT four_typed_value_locals(Parser* parser,Value* code,Value* result,StringStream* source); vl.parser = new Parser; - vl.source = new StringStream (const_cast(script)); + vl.source = new StringStream (utf8ToTStr(script)); vl.source->log_to(NULL); save_current_frames(); try diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp index 3708a0906..ec1bb1f92 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp @@ -114,7 +114,7 @@ INode *CExportNel::getNELScaleReferenceNode(INode &node) { std::string boneScaleName= getName(node) + boneScaleNameExt; // Get the reference node - referenceNode= _Ip->GetINodeByName(boneScaleName.c_str()); + referenceNode= _Ip->GetINodeByName(utf8ToTStr(boneScaleName)); } } @@ -455,7 +455,7 @@ uint CExportNel::buildSkinning (CMesh::CMeshBuild& buildMesh, const TInodePtrInt nlassert ((uint)ite->secondsecond] = ite->first->GetName(); + buildMesh.BonesNames[ite->second] = tStrToUtf8(ite->first->GetName()); // Next ite++; @@ -1306,7 +1306,7 @@ static sint getBoneSide(INode *bone, std::string &mirrorName) { sint side= 0; sint pos; - mirrorName= bone->GetName(); + mirrorName = tStrToUtf8(bone->GetName()); if((pos= mirrorName.find(" R "))!=std::string::npos) { @@ -1335,7 +1335,7 @@ static INode *getMirrorBone(const std::vector &skeletonNodes, INode *bon // find for(uint i=0;iGetName()) + if(mirrorName == tStrToUtf8(skeletonNodes[i]->GetName())) return skeletonNodes[i]; } } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h index e9f3b6b3f..d6c4bb522 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h @@ -450,7 +450,7 @@ public: } catch (const NLMISC::EStream& excp) { - MessageBox (NULL, excp.what(), "Load error", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(excp.what()), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } } return _bank; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp index 55e8a8c55..ea21e8fbe 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp @@ -193,7 +193,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo } catch (const EStream& e) { - MessageBox (NULL, stream.what(), _T("Error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(e.what()), _T("Error"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -253,25 +253,22 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo if (!patchError.empty()) { // Make an error message - char error[2098]; - smprintf (error, 2098, "Error: triple edge detected in "); + std::string error = "Error: triple edge detected in "; // For each error set::iterator ite=patchError.begin(); while (ite!=patchError.end()) { // Sub error message - char subError[512]; - smprintf (subError, 512, "patch %d ", (*ite)+1); - strcat (error, subError); + error += toString("patch %d ", (*ite)+1); // Next error ite++; } // Show the message - mprintf (error); - nlwarning (error); + mprintf (utf8ToTStr(error)); + nlwarning (error.c_str()); // Error return false; @@ -612,7 +609,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo uint i; for (i=0; iSetAlphaSource (ALPHA_NONE); tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsRGB (FALSE); - tex->SetMapName (const_cast((Bank.getAbsPath()+tile->getRelativeFileName(CTile::diffuse)).c_str())); + tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::diffuse))); // Assign BitmapTex rgb->SetSubTexmap (0, tex); @@ -481,7 +479,7 @@ bool Tile_utility::SetupMaterial () const tex->SetAlphaSource (ALPHA_NONE); tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsRGB (FALSE); - tex->SetMapName (const_cast((Bank.getAbsPath()+tile->getRelativeFileName(CTile::additive)).c_str())); + tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::additive))); // Assign BitmapTex rgb->SetSubTexmap (1, tex); diff --git a/code/nel/tools/3d/tile_edit/View.cpp b/code/nel/tools/3d/tile_edit/View.cpp index d0eecb229..0cfe0719a 100644 --- a/code/nel/tools/3d/tile_edit/View.cpp +++ b/code/nel/tools/3d/tile_edit/View.cpp @@ -417,9 +417,8 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile: else { // Error: bitmap not in the absolute path.. - char msg[512]; - sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); - MessageBox (NULL, msg, "Load error", MB_OK|MB_ICONEXCLAMATION); + std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); + MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } return 1; diff --git a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp index a8aa6878c..e1ccf4f4f 100644 --- a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp +++ b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp @@ -68,8 +68,8 @@ void CChooseVegetSet::OnBrowse() if (dialog.DoModal() == IDOK) { // Get the file name - FileName = dialog.GetFileName (); - Name.SetWindowText (FileName.c_str()); + FileName = tStrToUtf8(dialog.GetFileName ()); + Name.SetWindowText (utf8ToTStr(FileName)); } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp index 301a9d893..2e1cafce8 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp @@ -193,7 +193,7 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn) for (parent=0; parentmodify (new CActionStringVectorVector (IAction::DfnStructure, stringVector, *doc, doc->getLeftView ()->getCurrentSelectionId (), 0)); @@ -301,19 +301,19 @@ CEditListCtrl::TItemEdit CDfnEditListCtrl::getItemEditMode (uint item, uint subI return CEditListCtrl::EditFixedCombo; else if (subItem == 2) { - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if (type != "Virtual Dfn") return CEditListCtrl::EditMemCombo; } else if (subItem == 3) { - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) return CEditListCtrl::EditMemCombo; } else if (subItem == 4) { - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) return CEditListCtrl::EditMemCombo; } @@ -349,7 +349,7 @@ void CDfnEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string browse = true; // Get type string - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Type MemCombo"; else if ((type == "Dfn") || (type == "Dfn array")) @@ -390,7 +390,7 @@ void CDfnEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defE if (subItem == 2) { // Get type string - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) { filter = TypeFilter; @@ -415,7 +415,7 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem) if (subItem == 1) { // Get type string - string type = ListCtrl.GetItemText (item, 1); + string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) { CString str; @@ -470,16 +470,16 @@ void CDfnDialog::onOpenSelected () int nItem = Parents.ListCtrl.GetNextSelectedItem(pos); // Get the string - CString str = Parents.ListCtrl.GetItemText (nItem, 0); - if (str != "") + std::string str = tStrToUtf8(Parents.ListCtrl.GetItemText (nItem, 0)); + if (!str.empty()) { // Look for the file - string name = CPath::lookup ((const char*)str, false, false); + string name = CPath::lookup (str, false, false); if (name.empty ()) name = str; // Open the file - theApp.OpenDocumentFile (name.c_str ()); + theApp.OpenDocumentFile (utf8ToTStr(name)); } } } @@ -492,16 +492,16 @@ void CDfnDialog::onOpenSelected () int nItem = Struct.ListCtrl.GetNextSelectedItem(pos); // Get the string - CString str = Struct.ListCtrl.GetItemText (nItem, 2); - if (str != "") + std::string str = tStrToUtf8(Struct.ListCtrl.GetItemText (nItem, 2)); + if (!str.empty()) { // Look for the file - string name = CPath::lookup ((const char*)str, false, false); + string name = CPath::lookup (str, false, false); if (name.empty ()) name = str; // Open the file - theApp.OpenDocumentFile (name.c_str ()); + theApp.OpenDocumentFile (utf8ToTStr(name)); } } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp index 549c953e4..e42408f3d 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp @@ -477,9 +477,9 @@ void CGeorgesEditApp::OnAppAbout() void CGeorgesEditApp::outputError (const char* message) { if (m_pMainWnd) - m_pMainWnd->MessageBox (message, "Georges Edit", MB_OK|MB_ICONEXCLAMATION); + m_pMainWnd->MessageBox (utf8ToTStr(message), _T("Georges Edit"), MB_OK|MB_ICONEXCLAMATION); else - MessageBox (NULL, message, "Georges Edit", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(message), _T("Georges Edit"), MB_OK|MB_ICONEXCLAMATION); } void CGeorgesEditApp::getConfigFilePath (std::string &output) diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp index 1d7396ee0..d43277d6c 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp @@ -698,8 +698,8 @@ void CMissionCompilerFeDlg::OnSpecialRuncompilertest() catch(const EParseException &e) { string msg = "In primitive "; - msg += buildPrimPath(e.Primitive) +" : "+e.Why; - AfxMessageBox(msg.c_str()); + msg += buildPrimPath(e.Primitive) + ": " + e.Why; + AfxMessageBox(utf8ToTStr(msg)); } } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp index 30b15cf8d..63b1d545f 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp @@ -130,7 +130,7 @@ bool CDataBase::init (const string &Path, CZoneBank &zb) string sDirBackup = NLMISC::CPath::getCurrentPath(); // "Path" can be relative to the doc path so we have to be first in the doc path - string s2 = NLMISC::CFile::getPath ((LPCTSTR)getMainFrame()->getDocument()->GetPathName()); + string s2 = NLMISC::CFile::getPath (tStrToUtf8(getMainFrame()->getDocument()->GetPathName())); NLMISC::CPath::setCurrentPath(s2.c_str()); string ss = NLMISC::CPath::getFullPath(Path); NLMISC::CPath::setCurrentPath (ss.c_str()); @@ -622,8 +622,8 @@ bool CBuilderZone::refresh () if (!_ZoneRegions[_ZoneRegionSelected]->init (&_ZoneBank, this, error)) { unload (_ZoneRegionSelected); - MessageBox (NULL, ("Cannot add this zone :\n"+error).c_str(), - "Error", MB_ICONERROR|MB_OK); + std::string msg = NLMISC::toString("Cannot add this zone :\n%s", error.c_str()); + MessageBox (NULL, utf8ToTStr(msg), _T("Error"), MB_ICONERROR|MB_OK); return false; } @@ -1601,7 +1601,7 @@ bool CBuilderZone::initZoneBank (const string &sPathName) // TODO: replace by NeL methods TCHAR sDirBackup[512]; GetCurrentDirectory (512, sDirBackup); - SetCurrentDirectory (sPathName.c_str()); + SetCurrentDirectory (utf8ToTStr(sPathName)); WIN32_FIND_DATA findData; HANDLE hFind; hFind = FindFirstFile (_T("*.ligozone"), &findData); @@ -1612,7 +1612,7 @@ bool CBuilderZone::initZoneBank (const string &sPathName) if (!((_tcscmp (findData.cFileName, _T(".")) == 0) || (_tcscmp (findData.cFileName, _T("..")) == 0))) { string error; - if (!_ZoneBank.addElement (findData.cFileName, error)) + if (!_ZoneBank.addElement (tStrToUtf8(findData.cFileName), error)) theApp.errorMessage (error.c_str()); } if (FindNextFile (hFind, &findData) == 0) diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp index 9ee63294a..706c4053e 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp @@ -37,9 +37,9 @@ CFileDialogEx::CFileDialogEx(LPCTSTR lpszRegistryPath, LPCTSTR lpszFileType,BOOL LPCTSTR lpszDefExt, LPCTSTR lpszFileName, DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd) { - _RegistryPath = lpszRegistryPath; + _RegistryPath = tStrToUtf8(lpszRegistryPath); _RegistryPath += "\\CFileDialogEx"; - _FileType = lpszFileType; + _FileType = tStrToUtf8(lpszFileType); } // *************************************************************************** @@ -58,10 +58,10 @@ INT_PTR CFileDialogEx::DoModal () path[0] = 0; HKEY hKey; DWORD type = REG_SZ; - DWORD size = 512; - if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS) + DWORD size = 512 * sizeof(TCHAR); + if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(_RegistryPath), &hKey) == ERROR_SUCCESS) { - if (RegQueryValueEx (hKey, _FileType.c_str (), 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) + if (RegQueryValueEx (hKey, utf8ToTStr(_FileType), 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) m_ofn.lpstrInitialDir = path; } @@ -73,9 +73,9 @@ INT_PTR CFileDialogEx::DoModal () if ((result = CFileDialog::DoModal ()) == IDOK) { // Update the path - std::string newPath = (const char *)GetPathName (); + std::string newPath = tStrToUtf8(GetPathName ()); newPath = NLMISC::CFile::getPath (newPath); - RegSetValueEx (hKey, _FileType.c_str (), 0, REG_SZ, (LPBYTE)newPath.c_str (), newPath.size ()+1); + RegSetValueEx (hKey, utf8ToTStr(_FileType), 0, REG_SZ, (LPBYTE)newPath.c_str (), newPath.size ()+1); // Update the path list set oldPath; @@ -83,15 +83,15 @@ INT_PTR CFileDialogEx::DoModal () for (i=0; i::const_iterator ite = oldPath.begin (); uint index = 0; while (ite != oldPath.end ()) { - RegSetValueEx (hKey, toString (index).c_str (), 0, REG_SZ, (LPBYTE)ite->c_str (), ite->size ()+1); + RegSetValueEx (hKey, utf8ToTStr(toString(index)), 0, REG_SZ, (LPBYTE)ite->c_str (), ite->size ()+1); ite++; index++; } @@ -153,13 +153,13 @@ BOOL CFileDialogEx::OnInitDialog() HKEY hKey; DWORD type = REG_SZ; DWORD size; - if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS) + if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(_RegistryPath), &hKey) == ERROR_SUCCESS) { uint i; for (i=0; isetCurrentSelection(resSet); - - }catch(const exception &e){ - GraphDlg->MessageBox(e.what()); + } + catch(const exception &e) + { + GraphDlg->MessageBox(utf8ToTStr(e.what())); } } } \ No newline at end of file diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp index 223860403..54184c45a 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp @@ -301,7 +301,7 @@ void CDialogFlags::setCurrentEntityDisplayMode(TEntityDisplayMode edm) void CDialogFlags::loadEntityDisplayInfoToRegistry(TEntityDisplayInfoVect &infos, const std::string ®Id) { HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, (REGKEY_ENTITY_DISPLAY_INFO + regId).c_str(), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_CURRENT_USER, utf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { DWORD index = 0; for(;;) @@ -338,14 +338,14 @@ void CDialogFlags::loadEntityDisplayInfoToRegistry(TEntityDisplayInfoVect &infos void CDialogFlags::saveEntityDisplayInfoToRegistry(const TEntityDisplayInfoVect &infos, const std::string ®Id) { HKEY hKey; - if (RegCreateKeyEx(HKEY_CURRENT_USER, (REGKEY_ENTITY_DISPLAY_INFO + regId).c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) + if (RegCreateKeyEx(HKEY_CURRENT_USER, utf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { for(uint k = 0; k < infos.size(); ++k) { char colorStr[128]; CRGBA color = infos[k].Color; sprintf(colorStr, "%d, %d, %d, visible = %d", (int) color.R, (int) color.G, (int) color.B, (int) (infos[k].Visible ? 1 : 0)); - LONG result = RegSetValueEx(hKey, toString((int) infos[k].Value).c_str(), 0, REG_SZ, (const BYTE *) colorStr, strlen(colorStr)); + LONG result = RegSetValueEx(hKey, utf8ToTStr(toString(infos[k].Value)), 0, REG_SZ, (const BYTE *) colorStr, strlen(colorStr)); if (result != ERROR_SUCCESS) { nlwarning("Couldn't write registry key for entity % color", infos[k].Name); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp index 5788c2d72..531b58e89 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp @@ -47,7 +47,7 @@ void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT { // Register a window Id = nId; - RegisterAdress = registerAdress; + RegisterAdress = tStrToUtf8(registerAdress); MemoryCount = memoryCount; LPCTSTR clas = AfxRegisterWndClass (0); if (clas) @@ -95,16 +95,16 @@ bool CMemoryComboBox::getMemory (int slot, std::string &ret) { // Open the key HKEY hKey; - if (RegOpenKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) + if (RegOpenKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Get the value char strSrc[512]; smprintf (strSrc, 512, "%d", slot); - char str[512]; - long size = 512; - if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS) + TCHAR str[512]; + long size = 512*sizeof(TCHAR); + if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { - ret = str; + ret = tStrToUtf8(str); // Close RegCloseKey (hKey); @@ -124,7 +124,7 @@ void CMemoryComboBox::scrollDown (int start, int end) { // Open the key HKEY hKey; - if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) + if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Scroll down the list for (int i=end-1; i>start; i--) @@ -132,14 +132,14 @@ void CMemoryComboBox::scrollDown (int start, int end) // Get the old value char strSrc[512]; smprintf (strSrc, 512, "%d", i-1); - char str[512]; - long size = 512; - if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS) + TCHAR str[512]; + long size = 512 * sizeof(TCHAR); + if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { // Set the value char strDst[512]; smprintf (strDst, 512, "%d", i); - RegSetValue (hKey, strDst, REG_SZ, str, size); + RegSetValue (hKey, utf8ToTStr(strDst), REG_SZ, str, size); } } @@ -154,10 +154,10 @@ void CMemoryComboBox::writeStringInRegistry (const std::string &str) { // Open the key HKEY hKey; - if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) + if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Set the value - RegSetValue (hKey, "0", REG_SZ, str.c_str (), str.size ()); + RegSetValue (hKey, _T("0"), REG_SZ, utf8ToTStr(str), str.size ()); // Close RegCloseKey (hKey); @@ -364,7 +364,7 @@ void CMemoryComboBox::pushString () { CString str; GetWindowText (str); - pushString((LPCTSTR) str); + pushString(tStrToUtf8(str)); } @@ -428,7 +428,7 @@ void CMemoryComboBox::pushString (const std::string &str) if (i == (int)(itemCount+Commands.size()+ StaticStrings.size())) { // Insert the sting - _ComboBox.InsertString (Commands.size()+ StaticStrings.size(), str.c_str()); + _ComboBox.InsertString (Commands.size()+ StaticStrings.size(), utf8ToTStr(str)); } } } @@ -449,7 +449,7 @@ void CMemoryComboBox::refreshStrings () int count = Commands.size(); for (i=0; iUpdateData (TRUE); - _SHost = (const char*)_DialogFlag->ShardCtrl.getCurrString(); + _SHost = tStrToUtf8(_DialogFlag->ShardCtrl.getCurrString()); _DialogFlag->ShardCtrl.onOK(); @@ -1189,7 +1189,7 @@ void CPlugin::updateConnectionState() // Change the text _DialogFlag->ConnectCtrl.SetWindowText (getStringRsc(IDS_DISCONNECT)); _DialogFlag->State = (LPCTSTR) (getStringRsc(IDS_CONNECTED_TO) + _SHost.c_str()); - _DialogFlag->Sent = (toString ((uint32)_Client->getBytesSent ()) + (LPCTSTR) getStringRsc(IDS_BYTE_SENT)).c_str(); + _DialogFlag->Sent = CString(utf8ToTStr(toString (_Client->getBytesSent ()))) + getStringRsc(IDS_BYTE_SENT); //_DialogFlag->Received = (toString ((uint32)_Client->getBytesReceived ()) + " bytes received").c_str(); _DialogFlag->Received = (toString("%.1f", bandwidth/1024.0) + " kB/s").c_str(); _DialogFlag->DownloadValue = (toString("%.1f kB/s", _DialogFlag->Download/1024.0)).c_str(); @@ -1198,12 +1198,12 @@ void CPlugin::updateConnectionState() break; case WaitingServerParams: _DialogFlag->ConnectCtrl.SetWindowText (getStringRsc(IDS_CANCEL_CONNECT)); - _DialogFlag->State = (LPCTSTR) (getStringRsc(IDS_WAITING_SERVER_PARAMS) + _SHost.c_str()); + _DialogFlag->State = getStringRsc(IDS_WAITING_SERVER_PARAMS) + utf8ToTStr(_SHost); break; case WaitingLoginConfirmation: { _DialogFlag->ConnectCtrl.SetWindowText (getStringRsc(IDS_CANCEL_CONNECT)); - std::string label = (LPCTSTR) getStringRsc(IDS_WAITING_LOGIN_CONFIRMATION) +_SHost; + std::string label = tStrToUtf8(getStringRsc(IDS_WAITING_LOGIN_CONFIRMATION)) + _SHost; switch((NLMISC::CTime::getLocalTime() / 200) % 4) { case 0: label+= "-"; break; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp index 0d1e0cbe7..a83578c9f 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp @@ -225,19 +225,20 @@ void CDialogFlags::OnTimer(UINT_PTR nIDEvent) c = _SbList.GetItemCount(); for (i=0; i