develop
kaetemi 4 years ago
parent 5a470a7b16
commit ecabc00ec5

@ -168,7 +168,7 @@ extern NLMISC::CCmdArgs Args;
// Tips of the day count // Tips of the day count
#define RZ_NUM_TIPS 17 #define RZ_NUM_TIPS 17
ucstring TipsOfTheDay; std::string TipsOfTheDay;
uint TipsOfTheDayIndex; uint TipsOfTheDayIndex;
// includes for following register classes // includes for following register classes
@ -272,19 +272,19 @@ static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARA
{ {
if (CI18N::hasTranslation("TheSagaOfRyzom")) if (CI18N::hasTranslation("TheSagaOfRyzom"))
{ {
if (!SetWindowTextW(hwndDlg, (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str ())) if (!SetWindowTextW(hwndDlg, nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str())))
{ {
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str()); nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
} }
} }
SetDlgItemTextW(hwndDlg, IDC_ERROR_MSG_TEXT, (WCHAR*) CurrentErrorMessage.c_str ()); SetDlgItemTextW(hwndDlg, IDC_ERROR_MSG_TEXT, (WCHAR*)CurrentErrorMessage.c_str());
if (CI18N::hasTranslation("uiRyzomErrorMsgBoxExit")) if (CI18N::hasTranslation("uiRyzomErrorMsgBoxExit"))
{ {
SetDlgItemTextW(hwndDlg, IDOK, (WCHAR*)CI18N::get ("uiRyzomErrorMsgBoxExit").c_str ()); SetDlgItemTextW(hwndDlg, IDOK, nlUtf8ToWide(CI18N::get("uiRyzomErrorMsgBoxExit").c_str()));
} }
if (CI18N::hasTranslation("uiRyzomErrorMsgBoxHelp")) if (CI18N::hasTranslation("uiRyzomErrorMsgBoxHelp"))
{ {
SetDlgItemTextW(hwndDlg, IDC_RYZOM_ERROR_HELP, (WCHAR*)CI18N::get ("uiRyzomErrorMsgBoxHelp").c_str ()); SetDlgItemTextW(hwndDlg, IDC_RYZOM_ERROR_HELP, nlUtf8ToWide(CI18N::get("uiRyzomErrorMsgBoxHelp").c_str()));
} }
RECT rect; RECT rect;
RECT rectDesktop; RECT rectDesktop;
@ -343,7 +343,7 @@ void ExitClientError (const char *format, ...)
/* /*
ucstring ucstr; ucstring ucstr;
ucstr.fromUtf8 (str); ucstr.fromUtf8 (str);
MessageBoxW (NULL, (WCHAR*)ucstr.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_OK|MB_ICONERROR); MessageBoxW (NULL, (WCHAR *)ucstr.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONERROR);
*/ */
#else #else
fprintf (stderr, "%s\n", str); fprintf (stderr, "%s\n", str);
@ -360,7 +360,7 @@ void ExitClientError (const char *format, ...)
void ClientInfo (const ucstring &message) void ClientInfo (const ucstring &message)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
MessageBoxW (NULL, (WCHAR*)message.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_OK|MB_ICONINFORMATION); MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_OK|MB_ICONINFORMATION);
#endif #endif
} }
@ -368,7 +368,7 @@ void ClientInfo (const ucstring &message)
bool ClientQuestion (const ucstring &message) bool ClientQuestion (const ucstring &message)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
return MessageBoxW (NULL, (WCHAR*)message.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_YESNO|MB_ICONQUESTION) != IDNO; return MessageBoxW(NULL, (WCHAR *)message.c_str(), nlUtf8ToWide(CI18N::get("TheSagaOfRyzom").c_str()), MB_YESNO|MB_ICONQUESTION) != IDNO;
#else #else
return false; return false;
#endif #endif

