From 7d4bfd3d13bfa5d7414c7f969ba9a54cb4f49084 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 14 Feb 2008 06:57:00 +0000 Subject: [PATCH] Fixed previous patch for detecing of invalid kart names. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1492 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/main.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index afcc37106..57b7cac28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,12 +144,19 @@ int handleCmdLine(int argc, char **argv) } else if( (!strcmp(argv[i], "--kart") && i+1getKart(argv[i+1])) - { - fprintf(stdout, _("Kart '%s' not found, ignored.\n"), - argv[i+1]); - } - else race_manager->setPlayerKart(0, argv[i+1]); + std::string filename=std::string("data")+ + Loader::DIR_SEPARATOR+argv[i+1]+".tkkf"; + try + { + std::string s=loader->getPath(filename); + race_manager->setPlayerKart(0, argv[i+1]); + fprintf ( stdout, _("You choose to use kart '%s'.\n"), argv[i+1] ) ; + } + catch(std::runtime_error) + { + fprintf(stdout, _("Kart '%s' not found, ignored.\n"), + argv[i+1]); + } } else if( (!strcmp(argv[i], "--mode") && i+1