diff --git a/library/DataIdentity.cpp b/library/DataIdentity.cpp index 2e15e0d048..3d8373bcd0 100644 --- a/library/DataIdentity.cpp +++ b/library/DataIdentity.cpp @@ -58,4 +58,7 @@ namespace df { OPAQUE_IDENTITY_TRAITS(std::weak_ptr); buffer_container_identity buffer_container_identity::base_instance; + + DFHACK_EXPORT stl_container_identity > stl_vector_int32_t_identity("vector", identity_traits::get()); + DFHACK_EXPORT stl_container_identity > stl_vector_int16_t_identity("vector", identity_traits::get()); } diff --git a/library/include/DataIdentity.h b/library/include/DataIdentity.h index a3dd3216e5..6d1806c2f4 100644 --- a/library/include/DataIdentity.h +++ b/library/include/DataIdentity.h @@ -370,6 +370,7 @@ namespace df return ((uint8_t*)ptr) + idx * item->byte_size(); } }; +#endif template class stl_container_identity : public container_identity { @@ -406,6 +407,7 @@ namespace df } }; +#ifdef BUILD_DFHACK_LIB template class ro_stl_container_identity : public container_identity { protected: @@ -667,6 +669,18 @@ namespace df static stl_ptr_vector_identity *get(); }; + // explicit specializations for these two types + // for availability in plugins + + template<> struct identity_traits > { + static container_identity* get(); + }; + + template<> struct identity_traits > { + static container_identity* get(); + }; + + #ifdef BUILD_DFHACK_LIB template struct identity_traits > { static container_identity *get(); @@ -739,6 +753,19 @@ namespace df return &identity; } + // explicit specializations for these two types + // for availability in plugins + + extern DFHACK_EXPORT stl_container_identity > stl_vector_int32_t_identity; + inline container_identity* identity_traits >::get() { + return &stl_vector_int32_t_identity; + } + + extern DFHACK_EXPORT stl_container_identity > stl_vector_int16_t_identity; + inline container_identity* identity_traits >::get() { + return &stl_vector_int16_t_identity; + } + #ifdef BUILD_DFHACK_LIB template inline container_identity *identity_traits >::get() {