@ -200,9 +200,9 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
// Names // Names
const char *templateName; const char *templateName;
ucstring theTribeName; const char *theTribeName = "";
ucstring entityName = entity->getDisplayName(); std::string entityName = entity->getDisplayName();
ucstring entityTitle = entity->getTitle(); std::string entityTitle = entity->getTitle().toUtf8();
// For some NPC's the name is empty and only a title is given, // For some NPC's the name is empty and only a title is given,
// in that case, treat the title as the name. // in that case, treat the title as the name.
@ -780,19 +780,19 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
// Set player name // Set player name
if (info->_Name) if (info->_Name)
{ {
info->_Name->setText(entityName.toUtf8()); info->_Name->setText(entityName);
info->_Name->setModulateGlobalColor(false); info->_Name->setModulateGlobalColor(false);
} }
// Set player title // Set player title
if (info->_Title) if (info->_Title)
info->_Title->setText(entityTitle.toUtf8()); info->_Title->setText(entityTitle);
// Set tribe name // Set tribe name
if (info->_TribeName) if (info->_TribeName)
{ {
nlassert(info->_GuildName == NULL); nlassert(info->_GuildName == NULL);
info->_TribeName->setText(theTribeName.toUtf8()); info->_TribeName->setText(theTribeName);
} }
// Init user leaf nodes // Init user leaf nodes

@ -2530,19 +2530,19 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
NLMISC::CVector2f mapPos; NLMISC::CVector2f mapPos;
worldToMap(mapPos, rCLM.Pos); worldToMap(mapPos, rCLM.Pos);
const ucstring ucsTmp(CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID)); const char *ucsTmp = CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID);
const ucstring lcTitle = toLower(ucsTmp); const std::string lcTitle = toLower(ucsTmp);
bool searchMatch = notWorldMode && _LandmarkFilter.size() > 0 && filterLandmark(lcTitle); bool searchMatch = notWorldMode && _LandmarkFilter.size() > 0 && filterLandmark(lcTitle);
if (searchMatch) if (searchMatch)
_MatchedLandmarks.push_back(SMatchedLandmark(rCLM.Pos, ucsTmp, _ContinentLMOptions)); _MatchedLandmarks.push_back(SMatchedLandmark(rCLM.Pos, ucstring::makeFromUtf8(ucsTmp), _ContinentLMOptions));
// Add button if not a region nor a place // Add button if not a region nor a place
if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) && if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) &&
(rCLM.Type != CContLandMark::Street)) (rCLM.Type != CContLandMark::Street))
{ {
if (rCLM.Type != CContLandMark::Stable) if (rCLM.Type != CContLandMark::Stable)
addLandMark(_ContinentLM, mapPos, ucsTmp, _ContinentLMOptions); addLandMark(_ContinentLM, mapPos, ucstring::makeFromUtf8(ucsTmp), _ContinentLMOptions);
else else
addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions); addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions);
_ContinentLM.back()->Type = rCLM.Type; _ContinentLM.back()->Type = rCLM.Type;
@ -2551,7 +2551,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
else // just add a text else // just add a text
{ {
CLandMarkText *pNewText = new CLandMarkText(CViewBase::TCtorParam()); CLandMarkText *pNewText = new CLandMarkText(CViewBase::TCtorParam());
pNewText->setText(ucsTmp.toUtf8()); pNewText->setText(ucsTmp);
pNewText->Pos = mapPos; pNewText->Pos = mapPos;
pNewText->setParent(this); pNewText->setParent(this);
pNewText->setParentPosRef(Hotspot_BL); pNewText->setParentPosRef(Hotspot_BL);

@ -50,7 +50,7 @@ extern NL3D::UMaterial LoadingMaterialFull;
extern std::vector<UTextureFile*> LogoBitmaps; extern std::vector<UTextureFile*> LogoBitmaps;
extern uint TipsOfTheDayIndex; extern uint TipsOfTheDayIndex;
extern ucstring TipsOfTheDay; extern string TipsOfTheDay;
extern bool UseEscapeDuringLoading; extern bool UseEscapeDuringLoading;
CProgress::CProgress () CProgress::CProgress ()
@ -287,8 +287,8 @@ void CProgress::internalProgress (float value)
// Display the tips of the day. // Display the tips of the day.
TextContext->setFontSize((uint)(16.f * fontFactor)); TextContext->setFontSize((uint)(16.f * fontFactor));
TextContext->setHotSpot(UTextContext::MiddleTop); TextContext->setHotSpot(UTextContext::MiddleTop);
ucstring::size_type index = 0; string::size_type index = 0;
ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n'); string::size_type end = TipsOfTheDay.find('\n');
if (end == string::npos) if (end == string::npos)
end = TipsOfTheDay.size(); end = TipsOfTheDay.size();
float fY = ClientCfg.TipsY; float fY = ClientCfg.TipsY;
@ -297,15 +297,15 @@ void CProgress::internalProgress (float value)
while (index < end) while (index < end)
{ {
// Get the line // Get the line
ucstring line = TipsOfTheDay.substr (index, end-index); string line = TipsOfTheDay.substr (index, end-index);
// Draw the line // Draw the line
TextContext->printAt(0.5f, fY, line); TextContext->printAt(0.5f, fY, line);
fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
index=end+1; index=end+1;
end = TipsOfTheDay.find((ucchar)'\n', index); end = TipsOfTheDay.find('\n', index);
if (end == ucstring::npos) if (end == string::npos)
end = TipsOfTheDay.size(); end = TipsOfTheDay.size();
} }
@ -338,7 +338,7 @@ void CProgress::internalProgress (float value)
TextContext->setFontSize((uint)(15.f * fontFactor)); TextContext->setFontSize((uint)(15.f * fontFactor));
TextContext->setHotSpot(UTextContext::BottomLeft); TextContext->setHotSpot(UTextContext::BottomLeft);
ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel"); string uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText.toUtf8() + ") - " + CI18N::get("uiDelayedTPCancel");
UTextContext::CStringInfo info = TextContext->getStringInfo(uc); UTextContext::CStringInfo info = TextContext->getStringInfo(uc);
float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2); float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2);
TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc); TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc);
@ -386,13 +386,13 @@ void CProgress::internalProgress (float value)
TextContext->setFontSize( (uint)(16.f * fontFactor)); TextContext->setFontSize( (uint)(16.f * fontFactor));
// build the ucstr(s) // build the ucstr(s)
ucstring ucstr = CI18N::get((*itpc).Text); string ucstr = CI18N::get((*itpc).Text);
vector<ucstring> vucstr; vector<string> vucstr;
ucstring sep("\n"); string sep("\n");
splitUCString(ucstr,sep,vucstr); splitString(ucstr,sep,vucstr);
// Letter size // Letter size
UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); UTextContext::CStringInfo si = TextContext->getStringInfo("|");
uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap
uint i; uint i;

