[Orxonox-commit 2606] r7311 - in code/branches/doc/src/modules/questsystem: . effects
dafrick at orxonox.net
dafrick at orxonox.net
Wed Sep 1 12:32:56 CEST 2010
Author: dafrick
Date: 2010-09-01 12:32:56 +0200 (Wed, 01 Sep 2010)
New Revision: 7311
Added:
code/branches/doc/src/modules/questsystem/effects/
code/branches/doc/src/modules/questsystem/effects/AddQuest.cc
code/branches/doc/src/modules/questsystem/effects/AddQuest.h
code/branches/doc/src/modules/questsystem/effects/AddQuestHint.cc
code/branches/doc/src/modules/questsystem/effects/AddQuestHint.h
code/branches/doc/src/modules/questsystem/effects/AddReward.cc
code/branches/doc/src/modules/questsystem/effects/AddReward.h
code/branches/doc/src/modules/questsystem/effects/CMakeLists.txt
code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.cc
code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.h
code/branches/doc/src/modules/questsystem/effects/CompleteQuest.cc
code/branches/doc/src/modules/questsystem/effects/CompleteQuest.h
code/branches/doc/src/modules/questsystem/effects/FailQuest.cc
code/branches/doc/src/modules/questsystem/effects/FailQuest.h
Removed:
code/branches/doc/src/modules/questsystem/AddQuest.cc
code/branches/doc/src/modules/questsystem/AddQuest.h
code/branches/doc/src/modules/questsystem/AddQuestHint.cc
code/branches/doc/src/modules/questsystem/AddQuestHint.h
code/branches/doc/src/modules/questsystem/AddReward.cc
code/branches/doc/src/modules/questsystem/AddReward.h
code/branches/doc/src/modules/questsystem/ChangeQuestStatus.cc
code/branches/doc/src/modules/questsystem/ChangeQuestStatus.h
code/branches/doc/src/modules/questsystem/CompleteQuest.cc
code/branches/doc/src/modules/questsystem/CompleteQuest.h
code/branches/doc/src/modules/questsystem/FailQuest.cc
code/branches/doc/src/modules/questsystem/FailQuest.h
Modified:
code/branches/doc/src/modules/questsystem/CMakeLists.txt
Log:
Moving the QuestEffects to subfolder effects.
Deleted: code/branches/doc/src/modules/questsystem/AddQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/AddQuest.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,110 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the AddQuest class.
-*/
-
-#include "AddQuest.h"
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "QuestManager.h"
-#include "Quest.h"
-
-namespace orxonox
-{
- CreateFactory(AddQuest);
-
- /**
- @brief
- Constructor. Registers the object.
- */
- AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator)
- {
- RegisterObject(AddQuest);
- }
-
- /**
- @brief
- Destructor.
- */
- AddQuest::~AddQuest()
- {
- }
-
- /**
- @brief
- Method for creating a AddQuest object through XML.
- */
- void AddQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(AddQuest, XMLPort, xmlelement, mode);
-
- COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
- }
-
- /**
- @brief
- Invokes the QuestEffect.
- @param player
- The player the QuestEffect is invoked on.
- @return
- Returns true if the QuestEffect was successfully invoked.
- */
- bool AddQuest::invoke(PlayerInfo* player)
- {
- if(player == NULL) //!< Null-pointers are badass.
- {
- COUT(2) << "Input player is NULL." << std::endl;
- return false;
- }
-
- COUT(5) << "AddQuest on player: " << player << " ." << std::endl;
-
- try
- {
- Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
- if(quest == NULL || !quest->start(player))
- {
- return false;
- }
- }
- catch(const orxonox::Exception& ex)
- {
- COUT(2) << ex.getFullDescription() << std::endl;
- return false;
- }
-
- COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
- return true;
- }
-
-
-}
Deleted: code/branches/doc/src/modules/questsystem/AddQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/AddQuest.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,68 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the AddQuest class.
-*/
-
-#ifndef _AddQuest_H__
-#define _AddQuest_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-#include "ChangeQuestStatus.h"
-
-namespace orxonox
-{
- /**
- @brief
- Adds a Quest, resp. changes the quests status to active for the player invoking the Quest.
-
- Creating a AddQuest through XML goes as follows:
-
- @code
- <AddQuest questId="id" /> //Where id identifies the Quest that should be added.
- @endcode
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport AddQuest : public ChangeQuestStatus
- {
- public:
- AddQuest(BaseObject* creator);
- virtual ~AddQuest();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
-
- virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
-
- };
-
-}
-
-#endif /* _AddQuest_H__ */
Deleted: code/branches/doc/src/modules/questsystem/AddQuestHint.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/AddQuestHint.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddQuestHint.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,133 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the AddQuestHint class.
-*/
-
-#include "AddQuestHint.h"
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "QuestManager.h"
-#include "QuestItem.h"
-#include "QuestHint.h"
-
-namespace orxonox
-{
- CreateFactory(AddQuestHint);
-
- /**
- @brief
- Constructor. Registers the object.
- */
- AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
- {
- RegisterObject(AddQuestHint);
- }
-
- /**
- @brief
- Destructor.
- */
- AddQuestHint::~AddQuestHint()
- {
- }
-
- /**
- @brief
- Method for creating a AddQuestHint object through XML.
- */
- void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(AddQuestHint, XMLPort, xmlelement, mode);
-
- XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
-
- COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
- }
-
- /**
- @brief
- Sets the id of the QuestHint to be added to the player the QuestEffect is invoked on.
- @param id
- The QuestHint id.
- @return
- Returns true if successful.
- */
- bool AddQuestHint::setHintId(const std::string & id)
- {
- if(id.compare(BLANKSTRING) == 0)
- {
- COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
- return false;
- }
-
- this->hintId_ = id;
- return true;
- }
-
- /**
- @brief
- Invokes the QuestEffect.
- @param player
- The player.
- @return
- Returns true if the QuestEffect was successfully invoked.
- */
- bool AddQuestHint::invoke(PlayerInfo* player)
- {
- if(player == NULL) //!< NULL-pointers are evil!
- {
- COUT(2) << "The input player is NULL." << std::endl;
- return false;
- }
-
- COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl;
-
- try
- {
- QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
- if(hint == NULL || !hint->setActive(player))
- {
- return false;
- }
- }
- catch(const Exception& e)
- {
- COUT(2) << e.getFullDescription() << std::endl;
- return false;
- }
-
- COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
- return true;
-
- }
-}
Deleted: code/branches/doc/src/modules/questsystem/AddQuestHint.h
===================================================================
--- code/branches/doc/src/modules/questsystem/AddQuestHint.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddQuestHint.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,82 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the AddQuestHint class.
-*/
-
-#ifndef _AddQuestHint_H__
-#define _AddQuestHint_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-
-#include <string>
-#include "QuestEffect.h"
-
-namespace orxonox
-{
- /**
- @brief
- Adds a QuestHint, resp. activates the QuestHint of the given id for the player the QuestEffect is invoked on.
-
- Creating a AddQuestHint through XML goes as follows:
-
- @code
- <AddQuestHint hintId="id" /> //Where id identifies the QuestHint that should be added.
- @endcode
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport AddQuestHint : public QuestEffect
- {
- public:
- AddQuestHint(BaseObject* creator);
- virtual ~AddQuestHint();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML.
-
- virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
-
- private:
- std::string hintId_; //!< The id of the QuestHint.
-
- /**
- @brief Returns the id of the QuestHint.
- @return Returns the id of the QuestHint.
- */
- inline const std::string & getHintId(void) const
- { return this->hintId_; }
-
- bool setHintId(const std::string & id); //!< Sets the id of the QuestHint.
-
- };
-
-}
-
-#endif /* _AddQuestHint_H__ */
Deleted: code/branches/doc/src/modules/questsystem/AddReward.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/AddReward.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddReward.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,118 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the AddReward class.
-*/
-
-#include "AddReward.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "interfaces/Rewardable.h"
-
-namespace orxonox
-{
- CreateFactory(AddReward);
-
- /**
- @brief
- Constructor. Registers the object.
- */
- AddReward::AddReward(BaseObject* creator) : QuestEffect(creator)
- {
- RegisterObject(AddReward);
- }
-
- /**
- @brief
- Destructor.
- */
- AddReward::~AddReward()
- {
- }
-
- /**
- Method for creating a AddReward object through XML.
- */
- void AddReward::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(AddReward, XMLPort, xmlelement, mode);
-
- XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
-
- COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
- }
-
- /**
- @brief
- Returns the Rewardable object at the given index.
- @param index
- The index.
- @return
- Returns a pointer to the Rewardable object at the given index.
- */
- const Rewardable* AddReward::getRewardables(unsigned int index) const
- {
- int i = index;
- for (std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)
- {
- if(i == 0)
- {
- return *reward;
- }
- i--;
- }
- return NULL;
- }
-
- /**
- @brief
- Invokes the QuestEffect.
- @param player
- The player.
- @return
- Returns true if the QuestEffect was invoked successfully.
- */
- bool AddReward::invoke(PlayerInfo* player)
- {
- COUT(5) << "AddReward on player: " << player << " ." << std::endl;
-
- bool check = true;
- for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
- {
- check = check && (*reward)->reward(player);
- }
-
- COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
-
- return check;
- }
-
-}
Deleted: code/branches/doc/src/modules/questsystem/AddReward.h
===================================================================
--- code/branches/doc/src/modules/questsystem/AddReward.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/AddReward.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,86 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the AddReward class.
-*/
-
-#ifndef _AddReward_H__
-#define _AddReward_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-
-#include <list>
-#include "QuestEffect.h"
-
-namespace orxonox
-{
- /**
- @brief
- Adds a list of Rewardables to a player.
-
- Creating a AddReward through XML goes as follows:
-
- @code
- <AddReward>
- <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.
- ...
- <Rewardable />
- </AddReward>
- @endcode
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport AddReward : public QuestEffect
- {
- public:
- AddReward(BaseObject* creator);
- virtual ~AddReward();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML.
-
- virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
-
- private:
- std::list<Rewardable*> rewards_; //!< A list of Rewardables to be added to the player invoking the QuestEffect.
-
- /**
- @brief Add a Rewardable object to the list of objects to be awarded to the player invoking the QuestEffect.
- @param reward Pointer to the Rewardable to be added.
- */
- inline void addRewardable(Rewardable* reward)
- { this->rewards_.push_back(reward); }
-
- const Rewardable* getRewardables(unsigned int index) const; //!< Returns the Rewardable object at the given index.
-
- };
-
-}
-
-#endif /* _AddReward_H__ */
Modified: code/branches/doc/src/modules/questsystem/CMakeLists.txt
===================================================================
--- code/branches/doc/src/modules/questsystem/CMakeLists.txt 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/CMakeLists.txt 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,10 +1,4 @@
SET_SOURCE_FILES(QUESTSYSTEM_SRC_FILES
- AddQuest.cc
- AddQuestHint.cc
- AddReward.cc
- ChangeQuestStatus.cc
- CompleteQuest.cc
- FailQuest.cc
GlobalQuest.cc
LocalQuest.cc
Quest.cc
@@ -18,6 +12,8 @@
QuestNotification.cc
)
+ADD_SUBDIRECTORY(effects)
+
ORXONOX_ADD_LIBRARY(questsystem
MODULE
FIND_HEADER_FILES
Deleted: code/branches/doc/src/modules/questsystem/ChangeQuestStatus.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/ChangeQuestStatus.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/ChangeQuestStatus.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,90 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the ChangeQuestStatus class.
-*/
-
-#include "ChangeQuestStatus.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "QuestItem.h"
-
-namespace orxonox
-{
- /**
- @brief
- Constructor. Registers the object.
- */
- ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator)
- {
- RegisterObject(ChangeQuestStatus);
- }
-
- /**
- @brief
- Destructor.
- */
- ChangeQuestStatus::~ChangeQuestStatus()
- {
- }
-
- /**
- @brief
- Method for creating a ChangeQuestStatus object through XML.
- */
- void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
-
- XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
- }
-
- /**
- @brief
- Sets the id of the Quest the Questffect changes the status of.
- @param id
- The id of the Quest.
- @return
- Returns true if successful.
- */
- bool ChangeQuestStatus::setQuestId(const std::string & id)
- {
- if(id.compare(BLANKSTRING) == 0)
- {
- COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
- return false;
- }
-
- this->questId_ = id;
- return true;
- }
-
-}
Deleted: code/branches/doc/src/modules/questsystem/ChangeQuestStatus.h
===================================================================
--- code/branches/doc/src/modules/questsystem/ChangeQuestStatus.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/ChangeQuestStatus.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,77 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the ChangeQuestStatus class.
-*/
-
-#ifndef _ChangeQuestStatus_H__
-#define _ChangeQuestStatus_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-
-#include <string>
-#include "QuestEffect.h"
-
-namespace orxonox
-{
- /**
- @brief
- A QuestEffect which changes the status of a specified Quest for the player invoking the QuestEffect.
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport ChangeQuestStatus : public QuestEffect
- {
- public:
- ChangeQuestStatus(BaseObject* creator);
- virtual ~ChangeQuestStatus();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML.
-
- virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
-
- protected:
- /**
- @brief Returns the id of the Quest.
- @return Returns the id of the Quest.
- */
- inline const std::string & getQuestId(void) const
- { return this->questId_; }
-
- private:
- std::string questId_; //!< The id of the Quest the status should be changed of.
-
- bool setQuestId(const std::string & id); //!< Sets the id of the Quest.
-
- };
-
-}
-
-#endif /* _ChangeQuestStatus_H__ */
Deleted: code/branches/doc/src/modules/questsystem/CompleteQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/CompleteQuest.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/CompleteQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,112 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the CompleteQuest class.
-*/
-
-#include "CompleteQuest.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "QuestManager.h"
-#include "Quest.h"
-
-namespace orxonox
-{
- CreateFactory(CompleteQuest);
-
- /**
- @brief
- Constructor. Registers the object.
- */
- CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator)
- {
- RegisterObject(CompleteQuest);
- }
-
- /**
- @brief
- Destructor.
- */
- CompleteQuest::~CompleteQuest()
- {
- }
-
- /**
- @brief
- Method for creating a CompleteQuest object through XML.
- */
- void CompleteQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(CompleteQuest, XMLPort, xmlelement, mode);
-
- COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
- }
-
- /**
- @brief
- Invokes the QuestEffect.
- @param player
- The player the QuestEffect is invoked on.
- @return
- Returns true if the QuestEffect was invoked successfully.
- */
- bool CompleteQuest::invoke(PlayerInfo* player)
- {
- if(player == NULL) //!< You know, what we think of NULL-pointers...
- {
- COUT(2) << "Input player is NULL." << std::endl;
- return false;
- }
-
- COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl;
-
- Quest* quest;
-
- try
- {
- quest = QuestManager::getInstance().findQuest(this->getQuestId());
- if(quest == NULL || !quest->complete(player))
- {
- return false;
- }
- }
- catch(const Exception& e)
- {
- COUT(2) << e.getFullDescription() << std::endl;
- return false;
- }
-
- COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
- return true;
- }
-
-
-}
Deleted: code/branches/doc/src/modules/questsystem/CompleteQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/CompleteQuest.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/CompleteQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,68 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the CompleteQuest class.
-*/
-
-#ifndef _CompleteQuest_H__
-#define _CompleteQuest_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-#include "ChangeQuestStatus.h"
-
-namespace orxonox
-{
- /**
- @brief
- Completes a Quest (with a specified id) for the player invoking the QuestEffect.
-
- Creating a CompleteQuest through XML goes as follows:
-
- @code
- <CompleteQuest questId="id" /> //Where id identifies the Quest that should be completed.
- @endcode
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport CompleteQuest : public ChangeQuestStatus
- {
- public:
- CompleteQuest(BaseObject* creator);
- virtual ~CompleteQuest();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML.
-
- virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
-
- };
-
-}
-
-#endif /* _CompleteQuest_H__ */
Deleted: code/branches/doc/src/modules/questsystem/FailQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/FailQuest.cc 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/FailQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,111 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the FailQuest class.
-*/
-
-#include "FailQuest.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "QuestManager.h"
-#include "Quest.h"
-
-namespace orxonox
-{
- CreateFactory(FailQuest);
-
- /**
- @brief
- Constructor. Registers the object.
- */
- FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
- {
- RegisterObject(FailQuest);
- }
-
- /**
- @brief
- Destructor.
- */
- FailQuest::~FailQuest()
- {
- }
-
- /**
- @brief
- Method for creating a FailQuest object through XML.
- */
- void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(FailQuest, XMLPort, xmlelement, mode);
-
- COUT(4) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
- }
-
- /**
- @brief
- Invokes the QuestEffect.
- @param player
- The player the QuestEffect is invoked on.
- @return
- Returns true if the QuestEffect was invoked successfully.
- */
- bool FailQuest::invoke(PlayerInfo* player)
- {
- if(player == NULL) //!< We don't know what to do with no player.
- {
- COUT(2) << "Input player is NULL." << std::endl;
- return false;
- }
-
- COUT(4) << "FailQuest on player: " << player << " ." << std::endl;
-
- Quest* quest;
- try
- {
- quest = QuestManager::getInstance().findQuest(this->getQuestId());
- if(quest == NULL || !quest->fail(player))
- {
- return false;
- }
- }
- catch(const Exception& e)
- {
- COUT(2) << e.getFullDescription() << std::endl;
- return false;
- }
-
- COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
- return true;
- }
-
-
-}
Deleted: code/branches/doc/src/modules/questsystem/FailQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/FailQuest.h 2010-09-01 09:58:35 UTC (rev 7310)
+++ code/branches/doc/src/modules/questsystem/FailQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -1,68 +0,0 @@
-/*
- * 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:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of the FailQuest class.
-*/
-
-#ifndef _FailQuest_H__
-#define _FailQuest_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-#include "ChangeQuestStatus.h"
-
-namespace orxonox
-{
- /**
- @brief
- Fails a quest (with a specified id) for the player invoking the QuestEffect.
-
- Creating a FailQuest through XML goes as follows:
-
- @code
- <FailQuest questId="id" /> //Where id identifies the Quest that should be failed.
- @endcode
- @author
- Damian 'Mozork' Frick
- */
- class _QuestsystemExport FailQuest : public ChangeQuestStatus
- {
- public:
- FailQuest(BaseObject* creator);
- virtual ~FailQuest();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML.
-
- virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
-
- };
-
-}
-
-#endif /* _FailQuest_H__ */
Added: code/branches/doc/src/modules/questsystem/effects/AddQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddQuest.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,110 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the AddQuest class.
+*/
+
+#include "AddQuest.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "questsystem/QuestManager.h"
+#include "questsystem/Quest.h"
+
+namespace orxonox
+{
+ CreateFactory(AddQuest);
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ {
+ RegisterObject(AddQuest);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ AddQuest::~AddQuest()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a AddQuest object through XML.
+ */
+ void AddQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(AddQuest, XMLPort, xmlelement, mode);
+
+ COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+ }
+
+ /**
+ @brief
+ Invokes the QuestEffect.
+ @param player
+ The player the QuestEffect is invoked on.
+ @return
+ Returns true if the QuestEffect was successfully invoked.
+ */
+ bool AddQuest::invoke(PlayerInfo* player)
+ {
+ if(player == NULL) //!< Null-pointers are badass.
+ {
+ COUT(2) << "Input player is NULL." << std::endl;
+ return false;
+ }
+
+ COUT(5) << "AddQuest on player: " << player << " ." << std::endl;
+
+ try
+ {
+ Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
+ if(quest == NULL || !quest->start(player))
+ {
+ return false;
+ }
+ }
+ catch(const orxonox::Exception& ex)
+ {
+ COUT(2) << ex.getFullDescription() << std::endl;
+ return false;
+ }
+
+ COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
+ return true;
+ }
+
+
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddQuest.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/AddQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddQuest.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the AddQuest class.
+*/
+
+#ifndef _AddQuest_H__
+#define _AddQuest_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Adds a Quest, resp. changes the quests status to active for the player invoking the Quest.
+
+ Creating a AddQuest through XML goes as follows:
+
+ @code
+ <AddQuest questId="id" /> //Where id identifies the Quest that should be added.
+ @endcode
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport AddQuest : public ChangeQuestStatus
+ {
+ public:
+ AddQuest(BaseObject* creator);
+ virtual ~AddQuest();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
+
+ virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+ };
+
+}
+
+#endif /* _AddQuest_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddQuest.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/AddQuestHint.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddQuestHint.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddQuestHint.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,133 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the AddQuestHint class.
+*/
+
+#include "AddQuestHint.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "questsystem/QuestManager.h"
+#include "questsystem/QuestItem.h"
+#include "questsystem/QuestHint.h"
+
+namespace orxonox
+{
+ CreateFactory(AddQuestHint);
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
+ {
+ RegisterObject(AddQuestHint);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ AddQuestHint::~AddQuestHint()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a AddQuestHint object through XML.
+ */
+ void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(AddQuestHint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
+
+ COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
+ }
+
+ /**
+ @brief
+ Sets the id of the QuestHint to be added to the player the QuestEffect is invoked on.
+ @param id
+ The QuestHint id.
+ @return
+ Returns true if successful.
+ */
+ bool AddQuestHint::setHintId(const std::string & id)
+ {
+ if(id.compare(BLANKSTRING) == 0)
+ {
+ COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+ return false;
+ }
+
+ this->hintId_ = id;
+ return true;
+ }
+
+ /**
+ @brief
+ Invokes the QuestEffect.
+ @param player
+ The player.
+ @return
+ Returns true if the QuestEffect was successfully invoked.
+ */
+ bool AddQuestHint::invoke(PlayerInfo* player)
+ {
+ if(player == NULL) //!< NULL-pointers are evil!
+ {
+ COUT(2) << "The input player is NULL." << std::endl;
+ return false;
+ }
+
+ COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl;
+
+ try
+ {
+ QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
+ if(hint == NULL || !hint->setActive(player))
+ {
+ return false;
+ }
+ }
+ catch(const Exception& e)
+ {
+ COUT(2) << e.getFullDescription() << std::endl;
+ return false;
+ }
+
+ COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
+ return true;
+
+ }
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddQuestHint.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/AddQuestHint.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddQuestHint.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddQuestHint.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,82 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the AddQuestHint class.
+*/
+
+#ifndef _AddQuestHint_H__
+#define _AddQuestHint_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+
+#include <string>
+#include "questsystem/QuestEffect.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Adds a QuestHint, resp. activates the QuestHint of the given id for the player the QuestEffect is invoked on.
+
+ Creating a AddQuestHint through XML goes as follows:
+
+ @code
+ <AddQuestHint hintId="id" /> //Where id identifies the QuestHint that should be added.
+ @endcode
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport AddQuestHint : public QuestEffect
+ {
+ public:
+ AddQuestHint(BaseObject* creator);
+ virtual ~AddQuestHint();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML.
+
+ virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+ private:
+ std::string hintId_; //!< The id of the QuestHint.
+
+ /**
+ @brief Returns the id of the QuestHint.
+ @return Returns the id of the QuestHint.
+ */
+ inline const std::string & getHintId(void) const
+ { return this->hintId_; }
+
+ bool setHintId(const std::string & id); //!< Sets the id of the QuestHint.
+
+ };
+
+}
+
+#endif /* _AddQuestHint_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddQuestHint.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/AddReward.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddReward.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddReward.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,118 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the AddReward class.
+*/
+
+#include "AddReward.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "interfaces/Rewardable.h"
+
+namespace orxonox
+{
+ CreateFactory(AddReward);
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ AddReward::AddReward(BaseObject* creator) : QuestEffect(creator)
+ {
+ RegisterObject(AddReward);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ AddReward::~AddReward()
+ {
+ }
+
+ /**
+ Method for creating a AddReward object through XML.
+ */
+ void AddReward::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(AddReward, XMLPort, xmlelement, mode);
+
+ XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
+
+ COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
+ }
+
+ /**
+ @brief
+ Returns the Rewardable object at the given index.
+ @param index
+ The index.
+ @return
+ Returns a pointer to the Rewardable object at the given index.
+ */
+ const Rewardable* AddReward::getRewardables(unsigned int index) const
+ {
+ int i = index;
+ for (std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)
+ {
+ if(i == 0)
+ {
+ return *reward;
+ }
+ i--;
+ }
+ return NULL;
+ }
+
+ /**
+ @brief
+ Invokes the QuestEffect.
+ @param player
+ The player.
+ @return
+ Returns true if the QuestEffect was invoked successfully.
+ */
+ bool AddReward::invoke(PlayerInfo* player)
+ {
+ COUT(5) << "AddReward on player: " << player << " ." << std::endl;
+
+ bool check = true;
+ for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
+ {
+ check = check && (*reward)->reward(player);
+ }
+
+ COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
+
+ return check;
+ }
+
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddReward.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/AddReward.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/AddReward.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/AddReward.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,86 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the AddReward class.
+*/
+
+#ifndef _AddReward_H__
+#define _AddReward_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+
+#include <list>
+#include "questsystem/QuestEffect.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Adds a list of Rewardables to a player.
+
+ Creating a AddReward through XML goes as follows:
+
+ @code
+ <AddReward>
+ <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.
+ ...
+ <Rewardable />
+ </AddReward>
+ @endcode
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport AddReward : public QuestEffect
+ {
+ public:
+ AddReward(BaseObject* creator);
+ virtual ~AddReward();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML.
+
+ virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+ private:
+ std::list<Rewardable*> rewards_; //!< A list of Rewardables to be added to the player invoking the QuestEffect.
+
+ /**
+ @brief Add a Rewardable object to the list of objects to be awarded to the player invoking the QuestEffect.
+ @param reward Pointer to the Rewardable to be added.
+ */
+ inline void addRewardable(Rewardable* reward)
+ { this->rewards_.push_back(reward); }
+
+ const Rewardable* getRewardables(unsigned int index) const; //!< Returns the Rewardable object at the given index.
+
+ };
+
+}
+
+#endif /* _AddReward_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/AddReward.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/CMakeLists.txt
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/CMakeLists.txt (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/CMakeLists.txt 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,9 @@
+ADD_SOURCE_FILES(QUESTSYSTEM_SRC_FILES
+ AddQuest.cc
+ AddQuestHint.cc
+ AddReward.cc
+ ChangeQuestStatus.cc
+ CompleteQuest.cc
+ FailQuest.cc
+)
+
Added: code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,90 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the ChangeQuestStatus class.
+*/
+
+#include "ChangeQuestStatus.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "questsystem/QuestItem.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator)
+ {
+ RegisterObject(ChangeQuestStatus);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ ChangeQuestStatus::~ChangeQuestStatus()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a ChangeQuestStatus object through XML.
+ */
+ void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Sets the id of the Quest the Questffect changes the status of.
+ @param id
+ The id of the Quest.
+ @return
+ Returns true if successful.
+ */
+ bool ChangeQuestStatus::setQuestId(const std::string & id)
+ {
+ if(id.compare(BLANKSTRING) == 0)
+ {
+ COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+ return false;
+ }
+
+ this->questId_ = id;
+ return true;
+ }
+
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the ChangeQuestStatus class.
+*/
+
+#ifndef _ChangeQuestStatus_H__
+#define _ChangeQuestStatus_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+
+#include <string>
+#include "questsystem/QuestEffect.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ A QuestEffect which changes the status of a specified Quest for the player invoking the QuestEffect.
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport ChangeQuestStatus : public QuestEffect
+ {
+ public:
+ ChangeQuestStatus(BaseObject* creator);
+ virtual ~ChangeQuestStatus();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML.
+
+ virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
+
+ protected:
+ /**
+ @brief Returns the id of the Quest.
+ @return Returns the id of the Quest.
+ */
+ inline const std::string & getQuestId(void) const
+ { return this->questId_; }
+
+ private:
+ std::string questId_; //!< The id of the Quest the status should be changed of.
+
+ bool setQuestId(const std::string & id); //!< Sets the id of the Quest.
+
+ };
+
+}
+
+#endif /* _ChangeQuestStatus_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/ChangeQuestStatus.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/CompleteQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/CompleteQuest.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/CompleteQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,112 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the CompleteQuest class.
+*/
+
+#include "CompleteQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "questsystem/QuestManager.h"
+#include "questsystem/Quest.h"
+
+namespace orxonox
+{
+ CreateFactory(CompleteQuest);
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ {
+ RegisterObject(CompleteQuest);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ CompleteQuest::~CompleteQuest()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a CompleteQuest object through XML.
+ */
+ void CompleteQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(CompleteQuest, XMLPort, xmlelement, mode);
+
+ COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+ }
+
+ /**
+ @brief
+ Invokes the QuestEffect.
+ @param player
+ The player the QuestEffect is invoked on.
+ @return
+ Returns true if the QuestEffect was invoked successfully.
+ */
+ bool CompleteQuest::invoke(PlayerInfo* player)
+ {
+ if(player == NULL) //!< You know, what we think of NULL-pointers...
+ {
+ COUT(2) << "Input player is NULL." << std::endl;
+ return false;
+ }
+
+ COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl;
+
+ Quest* quest;
+
+ try
+ {
+ quest = QuestManager::getInstance().findQuest(this->getQuestId());
+ if(quest == NULL || !quest->complete(player))
+ {
+ return false;
+ }
+ }
+ catch(const Exception& e)
+ {
+ COUT(2) << e.getFullDescription() << std::endl;
+ return false;
+ }
+
+ COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
+ return true;
+ }
+
+
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/CompleteQuest.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/CompleteQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/CompleteQuest.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/CompleteQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the CompleteQuest class.
+*/
+
+#ifndef _CompleteQuest_H__
+#define _CompleteQuest_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Completes a Quest (with a specified id) for the player invoking the QuestEffect.
+
+ Creating a CompleteQuest through XML goes as follows:
+
+ @code
+ <CompleteQuest questId="id" /> //Where id identifies the Quest that should be completed.
+ @endcode
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport CompleteQuest : public ChangeQuestStatus
+ {
+ public:
+ CompleteQuest(BaseObject* creator);
+ virtual ~CompleteQuest();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML.
+
+ virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+ };
+
+}
+
+#endif /* _CompleteQuest_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/CompleteQuest.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/FailQuest.cc
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/FailQuest.cc (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/FailQuest.cc 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,111 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the FailQuest class.
+*/
+
+#include "FailQuest.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "questsystem/QuestManager.h"
+#include "questsystem/Quest.h"
+
+namespace orxonox
+{
+ CreateFactory(FailQuest);
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ {
+ RegisterObject(FailQuest);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ FailQuest::~FailQuest()
+ {
+ }
+
+ /**
+ @brief
+ Method for creating a FailQuest object through XML.
+ */
+ void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(FailQuest, XMLPort, xmlelement, mode);
+
+ COUT(4) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+ }
+
+ /**
+ @brief
+ Invokes the QuestEffect.
+ @param player
+ The player the QuestEffect is invoked on.
+ @return
+ Returns true if the QuestEffect was invoked successfully.
+ */
+ bool FailQuest::invoke(PlayerInfo* player)
+ {
+ if(player == NULL) //!< We don't know what to do with no player.
+ {
+ COUT(2) << "Input player is NULL." << std::endl;
+ return false;
+ }
+
+ COUT(4) << "FailQuest on player: " << player << " ." << std::endl;
+
+ Quest* quest;
+ try
+ {
+ quest = QuestManager::getInstance().findQuest(this->getQuestId());
+ if(quest == NULL || !quest->fail(player))
+ {
+ return false;
+ }
+ }
+ catch(const Exception& e)
+ {
+ COUT(2) << e.getFullDescription() << std::endl;
+ return false;
+ }
+
+ COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
+ return true;
+ }
+
+
+}
Property changes on: code/branches/doc/src/modules/questsystem/effects/FailQuest.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Added: code/branches/doc/src/modules/questsystem/effects/FailQuest.h
===================================================================
--- code/branches/doc/src/modules/questsystem/effects/FailQuest.h (rev 0)
+++ code/branches/doc/src/modules/questsystem/effects/FailQuest.h 2010-09-01 10:32:56 UTC (rev 7311)
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the FailQuest class.
+*/
+
+#ifndef _FailQuest_H__
+#define _FailQuest_H__
+
+#include "questsystem/QuestsystemPrereqs.h"
+#include "ChangeQuestStatus.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Fails a quest (with a specified id) for the player invoking the QuestEffect.
+
+ Creating a FailQuest through XML goes as follows:
+
+ @code
+ <FailQuest questId="id" /> //Where id identifies the Quest that should be failed.
+ @endcode
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _QuestsystemExport FailQuest : public ChangeQuestStatus
+ {
+ public:
+ FailQuest(BaseObject* creator);
+ virtual ~FailQuest();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML.
+
+ virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
+
+ };
+
+}
+
+#endif /* _FailQuest_H__ */
Property changes on: code/branches/doc/src/modules/questsystem/effects/FailQuest.h
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Orxonox-commit
mailing list