mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-21 21:12:29 +01:00
Don't use std::forward on a variable multiple times
The previous usage was just wrong, it may have been subtly broken.
This commit is contained in:
parent
3d205cdf95
commit
2ce34524c4
@ -26,46 +26,46 @@ private:
|
||||
};
|
||||
|
||||
template <typename Pred>
|
||||
Pred RwFrameForAllChildren(RwFrame* frame, Pred&& callback)
|
||||
Pred RwFrameForAllChildren(RwFrame* frame, Pred callback)
|
||||
{
|
||||
for ( RwFrame* curFrame = frame->child; curFrame != nullptr; curFrame = curFrame->next )
|
||||
{
|
||||
if ( std::forward<Pred>(callback)(curFrame) == nullptr )
|
||||
if ( callback(curFrame) == nullptr )
|
||||
break;
|
||||
}
|
||||
return std::forward<Pred>(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Pred>
|
||||
Pred RwFrameForAllObjects(RwFrame* frame, Pred&& callback)
|
||||
Pred RwFrameForAllObjects(RwFrame* frame, Pred callback)
|
||||
{
|
||||
for ( RwLLLink* link = rwLinkListGetFirstLLLink(&frame->objectList); link != rwLinkListGetTerminator(&frame->objectList); link = rwLLLinkGetNext(link) )
|
||||
{
|
||||
if ( std::forward<Pred>(callback)(&rwLLLinkGetData(link, RwObjectHasFrame, lFrame)->object) == nullptr )
|
||||
if ( callback(&rwLLLinkGetData(link, RwObjectHasFrame, lFrame)->object) == nullptr )
|
||||
break;
|
||||
}
|
||||
|
||||
return std::forward<Pred>(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Pred>
|
||||
Pred RpClumpForAllAtomics(RpClump* clump, Pred&& callback)
|
||||
Pred RpClumpForAllAtomics(RpClump* clump, Pred callback)
|
||||
{
|
||||
for ( RwLLLink* link = rwLinkListGetFirstLLLink(&clump->atomicList); link != rwLinkListGetTerminator(&clump->atomicList); link = rwLLLinkGetNext(link) )
|
||||
{
|
||||
if ( std::forward<Pred>(callback)(rwLLLinkGetData(link, RpAtomic, inClumpLink)) == nullptr )
|
||||
if ( callback(rwLLLinkGetData(link, RpAtomic, inClumpLink)) == nullptr )
|
||||
break;
|
||||
}
|
||||
return std::forward<Pred>(callback);
|
||||
return callback;
|
||||
}
|
||||
|
||||
template <typename Pred>
|
||||
Pred RpGeometryForAllMaterials(RpGeometry* geometry, Pred&& callback)
|
||||
Pred RpGeometryForAllMaterials(RpGeometry* geometry, Pred callback)
|
||||
{
|
||||
for ( RwInt32 i = 0, j = geometry->matList.numMaterials; i < j; i++ )
|
||||
{
|
||||
if ( std::forward<Pred>(callback)(geometry->matList.materials[i]) == nullptr )
|
||||
if ( callback(geometry->matList.materials[i]) == nullptr )
|
||||
break;
|
||||
}
|
||||
return std::forward<Pred>(callback);
|
||||
return callback;
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit cc5c9df5895e7c0ca0dc087a716f4782635ddcfe
|
||||
Subproject commit d70ae68a8e20c4cbd43f60e45586ce65304c1741
|
@ -159,7 +159,7 @@ RwFrame* GetFrameFromName( RwFrame* topFrame, const char* name )
|
||||
foundFrame = frame;
|
||||
return nullptr;
|
||||
}
|
||||
RwFrameForAllChildren( frame, std::forward<GetFramePredicate>(*this) );
|
||||
RwFrameForAllChildren(frame, std::ref(*this));
|
||||
return foundFrame != nullptr ? nullptr : frame;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ RwFrame* GetFrameFromID( RwFrame* topFrame, int32_t ID )
|
||||
foundFrame = frame;
|
||||
return nullptr;
|
||||
}
|
||||
RwFrameForAllChildren( frame, std::forward<GetFramePredicate>(*this) );
|
||||
RwFrameForAllChildren(frame, std::ref(*this));
|
||||
return foundFrame != nullptr ? nullptr : frame;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user