From f55bf7f4bd2bca71fbff4e208f6b2989a619f1ba Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 16 Jan 2021 16:46:35 +0100 Subject: [PATCH] Fix ambigous template arguments. --- CMakeLists.txt | 2 +- libs/generic/callback.h | 4 +-- libs/property.h | 66 ++++++++++++++++++++++------------------- radiant/dialog.cpp | 31 +++++++++---------- tools/vmap/game_fte.h | 2 +- 5 files changed, 56 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7d5c06..71ac1c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ endif () # CMake 3.0+ would allow this in project() set(WorldSpawn_VERSION_MAJOR 1) -set(WorldSpawn_VERSION_MINOR 0) +set(WorldSpawn_VERSION_MINOR 1) set(WorldSpawn_VERSION_PATCH 0) set(WorldSpawn_VERSION "${WorldSpawn_VERSION_MAJOR}.${WorldSpawn_VERSION_MINOR}.${WorldSpawn_VERSION_PATCH}") diff --git a/libs/generic/callback.h b/libs/generic/callback.h index 577dd9d..7479826 100644 --- a/libs/generic/callback.h +++ b/libs/generic/callback.h @@ -101,7 +101,7 @@ namespace detail { // pointer - template + template::value>::type> inline const void *convertToOpaque(const T *t) { return t; } @@ -113,7 +113,7 @@ namespace detail { } }; - template + template::value>::type> inline void *convertToOpaque(T *t) { return t; } diff --git a/libs/property.h b/libs/property.h index abdb32f..71bf060 100644 --- a/libs/property.h +++ b/libs/property.h @@ -102,6 +102,23 @@ Property make_property(Self &self) { // chain +template +struct make_property_chain_I_1 { + static void ExportThunk(const Callback &self, SRC value) { + PropertyImpl::Export(value, self); + } + + static void Export(const X &self, const Callback &returnz) { + A::Get::thunk_(self, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); + } + + static void Import(X &self, DST value) { + SRC out; + PropertyImpl::Import(out, value); + A::Set::thunk_(self, out); + } +}; + template Property> make_property_chain(detail::propertyimpl_self &it) { using DST = detail::propertyimpl_other; @@ -109,45 +126,34 @@ Property> make_property_chain(detail::proper using X = detail::propertyimpl_self; using A = property_impl; - struct I { - static void ExportThunk(const Callback &self, SRC value) { - PropertyImpl::Export(value, self); - } - - static void Export(const X &self, const Callback &returnz) { - A::Get::thunk_(self, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); - } - - static void Import(X &self, DST value) { - SRC out; - PropertyImpl::Import(out, value); - A::Set::thunk_(self, out); - } - }; + using I = make_property_chain_I_1; return make_property>(it); } +template +struct make_property_chain_I_2 { + static void ExportThunk(const Callback &self, SRC value) { + PropertyImpl::Export(value, self); + } + + static void Export(const Callback &returnz) { + A::Get::thunk_(nullptr, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); + } + + static void Import(DST value) { + SRC out; + PropertyImpl::Import(out, value); + A::Set::thunk_(nullptr, out); + } +}; + template Property> make_property_chain() { using DST = detail::propertyimpl_other; using SRC = detail::propertyimpl_self; using A = property_impl_free; - struct I { - static void ExportThunk(const Callback &self, SRC value) { - PropertyImpl::Export(value, self); - } - - static void Export(const Callback &returnz) { - A::Get::thunk_(nullptr, ConstReferenceCaller, void(SRC), ExportThunk>(returnz)); - } - - static void Import(DST value) { - SRC out; - PropertyImpl::Import(out, value); - A::Set::thunk_(nullptr, out); - } - }; + using I = make_property_chain_I_2; return make_property>(); } diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 3b59f6a..a1baafc 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -284,27 +284,28 @@ public: } }; +template +struct AddDataCustom_Wrapper { + static void Export(const native &self, const Callback &returnz) { + native *p = &const_cast(self); + auto widget = Self::from(p); + Widget::Get::thunk_(widget, returnz); + } + + static void Import(native &self, T value) { + native *p = &self; + auto widget = Self::from(p); + Widget::Set::thunk_(widget, value); + } +}; + template void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property const &property) { using Self = typename Widget::Type; using T = typename Widget::Other; using native = typename std::remove_pointer::type; - struct Wrapper { - static void Export(const native &self, const Callback &returnz) - { - native *p = &const_cast(self); - auto widget = Self::from(p); - Widget::Get::thunk_(widget, returnz); - } - - static void Import(native &self, T value) - { - native *p = &self; - auto widget = Self::from(p); - Widget::Set::thunk_(widget, value); - } - }; + using Wrapper = AddDataCustom_Wrapper; self.push_back(new CallbackDialogData( make_property>(*static_cast(widget)), property diff --git a/tools/vmap/game_fte.h b/tools/vmap/game_fte.h index 7f09780..b8abd22 100644 --- a/tools/vmap/game_fte.h +++ b/tools/vmap/game_fte.h @@ -186,7 +186,7 @@ { "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 }, /* nodraw2 is seen by the engine but NOT handled by the compiler tools, and thus never stripped */ - { "nodraw2", 0, 0, Q_SURF_NODRAW, 0, 0, 0 }, + { "nodraw2", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 }, /* q2/hlish-style ladder volumes */ { "laddervolume", FTE_CONT_LADDER, Q_CONT_SOLID, 0, 0, 0, 0 }, /* trisoup uses mesh collisions, instead of being non-solid */