Skip to content

Commit 2b1e739

Browse files
committed
fucking WHY
1 parent dc862d1 commit 2b1e739

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/ui/MLRSongCell.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,19 @@ void MLRSongCell::onPlaySong(CCObject*) {
177177

178178
void MLRSongCell::updateProgressBar() const {
179179
SongManager& songManager = SongManager::get();
180+
if (!songManager.getFinishedCalculatingSongLengths() || !this->m_currentB || !this->m_totalBar) return;
181+
geode::log::info("foobar songManager");
180182
FMODAudioEngine* fmod = FMODAudioEngine::get();
183+
geode::log::info("foobar fmod");
181184
const std::string& currSong = songManager.getCurrentSong();
182-
if (fmod->getActiveMusic(0) == currSong && songManager.getSongToSongDataEntries().contains(currSong)) {
183-
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
184-
const int lastPosition = songManager.getLastMenuLoopPosition();
185-
this->m_currentB->setContentWidth(((1.f * lastPosition) / (1.f * fullLength)) * this->m_totalBar->getContentWidth());
186-
}
185+
geode::log::info("currSong: {}", currSong);
186+
if (fmod->getActiveMusic(0) != currSong || !songManager.getSongToSongDataEntries().contains(currSong)) return;
187+
geode::log::info("no more early return");
188+
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
189+
geode::log::info("found fullLength: {}", fullLength);
190+
const int lastPosition = songManager.getLastMenuLoopPosition();
191+
geode::log::info("found lastPosition: {}", lastPosition);
192+
this->m_currentB->setContentWidth(((1.f * lastPosition) / (1.f * fullLength)) * this->m_totalBar->getContentWidth());
187193
}
188194

189195
void MLRSongCell::checkIfCurrentSong() const {

0 commit comments

Comments
 (0)