Mercurial > fife-parpg
diff engine/core/video/animation.cpp @ 378:64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Jan 2010 23:34:52 +0000 |
parents | 3804348fe3fb |
children | 16c2b3ee59ce |
line wrap: on
line diff
--- a/engine/core/video/animation.cpp Wed Dec 09 17:01:52 2009 +0000 +++ b/engine/core/video/animation.cpp Mon Jan 11 23:34:52 2010 +0000 @@ -79,12 +79,9 @@ return val; } - bool Animation::isValidIndex(int index) { + bool Animation::isValidIndex(int index) const{ int size = m_frames.size(); - if ((size == 0) || (index > (size - 1)) || (index < 0)) { - return false; - } - return true; + return size > 0 && index >= 0 && index < size; } Image* Animation::getFrame(int index) { @@ -99,7 +96,7 @@ return getFrame(getFrameIndex(timestamp)); } - int Animation::getFrameDuration(int index) { + int Animation::getFrameDuration(int index) const{ if (isValidIndex(index)) { return m_frames[index].duration; } else { @@ -112,7 +109,7 @@ } void Animation::setDirection(unsigned int direction) { - m_direction = direction % 360; + m_direction %= 360; } } /* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */