Changed: Changes from last patch

This commit is contained in:
kervala 2011-03-11 18:40:06 +01:00
parent 3fd9f30695
commit f4040f6c1b
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; 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 // 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); CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
if (node && node->getValueBool()) if (node && node->getValueBool())
@ -599,15 +614,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
ucstring title; ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if ( ! title.empty()) prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
{ pos = newmsg.find(ucstring("] "));
prefix = " " + title; 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; break;

View file

@ -765,34 +765,36 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// if found, display, else discarded // if found, display, else discarded
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer) 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); 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); 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); // Add dyn chan number before string
ucstring title; ucstring prefix("[" + NLMISC::toString(dbIndex) + "]");
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); // Find position to put the new string
if ( ! title.empty()) // 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 else

View file

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