Skip to content

Commit 120701c

Browse files
committed
formatting
1 parent 5860a41 commit 120701c

File tree

7 files changed

+89
-86
lines changed

7 files changed

+89
-86
lines changed

inkcpp/story_ptr.cpp

+53-53
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,68 @@
88

99
namespace ink::runtime::internal
1010
{
11-
void ref_block::remove_reference(ref_block*& block)
12-
{
13-
if (block == nullptr)
14-
return;
15-
16-
// If we only have one references left
17-
if (block->references <= 1)
18-
{
19-
// delete the block
20-
delete block;
21-
block = nullptr;
22-
return;
23-
}
11+
void ref_block::remove_reference(ref_block*& block)
12+
{
13+
if (block == nullptr)
14+
return;
2415

25-
// Otherwise, decrement references
26-
block->references--;
16+
// If we only have one references left
17+
if (block->references <= 1) {
18+
// delete the block
19+
delete block;
20+
block = nullptr;
21+
return;
2722
}
2823

29-
story_ptr_base::story_ptr_base(internal::ref_block* story)
30-
: _story_block(story)
31-
{
32-
_instance_block = new ref_block();
33-
}
24+
// Otherwise, decrement references
25+
block->references--;
26+
}
3427

35-
story_ptr_base::story_ptr_base(internal::ref_block* story, internal::ref_block* instance)
36-
: _story_block(story), _instance_block(instance)
37-
{
38-
}
28+
story_ptr_base::story_ptr_base(internal::ref_block* story)
29+
: _story_block(story)
30+
{
31+
_instance_block = new ref_block();
32+
}
3933

40-
story_ptr_base::story_ptr_base(const story_ptr_base& other)
41-
: _story_block(other._story_block)
42-
, _instance_block(other._instance_block)
43-
{
44-
}
34+
story_ptr_base::story_ptr_base(internal::ref_block* story, internal::ref_block* instance)
35+
: _story_block(story)
36+
, _instance_block(instance)
37+
{
38+
}
4539

46-
void story_ptr_base::set(const story_ptr_base& other)
47-
{
48-
_story_block = other._story_block;
49-
_instance_block = other._instance_block;
50-
}
40+
story_ptr_base::story_ptr_base(const story_ptr_base& other)
41+
: _story_block(other._story_block)
42+
, _instance_block(other._instance_block)
43+
{
44+
}
5145

52-
void story_ptr_base::add_reference()
53-
{
54-
// If our block isn't valid, don't bother
55-
if (_story_block == nullptr || _instance_block == nullptr || !_story_block->valid || !_instance_block->valid)
56-
{
57-
_story_block = _instance_block = nullptr;
58-
return;
59-
}
46+
void story_ptr_base::set(const story_ptr_base& other)
47+
{
48+
_story_block = other._story_block;
49+
_instance_block = other._instance_block;
50+
}
6051

61-
_instance_block->references++;
62-
_story_block->references++;
52+
void story_ptr_base::add_reference()
53+
{
54+
// If our block isn't valid, don't bother
55+
if (_story_block == nullptr || _instance_block == nullptr || ! _story_block->valid
56+
|| ! _instance_block->valid) {
57+
_story_block = _instance_block = nullptr;
58+
return;
6359
}
6460

65-
bool story_ptr_base::remove_reference()
66-
{
67-
ref_block::remove_reference(_story_block);
68-
ref_block::remove_reference(_instance_block);
61+
_instance_block->references++;
62+
_story_block->references++;
63+
}
6964

70-
bool is_destroyed = _instance_block == nullptr;
65+
bool story_ptr_base::remove_reference()
66+
{
67+
ref_block::remove_reference(_story_block);
68+
ref_block::remove_reference(_instance_block);
7169

72-
_instance_block = _story_block = nullptr;
73-
return is_destroyed;
74-
}
75-
} // namespace ink::runtime::internal
70+
bool is_destroyed = _instance_block == nullptr;
71+
72+
_instance_block = _story_block = nullptr;
73+
return is_destroyed;
74+
}
75+
} // namespace ink::runtime::internal

inkcpp/string_table.h

+25-25
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,36 @@
1212

1313
namespace ink::runtime::internal
1414
{
15-
// hash tree sorted by string pointers
16-
class string_table final : public snapshot_interface
17-
{
18-
public:
19-
virtual ~string_table();
15+
// hash tree sorted by string pointers
16+
class string_table final : public snapshot_interface
17+
{
18+
public:
19+
virtual ~string_table();
2020

21-
// Create a dynamic string of a particular length
22-
char* create(size_t length);
23-
char* duplicate(const char* str);
21+
// Create a dynamic string of a particular length
22+
char* create(size_t length);
23+
char* duplicate(const char* str);
2424

25-
// zeroes all usage values
26-
void clear_usage();
25+
// zeroes all usage values
26+
void clear_usage();
2727

28-
// mark a string as used
29-
void mark_used(const char* string);
28+
// mark a string as used
29+
void mark_used(const char* string);
3030

3131

32-
// snapshot interface implementation
33-
size_t snap(unsigned char* data, const snapper&) const;
34-
const unsigned char* snap_load(const unsigned char* data, const loader&);
32+
// snapshot interface implementation
33+
size_t snap(unsigned char* data, const snapper&) const;
34+
const unsigned char* snap_load(const unsigned char* data, const loader&);
3535

36-
// get position of string when iterate through data
37-
// used to enable storing a string table references
38-
size_t get_id(const char* string) const;
36+
// get position of string when iterate through data
37+
// used to enable storing a string table references
38+
size_t get_id(const char* string) const;
3939

40-
// deletes all unused strings
41-
void gc();
40+
// deletes all unused strings
41+
void gc();
4242

43-
private:
44-
avl_array<const char*, bool, ink::size_t, 100> _table;
45-
static constexpr const char* EMPTY_STRING = "\x03";
46-
};
47-
}
43+
private:
44+
avl_array<const char*, bool, ink::size_t, 100> _table;
45+
static constexpr const char* EMPTY_STRING = "\x03";
46+
};
47+
} // namespace ink::runtime::internal

