mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-04 20:26:05 +00:00
CScriptObject: Make use of ranged for where applicable
This commit is contained in:
parent
9f8ecc855b
commit
d93810568b
@ -199,7 +199,7 @@ void CScriptObject::RemoveLink(ELinkType Type, CLink *pLink)
|
|||||||
{
|
{
|
||||||
std::vector<CLink*> *pLinkVec = (Type == ELinkType::Incoming ? &mInLinks : &mOutLinks);
|
std::vector<CLink*> *pLinkVec = (Type == ELinkType::Incoming ? &mInLinks : &mOutLinks);
|
||||||
|
|
||||||
for (auto it = pLinkVec->begin(); it != pLinkVec->end(); it++)
|
for (auto it = pLinkVec->begin(); it != pLinkVec->end(); ++it)
|
||||||
{
|
{
|
||||||
if (*it == pLink)
|
if (*it == pLink)
|
||||||
{
|
{
|
||||||
@ -211,20 +211,20 @@ void CScriptObject::RemoveLink(ELinkType Type, CLink *pLink)
|
|||||||
|
|
||||||
void CScriptObject::BreakAllLinks()
|
void CScriptObject::BreakAllLinks()
|
||||||
{
|
{
|
||||||
for (auto it = mInLinks.begin(); it != mInLinks.end(); it++)
|
for (auto* link : mInLinks)
|
||||||
{
|
{
|
||||||
CLink *pLink = *it;
|
if (CScriptObject* sender = link->Sender())
|
||||||
CScriptObject *pSender = pLink->Sender();
|
sender->RemoveLink(ELinkType::Outgoing, link);
|
||||||
if (pSender) pSender->RemoveLink(ELinkType::Outgoing, pLink);
|
|
||||||
delete pLink;
|
delete link;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto it = mOutLinks.begin(); it != mOutLinks.end(); it++)
|
for (auto* link : mOutLinks)
|
||||||
{
|
{
|
||||||
CLink *pLink = *it;
|
if (CScriptObject* receiver = link->Receiver())
|
||||||
CScriptObject *pReceiver = pLink->Receiver();
|
receiver->RemoveLink(ELinkType::Incoming, link);
|
||||||
if (pReceiver) pReceiver->RemoveLink(ELinkType::Incoming, pLink);
|
|
||||||
delete pLink;
|
delete link;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInLinks.clear();
|
mInLinks.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user