mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 23:03:01 +05:00
Fixes for C++17 conformance
This commit is contained in:
parent
0a5f47ab1b
commit
ce0fe83e66
2 changed files with 15 additions and 10 deletions
|
@ -116,21 +116,20 @@ std::tuple<int,int> CObject::TryOrFreeUpTempObjects( int numObjects, bool force
|
|||
int numProcessed = 0, numFreed = 0;
|
||||
|
||||
auto& pool = CPools::GetObjectPool();
|
||||
for ( auto& obj : pool )
|
||||
for ( auto obj : pool )
|
||||
{
|
||||
if ( numFreed >= numObjects ) break;
|
||||
|
||||
CObject* const objPtr = &obj;
|
||||
if ( pool.IsValidPtr( objPtr ) )
|
||||
if ( pool.IsValidPtr( obj ) )
|
||||
{
|
||||
if ( objPtr->m_objectCreatedBy == TEMP_OBJECT )
|
||||
if ( obj->m_objectCreatedBy == TEMP_OBJECT )
|
||||
{
|
||||
numProcessed++;
|
||||
if ( force || !objPtr->IsVisible() )
|
||||
if ( force || !obj->IsVisible() )
|
||||
{
|
||||
numFreed++;
|
||||
WorldRemove( objPtr );
|
||||
delete objPtr;
|
||||
WorldRemove( obj );
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,15 @@ public:
|
|||
return !GetIsFree( index );
|
||||
}
|
||||
|
||||
class iterator : public std::iterator<std::random_access_iterator_tag, ReturnType>
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
using value_type = ReturnType*;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = ReturnType* const *;
|
||||
using reference = ReturnType*;
|
||||
|
||||
iterator() : m_ptr(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -64,8 +70,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
reference operator* () const { return *reinterpret_cast<ReturnType*>(m_ptr); }
|
||||
pointer operator->() const { return reinterpret_cast<ReturnType*>(m_ptr); }
|
||||
reference operator* () const { return reinterpret_cast<ReturnType*>(m_ptr); }
|
||||
pointer operator->() const { return &reinterpret_cast<ReturnType*>(m_ptr); }
|
||||
|
||||
iterator& operator ++ () { ++m_ptr; return *this; }
|
||||
bool operator == ( const iterator& rhs ) const { return m_ptr == rhs.m_ptr; }
|
||||
|
|
Loading…
Reference in a new issue