Added --ftl-debug command line option, to print some debug information for
FTL (esp. GP) races. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8018 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a7bf9f0092
commit
28aaaf4f5b
@ -306,6 +306,9 @@ namespace UserConfigParams
|
|||||||
/** True if slipstream debugging is activated. */
|
/** True if slipstream debugging is activated. */
|
||||||
PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );
|
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. */
|
/** True if currently developed tutorial debugging is enabled. */
|
||||||
PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false );
|
PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false );
|
||||||
|
|
||||||
|
@ -415,6 +415,10 @@ int handleCmdLine(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
UserConfigParams::m_material_debug = true;
|
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"))
|
else if(UserConfigParams::m_artist_debug_mode && !strcmp(argv[i], "--camera-debug"))
|
||||||
{
|
{
|
||||||
UserConfigParams::m_camera_debug=1;
|
UserConfigParams::m_camera_debug=1;
|
||||||
|
@ -86,6 +86,11 @@ void FollowTheLeaderRace::countdownReachedZero()
|
|||||||
} //
|
} //
|
||||||
else
|
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());
|
removeKart(kart->getWorldKartId());
|
||||||
|
|
||||||
// In case that the kart on position 1 was removed, we have
|
// In case that the kart on position 1 was removed, we have
|
||||||
|
@ -631,9 +631,9 @@ Highscores* World::getHighscores() const
|
|||||||
} // getHighscores
|
} // getHighscores
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/*
|
/** Called at the end of a race. Checks if the current times are worth a new
|
||||||
* 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
|
||||||
* score, if so it notifies the HighscoreManager so the new score is added and saved.
|
* and saved.
|
||||||
*/
|
*/
|
||||||
void World::updateHighscores()
|
void World::updateHighscores()
|
||||||
{
|
{
|
||||||
|
@ -207,6 +207,11 @@ void RaceManager::startNew()
|
|||||||
m_kart_status.push_back(KartStatus(m_ai_kart_list[i], i, -1, -1,
|
m_kart_status.push_back(KartStatus(m_ai_kart_list[i], i, -1, -1,
|
||||||
init_gp_rank, KT_AI));
|
init_gp_rank, KT_AI));
|
||||||
init_gp_rank ++;
|
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
|
// Then the players, which start behind the AI karts
|
||||||
@ -220,6 +225,11 @@ void RaceManager::startNew()
|
|||||||
m_player_karts[i].getGlobalPlayerId(),
|
m_player_karts[i].getGlobalPlayerId(),
|
||||||
init_gp_rank, kt
|
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 ++;
|
init_gp_rank ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,14 +377,26 @@ void RaceManager::computeGPRanks()
|
|||||||
sd->m_race_time = -1;
|
sd->m_race_time = -1;
|
||||||
sort_data.push_back(sd);
|
sort_data.push_back(sd);
|
||||||
m_kart_status[0].m_gp_rank = -1;
|
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)
|
for (unsigned int kart_id = start; kart_id < NUM_KARTS; ++kart_id)
|
||||||
{
|
{
|
||||||
computeGPRanksData::SortData *sd = new computeGPRanksData::SortData();
|
computeGPRanksData::SortData *sd = new computeGPRanksData::SortData();
|
||||||
sd->m_position = kart_id;
|
sd->m_position = kart_id;
|
||||||
sd->m_score = race_manager->getKartScore(kart_id);
|
sd->m_score = getKartScore(kart_id);
|
||||||
sd->m_race_time = race_manager->getOverallTime(kart_id);
|
sd->m_race_time = getOverallTime(kart_id);
|
||||||
sort_data.push_back(sd);
|
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);
|
sort_data.insertionSort(start);
|
||||||
@ -382,6 +404,18 @@ void RaceManager::computeGPRanks()
|
|||||||
{
|
{
|
||||||
//printf("setting kart %s to rank %i\n",
|
//printf("setting kart %s to rank %i\n",
|
||||||
// m_kart_status[position[i]].m_ident.c_str(), i-start);
|
// 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;
|
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);
|
// printf("kart %s has rank %i\n", 0, m_kart_status[0].m_gp_rank);
|
||||||
|
Loading…
Reference in New Issue
Block a user