diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index e313b87c9..a8195a6e9 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -306,6 +306,9 @@ namespace UserConfigParams /** True if slipstream debugging is activated. */ PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false ); + /** True if follow-the-leader debug information should be printed. */ + PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false ); + /** True if currently developed tutorial debugging is enabled. */ PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false ); diff --git a/src/main.cpp b/src/main.cpp index b06598d42..e33c28eae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -415,6 +415,10 @@ int handleCmdLine(int argc, char **argv) { UserConfigParams::m_material_debug = true; } + else if(!strcmp(argv[i], "--ftl-debug")) + { + UserConfigParams::m_ftl_debug = true; + } else if(UserConfigParams::m_artist_debug_mode && !strcmp(argv[i], "--camera-debug")) { UserConfigParams::m_camera_debug=1; diff --git a/src/modes/follow_the_leader.cpp b/src/modes/follow_the_leader.cpp index 927aa1426..b6ec4076b 100644 --- a/src/modes/follow_the_leader.cpp +++ b/src/modes/follow_the_leader.cpp @@ -86,6 +86,11 @@ void FollowTheLeaderRace::countdownReachedZero() } // else { + if(UserConfigParams::m_ftl_debug) + { + printf("[ftl] Eliminiating kart '%s' at position %d.\n", + kart->getIdent().c_str(), position_to_remove); + } removeKart(kart->getWorldKartId()); // In case that the kart on position 1 was removed, we have diff --git a/src/modes/world.cpp b/src/modes/world.cpp index 968a5bed1..eb5ab8596 100644 --- a/src/modes/world.cpp +++ b/src/modes/world.cpp @@ -631,9 +631,9 @@ Highscores* World::getHighscores() const } // getHighscores // ---------------------------------------------------------------------------- -/* - * Usually called at the end of a race. Checks if the current times are worth a new - * score, if so it notifies the HighscoreManager so the new score is added and saved. +/** Called at the end of a race. Checks if the current times are worth a new + * score, if so it notifies the HighscoreManager so the new score is added + * and saved. */ void World::updateHighscores() { diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 74210e946..300851ba2 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -207,6 +207,11 @@ void RaceManager::startNew() m_kart_status.push_back(KartStatus(m_ai_kart_list[i], i, -1, -1, init_gp_rank, KT_AI)); init_gp_rank ++; + if(UserConfigParams::m_ftl_debug) + { + printf("[ftl] rank %d ai-kart %s\n", init_gp_rank, + m_ai_kart_list[i].c_str()); + } } // Then the players, which start behind the AI karts @@ -220,6 +225,11 @@ void RaceManager::startNew() m_player_karts[i].getGlobalPlayerId(), init_gp_rank, kt ) ); + if(UserConfigParams::m_ftl_debug) + { + printf("[ftl] rank %d kart %s\n", init_gp_rank, + m_player_karts[i].getKartName().c_str()); + } init_gp_rank ++; } @@ -367,14 +377,26 @@ void RaceManager::computeGPRanks() sd->m_race_time = -1; sort_data.push_back(sd); m_kart_status[0].m_gp_rank = -1; + if(UserConfigParams::m_ftl_debug) + { + printf("[ftl] kart '%s' has position %d.\n", + World::getWorld()->getKart(0)->getIdent().c_str(), + sd->m_position); + } } for (unsigned int kart_id = start; kart_id < NUM_KARTS; ++kart_id) { computeGPRanksData::SortData *sd = new computeGPRanksData::SortData(); sd->m_position = kart_id; - sd->m_score = race_manager->getKartScore(kart_id); - sd->m_race_time = race_manager->getOverallTime(kart_id); + sd->m_score = getKartScore(kart_id); + sd->m_race_time = getOverallTime(kart_id); sort_data.push_back(sd); + if(UserConfigParams::m_ftl_debug) + { + printf("[ftl] kart '%s' has position %d score %d.\n", + World::getWorld()->getKart(kart_id)->getIdent().c_str(), + sd->m_position, sd->m_score); + } } sort_data.insertionSort(start); @@ -382,6 +404,18 @@ void RaceManager::computeGPRanks() { //printf("setting kart %s to rank %i\n", // m_kart_status[position[i]].m_ident.c_str(), i-start); + if(UserConfigParams::m_ftl_debug) + { + if(sort_data[i].m_position<0 || + sort_data[i].m_position>=getNumberOfKarts()) + printf("XX"); + const Kart *kart = + World::getWorld()->getKart(sort_data[i].m_position); + printf("[ftl] kart '%s' has now position %d.\n", + kart->getIdent().c_str(), + i-start); + } + m_kart_status[sort_data[i].m_position].m_gp_rank = i - start; } // printf("kart %s has rank %i\n", 0, m_kart_status[0].m_gp_rank);