Skip to content

Commit

Permalink
Fix crash & add usecase
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Feb 4, 2025
1 parent 9805f0c commit 23ba17d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/gui/dialogs/ghost_replay_info_dialog.stkgui
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>
<bubble id="info" width="100%" proportion="1" word_wrap="true"/>
</div>

<spacer width="10" height="5%"/>
<div width="95%" height="40%" align="center">
<buttonbar id="actions" x="0" y="0" height="100%" width="100%" align="center">
<icon-button id="back" width="128" height="128"
Expand All @@ -53,7 +53,7 @@
I18N="Ghost replay info screen action" text="Start Race" word_wrap="true" />
</buttonbar>
</div>
<spacer width="10" height="10%"/>
<spacer width="10" height="5%"/>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions data/replay/benchmark_black_forest.replay
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ reverse: 0
difficulty: 3
mode: time-trial
track: black_forest
info: Sped up 2x for benchmarking purpose.
laps: 1
min_time: 73.286743
replay_uid: 564944495606616311
Expand Down
7 changes: 5 additions & 2 deletions src/replay/replay_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ bool ReplayPlay::addReplayFile(const std::string& fn, bool custom_replay, int ca
if (s[last - 1] == '\n')
s[last - 1] = '\0';

rd.m_info = s + 6;
rd.m_info = s + 6;
if (rd.m_info.empty())
rd.m_info = L" ";

fgets(s, 1023, fd);
}
if (sscanf(s, "laps: %u", &rd.m_laps) != 1)
Expand Down Expand Up @@ -368,7 +371,7 @@ void ReplayPlay::loadFile(bool second_replay)
ReplayData &rd = m_replay_file_list[replay_index];
unsigned int num_kart = (unsigned int)m_replay_file_list.at(replay_index)
.m_kart_list.size();
unsigned int lines_to_skip = (rd.m_replay_version == 3) ? 7 : 10;
unsigned int lines_to_skip = (rd.m_replay_version == 3) ? 7 : 10 + !rd.m_info.empty();
lines_to_skip += (rd.m_replay_version == 3) ? num_kart : 2*num_kart;

for (unsigned int i = 0; i < lines_to_skip; i++)
Expand Down

0 comments on commit 23ba17d

Please sign in to comment.