Skip to content

Commit

Permalink
Fix #4926
Browse files Browse the repository at this point in the history
Also add more explicit error logging for this case.
  • Loading branch information
Alayan-stk-2 committed Nov 12, 2023
1 parent 8cd6a23 commit 858ed6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modes/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ std::shared_ptr<AbstractKart> World::createKart
}

int position = index+1;

if (index - gk < 0)
Log::error("World",
"Attempt to create a kart with a ghost_kart index.");

btTransform init_pos = getStartTransform(index - gk);
std::shared_ptr<AbstractKart> new_kart;
if (RewindManager::get()->isEnabled())
Expand Down
1 change: 1 addition & 0 deletions src/race/race_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ void RaceManager::startNextRace()
else
{
const bool random_pos_available = !NetworkConfig::get()->isNetworking() &&
!m_has_ghost_karts &&
(RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_NORMAL_RACE
|| RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL
|| RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER);
Expand Down

0 comments on commit 858ed6b

Please sign in to comment.