Skip to content

Commit 9ff5b4d

Browse files
committed
Fix tags and story.choose_path_string + update blade-ink natives to v1.2.1
1 parent 1ef409c commit 9ff5b4d

File tree

12 files changed

+52
-9
lines changed

12 files changed

+52
-9
lines changed

bink/choices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __getitem__(self, idx: int) -> str:
4040
if not isinstance(idx, int):
4141
raise TypeError
4242

43-
if idx < 0 or idx > self._len:
43+
if idx < 0 or idx >= self._len:
4444
raise IndexError
4545

4646
return self.get_text(idx)

bink/native/arm64/libbink.dylib

-29 KB
Binary file not shown.

bink/native/arm64/libbink.so

-3.31 MB
Binary file not shown.

bink/native/x86_64/bink.dll

42.5 KB
Binary file not shown.

bink/native/x86_64/libbink.dylib

-45.9 KB
Binary file not shown.

bink/native/x86_64/libbink.so

-3.15 MB
Binary file not shown.

bink/story.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ def get_current_tags(self) -> Tags:
127127

128128
def choose_path_string(self, path: str):
129129
err_msg = ctypes.c_char_p()
130-
story = ctypes.c_void_p()
131-
ret = LIB.bink_story_new(
132-
ctypes.byref(story),
130+
ret = LIB.bink_story_choose_path_string(
131+
self._story,
133132
path.encode('utf-8'),
134133
ctypes.byref(err_msg))
135134
if ret != BINK_OK:

bink/tags.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __next__(self):
2121

2222
class Tags:
2323
"""Contains a list of tags."""
24-
def __init__(self, tags, c_len):
24+
def __init__(self, tags, c_len: int):
2525
self._tags = tags
2626
self._len = c_len
2727

@@ -41,15 +41,15 @@ def __getitem__(self, idx: int) -> str:
4141
if not isinstance(idx, int):
4242
raise TypeError
4343

44-
if idx < 0 or idx > self._len:
44+
if idx < 0 or idx >= self._len:
4545
raise IndexError
4646

4747
return self.get(idx)
4848

4949
def get(self, idx) -> str:
5050
"""Returns the tag text."""
5151
tag = ctypes.c_char_p()
52-
ret = LIB.bink_choices_get_text(self._tags, idx, ctypes.byref(tag))
52+
ret = LIB.bink_tags_get(self._tags, idx, ctypes.byref(tag))
5353

5454
if ret != BINK_OK:
5555
raise RuntimeError("Error getting tag, index out of bounds?")
@@ -60,4 +60,4 @@ def get(self, idx) -> str:
6060
return result
6161

6262
def __del__(self):
63-
LIB.bink_choices_free(self._tags)
63+
LIB.bink_tags_free(self._tags)

inkfiles/tags.ink

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
VAR x = 2
2+
# author: Joe
3+
# title: My Great Story
4+
This is the content
5+
6+
== knot ==
7+
# knot tag
8+
Knot content
9+
# end of knot tag
10+
-> END
11+
12+
= stitch
13+
# stitch tag
14+
Stitch content
15+
# this tag is below some content so isn't included in the static tags for the stitch
16+
-> END

inkfiles/tags.ink.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"inkVersion":21,"root":[["#","^author: Joe","/#","#","^title: My Great Story","/#","^This is the content","\n",["done",{"#n":"g-0"}],null],"done",{"knot":["#","^knot tag","/#","^Knot content","\n","#","^end of knot tag","/#","end",{"stitch":["#","^stitch tag","/#","^Stitch content","\n","#","^this tag is below some content so isn't included in the static tags for the stitch","/#","end",null]}],"global decl":["ev",2,{"VAR=":"x"},"/ev","end",null]}],"listDefs":{}}

0 commit comments

Comments
 (0)