void UChildActorComponent::CreateChildActor()
{
    // Kill spawned actor if we have one
    DestroyChildActor();

    // This is no longer needed
    if (CachedInstanceData)
    {
        delete CachedInstanceData;
        CachedInstanceData = nullptr;
    }

    // If we have a class to spawn.
    if(ChildActorClass != nullptr)
    {
        UWorld* World = GetWorld();
        if(World != nullptr)
        {
            // Before we spawn let's try and prevent cyclic disaster
            bool bSpawn = true;
            AActor* Actor = GetOwner();
            while (Actor && bSpawn)
            {
                if (Actor->GetClass() == ChildActorClass)
                {
                    bSpawn = false;
                    UE_LOG(LogChildActorComponent, Error, TEXT("Found cycle in child actor component '%s'.  Not spawning Actor of class '%s' to break."), *GetPathName(), *ChildActorClass->GetName());
                }
                Actor = Actor->ParentComponentActor.Get();
            }

            if (bSpawn)
            {
                FActorSpawnParameters Params;
                Params.bNoCollisionFail = true;
                Params.bDeferConstruction = true; // We defer construction so that we set ParentComponentActor prior to component registration so they appear selected
                Params.bAllowDuringConstructionScript = true;
                Params.OverrideLevel = GetOwner()->GetLevel();
                Params.Name = ChildActorName;
                if (!HasAllFlags(RF_Transactional))
                {
                    Params.ObjectFlags &= ~RF_Transactional;
                }

                // Spawn actor of desired class
                FVector Location = GetComponentLocation();
                FRotator Rotation = GetComponentRotation();
                ChildActor = World->SpawnActor(ChildActorClass, &Location, &Rotation, Params);

                // If spawn was successful,
                if(ChildActor != nullptr)
                {
                    ChildActorName = ChildActor->GetFName();

                    // Remember which actor spawned it (for selection in editor etc)
                    ChildActor->ParentComponentActor = GetOwner();

                    ChildActor->AttachRootComponentTo(this);

                    // Parts that we deferred from SpawnActor
                    ChildActor->FinishSpawning(ComponentToWorld);
                }
            }
        }
    }
}
Beispiel #2
0
void InstallBranch::onChoice(wxCommandEvent& event)
{
	MCFBranch b = getBranch();

	if (b == UINT_MAX || b == (UINT_MAX - 1))
	{
		if (b == UINT_MAX)
			m_butInstall->SetLabel(Managers::GetString(L"#PLAY"));
		else
			m_butInstall->SetLabel(Managers::GetString(L"#FIND"));

		m_butInstall->Enable(true);
		return;
	}

	UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(m_Item);

	if ((m_bIsMod || m_bIsExpansion) && !m_bSelectBranch)
		pItemInfo = GetUserCore()->getItemManager()->findItemInfo(pItemInfo->getParentId());

	UserCore::Item::BranchInfoI* bi = pItemInfo->getBranchById(b);

	m_bBuy = (!(bi->getFlags()&UserCore::Item::BranchInfoI::BF_ONACCOUNT) && !(bi->getFlags()&UserCore::Item::BranchInfoI::BF_FREE));

	if (m_bBuy)
		m_butInstall->SetLabel(Managers::GetString(L"#PURCHASE"));
	else
		m_butInstall->SetLabel(Managers::GetString(L"#INSTALL"));

	bool noRelease = HasAllFlags(bi->getFlags(), UserCore::Item::BranchInfoI::BF_NORELEASES);
	bool isPreorder = bi->isPreOrder();
	bool onAccount = HasAllFlags(bi->getFlags(), UserCore::Item::BranchInfoI::BF_ONACCOUNT);

	m_butInstall->Enable(!(noRelease && isPreorder && onAccount));
}
void UIComplexModServiceTask::onComplete()
{
	if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX))
	{
		UserCore::MCFManager *mm = UserCore::GetMCFManager();
		mm->delMcfBackup(getItemInfo()->getParentId(), m_idLastInstalledMod);
	}

	if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_LINK))
	{
		if (m_uiCompleteAction == CA_LAUNCH)
			getItemHandle()->goToStageLaunch();
	}
	else
	{
		switch (m_uiCompleteAction)
		{
		case CA_INSTALL:
			getItemHandle()->goToStageInstallComplex(getMcfBranch(), getMcfBuild());
			break;

		case CA_UNINSTALL_BRANCH:
			getItemHandle()->goToStageUninstallBranch(getMcfBranch(), getMcfBuild());
			break;

		case CA_UNINSTALL:
			getItemInfo()->delSFlag(	UserCore::Item::ItemInfoI::STATUS_INSTALLED|
										UserCore::Item::ItemInfoI::STATUS_READY|
										UserCore::Item::ItemInfoI::STATUS_DOWNLOADING|
										UserCore::Item::ItemInfoI::STATUS_VERIFING|
										UserCore::Item::ItemInfoI::STATUS_INSTALLING|
										UserCore::Item::ItemInfoI::STATUS_UPDATING|
										UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER|
										UserCore::Item::ItemInfoI::STATUS_PAUSED|
										UserCore::Item::ItemInfoI::STATUS_PAUSABLE);

			completeUninstall(m_bRemoveAll, m_bRemoveAcc);
			break;

		case CA_UIPATCH:
			getItemHandle()->goToStageUninstallPatch(getMcfBranch(), getMcfBuild());
			break;
		};
	}

	if (m_bEndStage)
		getItemHandle()->completeStage(true);

	UIBaseServiceTask::onComplete();
}
Beispiel #4
0
UWorld* UUserWidget::GetWorld() const
{
	if ( HasAllFlags(RF_ClassDefaultObject) )
	{
		// If we are a CDO, we must return nullptr instead of calling Outer->GetWorld() to fool UObject::ImplementsGetWorld.
		return nullptr;
	}

	// Use the Player Context's world, if a specific player context is given, otherwise fall back to
	// following the outer chain.
	if ( PlayerContext.IsValid() )
	{
		if ( UWorld* World = PlayerContext.GetWorld() )
		{
			return World;
		}
	}

	// Could be a GameInstance, could be World, could also be a WidgetTree, so we're just going to follow
	// the outer chain to find the world we're in.
	UObject* Outer = GetOuter();

	while ( Outer )
	{
		UWorld* World = Outer->GetWorld();
		if ( World )
		{
			return World;
		}

		Outer = Outer->GetOuter();
	}

	return nullptr;
}
Beispiel #5
0
bool HGTController::expandDiffs()
{
	CourgetteInstance ci;

	bool failedSome = false;
	printf("\n");

	size_t fsSize = m_rvFileList.size();
	for (size_t x=0; x<fsSize; x++)
	{
		if (!HasAllFlags(m_rvFileList[x]->getFlags(), MCFFileI::FLAG_CANUSEDIFF))
			continue;

		printf("Expanding Courgette Diff for: %s\n", m_rvFileList[x]->getName());

		if (!expandDiff(&ci, m_rvFileList[x]))
		{
			m_rvFileList[x]->delFlag(MCFCore::MCFFileI::FLAG_COMPLETE);
			failedSome = true;
		}
		else
		{
			m_rvFileList[x]->delFlag(MCFFileI::FLAG_COMPRESSED);
			m_rvFileList[x]->addFlag(MCFFileI::FLAG_COMPLETE);
		}

		m_rvFileList[x]->clearDiff();
	}

	return !failedSome;
}
Beispiel #6
0
	PreloadButtonHelper(DesuraId id)
	{
		m_Id = id;

		UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo(id);

		if (!item)
			return;

		for (size_t x=0; x<item->getBranchCount(); x++)
		{
			uint32 flags = item->getBranch(x)->getFlags();
			
			if (HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES))
				continue;

			if (item->getBranch(x)->isPreOrder())
				continue;

			bool isDemo = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_DEMO|UserCore::Item::BranchInfoI::BF_TEST);
			bool onAccount = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE|UserCore::Item::BranchInfoI::BF_ONACCOUNT);
			bool isLocked = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_REGIONLOCK|UserCore::Item::BranchInfoI::BF_MEMBERLOCK);

			if (isDemo)
				m_DemoBranch = item->getBranch(x)->getBranchId();
			else if (onAccount && !isLocked)
				m_bOtherBranches = true;
		}
	}
