Skip to content

Commit

Permalink
Start asset ID at 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Dec 27, 2024
1 parent f45845c commit 9446ca7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ String toString(Graphics::AssetType type)

namespace Graphics
{
Asset::ID Asset::nextId;
Asset::ID Asset::lastId;

namespace
{
Expand Down
6 changes: 3 additions & 3 deletions src/include/Graphics/Asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ class Asset : public LinkedObjectTemplate<Asset>, public Meta
#undef XX
};

Asset() : mId(nextId++)
Asset() : mId(++lastId)
{
}

Asset(ID id) : mId(id)
{
nextId = std::max(nextId, ID(id + 1));
lastId = std::max(lastId, id);
}

using LinkedObjectTemplate::operator==;
Expand All @@ -122,7 +122,7 @@ class Asset : public LinkedObjectTemplate<Asset>, public Meta

private:
ID mId;
static ID nextId;
static ID lastId; ///< 0 is not used, indicates 'not assigned'
};

GRAPHICS_VERIFY_SIZE(Asset, 12)
Expand Down

0 comments on commit 9446ca7

Please sign in to comment.