Esempio n. 1
0
PCHAR GetBotScriptURL(DWORD Script, PCHAR Path)
{
	MDBG_Config("Config","GetBotScriptURL");
	// Функция возвращает полный адрес скрипта
	bool PathCreated = false;

	if (STR::IsEmpty(Path))
		Path = GetScriptByID(Script, PathCreated);


	if (STR::IsEmpty(Path))
		return NULL;
	

	PCHAR Host = GetActiveHost();

	PCHAR Result = NULL;

	if (Host != NULL)
	{
		Result = STR::New(3, "http://", Host, Path);

		STR::Free(Host);
	}

	if (PathCreated)
		STR::Free(Path);


	return Result;
}
Esempio n. 2
0
////////////////////////////////////////////////////////////////////////////
// Uses sessionID for newly allocated session
CDialogSession* CDialogSystem::InternalCreateSession(const string& scriptID, CDialogSystem::SessionID sessionID)
{
	const CDialogScript* pScript = GetScriptByID(scriptID);
	if (pScript == 0)
	{
		GameWarning("CDialogSystem::CreateSession: DialogScript '%s' unknown.", scriptID.c_str());
		return 0;
	}

	CDialogSession* pSession = new CDialogSession(this, pScript, sessionID);
	std::pair<TDialogSessionMap::iterator, bool> ok = m_allSessions.insert(TDialogSessionMap::value_type(sessionID, pSession));
	if (ok.second == false)
	{
		assert (false);
		GameWarning("CDialogSystem::CreateSession: Duplicate SessionID %d", sessionID);
		delete pSession;
		pSession = 0;
	}
	return pSession;
}