@ -279,12 +279,12 @@ void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPos
getEditor().getDMC().flushActions(); getEditor().getDMC().flushActions();
return; return;
} }
ucstring readableName; string readableName;
CLuaState &ls = getEditor().getLua(); CLuaState &ls = getEditor().getLua();
R2::getEditor().getEnv()["PaletteIdToGroupTranslation"][newEntityDesc->getAttr("Base")->toString()].push(); R2::getEditor().getEnv()["PaletteIdToGroupTranslation"][newEntityDesc->getAttr("Base")->toString()].push();
if (ls.isString(-1)) if (ls.isString(-1))
readableName.fromUtf8(ls.toString(-1)); readableName = ls.toString(-1);
ucstring ucGroupName = ucstring(readableName + " " + CI18N::get("uiR2EDNameGroup")); string ucGroupName = readableName + " " + CI18N::get("uiR2EDNameGroup");
newGroup->set("Name", getEditor().genInstanceName(ucGroupName).toUtf8()); newGroup->set("Name", getEditor().genInstanceName(ucGroupName).toUtf8());
getEditor().getDMC().requestInsertNode(destGroup->getParentAct()->getId(), getEditor().getDMC().requestInsertNode(destGroup->getParentAct()->getId(),

@ -1571,12 +1571,12 @@ int CEditor::luaGetUserEntityName(CLuaState &ls)
CLuaIHM::checkArgCount(ls, funcName, 1); // this is a method CLuaIHM::checkArgCount(ls, funcName, 1); // this is a method
if (UserEntity) if (UserEntity)
{ {
ucstring name = UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis; string name = UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis;
ls.push( name.toUtf8() ); ls.push( name );
} }
else else
{ {
ls.push(std::string("")); ls.push(std::string());
} }
return 1; return 1;

@ -551,9 +551,9 @@ void CToolDrawPrim::commit()
if (!_Extending) if (!_Extending)
{ {
// set readable name // set readable name
ucstring readableName = NLMISC::CI18N::get(_PrimType == Road ? "uiR2EDNameBotRoad" : "uiR2EDNameBotRegion"); string readableName = NLMISC::CI18N::get(_PrimType == Road ? "uiR2EDNameBotRoad" : "uiR2EDNameBotRegion");
readableName = getEditor().genInstanceName(readableName); readableName = getEditor().genInstanceName(readableName).toUtf8();
desc->set("Name", readableName.toUtf8()); desc->set("Name", readableName);
// send creation command // send creation command
// tmp : static npc counter // tmp : static npc counter
// add in component list of default feature // add in component list of default feature

Loading…
Cancel
Save