diff --git a/inkcpp/CMakeLists.txt b/inkcpp/CMakeLists.txt index 0e4a426d..9b818983 100644 --- a/inkcpp/CMakeLists.txt +++ b/inkcpp/CMakeLists.txt @@ -1,8 +1,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) list(APPEND SOURCES - collections/restorable.h - collections/restorable.cpp + restorable.h array.h choice.cpp functional.cpp @@ -18,11 +17,16 @@ list(APPEND SOURCES value.h value.cpp string_table.h string_table.cpp avl_array.h list_table.h list_table.cpp + casting.h + operations.h operation_bases.h + numeric_operations.h string_operations.h list_operations.h list_operations.cpp container_operations.h container_operations.cpp string_operations.cpp numeric_operations.cpp - header.cpp + header.cpp tuple.hpp + string_utils.h random.h + executioner.h ) source_group(Collections REGULAR_EXPRESSION collections/.*) add_library(inkcpp ${SOURCES}) diff --git a/inkcpp/avl_array.h b/inkcpp/avl_array.h index 9690149a..6071b8ca 100644 --- a/inkcpp/avl_array.h +++ b/inkcpp/avl_array.h @@ -482,9 +482,9 @@ class avl_array /** * Integrity (self) check - * \return True if the tree intergity is correct, false if error (should not happen normally) + * \return True if the tree integrity is correct, false if error (should not happen normally) */ - bool check() const + bool check_integrity() const { // check root if (empty() && (root_ != INVALID_IDX)) { diff --git a/inkcpp/collections/restorable.cpp b/inkcpp/collections/restorable.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/inkcpp/functional.cpp b/inkcpp/functional.cpp index 0fe4cc69..185e6e70 100644 --- a/inkcpp/functional.cpp +++ b/inkcpp/functional.cpp @@ -43,7 +43,10 @@ namespace ink::runtime::internal } #endif #ifdef INK_ENABLE_UNREAL - SUPPORT_TYPE_PARAMETER_ONLY(FString); + template<> + FString function_base::pop(basic_eval_stack* stack) { + return FString(pop(stack)); + } template<> FInkVar function_base::pop(basic_eval_stack* stack) @@ -51,42 +54,40 @@ namespace ink::runtime::internal value v = stack->pop(); switch (v.type()) { - case value_type::null: - case value_type::divert: - inkFail("Trying to pass null or divert as ink parameter to external function"); - break; - case value_type::integer: - return FInkVar(v.get()); - case value_type::decimal: - return FInkVar(v.get()); + case value_type::int32: + return FInkVar(v.get()); + case value_type::float32: + return FInkVar(v.get()); case value_type::string: - return FInkVar(v.get()); + return FInkVar(FString(v.get().str)); } + inkFail("You can only pass integers, floats, or strings into ink functions."); return FInkVar(); } template<> void function_base::push(basic_eval_stack* stack, const FInkVar& value) { + internal::value v; + switch (value.type) { case EInkVarType::None: - { - internal::value v; - stack->push(v); - } + // Set to none break; case EInkVarType::Int: - stack->push(value.intVar); + v.set(value.intVar); break; case EInkVarType::Float: - stack->push(value.floatVar); + v.set(value.floatVar); break; case EInkVarType::String: inkFail("NOT IMPLEMENTED"); // TODO: String support return; } + + stack->push(v); } #endif } diff --git a/inkcpp/list_operations.cpp b/inkcpp/list_operations.cpp index 252a7244..acc60fe8 100644 --- a/inkcpp/list_operations.cpp +++ b/inkcpp/list_operations.cpp @@ -23,7 +23,7 @@ ) \ )); \ } else {\ - inkAssert(vals[1].type()==value_type::list_flag);\ + inkAssert(vals[1].type()==value_type::list_flag, "Value must be a list!");\ stack.push(value{}.set( \ _list_table.FUN( \ vals[0].get(), \ @@ -32,7 +32,7 @@ )); \ } \ } else { \ - inkAssert(vals[0].type() == value_type::list); \ + inkAssert(vals[0].type() == value_type::list, "Value must be a list!"); \ if(vals[1].type() == value_type::list) { \ stack.push(value{}.set( \ _list_table.FUN( \ @@ -41,7 +41,7 @@ ) \ )); \ } else {\ - inkAssert(vals[1].type()==value_type::list_flag);\ + inkAssert(vals[1].type()==value_type::list_flag, "Value must be a list!");\ stack.push(value{}.set( \ _list_table.FUN( \ vals[0].get(), \ @@ -77,7 +77,7 @@ namespace ink::runtime::internal { int i = vals[1].type() == value_type::int32 ? vals[1].get() : vals[1].get(); - inkAssert(vals[0].type() == value_type::list); + inkAssert(vals[0].type() == value_type::list, "Value must be a list!"); stack.push(value{}.set( _list_table.add(vals[0].get(), i) )); @@ -88,9 +88,9 @@ namespace ink::runtime::internal { void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::list_flag); + inkAssert(vals[0].type() == value_type::list_flag, "Value must be a list!"); inkAssert(vals[1].type() == value_type::int32 - || vals[1].type() == value_type::uint32); + || vals[1].type() == value_type::uint32, "Second value must be a number!"); int i = vals[1].type() == value_type::int32 ? vals[1].get() : vals[1].get(); @@ -108,7 +108,7 @@ namespace ink::runtime::internal { int i = vals[1].type() == value_type::int32 ? vals[1].get() : vals[1].get(); - inkAssert(vals[0].type() == value_type::list); + inkAssert(vals[0].type() == value_type::list, "Value must be a list!"); stack.push(value{}.set( _list_table.sub(vals[0].get(), i) )); @@ -119,9 +119,9 @@ namespace ink::runtime::internal { void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::list_flag); + inkAssert(vals[0].type() == value_type::list_flag, "Value must be a list!"); inkAssert(vals[1].type() == value_type::int32 - || vals[1].type() == value_type::uint32); + || vals[1].type() == value_type::uint32, "Second value must be a number!"); int i = vals[1].type() == value_type::int32 ? vals[1].get() : vals[1].get(); @@ -170,8 +170,8 @@ namespace ink::runtime::internal { void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::string); - inkAssert(vals[1].type() == value_type::int32); + inkAssert(vals[0].type() == value_type::string, "Value must be a string!"); + inkAssert(vals[1].type() == value_type::int32, "Second value must be a number!"); list_flag entry = _list_table.get_list_id(vals[0].get()); entry.flag = vals[1].get() - 1; stack.push(value{}.set(entry)); @@ -181,14 +181,14 @@ namespace ink::runtime::internal { if(val.type() == value_type::int32) { return val.get() - 1; } else { - inkAssert(val.type() == value_type::list_flag); + inkAssert(val.type() == value_type::list_flag, "Value must be a list!"); return val.get().flag; } } void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::list); + inkAssert(vals[0].type() == value_type::list, "Value must be a list!"); stack.push(value{}.set(_list_table.range( vals[0].get(), get_limit(vals[1]), diff --git a/inkcpp/list_table.cpp b/inkcpp/list_table.cpp index 06b57aa8..7da5bc96 100644 --- a/inkcpp/list_table.cpp +++ b/inkcpp/list_table.cpp @@ -52,7 +52,7 @@ namespace ink::runtime::internal list_table::list list_table::create() { - for(int i = 0; i < _entry_state.size(); ++i) { + for(int i = 0; i < (int)_entry_state.size(); ++i) { if (_entry_state[i] == state::empty) { _entry_state[i] = state::used; return list(i); @@ -82,7 +82,7 @@ namespace ink::runtime::internal } void list_table::gc() { - for(int i = 0; i < _entry_state.size(); ++i) { + for(int i = 0; i < (int)_entry_state.size(); ++i) { if (_entry_state[i] == state::unused) { _entry_state[i] = state::empty; data_t* entry = getPtr(i); @@ -308,19 +308,19 @@ namespace ink::runtime::internal data_t* l = getPtr(arg.lid); data_t* o = getPtr(res.lid); bool active_flag = false;; - for(int i = 0; i < numLists(); ++i) { - if(hasList(l, i)) { + for(int m = 0; m < numLists(); ++m) { + if(hasList(l, m)) { bool has_flag = false; - for(int j = listBegin(i); j < _list_end[i] - i;++j) + for(int j = listBegin(m); j < _list_end[m] - m;++j) { if(hasFlag(l, j)) { - setFlag(o,j+i); + setFlag(o,j+m); has_flag = true; } } if(has_flag) { active_flag = true; - setList(o,i); + setList(o,m); } } } @@ -348,19 +348,19 @@ namespace ink::runtime::internal data_t* l = getPtr(arg.lid); data_t* o = getPtr(res.lid); bool active_flag = false; - for(int i = 0; i < numLists(); ++i) { - if(hasList(l, i)) { + for(int m = 0; m < numLists(); ++m) { + if(hasList(l, m)) { bool has_flag = false; - for(int j = listBegin(i) + i; j < _list_end[i]; ++j) + for(int j = listBegin(m) + m; j < _list_end[m]; ++j) { if(hasFlag(l,j)) { - setFlag(o,j-i); + setFlag(o,j-m); has_flag = true; } } if(has_flag) { active_flag = true; - setList(o, i); + setList(o, m); } } } @@ -554,8 +554,8 @@ namespace ink::runtime::internal list_flag list_table::lrnd(list lh, prng& rng) const { const data_t* l = getPtr(lh.lid); - int i = count(lh); - rng.rand(i); + int c = count(lh); + rng.rand(c); int count = 0; for(int i = 0; i < numLists(); ++i) { if(hasList(l, i)) { diff --git a/inkcpp/list_table.h b/inkcpp/list_table.h index 3ebd5497..5f2a7c0b 100644 --- a/inkcpp/list_table.h +++ b/inkcpp/list_table.h @@ -8,7 +8,7 @@ #endif namespace ink::internal { - class header; + struct header; } namespace ink::runtime::internal { @@ -215,7 +215,7 @@ namespace ink::runtime::internal abs(config::maxListTypes) + abs(config::maxFlags), sizeof(data_t) - ) * abs(config::maxLists); + ) * (int)abs(config::maxLists); int _entrySize; ///< entry size in data_t // entries (created lists) diff --git a/inkcpp/numeric_operations.cpp b/inkcpp/numeric_operations.cpp index 16f67ae0..2cdb8a9f 100644 --- a/inkcpp/numeric_operations.cpp +++ b/inkcpp/numeric_operations.cpp @@ -19,7 +19,7 @@ namespace ink::runtime::internal { void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::float32); + inkAssert(vals[0].type() == value_type::float32, "Value must be a float!"); stack.push(value{}.set( floor(vals->get()))); } @@ -27,7 +27,7 @@ namespace ink::runtime::internal { void operation::operator()( basic_eval_stack& stack, value* vals) { - inkAssert(vals[0].type() == value_type::float32); + inkAssert(vals[0].type() == value_type::float32, "Value must be a float!"); stack.push(value{}.set( ceil(vals->get()))); } diff --git a/inkcpp/operations.h b/inkcpp/operations.h index 98339ffe..9e79a711 100644 --- a/inkcpp/operations.h +++ b/inkcpp/operations.h @@ -2,7 +2,7 @@ /// Define base constructs to specify by operation headers. -#include "../shared/private/command.h" +#include "command.h" namespace ink::runtime::internal { diff --git a/inkcpp/output.cpp b/inkcpp/output.cpp index ac51713c..5c202370 100644 --- a/inkcpp/output.cpp +++ b/inkcpp/output.cpp @@ -108,11 +108,11 @@ namespace ink return false; } - template - void basic_stream::copy_string(const char* str, size_t& dataIter, OUT& output) + template + void basic_stream::copy_string(const char* str, size_t& dataIter, OutputType& output) { while(*str != 0) { - write_char(output, *str++); + write_char(output, *str++); } } diff --git a/inkcpp/output.h b/inkcpp/output.h index 60663f8e..0ccba23e 100644 --- a/inkcpp/output.h +++ b/inkcpp/output.h @@ -103,8 +103,8 @@ namespace ink size_t find_start() const; bool should_skip(size_t iter, bool& hasGlue, bool& lastNewline) const; - template - void copy_string(const char* str, size_t& dataIter, OUT& output); + template + void copy_string(const char* str, size_t& dataIter, OutputType& output); private: char _last_char; diff --git a/inkcpp/random.h b/inkcpp/random.h index 995b7947..ab6aff18 100644 --- a/inkcpp/random.h +++ b/inkcpp/random.h @@ -1,6 +1,6 @@ #pragma once -#include "../shared/public/system.h" +#include "system.h" namespace ink::runtime::internal { /** diff --git a/inkcpp/collections/restorable.h b/inkcpp/restorable.h similarity index 100% rename from inkcpp/collections/restorable.h rename to inkcpp/restorable.h diff --git a/inkcpp/runner_impl.cpp b/inkcpp/runner_impl.cpp index 8975e631..99296a96 100644 --- a/inkcpp/runner_impl.cpp +++ b/inkcpp/runner_impl.cpp @@ -531,8 +531,8 @@ namespace ink::runtime::internal // TODO return nullptr; -#endif } +#endif bool runner_impl::move_to(hash_t path) { @@ -832,7 +832,7 @@ namespace ink::runtime::internal if(flag & CommandFlag::TUNNEL_TO_VARIABLE) { hash_t var_name = read(); const value* val = get_var(var_name); - inkAssert(val != nullptr); + inkAssert(val != nullptr, "Tunnel variable undefined"); target = val->get(); } else { target = read(); @@ -847,7 +847,7 @@ namespace ink::runtime::internal if(flag & CommandFlag::FUNCTION_TO_VARIABLE) { hash_t var_name = read(); const value* val = get_var(var_name); - inkAssert(val != nullptr); + inkAssert(val != nullptr, "Function variable undefined"); target = val->get(); } else { target = read(); diff --git a/inkcpp/runner_impl.h b/inkcpp/runner_impl.h index 7f208036..41f3498f 100644 --- a/inkcpp/runner_impl.h +++ b/inkcpp/runner_impl.h @@ -191,6 +191,8 @@ namespace ink::runtime::internal _threadDone.clear(nullptr); } + virtual ~threads() { } + void clear() { base::clear(); _threadDone.clear(nullptr); diff --git a/inkcpp/stack.h b/inkcpp/stack.h index 147e4c54..b4362474 100644 --- a/inkcpp/stack.h +++ b/inkcpp/stack.h @@ -1,7 +1,7 @@ #pragma once #include "value.h" -#include "collections/restorable.h" +#include "restorable.h" #include "array.h" namespace ink diff --git a/inkcpp/tuple.hpp b/inkcpp/tuple.hpp index 528c8d47..eb4f99a5 100644 --- a/inkcpp/tuple.hpp +++ b/inkcpp/tuple.hpp @@ -2,7 +2,7 @@ /// very basic flat tuple implementation, only use for trivial data types. -#include "./include/traits.h" +#include "traits.h" namespace ink::runtime::internal { namespace tuple_internal { diff --git a/inkcpp/value.h b/inkcpp/value.h index 88382f5a..509278a2 100644 --- a/inkcpp/value.h +++ b/inkcpp/value.h @@ -6,7 +6,7 @@ /// define different value_types, and the mapping between type and data. #include "system.h" -#include "../shared/private/command.h" +#include "command.h" #include "list_table.h" #include "tuple.hpp" @@ -87,7 +87,7 @@ namespace ink::runtime::internal { /// help struct to determine cpp type which represent the value_type template struct ret { using type = void; }; - constexpr value() : _type{value_type::none}, uint32_value{0}{} + constexpr value() : uint32_value{0}, _type{value_type::none} { } /// get value of the type (if possible) template @@ -122,7 +122,7 @@ namespace ink::runtime::internal { /// this new type template value redefine(const value& oth, T& ... env) const { - inkAssert(type() == oth.type()); + inkAssert(type() == oth.type(), "Types must match!"); return redefine(oth, {&env...}); } diff --git a/inkcpp_compiler/binary_emitter.cpp b/inkcpp_compiler/binary_emitter.cpp index dd163e63..44c0e1d2 100644 --- a/inkcpp_compiler/binary_emitter.cpp +++ b/inkcpp_compiler/binary_emitter.cpp @@ -171,8 +171,8 @@ namespace ink::compiler::internal void binary_emitter::write_list(Command command, CommandFlag flag, const std::vector& entries) { uint32_t id = _list_count++; - for(const list_flag& flag : entries) { - _lists.write(flag); + for(const list_flag& entry_flag : entries) { + _lists.write(entry_flag); } _lists.write(null_flag); write(command, id, flag); diff --git a/inkcpp_compiler/json_compiler.cpp b/inkcpp_compiler/json_compiler.cpp index d5ebe17f..16047312 100644 --- a/inkcpp_compiler/json_compiler.cpp +++ b/inkcpp_compiler/json_compiler.cpp @@ -90,14 +90,14 @@ namespace ink::compiler::internal container_t myIndex = _next_container_index++; // Make appropriate flags - CommandFlag flags = CommandFlag::NO_FLAGS; + CommandFlag command_flags = CommandFlag::NO_FLAGS; if (visits) - flags |= CommandFlag::CONTAINER_MARKER_TRACK_VISITS; + command_flags |= CommandFlag::CONTAINER_MARKER_TRACK_VISITS; if (turns) - flags |= CommandFlag::CONTAINER_MARKER_TRACK_TURNS; + command_flags |= CommandFlag::CONTAINER_MARKER_TRACK_TURNS; // Write command out at this position - _emitter->write(Command::START_CONTAINER_MARKER, myIndex, flags); + _emitter->write(Command::START_CONTAINER_MARKER, myIndex, command_flags); data.indexToReturn = myIndex; @@ -196,8 +196,8 @@ namespace ink::compiler::internal std::vector divert_positions; // Write empty divert to be patched later - uint32_t position = _emitter->fallthrough_divert(); - divert_positions.push_back(position); + uint32_t div_pos = _emitter->fallthrough_divert(); + divert_positions.push_back(div_pos); // (2) Write deffered containers for (auto& t : meta.deferred) diff --git a/inkcpp_test/Restorable.cpp b/inkcpp_test/Restorable.cpp index 2da96f97..2a66ca17 100644 --- a/inkcpp_test/Restorable.cpp +++ b/inkcpp_test/Restorable.cpp @@ -1,6 +1,6 @@ #include "catch.hpp" -#include "../inkcpp/collections/restorable.h" +#include "../inkcpp/restorable.h" using ink::runtime::internal::restorable; diff --git a/inkcpp_test/Value.cpp b/inkcpp_test/Value.cpp index 47fb2cdd..34976d12 100644 --- a/inkcpp_test/Value.cpp +++ b/inkcpp_test/Value.cpp @@ -9,7 +9,7 @@ #include "../inkcpp/random.h" #include "../inkcpp/output.h" #include "../inkcpp/executioner.h" -#include "../shared/private/command.h" +#include "command.h" #include "../inkcpp/story_impl.h" #include "../inkcpp/runner_impl.h" diff --git a/shared/private/command.h b/shared/public/command.h similarity index 100% rename from shared/private/command.h rename to shared/public/command.h diff --git a/shared/public/system.h b/shared/public/system.h index 0779ac2c..3f76000e 100644 --- a/shared/public/system.h +++ b/shared/public/system.h @@ -118,8 +118,8 @@ namespace ink // assert #ifndef INK_ENABLE_UNREAL - void ink_assert(bool condition, const char* msg = nullptr); - [[ noreturn ]] inline void ink_assert(const char* msg = nullptr) { ink_assert(false, msg); exit(EXIT_FAILURE);} + void ink_assert(bool condition, const char* msg); + [[ noreturn ]] inline void ink_assert(const char* msg) { ink_assert(false, msg); exit(EXIT_FAILURE); } #else [[ noreturn ]] inline void ink_fail(const char*) { check(false); throw nullptr; } #endif @@ -141,7 +141,7 @@ namespace ink namespace runtime::internal { - constexpr unsigned abs(int i) { return i < 0 ? -i : i; } + constexpr unsigned abs(int i) { return static_cast(i < 0 ? -i : i); } template struct always_false { static constexpr bool value = false; }; @@ -175,8 +175,8 @@ namespace ink public: optional() {} optional(nullopt_t) {} - optional(T&& val) _has_value{true}, _value{std::forward(val)}{} - optional(const T& val) _has_value{true}, _value{val}{} + optional(T&& val): _has_value{true}, _value{std::forward(val)}{} + optional(const T& val): _has_value{true}, _value{val}{} const T& operator*() const { return _value; } T& operator*() { return _value; } @@ -184,15 +184,15 @@ namespace ink T* operator->() { return &_value; } constexpr bool has_value() const { return _has_value; } - constexpr T& value() { check(); return _value; } - constexpr const T& value() const { check(); return _value; } + constexpr T& value() { check_valid(); return _value; } + constexpr const T& value() const { check_valid(); return _value; } constexpr operator bool() const { return has_value(); } template constexpr T value_or(U&& u) const { return _has_value ? _value : static_cast(std::forward(u)); } private: - void check() const { + void check_valid() const { if ( ! _has_value) { throw ink_exception("Can't access empty optional!"); } diff --git a/unreal/inkcpp/Source/inkcpp/Private/Choice.cpp b/unreal/inkcpp/Source/inkcpp/Private/Choice.cpp deleted file mode 100644 index eed7467b..00000000 --- a/unreal/inkcpp/Source/inkcpp/Private/Choice.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "Choice.h" - -#include "ink/choice.h" - -FString UChoice::GetText() const -{ - return data->text(); -} - -int UChoice::GetIndex() const -{ - return data->index(); -} - -void UChoice::Initialize(const ink::runtime::choice* c) -{ - data = c; -} \ No newline at end of file diff --git a/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp b/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp new file mode 100644 index 00000000..85cd0b31 --- /dev/null +++ b/unreal/inkcpp/Source/inkcpp/Private/InkChoice.cpp @@ -0,0 +1,18 @@ +#include "InkChoice.h" + +#include "ink/choice.h" + +FString UInkChoice::GetText() const +{ + return data->text(); +} + +int UInkChoice::GetIndex() const +{ + return data->index(); +} + +void UInkChoice::Initialize(const ink::runtime::choice* c) +{ + data = c; +} \ No newline at end of file diff --git a/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp b/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp index 3bd0ca28..4a94987e 100644 --- a/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp +++ b/unreal/inkcpp/Source/inkcpp/Private/InkThread.cpp @@ -155,10 +155,10 @@ bool UInkThread::ExecuteInternal() // TODO: Record choices somewhere? // Forward to handler - TArray choices; + TArray choices; for (ink::size_t i = 0; i < mpRunner->num_choices(); i++) { - UChoice* choice = NewObject(this); + UInkChoice* choice = NewObject(this); choice->Initialize(mpRunner->get_choice(i)); choices.Add(choice); } diff --git a/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h b/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h index 812da6d6..59b272d3 100644 --- a/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h +++ b/unreal/inkcpp/Source/inkcpp/Public/InkAsset.h @@ -1,6 +1,6 @@ #pragma once -#include "Object.h" +#include "UObject/Object.h" #include "InkAsset.generated.h" diff --git a/unreal/inkcpp/Source/inkcpp/Public/Choice.h b/unreal/inkcpp/Source/inkcpp/Public/InkChoice.h similarity index 78% rename from unreal/inkcpp/Source/inkcpp/Public/Choice.h rename to unreal/inkcpp/Source/inkcpp/Public/InkChoice.h index a2898b4c..da31ab33 100644 --- a/unreal/inkcpp/Source/inkcpp/Public/Choice.h +++ b/unreal/inkcpp/Source/inkcpp/Public/InkChoice.h @@ -1,13 +1,13 @@ #pragma once -#include "Object.h" +#include "UObject/Object.h" -#include "Choice.generated.h" +#include "InkChoice.generated.h" namespace ink::runtime { class choice; } UCLASS(BlueprintType) -class UChoice : public UObject +class UInkChoice : public UObject { GENERATED_BODY() public: diff --git a/unreal/inkcpp/Source/inkcpp/Public/InkThread.h b/unreal/inkcpp/Source/inkcpp/Public/InkThread.h index aab55806..aceb0613 100644 --- a/unreal/inkcpp/Source/inkcpp/Public/InkThread.h +++ b/unreal/inkcpp/Source/inkcpp/Public/InkThread.h @@ -14,7 +14,7 @@ class UTagList; class AInkRuntime; -class UChoice; +class UInkChoice; DECLARE_DYNAMIC_DELEGATE_ThreeParams(FTagFunctionDelegate, FString, FirstParameter, FString, SecondParameter, FString, ThirdParameter); DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FTagFunctionMulticastDelegate, FString, FirstParameter, FString, SecondParameter, FString, ThirdParameter); @@ -67,7 +67,7 @@ class INKCPP_API UInkThread : public UObject // Called when the thread has requested a branch UFUNCTION(BlueprintNativeEvent) - void OnChoice(const TArray& choices); + void OnChoice(const TArray& choices); // Called before the thread is destroyed UFUNCTION(BlueprintNativeEvent) @@ -91,7 +91,7 @@ class INKCPP_API UInkThread : public UObject virtual void OnStartup_Implementation() { } virtual void OnLineWritten_Implementation(const FString& line, UTagList* tags) { } virtual void OnTag_Implementation(const FString& line) { } - virtual void OnChoice_Implementation(const TArray& choices) { } + virtual void OnChoice_Implementation(const TArray& choices) { } virtual void OnShutdown_Implementation() { } private: diff --git a/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs b/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs index 125b703c..5c7276bf 100644 --- a/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs +++ b/unreal/inkcpp/Source/inkcpp/inkcpp.Build.cs @@ -21,7 +21,8 @@ public inkcpp(ReadOnlyTargetRules Target) : base(Target) PrivateIncludePaths.AddRange( new string[] { - Path.Combine(ModuleDirectory, "../shared/Private") + Path.Combine(ModuleDirectory, "../shared/Private"), + Path.Combine(ModuleDirectory, "Public/ink"), } );