Fixed crashes caused by having an old user config file (which can contain
invalid kart or track groups, or an invalid kart id). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3099 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f48f8e8dd2
commit
00b98173ca
@ -7,6 +7,10 @@ SuperTuxKart SVN
|
||||
- Fixed several bugs related to track and character group selection.
|
||||
- Plunger would stay in face after a restart of a race
|
||||
- Prevented incorrect rescues in Fort magma.
|
||||
- Added slowdown for karts driving backwards
|
||||
- Fixed crash if the user_config contained an invalid last used
|
||||
kart id (e.g. too big because it's from a previous installation
|
||||
with more karts), kart or track group.
|
||||
* Code cleanup:
|
||||
- Removed all snprintfs and constants defining a maximum message size.
|
||||
|
||||
|
@ -247,8 +247,13 @@ void CharSel::updateScrollPosition()
|
||||
void CharSel::switchGroup()
|
||||
{
|
||||
m_index_avail_karts.clear();
|
||||
const std::vector<int> &karts =
|
||||
bool group_exist =
|
||||
kart_properties_manager->getKartsInGroup(user_config->m_kart_group).size()>0;
|
||||
if(!group_exist) user_config->m_kart_group = "standard";
|
||||
|
||||
const std::vector<int> &karts =
|
||||
kart_properties_manager->getKartsInGroup(user_config->m_kart_group);
|
||||
|
||||
for(unsigned int i=0; i<karts.size(); i++)
|
||||
{
|
||||
if(kart_properties_manager->kartAvailable(karts[i]))
|
||||
|
@ -166,6 +166,12 @@ void TrackSel::updateScrollPosition()
|
||||
void TrackSel::switchGroup()
|
||||
{
|
||||
m_index_avail_tracks.clear();
|
||||
bool group_available =
|
||||
(RaceManager::isBattleMode( race_manager->getMinorMode() )
|
||||
? track_manager->getArenasInGroup(user_config->m_track_group)
|
||||
: track_manager->getTracksInGroup(user_config->m_track_group)).size()>0;
|
||||
if(!group_available)
|
||||
user_config->m_track_group = "standard";
|
||||
|
||||
const std::vector<int> &tracks =
|
||||
RaceManager::isBattleMode( race_manager->getMinorMode() ) ?
|
||||
|
@ -223,6 +223,7 @@ bool KartPropertiesManager::testAndSetKart(int kartid)
|
||||
*/
|
||||
bool KartPropertiesManager::kartAvailable(int kartid)
|
||||
{
|
||||
if(kartid<0 || kartid>=(int)m_kart_available.size()) return false;
|
||||
if(!m_kart_available[kartid]) return false;
|
||||
std::vector<int>::iterator it;
|
||||
for (it = m_selected_karts.begin(); it < m_selected_karts.end(); it++)
|
||||
|
Loading…
Reference in New Issue
Block a user