예제 #1
0
파일: main.cpp 프로젝트: Kiddinglife/ryzom
std::string convert(const ucstring &str)
{
	if (useUtf8)
		return str.toUtf8();

	return str.toString();
}
예제 #2
0
//=============================================================================================================
void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow)
{
	// Special case for yubo chat
	if(_TargetGroup==CChatGroup::yubo_chat)
	{
		CInterfaceManager	*pIM= CInterfaceManager::getInstance();
		pIM->sendStringToYuboChat(msg);
		return;
	}

	// Common Target case
	if (ClientCfg.Local)
	{
		chatWindow->displayMessage(msg, CRGBA::White, _TargetGroup, _TargetDynamicChannelDbIndex);
		return;
	}

	// forward to the target
	if (_TargetPartyChat && _TargetPartyChat->getListener())
	{
		_TargetPartyChat->getListener()->msgEntered(msg, chatWindow);
	}
	else if (!_TargetPlayer.empty())
	{
		// the target must be a player, make a tell on him
		// TODO: adapt this to unicode when this is OK on server side
		ChatMngr.tell(_TargetPlayer.toString(), msg.toString());
		// direct output in the chat
		chatWindow->displayLocalPlayerTell(msg);
	}
	else
	{
		 // chat to a chat group (say, shout, universe) also for team (with special case in setChatMode)
		 // this mode is cached so this should be ok
		ChatMngr.setChatMode(_TargetGroup, ChatMngr.getDynamicChannelIdFromDbIndex(_TargetDynamicChannelDbIndex));
		// send the string
		ChatMngr.chat(msg, _TargetGroup == CChatGroup::team);
	}
}
예제 #3
0
// ****************************************************************************
void CViewTextFormated::setFormatString(const ucstring &format)
{
	_FormatString = format;
	if ( (_FormatString.size()>2) && (_FormatString[0] == 'u') && (_FormatString[1] == 'i'))
		_FormatString = NLMISC::CI18N::get (format.toString());
}
예제 #4
0
//-----------------------------------------------
//	getString
//
//-----------------------------------------------
bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args, const ucstring &ucstrbase )
{
	result = ucstrbase;

	bool finalString = true;

	// deal with parameters
	uint32 dynParamIdx = 0;
	bool dynParamSearch = true;
	char chTmp[1024];
	while( dynParamSearch )
	{
		// search if a parameter exists in the string
		sprintf(chTmp,"$%d",dynParamIdx);
		ucstring ucstrTmp( chTmp );
		ucstring::size_type idx = result.find(ucstrTmp);

		// if there's a parameter in the string
		if( idx != ucstring::npos )
		{
			ucstring rep;
			rep = "???";
			if (dynParamIdx >= args.size())
			{
				nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx);
			}
			else
			{
				char c = (char)result[idx+ucstrTmp.size()];
				switch( c )
				{
					// parameter is an entry in the dynamic database
					case 'e':
					{
//							#ifdef OLD_STRING_SYSTEM
//								CDynamicStringInfos *res = _DynamicDB.getDynamicStringInfos ((uint32)args[dynParamIdx]);
//								if (!res->Associated)
//							#endif
							finalString = false;
//							#ifdef OLD_STRING_SYSTEM
//								rep = res->Str;
//							#endif
					}
					break;

					// parameter is a string
					case 's':
					{
						nlwarning ("string param not implemented in the vector<uint64> decoding");
					}
					break;

					// parameter is an unsigned integer
					case 'u':
					{
						uint32 nb = (uint32) args[dynParamIdx];
						rep = toString(nb);
					}
					break;

					// parameter is a signed integer
					case 'i':
					{
						sint32 nb = (sint32) args[dynParamIdx];
						rep = toString(nb);
					}
					break;

					// parameter is a float
					case 'f':
					{
						float nb = *(float *) &(args[dynParamIdx]);
						rep = toString(nb);
					}
					break;

					// parameter type is unknown
					default :
					{
						nlwarning("<CClientChatManager::getString> The dynamic type %c is unknown",c);
					}
					break;
				}
			}
			result.replace( idx, ucstrTmp.size()+1, rep );

			dynParamIdx++;
		}
		else
		{
			dynParamSearch = false;
		}
	};

	return finalString;

} // getString //