Beispiel #7
0
void InternalLink::onUploadTrigger(ut& info)
{
	FINDFORM(info.id, UploadMCFForm);

	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( info.id );
	if (!item && !GetUserCore()->isAdmin())
	{
		//cant upload show prompt
		gcMessageBox(g_pMainApp->getMainWindow(), Managers::GetString(L"#MF_NONDEV_ERROR"), Managers::GetString(L"#MF_PERMISSION_ERRTITLE"));
		return;
	}

	if (item && !HasAllFlags(item->getStatus(), UserCore::Item::ItemInfoI::STATUS_DEVELOPER) && !GetUserCore()->isAdmin())
	{
		//cant upload show prompt
		gcMessageBox(g_pMainApp->getMainWindow(), Managers::GetString(L"#MF_UPERMISSION_ERROR"), Managers::GetString(L"#MF_PERMISSION_ERRTITLE"));
		return;
	}

	//create new create from
	UploadMCFForm* form = new UploadMCFForm(m_pParent);
	form->setInfo_path(info.id, info.path.c_str());

	if (info.caller)
	{
		wxPoint pos = info.caller->GetScreenPosition();
		form->SetPosition(pos);
	}

	form->Show(true);	
	form->Raise();
	form->run();

	m_vSubForms.push_back(form);
}
bool UninstallAllThread::hasPaidBranch(UserCore::Item::ItemInfoI* item)
{
	for (size_t z=0; z<item->getBranchCount(); z++)
	{
		UserCore::Item::BranchInfoI* bi = item->getBranch(z);

		if (HasAllFlags(bi->getFlags(), UserCore::Item::BranchInfoI::BF_ONACCOUNT) && !HasAnyFlags(bi->getFlags(), UserCore::Item::BranchInfoI::BF_FREE|UserCore::Item::BranchInfoI::BF_DEMO|UserCore::Item::BranchInfoI::BF_TEST))
			return true;
	}
	return false;
}
void UInheritableComponentHandler::PreloadAll()
{
	if (HasAllFlags(RF_NeedLoad))
	{
		auto Linker = GetLinker();
		if (Linker)
		{
			Linker->Preload(this);
		}
	}
	PreloadAllTempates();
}
Beispiel #10
0
bool EventHandler::onKeyEvent(ChromiumDLL::KeyEventType type, int code, int modifiers, bool isSystemKey)
{
	if (type == ChromiumDLL::KEYEVENT_RAWKEYDOWN)
	{
		for (size_t x=0; x<g_uiMaxKeys; x++)
		{
			if (g_ShortCutList[x].key == (uint32)code && HasAllFlags(modifiers, g_ShortCutList[x].modifiers))
			{
				m_pParent->handleKeyEvent(g_ShortCutList[x].action);
				return true;
			}
		}
	}

	return false;
}
Beispiel #11
0
void InternalLink::showUpdateForm(DesuraId id, Args args)
{
	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id );

	if (!item)
		return;

	if (!HasAllFlags(item->getStatus(), UserCore::Item::ItemInfoI::STATUS_UPDATEAVAL))
		return;
	
	std::string reminder = args.getArgValue("reminder");

	//create new gather info form from
	UpdateInfoForm* form = new UpdateInfoForm(m_pParent);
	regForm(id, form);

	form->setInfo(id, reminder == "true");
	form->Show(true);
}
void DownloadToolTask::onComplete()
{
	bool notComplete = isStopped() || m_bCancelled;

	getUserCore()->getToolManager()->removeTransaction(m_ToolTTID, notComplete);
	m_ToolTTID = UINT_MAX;

	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (!m_bCancelled && !getUserCore()->getToolManager()->areAllToolsDownloaded(toolList))
	{
		gcException e(ERR_INVALID, "Failed to download tools.");
		onErrorEvent(e);
		notComplete = true;
	}

	if (notComplete)
	{
		getItemHandle()->completeStage(true);
		return;
	}

	uint32 blank = 0;
	onCompleteEvent(blank);

	if (m_bInstallAfter)
	{
		getItemHandle()->goToStageInstallTools(m_bLaunch);
	}
	else
	{
		if (HasAllFlags(getItemInfo()->getStatus(), UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX))
			getItemHandle()->goToStageInstallComplex(getMcfBranch(), getMcfBuild());
		else
			getItemHandle()->goToStageInstall(m_szDownloadPath.c_str(), getMcfBranch());
	}
}
Beispiel #13
0
void HGTController::doDownload()
{
	//header should be saved all ready so appened to it
	m_hFile.open(m_szFile, UTIL::FS::FILE_APPEND);
	m_hFile.seek(0);

	HttpHandle wc(m_szUrl.c_str());

	//wc->getProgressEvent() += delegate(this, &HGTController::onProgress);
	wc->getWriteEvent() += delegate(this, &HGTController::onWriteMemory);

	for (size_t x=0; x<m_vSuperBlockList.size(); x++)
	{
		m_pCurBlock = m_vSuperBlockList[x];

		wc->cleanUp();
		wc->setDownloadRange(m_pCurBlock->offset, m_pCurBlock->size);

		try
		{
			m_hFile.seek(m_pCurBlock->vBlockList[0]->fileOffset);
			wc->getWeb();
		}
		catch (gcException &e)
		{
			onErrorEvent(e);
			nonBlockStop();
		}
	}

	size_t fsSize = m_rvFileList.size();
	for (size_t x=0; x<fsSize; x++)
	{
		if (!HasAllFlags(m_rvFileList[x]->getFlags(), MCFFileI::FLAG_CANUSEDIFF))
			m_rvFileList[x]->addFlag(MCFFileI::FLAG_COMPLETE);
	}
}
Beispiel #14
0
bool VerifyServiceTask::checkUnAuthed()
{
	UserCore::Item::ItemInfo* pItem = getItemInfo();

	if (m_McfBuild != 0 || HasAllFlags(pItem->getStatus(), UserCore::Item::ItemInfoI::STATUS_UNAUTHED) == false)
		return false;

	McfHandle hMcf;
	hMcf->setHeader(getItemId(), m_McfBranch, m_McfBuild);

	try
	{
		MCFCore::Misc::UserCookies uc;
		getWebCore()->setMCFCookies(&uc); 
		hMcf->getDownloadProviders(getWebCore()->getMCFDownloadUrl(), &uc);
	}
	catch (gcException &except)
	{
		onError(except);
		return true;
	}		

	m_McfBuild = hMcf->getHeader()->getBuild();

	if (m_McfBuild == 0)
	{
		//cant remove this as this is the first version
		finishVerify();
		return true;
	}

	pItem->overideInstalledBuild(m_McfBuild);
	pItem->delSFlag(UserCore::Item::ItemInfoI::STATUS_UNAUTHED);
	
	return false;
}
Beispiel #15
0
bool  BranchInfo::isPreOrder()
{
	return isAvaliable() && HasAllFlags(m_uiFlags, BF_PREORDER);
}
		bool HasAllFlags(TEnumBitsClass flags) const	{ return HasAllFlags(static_cast<TStorage>(flags)); }
