|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-06 02:04:42
|
Module: performous
Branch: master
Commit: 4cf987042850f2febfd554dcabf76b47302e4ec8
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 5 04:56:17 2009 +0200
Workaround a C++ defect that makes our old code invalid (and it doesn't compile on MSVC debug mode).
---
game/song.cc | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/game/song.cc b/game/song.cc
index 6cc61bf..95070b8 100644
--- a/game/song.cc
+++ b/game/song.cc
@@ -266,11 +266,13 @@ std::string Song::collate(std::string const& str) {
}
namespace {
- bool noteEndLessThan(Note const& n, double time) { return n.end < time; }
+ // Cannot simply take double as its second argument because of a C++ defect
+ bool noteEndLessThan(Note const& a, Note const& b) { return a.end < b.end; }
}
Song::Status Song::status(double time) const {
- Notes::const_iterator it = std::lower_bound(notes.begin(), notes.end(), time, noteEndLessThan);
+ Note target; target.end = time;
+ Notes::const_iterator it = std::lower_bound(notes.begin(), notes.end(), target, noteEndLessThan);
if (it == notes.end()) return FINISHED;
if (it->begin > time + 4.0) return INSTRUMENTAL_BREAK;
return NORMAL;
|