Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9127


Ignore:
Timestamp:
Apr 27, 2012, 3:56:15 PM (12 years ago)
Author:
huttemat
Message:

shipselection core works now

Location:
code/branches/shipSelection
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua

    r9101 r9127  
    1616
    1717   P.shipList = {}
     18
     19  --for line in io.lines("../levels/templates/.shipmodels") do  orxonox.execute("orxout user_warning " .. line) end
     20  for line in io.lines("../levels/templates/.shipmodels") do 
     21        P.shipList[#P.shipList+1] = string.lower(line)
     22  end
    1823   --[[for f in io.lines("../levels/templates/.shipmodels") do
    1924        if selectedlevel:hasShip(f) then
     
    151156    end
    152157end
    153 --]]
     158
    154159function P.ShipSelectionStartButton_clicked(e)
    155160
    156161    if selectedlevel ~= nil then
    157         selectedlevel:selectShip("meinModell")
    158         --orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
     162        selectedlevel:selectShip(P.ShipSelectionGetSelectedLevel())
     163        orxonox.execute("startGame " .. "_temp.oxw")
    159164        hideAllMenuSheets()
    160165    else
  • code/branches/shipSelection/data/gui/scripts/SingleplayerMenu.lua

    r9074 r9127  
    4747    while index < size do
    4848        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    49         if level ~= nil then
     49        if (level ~= nil and level:getXMLFilename() ~= "_temp.oxw") then
     50            --os.execute("echo " .. level:getXMLFilename() .." >> ~/outputorx")
    5051            local levelXMLFilename = level:getXMLFilename()
    5152            -- create an imageset for each screenshot
  • code/branches/shipSelection/data/levels/tutorial.oxw

    r9057 r9127  
    44 tags = "tutorial, shipselection"
    55 screenshot = "codingtutorial.png"
    6  startingships = "spaceshipGhost, spaceshipPirate, spaceshipSpacecruiser"
     6 startingships = "spaceshipghost, spaceshippirate, spaceshipspacecruiser"
    77/>
    88
     
    1111  include("stats.oxo")
    1212  include("templates/spaceshipAssff.oxt")
     13  include("templates/spaceshipGhost.oxt")
     14  include("templates/spaceshipSpacecruiser.oxt")
    1315  include("templates/lodInformation.oxt")
    1416?>
  • code/branches/shipSelection/src/libraries/core/Loader.cc

    r8858 r9127  
    222222
    223223            orxout(verbose, context::loader) << "Namespace-tree:" << '\n' << rootNamespace->toString("  ") << endl;
    224 
     224                       
    225225            return true;
    226226        }
  • code/branches/shipSelection/src/orxonox/LevelInfo.h

    r9101 r9127  
    152152
    153153        private:
     154
    154155            inline void changeShip (const std::string& model) {
    155                 //HACK: Read Level XML File, find "shipselection", replace with ship model
    156                 std::string text;
    157                 std::ifstream myLevel ("test.txt");
    158                 std::ofstream tempLevel ("test2.txt");
    159                 while(!myLevel.eof())
    160                 {
    161                         std::string buff;
    162                         std::getline(myLevel, buff);
    163                         tempLevel.write(buff.c_str(), buff.length());
    164                 }
    165                 myLevel.close();
    166                 tempLevel.close();
    167                 orxout(user_status) << "done" << endl;
     156                static std::string shipSelectionTag = "shipselection";
     157                //HACK: Read Level XML File, find "shipselection", replace with ship model
     158                std::string levelPath = "../levels/";
     159                levelPath.append(this->getXMLFilename());
     160                std::string tempPath = "../levels/";
     161                tempPath.append("_temp.oxw");
     162                orxout(user_status) << levelPath << endl;
     163                orxout(user_status) << tempPath << endl;
     164                std::ifstream myLevel (levelPath.c_str());
     165                        std::ofstream tempLevel (tempPath.c_str());
     166                        while(!myLevel.eof())
     167                        {
     168                                std::string buff;
     169                                std::getline(myLevel, buff);
     170                                std::string pawndesignString = "pawndesign=";
     171                                size_t found = buff.find(pawndesignString.append(shipSelectionTag));
     172                                if (found!= std::string::npos)
     173                                        buff = buff.substr(0, found + 11) + model + buff.substr(found+11+shipSelectionTag.length(), std::string::npos);
     174                                tempLevel.write(buff.c_str(), buff.length());
     175                                tempLevel << std::endl;
     176                        }
     177                        myLevel.close();
     178                        tempLevel.close();
     179                        orxout(user_status) << "done" << endl;
    168180            }
    169181            void tagsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed.
  • code/branches/shipSelection/src/orxonox/LevelManager.cc

    r8891 r9127  
    256256        {
    257257            // TODO: Replace with tag?
    258             if (it->find("old/") != 0)
     258            if (it->find("old/") != 0 )
    259259            {
    260260                LevelInfoItem* info = NULL;
Note: See TracChangeset for help on using the changeset viewer.