mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Changed: Changes from last patch
This commit is contained in:
parent
3fd9f30695
commit
f4040f6c1b
3 changed files with 50 additions and 31 deletions
|
@ -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,16 +614,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Put the new prefix in the correct position
|
||||
size_t pos = newmsg.find(ucstring("] "));
|
||||
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
|
||||
pos = newmsg.find(ucstring("] "));
|
||||
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// NB: the yubo chat cannot be in a user chat
|
||||
|
|
|
@ -764,37 +764,39 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|||
sint32 dbIndex= ChatMngr.getDynamicChannelDbIndexFromId(dynChatId);
|
||||
// if found, display, else discarded
|
||||
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
|
||||
{
|
||||
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
|
||||
|
||||
// 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 (pIM->getLogState())
|
||||
{
|
||||
// Add dyn chan number before string
|
||||
ucstring prefix = "[" + NLMISC::toString(dbIndex) + "]";
|
||||
ucstring prefix("[" + NLMISC::toString(dbIndex) + "]");
|
||||
// Find position to put the new string
|
||||
// After timestamp?
|
||||
size_t pos = finalString.find(ucstring("]"));
|
||||
if (pos == ucstring::npos)
|
||||
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))
|
||||
{
|
||||
// No timestamp, so put it right after the color and add a space
|
||||
pos = finalString.find(ucstring("}"));
|
||||
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.
|
||||
CCDBNodeLeaf* node = pIM->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
|
||||
if (node && pIM->getLogState() && node->getValueBool())
|
||||
|
||||
if (node && node->getValueBool())
|
||||
{
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
if ( ! title.empty())
|
||||
{
|
||||
prefix = " " + title;
|
||||
}
|
||||
// Put the new prefix in the correct position
|
||||
size_t pos = finalString.find(ucstring("] "));
|
||||
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
|
||||
pos = finalString.find(ucstring("] "));
|
||||
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str());
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue