Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2010, 9:28:28 PM (15 years ago)
Author:
dafrick
Message:

Made the QuestGUI completely lua based in an attempt to remove a segfault that occured when closing orxonox. Successfully, I might add. ;)
In the process of doing so I expanded the GUITools by adding a function that calculates the height that text in an input window needs, with word-wrap enabled.
Also fixed a small error in the Quest_PirateAttack level.

Location:
code/branches/presentation3/src/modules/questsystem
Files:
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/questsystem/CMakeLists.txt

    r6800 r7072  
    1212  QuestEffect.cc
    1313  QuestEffectBeacon.cc
    14   QuestGUINode.cc
    15   QuestGUI.cc
    1614  QuestHint.cc
    1715  QuestItem.cc
     
    2826  TOLUA_FILES
    2927    QuestManager.h
     28    QuestDescription.h
     29    Quest.h
     30    QuestHint.h
    3031  DEFINE_SYMBOL
    3132    "QUESTSYSTEM_SHARED_BUILD"
  • code/branches/presentation3/src/modules/questsystem/Quest.h

    r6940 r7072  
    4141#include "QuestItem.h"
    4242
    43 namespace orxonox
    44 {
     43namespace orxonox // tolua_export
     44{ // tolua_export
    4545    namespace QuestStatus
    4646    {
     
    6767        Damian 'Mozork' Frick
    6868    */
    69     class _QuestsystemExport Quest : public QuestItem
    70     {
     69    class _QuestsystemExport Quest // tolua_export
     70        : public QuestItem
     71    { // tolua_export
    7172        public:
    7273            Quest(BaseObject* creator);
     
    9798
    9899            bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
    99             bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
    100             bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
    101             bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
     100            bool isActive(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'active'.
     101            bool isFailed(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'failed'.
     102            bool isCompleted(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'completed'.
    102103
    103104            bool start(PlayerInfo* player); //!< Sets a Quest to active.
     
    151152            bool addCompleteEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of complete QuestEffects.
    152153
    153     };
     154    }; // tolua_export
    154155
    155 }
     156} // tolua_export
    156157
    157158#endif /* _Quest_H__ */
  • code/branches/presentation3/src/modules/questsystem/QuestHint.h

    r5781 r7072  
    4040#include "QuestItem.h"
    4141
    42 namespace orxonox
    43 {
     42namespace orxonox // tolua_export
     43{ // tolua_export
    4444    namespace QuestHintStatus
    4545    {
     
    6666        Damian 'Mozork' Frick
    6767    */
    68     class _QuestsystemExport QuestHint : public QuestItem
    69     {
     68    class _QuestsystemExport QuestHint // tolua_export
     69        : public QuestItem
     70    { // tolua_export
    7071
    7172        public:
     
    9192            std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
    9293
    93     };
     94    }; // tolua_export
    9495
    95 }
     96} // tolua_export
    9697
    9798#endif /* _QuestHint_H__ */
  • code/branches/presentation3/src/modules/questsystem/QuestManager.cc

    r6945 r7072  
    7474    QuestManager::~QuestManager()
    7575    {
    76         for(std::map<PlayerInfo*, QuestGUI*>::iterator it = this->questGUIs_.begin(); it != this->questGUIs_.end(); it++)
    77         {
    78             it->second->destroy();
    79         }
    80         this->questGUIs_.clear();
     76       
    8177    }
    8278
     
    244240    }
    245241
    246     /**
    247     @brief
    248         Retreive the main window for the GUI.
    249         This is for the use in the lua script tu start the QuestGUI.
    250     @param guiName
    251         The name of the GUI.
    252     @return
    253         Returns a CEGUI Window.
    254     */
    255     CEGUI::Window* QuestManager::getQuestGUI(const std::string & guiName)
    256     {
    257         PlayerInfo* player = this->retrievePlayer(guiName);
    258 
    259         if(this->questGUIs_.find(player) == this->questGUIs_.end()) //!< Create a new GUI, if there is none, yet.
    260             this->questGUIs_[player] = new QuestGUI(player);
    261 
    262         return this->questGUIs_[player]->getGUI();
     242    int QuestManager::getNumParentQuests(PlayerInfo* player)
     243    {
     244        int numQuests = 0;
     245        for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
     246        {
     247            if(it->second->getParentQuest() == NULL && !it->second->isInactive(player))
     248                numQuests++;
     249        }
     250        return numQuests;
     251    }
     252   
     253    Quest* QuestManager::getParentQuest(PlayerInfo* player, int index)
     254    {
     255        for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
     256        {
     257            if(it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0)
     258                return it->second;
     259        }
     260        return NULL;
     261    }
     262
     263    int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
     264    {
     265        std::list<Quest*> quests = quest->getSubQuestList();
     266        int numQuests = 0;
     267        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
     268        {
     269            if(!(*it)->isInactive(player))
     270                numQuests++;
     271        }
     272        return numQuests;
     273    }
     274   
     275    Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
     276    {
     277        std::list<Quest*> quests = quest->getSubQuestList();
     278        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
     279        {
     280            if(!(*it)->isInactive(player) && index-- == 0)
     281                return *it;
     282        }
     283        return NULL;
     284    }
     285
     286    int QuestManager::getNumHints(Quest* quest, PlayerInfo* player)
     287    {
     288        std::list<QuestHint*> hints = quest->getHintsList();
     289        int numHints = 0;
     290        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
     291        {
     292            if((*it)->isActive(player))
     293                numHints++;
     294        }
     295        return numHints;
     296    }
     297   
     298    QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index)
     299    {
     300        std::list<QuestHint*> hints = quest->getHintsList();
     301        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
     302        {
     303            if((*it)->isActive(player) && index-- == 0)
     304                return *it;
     305        }
     306        return NULL;
     307    }
     308
     309    QuestDescription* QuestManager::getDescription(Quest* item)
     310    {
     311        return item->getDescription();
     312    }
     313
     314    QuestDescription* QuestManager::getDescription(QuestHint* item)
     315    {
     316        return item->getDescription();
    263317    }
    264318
  • code/branches/presentation3/src/modules/questsystem/QuestManager.h

    r6940 r7072  
    3636
    3737#include "questsystem/QuestsystemPrereqs.h"
    38 #include <CEGUIForwardRefs.h>
    3938
    4039#include <list>
     
    4443#include "util/Singleton.h"
    4544#include "core/OrxonoxClass.h"
    46 
    47 #include "QuestGUI.h"
    4845
    4946// tolua_begin
     
    6360
    6461            friend class Singleton<QuestManager>;
    65             friend class QuestGUI;
    6662
    6763        public:
     
    7268            static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
    7369
    74             //! Retrieve the main window for the GUI.
    75             CEGUI::Window* getQuestGUI(const std::string & guiName); // tolua_export
     70            // tolua_begin
     71            int getNumParentQuests(orxonox::PlayerInfo* player);
     72            Quest* getParentQuest(orxonox::PlayerInfo* player, int index);
     73
     74            int getNumSubQuests(Quest* quest, orxonox::PlayerInfo* player);
     75            Quest* getSubQuest(Quest* quest, orxonox::PlayerInfo* player, int index);
     76
     77            int getNumHints(Quest* quest, orxonox::PlayerInfo* player);
     78            QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index);
     79
     80            QuestDescription* getDescription(Quest* item);
     81            QuestDescription* getDescription(QuestHint* item);
     82            // tolua_end
    7683
    7784            bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
     
    93100            std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
    94101
    95             std::map<PlayerInfo*, QuestGUI*> questGUIs_; //!< All GUI's registered by the players.
    96 
    97102    }; // tolua_export
    98103
  • code/branches/presentation3/src/modules/questsystem/QuestsystemPrereqs.h

    r5929 r7072  
    7777    class QuestEffect;
    7878    class QuestEffectBeacon;
    79     class QuestGUI;
    80     class QuestGUINode;
    8179    class QuestHint;
    8280    class QuestItem;
Note: See TracChangeset for help on using the changeset viewer.