Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2009, 5:16:29 PM (15 years ago)
Author:
bknecht
Message:

You don't need no —level or -l anymore now. You may choose your favorite level from the main menu ;-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/Loader.cc

    r2710 r3008  
    3030
    3131#include <tinyxml/ticpp.h>
     32#include <boost/filesystem.hpp>
    3233
    3334#include "XMLFile.h"
     
    4142#include "util/Debug.h"
    4243#include "util/Exception.h"
     44#include "Core.h"
    4345
    4446namespace orxonox
     
    210212        return Loader::load(file, mask);
    211213    }
     214
     215    std::vector<std::string> Loader::getLevelList()
     216    {
     217        std::vector<std::string> levelList;
     218
     219        boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");
     220        boost::filesystem::directory_iterator end;
     221
     222        while (file != end)
     223        {
     224            if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~')
     225            {
     226                std::string filename = file->path().leaf();
     227                if (filename.length() > 4)
     228                    levelList.push_back(filename.substr(0,filename.length()-4));
     229            }
     230            ++file;
     231        }
     232        return levelList;
     233    }
    212234}
Note: See TracChangeset for help on using the changeset viewer.