Implementation for df-other-vectors-type in C++. Still needs Lua and Ruby support.

develop
Ben Lubar 2020-04-27 18:26:31 -05:00
parent 0ffafbde29
commit fc10ed3df6
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
2 changed files with 11 additions and 0 deletions

@ -568,4 +568,14 @@ namespace DFHack
root->next = link; root->next = link;
} }
}; };
template<typename T, typename O, typename I>
struct DfOtherVectors
{
std::vector<I *> & operator[](O other_id)
{
auto vectors = reinterpret_cast<std::vector<I *> *>(this);
return vectors[other_id];
}
};
} }

@ -474,6 +474,7 @@ namespace df
using DFHack::BitArray; using DFHack::BitArray;
using DFHack::DfArray; using DFHack::DfArray;
using DFHack::DfLinkedList; using DFHack::DfLinkedList;
using DFHack::DfOtherVectors;
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor" #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"