From fc10ed3df63f610fa4c3756ae121201f3c7a79f4 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Mon, 27 Apr 2020 18:26:31 -0500 Subject: [PATCH] Implementation for df-other-vectors-type in C++. Still needs Lua and Ruby support. --- library/include/BitArray.h | 10 ++++++++++ library/include/DataDefs.h | 1 + 2 files changed, 11 insertions(+) diff --git a/library/include/BitArray.h b/library/include/BitArray.h index cfb859bd0..dfd187363 100644 --- a/library/include/BitArray.h +++ b/library/include/BitArray.h @@ -568,4 +568,14 @@ namespace DFHack root->next = link; } }; + + template + struct DfOtherVectors + { + std::vector & operator[](O other_id) + { + auto vectors = reinterpret_cast *>(this); + return vectors[other_id]; + } + }; } diff --git a/library/include/DataDefs.h b/library/include/DataDefs.h index fd70b7ba8..3b961df20 100644 --- a/library/include/DataDefs.h +++ b/library/include/DataDefs.h @@ -474,6 +474,7 @@ namespace df using DFHack::BitArray; using DFHack::DfArray; using DFHack::DfLinkedList; + using DFHack::DfOtherVectors; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"