Instead of aborting when a track does not have a dedicated

CheckLap structures, also accept any CheckStructure that
triggers a new lap, but print a warning (since it will
likely cause incorrect kart rankings).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10902 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-02-28 02:32:06 +00:00
parent fe4388de63
commit 2fb96dc46f

View File

@@ -124,14 +124,24 @@ void CheckManager::update(float dt)
*/
unsigned int CheckManager::getLapLineIndex() const
{
// If possible find a proper check-lap structure:
for (unsigned int i=0; i<getCheckStructureCount(); i++)
{
CheckStructure* c = getCheckStructure(i);
if (dynamic_cast<CheckLap*>(c) != NULL) return i;
}
fprintf(stderr,
"No check-lap structure found! This can cause incorrect kart\n");
fprintf(stderr,
"ranking when crossing the line, but can otherwise be ignored.\n");
for (unsigned int i=0; i<getCheckStructureCount(); i++)
{
if(getCheckStructure(i)->getType()==CheckStructure::CT_NEW_LAP)
return i;
}
fprintf(stderr, "Error, no lap line for track found, aborting.\n");
fprintf(stderr, "Error, no kind of lap line for track found, aborting.\n");
exit(-1);
} // getLapLineIndex