Skip to content

[0.17] Tags aren't processed correctly #95

@MrHands

Description

@MrHands

NOTE: I'm already working on a pull request to address this issue.

I have a straightforward Ink program called "test.ink":

# first tag
This is the first line

# second tag
This is the second line

Here's a sample program for loading a binary compiled with inkcpp 0.17:

#include <ink/runner.h>
#include <ink/story.h>
#include <iostream>

int main(int argc, char** argv)
{
	std::cout << "Loading \"test.bin\"" << std::endl;

	try
	{
		auto story = ink::runtime::story::from_file("test.bin");
		auto runner = story->new_runner();

		std::cout << "line: " << runner->getline();
		std::cout << "tags: " << runner->num_tags() << std::endl;
		for (size_t i = 0; i < runner->num_tags(); ++i)
		{
			std::cout << "\t" << i << ": \"" << runner->get_tag(i) << "\"" << std::endl;
		}

		std::cout << "line: " << runner->getline();
		std::cout << "tags: " << runner->num_tags() << std::endl;
		for (size_t i = 0; i < runner->num_tags(); ++i)
		{
			std::cout << "\t" << i << ": \"" << runner->get_tag(i) << "\"" << std::endl;
		}
	}
	catch (std::exception& e)
	{
		std::cerr << e.what() << std::endl;
	}

	return 0;
}

This is the result I get from this test program:

Loading "test.bin"
line: This is the first line
tags: 1
        0: "first tag"
line: This is the second line
tags: 2
        0: "first tag"
        1: "second tag"

However, when I load the same "test.ink" file in Inky 0.15.1 (Ink 1.2.0), this is the result I get:

This is the first line

# first tag

This is the second line

# second tag

Reading through the relevant code, an assumption was made that tags are only cleared when a choice is encountered. This is incorrect, as outlined in the relevant docs for Ink:

Tags for a line can be written above it, or on the end of the line:
# the first tag
# the second tag
This is the line of content. # the third tag
All of the above tags will be included in the currentTags list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions