[Orxonox-commit 4430] r9101 - in code/branches/shipSelection: data/gui/scripts src/orxonox

huttemat at orxonox.net huttemat at orxonox.net
Fri Apr 20 16:19:27 CEST 2012


Author: huttemat
Date: 2012-04-20 16:19:27 +0200 (Fri, 20 Apr 2012)
New Revision: 9101

Modified:
   code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua
   code/branches/shipSelection/src/orxonox/LevelInfo.h
Log:
changing xml files

Modified: code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua
===================================================================
--- code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua	2012-04-20 14:16:58 UTC (rev 9100)
+++ code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua	2012-04-20 14:19:27 UTC (rev 9101)
@@ -120,7 +120,7 @@
         -- get the right tab and the right index
         local tabIndexes = P.activeTabIndexes[tabControl:getSelectedTabIndex()+1]
         local index = tabIndexes[listbox:getItemIndex(choice)+1]
-        return P.levelList[index]
+        --return P.levelList[index]
     else
         return nil
     end
@@ -154,7 +154,8 @@
 function P.ShipSelectionStartButton_clicked(e)
 
     if selectedlevel ~= nil then
-        orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
+	selectedlevel:selectShip("meinModell")
+        --orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
         hideAllMenuSheets()
     else
         orxonox.execute("keyESC")

Modified: code/branches/shipSelection/src/orxonox/LevelInfo.h
===================================================================
--- code/branches/shipSelection/src/orxonox/LevelInfo.h	2012-04-20 14:16:58 UTC (rev 9100)
+++ code/branches/shipSelection/src/orxonox/LevelInfo.h	2012-04-20 14:19:27 UTC (rev 9101)
@@ -42,6 +42,8 @@
 #include "util/StringUtils.h"
 
 #include "core/BaseObject.h"
+#include <iostream>
+#include <fstream>
 #include "core/OrxonoxClass.h"
 
 namespace orxonox // tolua_export
@@ -135,7 +137,9 @@
             */
 
             inline const std::string& getXMLFilename(void) const { return this->xmlfilename_; } // tolua_export
+	    inline void selectShip (const std::string& ship) { this->changeShip(ship); } // tolua_export
 
+
         protected:
             /**
             @brief Set the XML-filename of the Level.
@@ -147,6 +151,21 @@
             std::string xmlfilename_; //!< The XML-filename of the Level.
 
         private:
+	    inline void changeShip (const std::string& model) {
+                //HACK: Read Level XML File, find "shipselection", replace with ship model
+                std::string text;
+ 		std::ifstream myLevel ("test.txt");
+		std::ofstream tempLevel ("test2.txt");
+		while(!myLevel.eof())
+		{
+			std::string buff;
+			std::getline(myLevel, buff);
+			tempLevel.write(buff.c_str(), buff.length());
+		}
+		myLevel.close();
+		tempLevel.close();
+		orxout(user_status) << "done" << endl;
+	    } 
             void tagsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed.
             void shipsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed.
             static void initializeTags(void); //!< Initialize the set of allowed tags.




More information about the Orxonox-commit mailing list