fixed lap counting and invalid shortcut detection false positives when resetting race
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2308 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
1809dd1da1
commit
6371efb4c1
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
95065F6A0E9127B800B2C509 /* race_result_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95065F690E9127B700B2C509 /* race_result_message.cpp */; };
|
||||
9519653D0E8C592F001BB888 /* linear_world.hpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9519653B0E8C592F001BB888 /* linear_world.hpp */; };
|
||||
9519653E0E8C592F001BB888 /* linear_world.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9519653C0E8C592F001BB888 /* linear_world.cpp */; };
|
||||
95F0F25A0E85C054005F6693 /* callbacks.c in Sources */ = {isa = PBXBuildFile; fileRef = 95923F8B0E808EDC00388BDC /* callbacks.c */; };
|
||||
@ -257,6 +258,7 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
95065F690E9127B700B2C509 /* race_result_message.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = race_result_message.cpp; sourceTree = "<group>"; };
|
||||
9519653B0E8C592F001BB888 /* linear_world.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = linear_world.hpp; path = modes/linear_world.hpp; sourceTree = "<group>"; };
|
||||
9519653C0E8C592F001BB888 /* linear_world.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = linear_world.cpp; path = modes/linear_world.cpp; sourceTree = "<group>"; };
|
||||
956F3FAB0E85BE0E006F93B0 /* random_generator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = random_generator.cpp; sourceTree = "<group>"; };
|
||||
@ -1625,6 +1627,7 @@
|
||||
9592416F0E808EE200388BDC /* network */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95065F690E9127B700B2C509 /* race_result_message.cpp */,
|
||||
959241700E808EE200388BDC /* character_confirm_message.hpp */,
|
||||
959241710E808EE200388BDC /* character_info_message.hpp */,
|
||||
959241720E808EE200388BDC /* character_selected_message.hpp */,
|
||||
@ -2331,6 +2334,7 @@
|
||||
95F0F36F0E85C6A6005F6693 /* clock.cpp in Sources */,
|
||||
95F0F3840E85C76B005F6693 /* world.cpp in Sources */,
|
||||
9519653E0E8C592F001BB888 /* linear_world.cpp in Sources */,
|
||||
95065F6A0E9127B800B2C509 /* race_result_message.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -119,7 +119,7 @@ void FollowTheLeaderRace::update(float delta)
|
||||
//-----------------------------------------------------------------------------
|
||||
void FollowTheLeaderRace::restartRace()
|
||||
{
|
||||
World::restartRace();
|
||||
LinearWorld::restartRace();
|
||||
m_leader_intervals = stk_config->m_leader_intervals;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -72,6 +72,45 @@ LinearWorld::LinearWorld() : World()
|
||||
}// next kart
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void LinearWorld::restartRace()
|
||||
{
|
||||
World::restartRace();
|
||||
|
||||
const unsigned int kart_amount = m_kart.size();
|
||||
for(unsigned int n=0; n<kart_amount; n++)
|
||||
{
|
||||
KartInfo& info = m_kart_info[n];
|
||||
info.m_track_sector = Track::UNKNOWN_SECTOR;
|
||||
info.m_lap_start_time = -1.0f;
|
||||
info.m_shortcut_sector = Track::UNKNOWN_SECTOR;
|
||||
RaceManager::getTrack()->findRoadSector(m_kart[n]->getXYZ(), &info.m_track_sector);
|
||||
|
||||
//If m_track_sector == UNKNOWN_SECTOR, then the kart is not on top of
|
||||
//the road, so we have to use another function to find the sector.
|
||||
if (info.m_track_sector == Track::UNKNOWN_SECTOR )
|
||||
{
|
||||
info.m_on_road = false;
|
||||
info.m_track_sector =
|
||||
RaceManager::getTrack()->findOutOfRoadSector(m_kart[n]->getXYZ(),
|
||||
Track::RS_DONT_KNOW,
|
||||
Track::UNKNOWN_SECTOR );
|
||||
}
|
||||
else
|
||||
{
|
||||
info.m_on_road = true;
|
||||
}
|
||||
|
||||
RaceManager::getTrack()->spatialToTrack(info.m_curr_track_coords,
|
||||
m_kart[n]->getXYZ(),
|
||||
info.m_track_sector );
|
||||
|
||||
info.m_race_lap = -1;
|
||||
info.m_lap_start_time = -1.0f;
|
||||
info.m_time_at_last_lap = 99999.9f;
|
||||
|
||||
}// next kart
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void LinearWorld::update(float delta)
|
||||
{
|
||||
// store previous kart locations
|
||||
|
@ -81,6 +81,7 @@ public:
|
||||
virtual void moveKartAfterRescue(Kart* kart, btRigidBody* body);
|
||||
|
||||
virtual void terminateRace();
|
||||
virtual void restartRace();
|
||||
|
||||
float estimateFinishTimeForKart (Kart* kart, KartInfo& kart_info);
|
||||
void updateRacePosition ( Kart* kart, KartInfo& kart_info );
|
||||
|
@ -64,7 +64,7 @@ void StandardRace::onTerminate()
|
||||
//-----------------------------------------------------------------------------
|
||||
void StandardRace::restartRace()
|
||||
{
|
||||
World::restartRace();
|
||||
LinearWorld::restartRace();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void StandardRace::update(float delta)
|
||||
|
Loading…
Reference in New Issue
Block a user