void UChildActorComponent::CreateChildActor()
{
	// Kill spawned actor if we have one
	DestroyChildActor();

	// If we have a class to spawn.
	if(ChildActorClass != nullptr)
	{
		UWorld* World = GetWorld();
		if(World != nullptr)
		{
			// Before we spawn let's try and prevent cyclic disaster
			bool bSpawn = true;
			AActor* MyOwner = GetOwner();
			AActor* Actor = MyOwner;
			while (Actor && bSpawn)
			{
				if (Actor->GetClass() == ChildActorClass)
				{
					bSpawn = false;
					UE_LOG(LogChildActorComponent, Error, TEXT("Found cycle in child actor component '%s'.  Not spawning Actor of class '%s' to break."), *GetPathName(), *ChildActorClass->GetName());
				}
				if (UChildActorComponent* ParentComponent = Actor->GetParentComponent())
				{
					Actor = ParentComponent->GetOwner();
				}
				else
				{
					Actor = nullptr;
				}
			}

			if (bSpawn)
			{
				FActorSpawnParameters Params;
				Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
				Params.bDeferConstruction = true; // We defer construction so that we set ParentComponent prior to component registration so they appear selected
				Params.bAllowDuringConstructionScript = true;
				Params.OverrideLevel = (MyOwner ? MyOwner->GetLevel() : nullptr);
				Params.Name = ChildActorName;
				if (!HasAllFlags(RF_Transactional))
				{
					Params.ObjectFlags &= ~RF_Transactional;
				}

				// Spawn actor of desired class
				FVector Location = GetComponentLocation();
				FRotator Rotation = GetComponentRotation();
				ChildActor = World->SpawnActor(ChildActorClass, &Location, &Rotation, Params);

				// If spawn was successful, 
				if(ChildActor != nullptr)
				{
					ChildActorName = ChildActor->GetFName();

					// Remember which component spawned it (for selection in editor etc)
					FActorParentComponentSetter::Set(ChildActor, this);

					// Parts that we deferred from SpawnActor
					const FComponentInstanceDataCache* ComponentInstanceData = (CachedInstanceData ? CachedInstanceData->ComponentInstanceData : nullptr);
					ChildActor->FinishSpawning(ComponentToWorld, false, ComponentInstanceData);

					ChildActor->AttachRootComponentTo(this, NAME_None, EAttachLocation::SnapToTarget);
				}
			}
		}
	}

	// This is no longer needed
	if (CachedInstanceData)
	{
		delete CachedInstanceData;
		CachedInstanceData = nullptr;
	}
}
Beispiel #18
0
void HGTController::fillDownloadList(bool &usingDiffs)
{
	usingDiffs = false;
	safe_delete(m_vSuperBlockList);
	MCFCore::MCF *webMcf = new MCFCore::MCF();

	try
	{
		webMcf->dlHeaderFromHttp(m_szUrl.c_str());
	}
	catch (gcException &e)
	{
		onErrorEvent(e);
		safe_delete(webMcf);
		return;
	}

	webMcf->sortFileList();

	uint64 mcfOffset = m_pHeader->getSize();
	size_t fsSize = m_rvFileList.size();

	//find the last files offset
	for (size_t x=0; x< fsSize; x++)
	{
		if (!m_rvFileList[x]->isSaved())
			continue;

		if ((m_rvFileList[x]->isComplete() || m_rvFileList[x]->hasStartedDL()) && m_rvFileList[x]->getOffSet() > mcfOffset)
		{
			mcfOffset = m_rvFileList[x]->getOffSet() + m_rvFileList[x]->getCurSize();
		}
	}

	std::deque<Misc::WGTBlock*> vBlockList;
	std::sort(m_rvFileList.begin(), m_rvFileList.end(), SortByOffset);

	for (size_t x=0; x<fsSize; x++)
	{
		//dont download all ready downloaded items
		if (m_rvFileList[x]->isComplete())
			continue;

		//skip files that arnt "saved" in the MCF
		if (!m_rvFileList[x]->isSaved())
			continue;	

		uint32 index = webMcf->findFileIndexByHash(m_rvFileList[x]->getHash());
		MCFCore::MCFFile *webFile = webMcf->getFile(index);

		uint64 size = m_rvFileList[x]->getCurSize();
		bool started = m_rvFileList[x]->hasStartedDL();

		if (index == UNKNOWN_ITEM || !webFile || !webFile->isSaved())
		{
			Warning(gcString("File {0} is not in web MCF. Skipping download.\n", m_rvFileList[x]->getName()));

			if (!started)
				m_rvFileList[x]->delFlag(MCFCore::MCFFileI::FLAG_SAVE);

			continue;
		}	


		if (!started)
			m_rvFileList[x]->setOffSet(mcfOffset);


		Misc::WGTBlock* temp = new Misc::WGTBlock;

		temp->fileOffset = m_rvFileList[x]->getOffSet();
		temp->file = m_rvFileList[x];

		if (webFile->hasDiff() && HasAllFlags(m_rvFileList[x]->getFlags(), MCFFileI::FLAG_CANUSEDIFF))
		{
			temp->webOffset = webFile->getDiffOffSet();
			temp->size = webFile->getDiffSize();

			if (!started)
				mcfOffset += webFile->getSize();

			usingDiffs = true;
		}
		else
		{
			m_rvFileList[x]->delFlag(MCFFileI::FLAG_CANUSEDIFF);
			temp->webOffset = webFile->getOffSet();
			temp->size = size;

			if (!started)
				mcfOffset += size;
		}

		vBlockList.push_back(temp);
		m_uiTotal += temp->size;
	}


	std::sort(vBlockList.begin(), vBlockList.end(), &WGTBlockSort);

	while (vBlockList.size() > 0)
	{
		Misc::WGTSuperBlock* sb = new Misc::WGTSuperBlock();
		sb->offset = vBlockList[0]->webOffset;

		do
		{
			Misc::WGTBlock* block = vBlockList.front();
			vBlockList.pop_front();

			sb->size += block->size;
			sb->vBlockList.push_back(block);
		}
		while (vBlockList.size() > 0 && vBlockList[0]->webOffset == (sb->offset + sb->size));

		m_vSuperBlockList.push_back(sb);
	}
}
Beispiel #19
0
int InstallBranch::setInfo(DesuraId id, bool selectBranch)
{
	m_bSelectBranch = selectBranch;
	UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(id);

	if (!pItemInfo)
		return 1;

	m_bIsMod = id.getType() == DesuraId::TYPE_MOD;
	m_bIsExpansion = m_bIsMod == false && pItemInfo->getParentId().getType() == DesuraId::TYPE_GAME;

	m_Item = id;

	gcWString parName;
	gcWString itemName = pItemInfo->getName();
	
	DesuraId par = pItemInfo->getParentId();
	UserCore::Item::ItemInfoI *parInfo = NULL;
	if (par.isOk())
	{
		parInfo = GetUserCore()->getItemManager()->findItemInfo(par);

		if (parInfo)
			parName = gcWString(parInfo->getName());
	}

	fixName(parName);
	fixName(itemName);

	if (selectBranch == false && m_bIsMod)
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND"), itemName, parName));
		m_labInfo->Wrap( 350 );
	}
	else if (selectBranch == false && m_bIsExpansion)
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND_GAME"), itemName, parName));
		m_labInfo->Wrap( 350 );
	}
	else
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_BRANCHINFO"), itemName));
		m_labInfo->Wrap( 350 );
	}

	uint32 count = 0;
	int32 full = -1;
	uint32 fullReadyCount = 0;
	m_bBuy = true;

	UserCore::Item::ItemInfoI *i = pItemInfo;

	bool isCheckingParent = (m_bIsMod || m_bIsExpansion) && !selectBranch;

	if (isCheckingParent)
	{
		if (!parInfo)
		{
			gcMessageBox(GetParent(), Managers::GetString(L"#IF_IIPARENT"), Managers::GetString(L"#IF_IIERRTITLE"));
			return 1;
		}

		i = parInfo;
	}

	std::vector<UserCore::Item::BranchInfoI*> bList;

	for (uint32 x=0; x<i->getBranchCount(); x++)
	{
		UserCore::Item::BranchInfoI* bi = i->getBranch(x);

		if (!bi)
			continue;

		uint32 flags = bi->getFlags();

		bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES);
		bool isPreorder = bi->isPreOrder();
		bool isDemo = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_DEMO);
		bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT);
		bool locked = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_MEMBERLOCK|UserCore::Item::BranchInfoI::BF_REGIONLOCK);
		bool test = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_TEST);
		bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE);

		if (noRelease && !isPreorder)
			continue;

		if (!onAccount && locked)
			continue;
		
		if (!selectBranch && (isDemo || test))
			continue;

		if ((free || onAccount) && isPreorder && !selectBranch)
			continue;

		bool globalFound = false;

		for (size_t x=0; x<bList.size(); x++)
		{
			if (bList[x]->getGlobalId() == bi->getGlobalId())
			{
				globalFound = true;
				break;
			}
		}

		if (globalFound)
			continue;

		if (isDemo || test)
		{
		}
		else if (full == -1 || ((!m_bBuy || onAccount) && !free))
		{
			if (full == -1 || m_bBuy)
			{
				//if this is the first full game or this is the first full game that you dont have to buy
				m_bBuy = (!onAccount && !free);
				full = count;
			}
			
			if (onAccount || free)
				fullReadyCount++;
		}

		bList.push_back(bi);
		count++;
	}

	for (size_t x=0; x<bList.size(); x++)
	{
		UserCore::Item::BranchInfoI* bi = bList[x];
		gcString name = bi->getName();
		gcWString title;
		
		uint32 flags = bi->getFlags();

		bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES);
		bool isPreorder = bi->isPreOrder();
		bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT);
		bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE);

		if (!free)
			title = gcString("{0} - {1}", name, Managers::GetString("#IF_BROUGHT"));
		else
			title = gcString("{0} - {1}", name, Managers::GetString("#IF_FREE"));
		
		if (!free && !onAccount)
		{
			gcWString cost(bi->getCost());

			if (cost == "")
				cost = gcString(Managers::GetString("#TBA"));

			title = gcString("{0} - {1}", name, cost.c_str());
		}
		else if (isPreorder)
		{
			if (noRelease)
				title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED_NORELEASE"));
			else
				title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED"));
		}

		m_cbBranchList->Append(title, new BranchData(bi->getBranchId(), bi->getGlobalId()));
	}

	count = bList.size();

	if (full == -1)
		full = 0;

