[Orxonox-commit 2911] r7614 - in code/branches/releasetodo: data/levels src/orxonox
dafrick at orxonox.net
dafrick at orxonox.net
Thu Nov 4 17:01:40 CET 2010
Author: dafrick
Date: 2010-11-04 17:01:40 +0100 (Thu, 04 Nov 2010)
New Revision: 7614
Added:
code/branches/releasetodo/src/orxonox/LevelInfo.cc
code/branches/releasetodo/src/orxonox/LevelInfo.h
Modified:
code/branches/releasetodo/data/levels/notifications.oxw
code/branches/releasetodo/src/orxonox/CMakeLists.txt
code/branches/releasetodo/src/orxonox/Level.cc
code/branches/releasetodo/src/orxonox/LevelManager.cc
code/branches/releasetodo/src/orxonox/OrxonoxPrereqs.h
Log:
Trying out some stuff.
Modified: code/branches/releasetodo/data/levels/notifications.oxw
===================================================================
--- code/branches/releasetodo/data/levels/notifications.oxw 2010-11-04 10:08:32 UTC (rev 7613)
+++ code/branches/releasetodo/data/levels/notifications.oxw 2010-11-04 16:01:40 UTC (rev 7614)
@@ -5,6 +5,12 @@
include("templates/lodinformation.oxt")
?>
+<LevelInfo
+ name = "Notifications showcase"
+ description = "Level to test and showcase notifications."
+ tags = "test, showcase, notifications"
+/>
+
<Level
name = "Presentation"
description = "A simple testlevel"
Modified: code/branches/releasetodo/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/releasetodo/src/orxonox/CMakeLists.txt 2010-11-04 10:08:32 UTC (rev 7613)
+++ code/branches/releasetodo/src/orxonox/CMakeLists.txt 2010-11-04 16:01:40 UTC (rev 7614)
@@ -24,6 +24,7 @@
SET_SOURCE_FILES(ORXONOX_SRC_FILES
Level.cc
+ LevelInfo.cc
LevelManager.cc
Main.cc
MoodManager.cc
@@ -57,6 +58,7 @@
FIND_HEADER_FILES
TOLUA_FILES
ChatInputHandler.h
+ LevelInfo.h
LevelManager.h
MoodManager.h
controllers/HumanController.h
Modified: code/branches/releasetodo/src/orxonox/Level.cc
===================================================================
--- code/branches/releasetodo/src/orxonox/Level.cc 2010-11-04 10:08:32 UTC (rev 7613)
+++ code/branches/releasetodo/src/orxonox/Level.cc 2010-11-04 16:01:40 UTC (rev 7614)
@@ -75,7 +75,7 @@
XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode);
XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
-}
+ }
void Level::registerVariables()
{
Added: code/branches/releasetodo/src/orxonox/LevelInfo.cc
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelInfo.cc (rev 0)
+++ code/branches/releasetodo/src/orxonox/LevelInfo.cc 2010-11-04 16:01:40 UTC (rev 7614)
@@ -0,0 +1,89 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "LevelInfo.h"
+
+#include <sstream>
+#include <vector>
+
+#include "util/SubString.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "LevelManager.h"
+
+namespace orxonox
+{
+ CreateFactory(LevelInfo);
+
+ LevelInfo::LevelInfo(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(LevelInfo);
+
+ }
+
+ LevelInfo::~LevelInfo()
+ {
+
+ }
+
+ void LevelInfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(LevelInfo, XMLPort, xmlelement, mode);
+
+ XMLPortParam(LevelInfo, "description", setDescription, getDescription, xmlelement, mode);
+ XMLPortParam(LevelInfo, "tags", setTags, getTags, xmlelement, mode).defaultValues("");
+ }
+
+ void LevelInfo::setTags(const std::string& tags)
+ {
+ const std::vector<std::string>& strings = SubString(tags, ",", " ").getAllStrings();
+ for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
+ this->addTag(*it);
+
+ this->tagsUpdated();
+ }
+
+ void LevelInfo::tagsUpdated(void)
+ {
+ std::stringstream stream;
+ std::set<std::string>::const_iterator temp;
+ for(std::set<std::string>::const_iterator it = this->tags_.begin(); it != this->tags_.end(); )
+ {
+ temp = it;
+ if(++it == this->tags_.end()) // If this is the last tag.
+ stream << *temp;
+ else
+ stream << *temp << ", ";
+ }
+
+ this->tagsString_ = stream.str();
+ }
+
+}
+
Added: code/branches/releasetodo/src/orxonox/LevelInfo.h
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelInfo.h (rev 0)
+++ code/branches/releasetodo/src/orxonox/LevelInfo.h 2010-11-04 16:01:40 UTC (rev 7614)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _LevelInfo_H__
+#define _LevelInfo_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <set>
+#include <string>
+#include "core/BaseObject.h"
+
+namespace orxonox // tolua_export
+{ // tolua_export
+ class _OrxonoxExport LevelInfo // tolua_export
+ : public BaseObject
+ { // tolua_export
+
+ public:
+ LevelInfo(BaseObject* creator);
+ virtual ~LevelInfo();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setDescription(const std::string& description)
+ { this->description_ = description; }
+ inline const std::string& getDescription() const // tolua_export
+ { return this->description_; }
+
+ void setTags(const std::string& tags);
+ inline bool addTag(const std::string& tag)
+ { bool success = this->tags_.insert(tag).second; if(success) this->tagsUpdated(); return success; }
+ inline const std::string& getTags(void) const
+ { return this->tagsString_; }
+ bool hasTag(const std::string& tag) { return this->tags_.find(tag) != this->tags_.end(); } // tolua_export
+
+ private:
+ void tagsUpdated(void);
+
+ std::string description_;
+ std::set<std::string> tags_;
+ std::string tagsString_;
+
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _Level_H__ */
Modified: code/branches/releasetodo/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelManager.cc 2010-11-04 10:08:32 UTC (rev 7613)
+++ code/branches/releasetodo/src/orxonox/LevelManager.cc 2010-11-04 16:01:40 UTC (rev 7614)
@@ -31,13 +31,16 @@
#include <map>
#include "util/ScopedSingletonManager.h"
+#include "core/ClassTreeMask.h"
#include "core/CommandLineParser.h"
#include "core/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/Loader.h"
#include "core/Resource.h"
+#include "core/XMLFile.h"
#include "PlayerManager.h"
#include "Level.h"
+#include "LevelInfo.h"
namespace orxonox
{
@@ -141,8 +144,16 @@
if (it->find("old/") != 0)
{
size_t pos = it->find(".oxw");
+ COUT(0) << *it << std::endl;
+ XMLFile file = XMLFile(*it);
+ ClassTreeMask mask = ClassTreeMask();
+ mask.exclude(ClassIdentifier<BaseObject>::getIdentifier());
+ mask.include(ClassIdentifier<LevelInfo>::getIdentifier());
+ Loader::load(&file, mask);
+
this->availableLevels_.push_back(it->substr(0, pos));
}
}
+
}
}
Modified: code/branches/releasetodo/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/releasetodo/src/orxonox/OrxonoxPrereqs.h 2010-11-04 10:08:32 UTC (rev 7613)
+++ code/branches/releasetodo/src/orxonox/OrxonoxPrereqs.h 2010-11-04 16:01:40 UTC (rev 7614)
@@ -66,6 +66,7 @@
{
class CameraManager;
class Level;
+ class LevelInfo;
class LevelManager;
class PawnManager;
class PlayerManager;
More information about the Orxonox-commit
mailing list