Exemplo n.º 1
0
BOOL KAwardSetting::HasAssetAward(LPCSTR szModuleName, INT nLevel)
{
	BOOL bResult = FALSE;
	QString strModuleName(szModuleName);
	CONST QAssetAward* pAssetAward = g_cAwardSetting.RequestAssetAward(strModuleName, nLevel);
	PROCESS_ERROR(pAssetAward);

	bResult = TRUE;
EXIT0:
	return bResult;
}
Exemplo n.º 2
0
void DeamonModule::OnModuleConnected(const Twainet::ModuleName& moduleName)
{
	if(strlen(moduleName.m_host) != 0)
		return;
	
	int sizeName = 0;
	Twainet::GetModuleNameString(moduleName, 0, sizeName);
	std::string strModuleName(sizeName, 0);
	Twainet::GetModuleNameString(moduleName, (char*)strModuleName.c_str(), sizeName);
	
	for(std::vector<std::string>::iterator it = m_trustedModules.begin();
	    it != m_trustedModules.end(); it++)
	{
		if(*it == strModuleName)
		{
			LocalServerAttributesMessage msg(this);
			msg.set_port(Config::GetInstance().GetLocalServerPort());
			msg.set_username(m_userPassword.m_user);
			msg.set_password(m_userPassword.m_pass);
			toMessage(msg, moduleName);
			break;
		}
	}
}
Exemplo n.º 3
0
CModule::CModule(const char * szName)
{
	String strModuleName(szName);
	SharedUtility::RemoveIllegalCharacters(strModuleName);
	String strModulePath(SharedUtility::GetAbsolutePath("modules/%s", strModuleName.Get()));
#ifdef WIN32
	// In windows replace all '/' with '\\' or the module will not load
	strModulePath.Substitute("/", "\\");
#endif
	m_pLibrary = new CLibrary();

	if(!m_pLibrary)
		return;

	if(!m_pLibrary->Load(strModulePath.Get()))
	{
		delete m_pLibrary;
		m_pLibrary = NULL;
		return;
	}

	m_ModuleFunctions.pfnSetupFunctions = (SetupFunctions_t)m_pLibrary->GetProcedureAddress("SetupFunctions");
	m_ModuleFunctions.pfnSetupInterfaces = (SetupInterfaces_t)m_pLibrary->GetProcedureAddress("SetupInterfaces");
	m_ModuleFunctions.pfnSetupNewInterfaces = (SetupNewInterfaces_t)m_pLibrary->GetProcedureAddress("SetupNewInterfaces");
	m_ModuleFunctions.pfnInitModule = (InitModule_t)m_pLibrary->GetProcedureAddress("InitModule");
	m_ModuleFunctions.pfnScriptLoad = (ScriptLoad_t)m_pLibrary->GetProcedureAddress("ScriptLoad");
	m_ModuleFunctions.pfnScriptUnload = (ScriptUnload_t)m_pLibrary->GetProcedureAddress("ScriptUnload");
	m_ModuleFunctions.pfnPulse = (Pulse_t)m_pLibrary->GetProcedureAddress("Pulse");

	if(!IsValid())
	{
		delete m_pLibrary;
		m_pLibrary = NULL;
		return;
	}

	// Setup the functions
	m_ModuleFunctions.pfnSetupFunctions(FunctionContainer);

	// Setup the pointers
	InterfacesContainer[0] = (void*)g_pNetworkManager;
	InterfacesContainer[1] = (void*)g_pPlayerManager;
	InterfacesContainer[2] = (void*)g_pVehicleManager;
	InterfacesContainer[3] = (void*)g_pObjectManager;
	InterfacesContainer[4] = (void*)g_pBlipManager;
	InterfacesContainer[5] = (void*)g_pActorManager;
	InterfacesContainer[6] = (void*)g_pPickupManager;
	InterfacesContainer[7] = (void*)g_pCheckpointManager;
	InterfacesContainer[8] = (void*)NULL; // model manager
	InterfacesContainer[9] = (void*)g_pScriptingManager;
	InterfacesContainer[10] = (void*)g_pModuleManager;
	InterfacesContainer[11] = (void*)g_pNetworkManager->GetNetServer();
	InterfacesContainer[12] = (void*)NULL; // FIXME
	InterfacesContainer[13] = (void*)g_pTime;
	InterfacesContainer[14] = (void*)g_pTrafficLights;
	InterfacesContainer[15] = (void*)g_pEvents;
	InterfacesContainer[16] = new CSquirrelArgumentManager();

	// Setup new interfaces
	NewInterfaceContainer[0] = (void*)g_pActorModuleNatives;
	NewInterfaceContainer[1] = (void*)g_pBlipModuleNatives;
	NewInterfaceContainer[2] = (void*)g_pCheckpointModuleNatives;
	NewInterfaceContainer[3] = (void*)g_pObjectModuleNatives;
	NewInterfaceContainer[4] = (void*)g_pPickupModuleNatives;
	NewInterfaceContainer[5] = (void*)g_pPlayerModuleNatives;
	NewInterfaceContainer[6] = (void*)g_pServerModuleNatives;
	NewInterfaceContainer[7] = (void*)g_pVehicleModuleNatives;
	NewInterfaceContainer[8] = (void*)g_pScriptModuleNatives;
	NewInterfaceContainer[9] = (void*)g_pAreaModuleNatives;
	NewInterfaceContainer[10] = (void*)g_pHashModuleNatives;
	NewInterfaceContainer[11] = (void*)g_pWorldModuleNatives;

	// Send it
	if(m_ModuleFunctions.pfnSetupInterfaces)
		m_ModuleFunctions.pfnSetupInterfaces(InterfacesContainer);

	if(m_ModuleFunctions.pfnSetupNewInterfaces)
		m_ModuleFunctions.pfnSetupNewInterfaces(NewInterfaceContainer);

	char szModuleName[64];
	strcpy(szModuleName, szName);

	if(m_ModuleFunctions.pfnInitModule(szModuleName))
		CLogFile::Printf("%s module loaded", szModuleName);
}