Skip to content

Commit fe76032

Browse files
committed
Target: Use references when returning assets
1 parent adb5f06 commit fe76032

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/scratchcpp/target.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class LIBSCRATCHCPP_EXPORT Target
5353

5454
const std::vector<Costume> &costumes() const;
5555
int addCostume(const Costume &costume);
56-
Costume costumeAt(int index) const;
56+
const Costume &costumeAt(int index) const;
5757
int findCostume(const std::string &costumeName) const;
5858

5959
const std::vector<Sound> &sounds() const;
6060
int addSound(const Sound &sound);
61-
Sound soundAt(int index) const;
61+
const Sound &soundAt(int index) const;
6262
int findSound(const std::string &soundName) const;
6363

6464
int layerOrder() const;

src/scratch/target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ int Target::addCostume(const Costume &costume)
221221
}
222222

223223
/*! Returns the costume at index. */
224-
Costume Target::costumeAt(int index) const
224+
const libscratchcpp::Costume &Target::costumeAt(int index) const
225225
{
226226
// TODO: Add range check
227227
return impl->costumes[index];
@@ -267,7 +267,7 @@ int Target::addSound(const Sound &sound)
267267
}
268268

269269
/*! Returns the sound at index. */
270-
Sound Target::soundAt(int index) const
270+
const libscratchcpp::Sound &Target::soundAt(int index) const
271271
{
272272
// TODO: Add range check
273273
return impl->sounds[index];

0 commit comments

Comments
 (0)