[Scummvm-cvs-logs] SF.net SVN: scummvm:[52616] scummvm/trunk

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Tue Sep 7 11:02:47 CEST 2010


Revision: 52616
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52616&view=rev
Author:   wjpalenstijn
Date:     2010-09-07 09:02:46 +0000 (Tue, 07 Sep 2010)

Log Message:
-----------
COMMON: Remove Rational::operator int/double

This prevents accidental implicit rounding
and might also fix compilation on AmigaOS4 (bug #3060981).

Modified Paths:
--------------
    scummvm/trunk/common/rational.cpp
    scummvm/trunk/common/rational.h
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/graphics/video/coktel_decoder.cpp

Modified: scummvm/trunk/common/rational.cpp
===================================================================
--- scummvm/trunk/common/rational.cpp	2010-09-07 08:12:59 UTC (rev 52615)
+++ scummvm/trunk/common/rational.cpp	2010-09-07 09:02:46 UTC (rev 52616)
@@ -258,14 +258,6 @@
 	return (_num * FRAC_ONE) / _denom;
 }
 
-Rational::operator int() const {
-	return toInt();
-}
-
-Rational::operator double() const {
-	return toDouble();
-}
-
 const Rational operator+(int left, const Rational &right) {
 	Rational tmp = right;
 	tmp += left;

Modified: scummvm/trunk/common/rational.h
===================================================================
--- scummvm/trunk/common/rational.h	2010-09-07 08:12:59 UTC (rev 52615)
+++ scummvm/trunk/common/rational.h	2010-09-07 09:02:46 UTC (rev 52616)
@@ -76,9 +76,6 @@
 	bool operator>=(int right) const;
 	bool operator<=(int right) const;
 
-	operator int() const;
-	operator double() const;
-
 	void invert();
 	Rational getInverse() const;
 

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2010-09-07 08:12:59 UTC (rev 52615)
+++ scummvm/trunk/engines/agos/animation.cpp	2010-09-07 09:02:46 UTC (rev 52616)
@@ -372,10 +372,10 @@
 	_vm->_system->unlockScreen();
 
 	Common::Rational soundTime(_mixer->getSoundElapsedTime(_bgSound), 1000);
-	if ((_bgSoundStream == NULL) || ((int)(soundTime * getFrameRate()) / 1000 < getCurFrame() + 1)) {
+	if ((_bgSoundStream == NULL) || ((soundTime * getFrameRate()).toInt() / 1000 < getCurFrame() + 1)) {
 
 		if (_bgSoundStream && _mixer->isSoundHandleActive(_bgSound)) {
-			while (_mixer->isSoundHandleActive(_bgSound) && ((int) (soundTime * getFrameRate())) < getCurFrame()) {
+			while (_mixer->isSoundHandleActive(_bgSound) && (soundTime * getFrameRate()).toInt() < getCurFrame()) {
 				_vm->_system->delayMillis(10);
 				soundTime = Common::Rational(_mixer->getSoundElapsedTime(_bgSound), 1000);
 			}

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-09-07 08:12:59 UTC (rev 52615)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-09-07 09:02:46 UTC (rev 52616)
@@ -581,7 +581,7 @@
 	// the middle of a long video.
 
 	if (!hasSound())
-		return Common::Rational(1000, _frameRate).toInt();
+		return (1000 / _frameRate).toInt();
 
 	// If there /is/ audio, we do need to keep video and audio
 	// in sync, though.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list