COMMON: Remove Rational::operator int/double

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

svn-id: r52616
This commit is contained in:
Willem Jan Palenstijn 2010-09-07 09:02:46 +00:00
parent dd0095f1a2
commit 8f1143bfdc
4 changed files with 3 additions and 14 deletions

View file

@ -258,14 +258,6 @@ frac_t Rational::toFrac() const {
return (_num * FRAC_ONE) / _denom; 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) { const Rational operator+(int left, const Rational &right) {
Rational tmp = right; Rational tmp = right;
tmp += left; tmp += left;

View file

@ -76,9 +76,6 @@ public:
bool operator>=(int right) const; bool operator>=(int right) const;
bool operator<=(int right) const; bool operator<=(int right) const;
operator int() const;
operator double() const;
void invert(); void invert();
Rational getInverse() const; Rational getInverse() const;

View file

@ -372,10 +372,10 @@ bool MoviePlayerDXA::processFrame() {
_vm->_system->unlockScreen(); _vm->_system->unlockScreen();
Common::Rational soundTime(_mixer->getSoundElapsedTime(_bgSound), 1000); 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)) { 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); _vm->_system->delayMillis(10);
soundTime = Common::Rational(_mixer->getSoundElapsedTime(_bgSound), 1000); soundTime = Common::Rational(_mixer->getSoundElapsedTime(_bgSound), 1000);
} }

View file

@ -581,7 +581,7 @@ uint32 CoktelDecoder::getTimeToNextFrame() const {
// the middle of a long video. // the middle of a long video.
if (!hasSound()) if (!hasSound())
return Common::Rational(1000, _frameRate).toInt(); return (1000 / _frameRate).toInt();
// If there /is/ audio, we do need to keep video and audio // If there /is/ audio, we do need to keep video and audio
// in sync, though. // in sync, though.