fix bug with phase highlighting in replays (#5161)

* fix bug with incorrectly highlighted phases

* fix new bug with phases continuously darkening

* use preincrement instead of postincrement

* simplify conditional
This commit is contained in:
RickyRister 2024-11-05 09:23:01 -08:00 committed by GitHub
parent 0c4e8ca290
commit 6652012f4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 6 deletions

View file

@ -637,6 +637,19 @@ void TabGame::replayFastForwardButtonToggled(bool checked)
timelineWidget->setTimeScaleFactor(checked ? 10.0 : 1.0);
}
/**
* @brief Handles everything that needs to be reset when doing a replay rewind.
*/
void TabGame::replayRewind()
{
// reset chat log
messageLog->clearChat();
// reset phase markers
currentPhase = -1;
phasesToolbar->reset();
}
void TabGame::incrementGameTime()
{
int seconds = ++secondsElapsed;
@ -1718,7 +1731,7 @@ void TabGame::createReplayDock()
timelineWidget->setTimeline(replayTimeline);
connect(timelineWidget, SIGNAL(processNextEvent()), this, SLOT(replayNextEvent()));
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
connect(timelineWidget, &ReplayTimelineWidget::rewound, messageLog, &ChatView::clearChat);
connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &TabGame::replayRewind);
// timeline skip shortcuts
aReplaySkipForward = new QAction(timelineWidget);