diff --git a/inkcpp/runner_impl.cpp b/inkcpp/runner_impl.cpp index ff983bbd..b4b6d1b3 100644 --- a/inkcpp/runner_impl.cpp +++ b/inkcpp/runner_impl.cpp @@ -246,18 +246,18 @@ namespace ink::runtime::internal bool allEnteredAtStart = true; ip_t child_position = dest; if(record_visits) { - const ContainerData* iter = nullptr; + const ContainerData* iData = nullptr; size_t level = _container.size(); - while(_container.iter(iter) && - (level > comm_end || _story->container_flag(iter->offset) & CommandFlag::CONTAINER_MARKER_ONLY_FIRST )) + while(_container.iter(iData) && + (level > comm_end || _story->container_flag(iData->offset) & CommandFlag::CONTAINER_MARKER_ONLY_FIRST )) { - auto offset = iter->offset; - inkAssert(child_position >= offset, "Container stack order is broken"); + auto parrent_offset = iData->offset; + inkAssert(child_position >= parrent_offset, "Container stack order is broken"); // 6 == len of START_CONTAINER_SIGNAL, if its 6 bytes behind the container it is a unnnamed subcontainers first child // check if child_positino is the first child of current container - allEnteredAtStart = allEnteredAtStart && ((child_position - offset) <= 6); - child_position = offset; - _globals->visit(iter->id, allEnteredAtStart); + allEnteredAtStart = allEnteredAtStart && ((child_position - parrent_offset) <= 6); + child_position = parrent_offset; + _globals->visit(iData->id, allEnteredAtStart); } } diff --git a/inkcpp/story_impl.cpp b/inkcpp/story_impl.cpp index 9d96c1e8..7c4689ac 100644 --- a/inkcpp/story_impl.cpp +++ b/inkcpp/story_impl.cpp @@ -156,8 +156,8 @@ namespace ink::runtime::internal CommandFlag story_impl::container_flag(ip_t offset) const { - inkAssert(static_cast(offset[0]) == Command::START_CONTAINER_MARKER || - static_cast(offset[0]) == Command::END_CONTAINER_MARKER); + inkAssert((static_cast(offset[0]) == Command::START_CONTAINER_MARKER || + static_cast(offset[0]) == Command::END_CONTAINER_MARKER), "Tried to fetch container flag from non container command!"); return static_cast(offset[1]); } CommandFlag story_impl::container_flag(container_t id) const { @@ -166,11 +166,12 @@ namespace ink::runtime::internal container_t c_id; while(iterate_containers(iter, c_id, offset)) { if (c_id == id) { - inkAssert(static_cast(offset[0]) == Command::START_CONTAINER_MARKER); + inkAssert(static_cast(offset[0]) == Command::START_CONTAINER_MARKER, "Container list pointer is invalid!"); return static_cast(offset[1]); } } - inkAssert("Container not found -> can't fetch flag"); + inkFail("Container not found -> can't fetch flag"); + return CommandFlag::NO_FLAGS; } ip_t story_impl::find_offset_for(hash_t path) const diff --git a/inkcpp/value.cpp b/inkcpp/value.cpp index 30962872..ec2fc0c0 100644 --- a/inkcpp/value.cpp +++ b/inkcpp/value.cpp @@ -15,7 +15,8 @@ namespace ink::runtime::internal template<> bool truthy_impl(const value& v, const list_table& lists) { - inkAssert("Type was not found in operational types or it has no conversion to boolean"); + inkFail("Type was not found in operational types or it has no conversion to boolean"); + return false; } template<> @@ -87,7 +88,8 @@ namespace ink::runtime::internal template<> bool truthy_impl(const value& v, const list_table& lists) { if (v.type() == value_type::divert) { - inkAssert("Divert can not be evaluated to boolean"); + inkFail("Divert can not be evaluated to boolean"); + return false; } else { return truthy_impl(v, lists); }