#ifdef WIN32
	if (HasAnyFlags(i->getStatus(), UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER))
		m_cbBranchList->Append(Managers::GetString("#IF_ONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-1), MCFBranch::BranchFromInt(-1)));
	else
		m_cbBranchList->Append(Managers::GetString("#IF_FINDONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-2), MCFBranch::BranchFromInt(-2)));
#endif

	m_cbBranchList->SetSelection(full);

	if (pItemInfo->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(pItemInfo->getIcon())))
		setIcon(pItemInfo->getIcon());

	SetTitle(gcWString(Managers::GetString(L"#IF_BRANCHTITLE"), itemName));


	uint32 ret = 0;

	if (count == 0)
	{
		if (!isCheckingParent)
			gcMessageBox(GetParent(), Managers::GetString(L"#IF_IINOBRANCHES"), Managers::GetString(L"#IF_IIERRTITLE"));
		else if (selectBranch)
			ret = 1;
	}
	else if ((count == 1 || fullReadyCount == 1) && !m_bBuy)
	{	
		ret =  1;
	}
	else
	{
		wxCommandEvent e;
		onChoice(e);
	}

	return ret;
}
Beispiel #20
0
bool BranchInfo::hasCDKey()
{
	return HasAllFlags(m_uiFlags, BF_CDKEY);
}
Beispiel #21
0
bool BranchInfo::isSteamGame()
{
	return HasAllFlags(m_uiFlags, BF_STEAMGAME);
}
void UChildActorComponent::CreateChildActor()
{
	AActor* MyOwner = GetOwner();

	if (MyOwner && !MyOwner->HasAuthority())
	{
		AActor* ChildClassCDO = (ChildActorClass ? ChildActorClass->GetDefaultObject<AActor>() : nullptr);
		if (ChildClassCDO && ChildClassCDO->GetIsReplicated())
		{
			// If we belong to an actor that is not authoritative and the child class is replicated then we expect that Actor will be replicated across so don't spawn one
			return;
		}
	}

	// Kill spawned actor if we have one
	DestroyChildActor();

	// If we have a class to spawn.
	if(ChildActorClass != nullptr)
	{
		UWorld* World = GetWorld();
		if(World != nullptr)
		{
			// Before we spawn let's try and prevent cyclic disaster
			bool bSpawn = true;
			AActor* Actor = MyOwner;
			while (Actor && bSpawn)
			{
				if (Actor->GetClass() == ChildActorClass)
				{
					bSpawn = false;
					UE_LOG(LogChildActorComponent, Error, TEXT("Found cycle in child actor component '%s'.  Not spawning Actor of class '%s' to break."), *GetPathName(), *ChildActorClass->GetName());
				}
				Actor = Actor->GetParentActor();
			}

			if (bSpawn)
			{
				FActorSpawnParameters Params;
				Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
				Params.bDeferConstruction = true; // We defer construction so that we set ParentComponent prior to component registration so they appear selected
				Params.bAllowDuringConstructionScript = true;
				Params.OverrideLevel = (MyOwner ? MyOwner->GetLevel() : nullptr);
				Params.Name = ChildActorName;
				Params.Template = ChildActorTemplate;
				if (!HasAllFlags(RF_Transactional))
				{
					Params.ObjectFlags &= ~RF_Transactional;
				}

				// Spawn actor of desired class
				ConditionalUpdateComponentToWorld();
				FVector Location = GetComponentLocation();
				FRotator Rotation = GetComponentRotation();
				ChildActor = World->SpawnActor(ChildActorClass, &Location, &Rotation, Params);

				// If spawn was successful, 
				if(ChildActor != nullptr)
				{
					ChildActorName = ChildActor->GetFName();

					// Remember which component spawned it (for selection in editor etc)
					FActorParentComponentSetter::Set(ChildActor, this);

					// Parts that we deferred from SpawnActor
					const FComponentInstanceDataCache* ComponentInstanceData = (CachedInstanceData ? CachedInstanceData->ComponentInstanceData : nullptr);
					ChildActor->FinishSpawning(ComponentToWorld, false, ComponentInstanceData);

					ChildActor->AttachToComponent(this, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

					SetIsReplicated(ChildActor->GetIsReplicated());
				}
			}
		}
	}

	// This is no longer needed
	if (CachedInstanceData)
	{
		delete CachedInstanceData;
		CachedInstanceData = nullptr;
	}
}