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
3 changes: 2 additions & 1 deletion inkcpp_compiler/json_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ void json_compiler::compile_container(
bool is_knot = name_override != "" && index_in_parent == -1;
if (is_knot) {
// it is not a wave or choice
if (name_override.starts_with("c-") || name_override.starts_with("g-")) {
if (::ink::internal::starts_with(name_override.c_str(), "c-")
|| ::ink::internal::starts_with(name_override.c_str(), "g-")) {
is_knot = false;
for (auto itr = name_override.begin() + 2; itr != name_override.end(); ++itr) {
if (*itr > '9' || *itr < '0') {
Expand Down
13 changes: 13 additions & 0 deletions shared/public/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ constexpr list_flag empty_flag{-1, 0};

namespace internal
{
/** Checks if a string starts with a given prefix*/
static bool starts_with(const char* string, const char* prefix)
{
while (*prefix) {
if (*string != *prefix) {
return false;
}
string++;
prefix++;
}
return true;
}

/** Checks if a string is only whitespace*/
static bool is_whitespace(const char* string, bool includeNewline = true)
{
Expand Down
Loading