More CCameraManager progress

This commit is contained in:
2024-09-22 23:56:21 -06:00
parent 3d73c595c0
commit 141d88c0f7
15 changed files with 267 additions and 35 deletions

View File

@@ -37,12 +37,10 @@ public:
return *this;
}
const_pointer_iterator operator+(int v) const {
const_pointer_iterator it = *this;
return it += v;
return const_pointer_iterator(this->current + v);
}
const_pointer_iterator operator-(int v) const {
const_pointer_iterator it = *this;
return it -= v;
return const_pointer_iterator(this->current - v);
}
difference_type operator-(const const_pointer_iterator& other) const {
return this->current - other.current;
@@ -77,9 +75,8 @@ public:
typedef typename base::iterator_category iterator_category;
typedef typename base::value_type value_type;
pointer_iterator() : const_pointer_iterator< T, Vec, Alloc >(nullptr) {}
pointer_iterator(T* begin) : const_pointer_iterator< T, Vec, Alloc >(begin) {}
void operator=(const T& other) { rstl::construct(this->current, other); }
pointer_iterator() : base(nullptr) {}
pointer_iterator(T* begin) : base(begin) {}
T& operator*() { return *this->current; }
// TODO map says const, but breaks CScriptMazeNode::GenerateObjects
T* operator->() { return this->current; }
@@ -104,12 +101,10 @@ public:
return *this;
}
pointer_iterator operator+(int v) const {
pointer_iterator it = *this;
return it += v;
return pointer_iterator(current + v);
}
pointer_iterator operator-(int v) const {
pointer_iterator it = *this;
return it -= v;
return pointer_iterator(current - v);
}
// HACK: non-const operator- is required to match vector::insert
difference_type operator-(const pointer_iterator& other) { return this->current - other.current; }

View File

@@ -3,6 +3,7 @@
#include "types.h"
#include "rstl/iterator.hpp"
#include "rstl/pointer_iterator.hpp"
#include "rstl/rmemory_allocator.hpp"
@@ -215,17 +216,17 @@ typename vector< T, Alloc >::iterator vector< T, Alloc >::erase(iterator it) {
return erase(it, it + 1);
}
// TODO nonmatching (CCameraManager::RemoveCinemaCamera)
template < typename T, typename Alloc >
typename vector< T, Alloc >::iterator vector< T, Alloc >::erase(iterator first, iterator last) {
destroy(first, last);
iterator start = begin();
int newCount = rstl::distance(first, start);
int newCount = start - first;
iterator moved = start + newCount;
for (iterator it = last; it != end(); ++it) {
for (iterator it = last; it != end(); ++moved, ++newCount, ++it) {
construct(&*moved, *it);
++moved;
++newCount;
}
x4_count = newCount;