Skip to content

Commit

Permalink
fix(assets): update when reflectedId changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Jan 29, 2024
1 parent 683fc8d commit 4522bca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion engine/src/cubos/engine/assets/asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ AnyAsset& AnyAsset::operator=(const AnyAsset& other)
AnyAsset& AnyAsset::operator=(AnyAsset&& other) noexcept
{
this->decRef();
reflectedId = other.mId;
reflectedId = other.reflectedId;
mId = other.mId;
mRefCount = other.mRefCount;
mVersion = other.mVersion;
Expand Down
8 changes: 7 additions & 1 deletion engine/src/cubos/engine/assets/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ bool Assets::update(AnyAsset& handle) const
return false;
}

if (assetEntry->version > handle.getVersion())
if (handle.mId != handle.reflectedId)
{
handle = AnyAsset{handle.reflectedId};
handle.mVersion = assetEntry->version;
return true;
}
else if (assetEntry->version > handle.getVersion())
{
handle.mVersion = assetEntry->version;
return true;
Expand Down

0 comments on commit 4522bca

Please sign in to comment.