1) Changed the challenges dependencies to have not more than

3 challenges at the same time.
2) Moved reading of grand prix challenges into unlock manager
   (previous location would not read the status of the challenges
   correctly from the user config file).
3) Fixed position requirement of 'follow the leader' challenges
   (winner has position 2, not 1).
4) GP which have missing tracks are now ignored (solves crash
   when STK is installed on top of an old installation)
5) Made the images in the race result screen non-active.
6) Made the description of challenges non-active.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2194 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2008-07-29 13:40:25 +00:00
parent 82e9cb0fff
commit 46c5b8ab7d
9 changed files with 37 additions and 15 deletions

View File

@@ -6,7 +6,7 @@
(description _("Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts."))
(unlock-gp "alltracks")
(unlock-difficulty "skidding" _("Skidding Preview"))
(depend-on "islandfollow" "racetracktime" "tollwaytime" "junglefollow" "citytime" "tollwayhead")
(depend-on "islandfollow")
(major "grandprix")
(minor "quickrace")
(gp "atworldsend")

View File

@@ -5,14 +5,14 @@
(name _("Follow the Leader on a\nDesert Island"))
(description _("Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island."))
(unlock-gp "atworldsend")
(depend-on "tothemoonandbackgp" "tollwaytime" "citytime")
(depend-on "tothemoonandbackgp" "tollwayhead2head" "tollwaytime" "citytime")
(major "single")
(minor "followtheleader")
(track "islandtrack")
(difficulty "easy")
(laps 3)
(karts 4)
(position 1)
(position 2)
)
;; EOF ;;

View File

@@ -61,16 +61,22 @@ GrandPrixData::GrandPrixData(const std::string filename)
// ----------------------------------------------------------------------------
bool GrandPrixData::checkConsistency()
{
bool correct=true;
for(unsigned int i=0; i<m_tracks.size(); i++)
{
if(!track_manager->getTrack(m_tracks[i]))
try
{
fprintf(stderr, "Grand Prix '%s': Track '%s' does not exist!",
m_name.c_str(), m_tracks[i].c_str());
correct=false;
Track *track=track_manager->getTrack(m_tracks[i]);
}
catch(std::exception& e)
{
(void)e;
fprintf(stderr, "Grand Prix '%s': Track '%s' does not exist!\n",
m_name.c_str(), m_tracks[i].c_str());
fprintf(stderr, "This Grand Prix will not be available.\n");
return false;
}
} // for i
return correct;
return true;
}
/* EOF */

View File

@@ -22,7 +22,6 @@
#include "string_utils.hpp"
#include "file_manager.hpp"
#include "grand_prix_manager.hpp"
#include "unlock_manager.hpp"
GrandPrixManager *grand_prix_manager = NULL;
@@ -35,8 +34,6 @@ GrandPrixManager::GrandPrixManager()
i != result.end() ; i++)
{
if (StringUtils::has_suffix(*i, ".grandprix")) load("grandprix/"+*i);
if (StringUtils::has_suffix(*i, ".challenge"))
unlock_manager->addChallenge(file_manager->getConfigFile("grandprix/"+*i));
} // for i
} // GrandPrixManager
@@ -67,7 +64,12 @@ void GrandPrixManager::checkConsistency()
{
for(unsigned int i=0; i<m_gp_data.size(); i++)
{
m_gp_data[i]->checkConsistency();
if(!m_gp_data[i]->checkConsistency())
{
// delete this GP, since a track is missing
m_gp_data.erase(m_gp_data.begin()+i);
i--;
}
}
} // checkConsistency
// ----------------------------------------------------------------------------

View File

@@ -45,6 +45,7 @@ ChallengesMenu::ChallengesMenu()
}
widget_manager->addTextButtonWgt( WTOK_DESCRIPTION, 60, 30, "");
widget_manager->deactivateWgt(WTOK_DESCRIPTION);
widget_manager->breakLine();
widget_manager->addTextButtonWgt(WTOK_BACK, 50, 7,

View File

@@ -236,7 +236,8 @@ void RaceOptions::select()
case WTOK_LAPS_DOWN:
{
m_num_laps--;
if(m_num_laps<1) m_num_laps=10;
printf("fixme: numlaps=0\n");
if(m_num_laps<0) m_num_laps=10;
char label[ MAX_MESSAGE_LENGTH ];
snprintf( label, MAX_MESSAGE_LENGTH, "%d", m_num_laps );

View File

@@ -227,6 +227,8 @@ Widget *RaceResultsGUI::displayKartList(unsigned int from, unsigned int to,
Widget *image=widget_manager->addImgButtonWgt(WTOK_FIRST_IMAGE + i, 7, 7,
KART->getKartProperties()->getIconFile() );
widget_manager->deactivateWgt(WTOK_FIRST_IMAGE+i);
image->setPosition(WGT_DIR_FROM_LEFT, horizontal, NULL,
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
Widget *w=widget_manager->addTextWgt(WTOK_FIRST_RESULT + i, 5, 7,

View File

@@ -49,7 +49,7 @@ Track* TrackManager::getTrack(const std::string& ident) const
}
char msg[MAX_ERROR_MESSAGE_LENGTH];
fprintf(stderr, "TrackManager: Couldn't find track: '%s'", ident.c_str() );
sprintf(msg, "TrackManager: Couldn't find track: '%s'", ident.c_str() );
throw std::runtime_error(msg);
} // getTrack

View File

@@ -102,6 +102,16 @@ UnlockManager::UnlockManager()
addChallenge(new ChallengeData(challenge_file));
} // for i
// Challenges from .../data/grandprix
// ----------------------------------
file_manager->listFiles(result, "data/grandprix");
for(std::set<std::string>::iterator i = result.begin();
i != result.end() ; i++)
{
if (StringUtils::has_suffix(*i, ".challenge"))
addChallenge(file_manager->getConfigFile("grandprix/"+*i));
} // for i
// Hard coded challenges can be added here.
computeActive();