Changed: Changes from last patch

This commit is contained in:
kervala 2011-03-11 18:40:06 +01:00
parent 2cb3acb4c0
commit f7b7dae1a3
3 changed files with 50 additions and 31 deletions

View file

@ -592,6 +592,21 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
{
gl = gl2;
// Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dynamicChatDbIndex) + "]");
// Find position to put the new string
// After timestamp?
size_t pos = newmsg.find(ucstring("]"));
size_t colonpos = newmsg.find(ucstring(": @{"));
// If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos))
{
// No timestamp, so put it right after the color and add a space
pos = newmsg.find(ucstring("}"));;
prefix += " ";
}
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
// Add dynchannel number and optionally name before text if user channel
CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
if (node && node->getValueBool())
@ -599,15 +614,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if ( ! title.empty())
{
prefix = " " + title;
}
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
pos = newmsg.find(ucstring("] "));
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
}
// Put the new prefix in the correct position
size_t pos = newmsg.find(ucstring("] "));
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
}
break;

View file

@ -765,34 +765,36 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// if found, display, else discarded
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
{
// Add dyn chan number before string
ucstring prefix = "[" + NLMISC::toString(dbIndex) + "]";
// Find position to put the new string
// After timestamp?
size_t pos = finalString.find(ucstring("]"));
if (pos == ucstring::npos)
{
// No timestamp, so put it right after the color and add a space
pos = finalString.find(ucstring("}"));
prefix += " ";
}
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
// Add optionally dynchannel name before text so that the chat log
// will show the correct string if enabled.
// Add dynchannel info before text so that the chat log will show the correct string.
CCDBNodeLeaf* node = pIM->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
if (node && pIM->getLogState() && node->getValueBool())
if (pIM->getLogState())
{
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if ( ! title.empty())
// Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dbIndex) + "]");
// Find position to put the new string
// After timestamp?
size_t pos = finalString.find(ucstring("]"));
size_t colonpos = finalString.find(ucstring(": @{"));
// If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos))
{
prefix = " " + title;
// No timestamp, so put it right after the color and add a space
pos = finalString.find(ucstring("}"));;
prefix += " ";
}
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
if (node && node->getValueBool())
{
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
pos = finalString.find(ucstring("] "));
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
}
// Put the new prefix in the correct position
size_t pos = finalString.find(ucstring("] "));
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
}
}
else

View file

@ -1387,6 +1387,13 @@ const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bo
return emptyString.c_str();
}
if (label[0] == '#')
{
static ucstring rawString;
rawString = label.substr(1, label.size()-1);
return rawString.c_str();
}
// avoid case problems
static std::string lwrLabel;
lwrLabel = label;