inkcpp_test/LabelCondition.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using namespace ink::runtime;
1010

1111
SCENARIO( "run story with hidden choice" )
1212
{
13-
GIVEN( "a story with choice visible by second visit" )
13+
GIVEN("a story with choice visible by second visit")
1414
{
1515
auto ink = story::from_file(INK_TEST_RESOURCE_DIR "LabelConditionStory.bin");
1616
globals globals = ink->new_globals();

unreal/inkcpp/Source/inkcpp/Private/InkList.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ bool UInkList::ContainsFlag(const FString& flag_name) const
1818
bool UInkList::ContainsEnum(const UEnum* Enum, const uint8& value) const
1919
{
2020
if (! Enum) {
21-
UE_LOG(InkCpp, Warning, TEXT("No Enum provided for ContainsEnum; therefore ContainsEnum has failed!"));
21+
UE_LOG(
22+
InkCpp, Warning,
23+
TEXT("No Enum provided for ContainsEnum; therefore ContainsEnum has failed!")
24+
);
2225
return false;
2326
}
2427

unreal/inkcpp/Source/inkcpp/Public/InkAsset.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
/** Assets containing a InkCPP .bin.
1414
* Asset can be constructed from a `.ink.json` file outputted from inky or inklecate.
15-
* And generally also directly from a `.ink` file (it may fail if the shipped version of inklecate is
16-
* incompatible with your system).
15+
* And generally also directly from a `.ink` file (it may fail if the shipped version of inklecate
16+
* is incompatible with your system).
1717
*
1818
* @todo Please note that reimport does not work properly if your ink file has includes.
1919
* Since the reimport only watches the main file for changes.

unreal/inkcpp/Source/inkcpp/Public/InkVar.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ struct INKCPP_API FInkVar
8080
ink::runtime::value to_value() const;
8181

8282

83-
// allow changing via Editor, but not in control flow, it is just a wrapper type to create a new one
84-
// UPROPERTY(EditAnywhere, Category = "Ink")
83+
// allow changing via Editor, but not in control flow, it is just a wrapper type to create a new
84+
// one UPROPERTY(EditAnywhere, Category = "Ink")
8585
/** @private */
8686
TUnion<float, int, unsigned, bool, FString, UInkList*> value;
8787

unreal/inkcpp/Source/inkcpp/Public/inkcpp.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@
9696
*
9797
* @subsection ue_list InkList
9898
* @ref UInkList is a wrapper for the list type inside ink.
99-
* A ink list is like a set for enum values. For a in depth explanation please refer to the [official
100-
* guide](https://blueprintue.com/blueprint/hdybtdjp/)
99+
* A ink list is like a set for enum values. For a in depth explanation please refer to the
100+
* [official guide](https://blueprintue.com/blueprint/hdybtdjp/)
101101
*
102102
* If you define Enums similar to the Lists in the ink script you can use them for an easier access.
103103
*

0 commit comments

Comments
 (0)