Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2009, 5:16:29 PM (16 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 ;-)

Location:
code/trunk/src/orxonox/gamestates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r2928 r3008  
    6060    SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l");
    6161    SetConsoleCommand(GSLevel, showIngameGUI, true);
     62    SetConsoleCommand(GSLevel, setLevel, true);
     63
     64    XMLFile* GSLevel::startFile_s = NULL;
    6265
    6366    GSLevel::GSLevel(const std::string& name)
     
    6871        , guiKeysOnlyInputState_(0)
    6972        , radar_(0)
    70         , startFile_(0)
    7173        , cameraManager_(0)
    7274        , levelManager_(0)
     
    252254        COUT(0) << "Loading level..." << std::endl;
    253255        std::string levelName;
    254         CommandLine::getValue("level", &levelName);
    255         startFile_ = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
    256         Loader::open(startFile_);
     256        if (!startFile_s)
     257        {
     258            CommandLine::getValue("level", &levelName);
     259            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
     260        }
     261        Loader::open(startFile_s);
     262    }
     263
     264    void GSLevel::setLevel(std::string levelName)
     265    {
     266        delete GSLevel::startFile_s;
     267        GSLevel::startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
    257268    }
    258269
     
    265276        //////////////////////////////////////////////////////////////////////////////////////////
    266277
    267         delete this->startFile_;
     278        delete startFile_s;
    268279    }
    269280
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r2911 r3008  
    4848
    4949        static void showIngameGUI(bool show);
     50        static void setLevel(std::string levelName);
     51
     52        static XMLFile* startFile_s;
    5053
    5154    protected:
     
    6366        SimpleInputState*     guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
    6467        Radar*                radar_;                   //!< represents the Radar (not the HUD part)
    65         XMLFile*              startFile_;               //!< current hard coded default level
    6668        CameraManager*        cameraManager_;           //!< camera manager for this level
    6769        LevelManager*         levelManager_;            //!< global level manager
Note: See TracChangeset for help on using the changeset viewer.