Skip to content

Commit

Permalink
ResourceSystem: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Nov 16, 2013
1 parent ac65261 commit 5d9c3ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions doomsday/client/include/resource/animgroups.h
Expand Up @@ -52,7 +52,7 @@ class AnimGroup
ushort tics() const;

/**
* Returns the additional duration of the frame tics.
* Returns the additional duration of the frame in tics.
*/
ushort randomTics() const;

Expand Down Expand Up @@ -100,12 +100,12 @@ class AnimGroup
*
* @param texture Manifest for the texture to use during the frame.
* @param tics Duration of the frame in tics.
* @param randomTics Random duration of the frame in tics.
* @param randomTics Additional random duration of the frame in tics.
*
* @return The new frame.
*/
Frame &newFrame(TextureManifest &textureManifest, ushort tics,
ushort randomTics = 0);
ushort randomTics = 0);

/**
* Clear all frames in the animation.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/resource/resourcesystem.h
Expand Up @@ -145,9 +145,9 @@ class ResourceSystem : public de::System
void clearAllAnimGroups();

/**
* Returns the AnimGroup associated with @a index; otherwise @c 0.
* Returns the AnimGroup associated with @a uniqueId (1-based); otherwise @c 0.
*/
de::AnimGroup *animGroup(int index);
de::AnimGroup *animGroup(int uniqueId);

/**
* Construct a new animation group.
Expand Down
10 changes: 5 additions & 5 deletions doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -1184,21 +1184,21 @@ int ResourceSystem::animGroupCount()
return d->animGroups.count();
}

AnimGroup *ResourceSystem::animGroup(int index)
AnimGroup *ResourceSystem::animGroup(int uniqueId)
{
LOG_AS("ResourceSystem::animGroup");
if(index >= 0 && index < d->animGroups.count())
if(uniqueId > 0 && uniqueId <= d->animGroups.count())
{
return d->animGroups.at(index);
return d->animGroups.at(uniqueId - 1);
}
LOG_DEBUG("Invalid group #%i, returning NULL.") << index;
LOG_DEBUG("Invalid group #%i, returning NULL.") << uniqueId;
return 0;
}

AnimGroup &ResourceSystem::newAnimGroup(int flags)
{
LOG_AS("ResourceSystem");
int const uniqueId = d->animGroups.count() + 1; // 1-based index.
int const uniqueId = d->animGroups.count() + 1; // 1-based.
// Allocating one by one is inefficient but it doesn't really matter.
d->animGroups.append(new AnimGroup(uniqueId, flags));
return *d->animGroups.last();
Expand Down

0 comments on commit 5d9c3ff

Please sign in to comment.