Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions inkcpp/runner_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
9 changes: 5 additions & 4 deletions inkcpp/story_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ namespace ink::runtime::internal


CommandFlag story_impl::container_flag(ip_t offset) const {
inkAssert(static_cast<Command>(offset[0]) == Command::START_CONTAINER_MARKER ||
static_cast<Command>(offset[0]) == Command::END_CONTAINER_MARKER);
inkAssert((static_cast<Command>(offset[0]) == Command::START_CONTAINER_MARKER ||
static_cast<Command>(offset[0]) == Command::END_CONTAINER_MARKER), "Tried to fetch container flag from non container command!");
return static_cast<CommandFlag>(offset[1]);
}
CommandFlag story_impl::container_flag(container_t id) const {
Expand All @@ -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<Command>(offset[0]) == Command::START_CONTAINER_MARKER);
inkAssert(static_cast<Command>(offset[0]) == Command::START_CONTAINER_MARKER, "Container list pointer is invalid!");
return static_cast<CommandFlag>(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
Expand Down
6 changes: 4 additions & 2 deletions inkcpp/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace ink::runtime::internal

template<>
bool truthy_impl<value_type::OP_END>(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<>
Expand Down Expand Up @@ -87,7 +88,8 @@ namespace ink::runtime::internal
template<>
bool truthy_impl<value_type::divert>(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<value_type::divert + 1>(v, lists);
}
Expand Down