mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
macos std vector fix
This commit is contained in:
parent
74a8449533
commit
cc84d821d9
2 changed files with 15 additions and 7 deletions
loader
|
@ -311,7 +311,8 @@ namespace gd {
|
|||
}
|
||||
|
||||
vector(std::vector<T> input) {
|
||||
auto tmp = new T[input.size()];
|
||||
std::allocator<T> alloc;
|
||||
auto tmp = alloc.allocate(input.size());
|
||||
|
||||
m_start = tmp;
|
||||
m_finish = m_start + input.size();
|
||||
|
@ -323,7 +324,8 @@ namespace gd {
|
|||
}
|
||||
|
||||
vector(std::initializer_list<T> const& input) {
|
||||
auto tmp = new T[input.size()];
|
||||
std::allocator<T> alloc;
|
||||
auto tmp = alloc.allocate(input.size());
|
||||
m_start = tmp;
|
||||
m_finish = m_start + input.size();
|
||||
m_capacity_end = m_start + input.size();
|
||||
|
@ -331,11 +333,11 @@ namespace gd {
|
|||
}
|
||||
|
||||
void clear() {
|
||||
delete[] m_start;
|
||||
auto tmp = new T[0];
|
||||
m_start = tmp;
|
||||
std::allocator<T> alloc;
|
||||
alloc.deallocate(m_start, (m_finish - m_start) / 8);
|
||||
m_start = alloc.allocate(1);
|
||||
m_finish = m_start;
|
||||
m_capacity_end = m_start;
|
||||
m_capacity_end = m_start + 8;
|
||||
}
|
||||
|
||||
T& front() {
|
||||
|
@ -363,7 +365,9 @@ namespace gd {
|
|||
vector() : vector(std::vector<T>()) {}
|
||||
|
||||
~vector() {
|
||||
delete[] m_start;
|
||||
for (auto i = m_start; i != m_finish; ++i) {
|
||||
delete i;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -36,6 +36,7 @@ void CCFileUtils::addPriorityPath(const char* path) {
|
|||
|
||||
void CCFileUtils::updatePaths() {
|
||||
// add search paths that aren't in PATHS or PACKS to PATHS
|
||||
|
||||
for (auto& path : m_searchPathArray) {
|
||||
bool isKnown = false;
|
||||
for (auto& pack : PACKS) {
|
||||
|
@ -60,10 +61,12 @@ void CCFileUtils::updatePaths() {
|
|||
}
|
||||
|
||||
// clear old paths
|
||||
|
||||
m_searchPathArray.clear();
|
||||
|
||||
// make sure addSearchPath doesn't add to PACKS or PATHS
|
||||
DONT_ADD_PATHS = true;
|
||||
|
||||
// add texture packs first
|
||||
for (auto& pack : PACKS) {
|
||||
for (auto& path : pack.m_paths) {
|
||||
|
@ -75,6 +78,7 @@ void CCFileUtils::updatePaths() {
|
|||
this->addSearchPath(path.c_str());
|
||||
}
|
||||
DONT_ADD_PATHS = false;
|
||||
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
|
Loading…
Add table
Reference in a new issue