diff options
| author | Léo Lam <leo@leolam.fr> | 2021-01-05 22:28:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-05 16:28:50 -0500 |
| commit | 978dcbcb5a9cb68d558de132c0661f6141887e5d (patch) | |
| tree | a5979f922825b85864e08cef6c79f742c1b4cd91 /ZAPD/ZRoom/Commands/SetActorList.cpp | |
| parent | 4ea37af45af670e65547a35c49a2288ef2a63245 (diff) | |
Avoid unnecessary copies (#46)
Pass some parameters by reference to avoid unnecessary copies.
When the parameter is intended to be copied into a member variable,
pass it by value and move it into the member instead.
This doesn't fix every occurrence of the issue but this diff is already
getting big so let's stop here for the moment.
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetActorList.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetActorList.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ZAPD/ZRoom/Commands/SetActorList.cpp b/ZAPD/ZRoom/Commands/SetActorList.cpp index 5869d6e..7365ce0 100644 --- a/ZAPD/ZRoom/Commands/SetActorList.cpp +++ b/ZAPD/ZRoom/Commands/SetActorList.cpp @@ -66,9 +66,9 @@ string SetActorList::GenerateSourceCodePass2(string roomName, int baseAddress) index++; } - zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, actors.size() * 16, + zRoom->parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::None, DeclarationPadding::Pad16, actors.size() * 16, "ActorEntry", StringHelper::Sprintf("%sActorList0x%06X", roomName.c_str(), segmentOffset), actors.size(), declaration); - + return sourceOutput; } @@ -94,7 +94,7 @@ RoomCommand SetActorList::GetRoomCommand() ActorSpawnEntry::ActorSpawnEntry(std::vector<uint8_t> rawData, int rawDataIndex) { - uint8_t* data = rawData.data(); + const uint8_t* data = rawData.data(); actorNum = BitConverter::ToInt16BE(data, rawDataIndex + 0); posX = BitConverter::ToInt16BE(data, rawDataIndex + 2); @@ -104,4 +104,4 @@ ActorSpawnEntry::ActorSpawnEntry(std::vector<uint8_t> rawData, int rawDataIndex) rotY = BitConverter::ToInt16BE(data, rawDataIndex + 10); rotZ = BitConverter::ToInt16BE(data, rawDataIndex + 12); initVar = BitConverter::ToInt16BE(data, rawDataIndex + 14); -}
\ No newline at end of file +} |
