Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7072


Ignore:
Timestamp:
Jun 1, 2010, 9:28:28 PM (14 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
Files:
4 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/data/gui/scripts/GUITools.lua

    r6746 r7072  
    4545    return 0.008*ratio/0.3204
    4646end
     47
     48function getStaticTextWindowHeight(window)
     49    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
     50    local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
     51    local frameHeight = window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
     52    local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
     53    local height = lines * window:getFont():getLineSpacing() + frameHeight
     54    return height
     55end
  • code/branches/presentation3/data/gui/scripts/PickupInventory.lua

    r6996 r7072  
    247247end
    248248
    249 -- TODO: Smarter
    250249function P.getNewDetailNumber()
    251250    local number = table.getn(P.detailsWindows)
  • code/branches/presentation3/data/gui/scripts/QuestGUI.lua

    r6746 r7072  
    33local P = createMenuSheet("QuestGUI")
    44
    5 function P.show()
    6     P.window:show() -- TODO: Do this through parent...
    7     P.visible = true
    8 
     5P.rootWindow = nil
     6P.detailsWindows = {}
     7P.quests = {}
     8P.hints = {}
     9P.player = nil
     10
     11-- design parameters
     12P.indentWidth = 20
     13P.scrollbarWidth = 13
     14P.buttonHeight = 30
     15P.titleHeight = 26
     16P.borderWidth = 5
     17
     18function P.onShow()
     19
     20    local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
     21
     22    P.player = orxonox.GUIManager:getInstance():getPlayer(P.name)
     23    P.rootWindow = P.createQuestGUI();
     24
     25    questsList:addChildWindow(P.rootWindow)
     26end
     27
     28function P.onHide()
     29    P.cleanup()
     30end
     31
     32function P.createQuestGUI()
    933    local questManager = orxonox.QuestManager:getInstance()
    1034
    11     local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
    12 
    13     local window = questManager:getQuestGUI(P.name)
    14 
    15     questsList:addChildWindow(window)
    16 
     35    local depth = 0
     36    local index = 0
     37
     38    local questWindow = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/QuestGUI/Quests")
     39    questWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0)))
     40
     41    -- Iterate through all parent-quests.
     42    local numParentQuests = orxonox.QuestManager:getInstance():getNumParentQuests(P.player)
     43    local i = 0
     44    while i <= numParentQuests-1 do
     45        local quest = orxonox.QuestManager:getInstance():getParentQuest(P.player, i)
     46        index = P.createQuestNodes(questWindow, quest, depth, index)
     47        i = i+1
     48    end
     49
     50    return questWindow
     51end
     52
     53function P.createQuestNodes(root, parent, depth, index)
     54    local number = table.getn(P.quests)+1
     55    local name = "orxonox/QuestGUI/Quests/" .. number
     56    local node = winMgr:createWindow("MenuWidgets/TabButton", name)
     57    node:setText(orxonox.QuestManager:getInstance():getDescription(parent):getTitle())
     58    node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.indentWidth*depth), CEGUI.UDim(0, P.buttonHeight*index)))
     59    node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
     60    orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openDetails_clicked")
     61    root:addChildWindow(node)
     62   
     63    table.insert(P.quests, parent)
     64
     65    index = index+1
     66
     67    -- Iterate through all sub-quests.
     68    local numQuests = orxonox.QuestManager:getInstance():getNumSubQuests(parent, P.player)
     69    local i = 0
     70    while i <= numQuests-1 do
     71        local quest = orxonox.QuestManager:getInstance():getSubQuest(parent, P.player, i)
     72        index = P.createQuestNodes(root, quest, depth+1, index)
     73        i = i+1
     74    end
     75
     76    return index;
     77end
     78
     79function P.cleanup()
     80    winMgr:destroyWindow(P.rootWindow)
     81    for k,v in pairs(P.detailsWindows) do
     82        if v ~= nil then
     83            winMgr:destroyWindow(v)
     84            P.detailsWindows[k] = nil
     85        end
     86    end
     87    P.detailsWindows = {}
     88
     89    P.quests = {}
     90    P.hints = {}
     91    P.player = nil
     92
     93    winMgr:destroyWindow(P.rootWindow)
     94    P.rootWindow = nil
     95end
     96
     97function P.openDetails_clicked(e)
     98    --Get some numbers from the window
     99    local we = CEGUI.toWindowEventArgs(e)
     100    local name = we.window:getName()
     101    local match = string.gmatch(name, "%d+")
     102    local questNr = tonumber(match())
     103
     104    name = name .. "/Details" .. P.getNewDetailNumber()
     105    quest = P.quests[questNr]
     106
     107    local details = winMgr:createWindow("MenuWidgets/FrameWindow", name)
     108    details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
     109    details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0)))
     110    details:setText(orxonox.QuestManager:getInstance():getDescription(quest):getTitle())
     111    details:setProperty("Alpha", 1.0)
     112    details:setProperty("InheritsAlpha", "setFalse")
     113    orxonox.GUIManager:subscribeEventHelper(details, "CloseClicked", P.name .. ".closeDetails_clicked")
     114
     115    table.insert(P.detailsWindows, details)
     116
     117    name = name .. "/Scrollable"
     118    local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name)
     119    window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
     120    window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight)))
     121    details:addChildWindow(window)
     122
     123    local offset = 0
     124
     125    local status = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Status")
     126    window:addChildWindow(status)
     127    status:setProperty("HorzFormatting", "WordWrapLeftAligned")
     128    status:setProperty("VertFormatting", "TopAligned")
     129    if quest:isActive(P.player) then
     130        status:setText("This quest is active.")
     131    elseif quest:isCompleted(P.player) then
     132        status:setText("This quest was completed.")
     133    elseif quest:isFailed(P.player) then
     134        status:setText("This quest was failed.")
     135    end
     136    status:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     137    status:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     138    local height = getStaticTextWindowHeight(status)
     139    status:setHeight(CEGUI.UDim(0, height))
     140    offset = offset + height
     141
     142    local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title");
     143    window:addChildWindow(descriptionTitle)
     144    descriptionTitle:setProperty("HorzFormatting", "HorzCentred")
     145    descriptionTitle:setProperty("VertFormatting", "TopAligned")
     146    descriptionTitle:setText("Description:")
     147    descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     148    descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     149    height = getStaticTextWindowHeight(descriptionTitle)
     150    descriptionTitle:setHeight(CEGUI.UDim(0, height))
     151    offset = offset + height
     152
     153    local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description");
     154    window:addChildWindow(description)
     155    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
     156    description:setProperty("VertFormatting", "TopAligned")
     157    description:setText(orxonox.QuestManager:getInstance():getDescription(quest):getDescription())
     158    description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     159    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     160    height = getStaticTextWindowHeight(description)
     161    description:setHeight(CEGUI.UDim(0, height))
     162    offset = offset + height
     163
     164    -- Display the hints of this quest
     165    local numHints = orxonox.QuestManager:getInstance():getNumHints(quest, P.player)
     166    if numHints > 0 then
     167        local hintsTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Hints/Title");
     168        window:addChildWindow(hintsTitle)
     169        hintsTitle:setProperty("HorzFormatting", "HorzCentred")
     170        hintsTitle:setProperty("VertFormatting", "TopAligned")
     171        hintsTitle:setText("Hints:")
     172        hintsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     173        hintsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     174        height = getStaticTextWindowHeight(hintsTitle)
     175        hintsTitle:setHeight(CEGUI.UDim(0, height))
     176        offset = offset + height
     177    end
     178    local i = 0
     179    while i <= numHints-1 do
     180        local hint = orxonox.QuestManager:getInstance():getHints(quest, P.player, i)
     181        table.insert(P.hints, hint)
     182        local number = table.getn(P.hints)
     183        local node = winMgr:createWindow("MenuWidgets/TabButton", name .. "/Hints" .. number)
     184        node:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle())
     185        node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     186        node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
     187        window:addChildWindow(node)
     188        offset = offset + P.buttonHeight
     189
     190        orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openHintDetails_clicked")
     191        i = i+1
     192    end
     193
     194    local window = winMgr:getWindow("orxonox/QuestGUI/Background")
     195    window:addChildWindow(details)
     196end
     197
     198function P.getNewDetailNumber()
     199    local number = table.getn(P.detailsWindows)
     200    for k,v in pairs(P.detailsWindows) do
     201        if v == nil then
     202            number = k-1
     203        end
     204    end
     205    return number+1
     206end
     207
     208function P.closeDetails_clicked(e)
     209    local we = CEGUI.toWindowEventArgs(e)
     210    local name = we.window:getName()
     211    local match = string.gmatch(name, "%d+")
     212    match()
     213    local detailsNr = tonumber(match())
     214
     215    winMgr:destroyWindow(P.detailsWindows[detailsNr])
     216    P.detailsWindows[detailsNr] = nil
     217end
     218
     219function P.openHintDetails_clicked(e)
     220    --Get some numbers from the window
     221    local we = CEGUI.toWindowEventArgs(e)
     222    local name = we.window:getName()
     223    local match = string.gmatch(name, "%d+")
     224    match()
     225    match()
     226    local hintNr = tonumber(match())
     227
     228    name = name .. "/Details" .. P.getNewDetailNumber()
     229    hint = P.hints[hintNr]
     230
     231    local details = winMgr:createWindow("MenuWidgets/FrameWindow", name)
     232    details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
     233    details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0)))
     234    details:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle())
     235    details:setProperty("Alpha", 1.0)
     236    details:setProperty("InheritsAlpha", "setFalse")
     237    orxonox.GUIManager:subscribeEventHelper(details, "CloseClicked", P.name .. ".closeHintDetails_clicked")
     238
     239    table.insert(P.detailsWindows, details)
     240
     241    name = name .. "/Scrollable"
     242    local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name)
     243    window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
     244    window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight)))
     245    details:addChildWindow(window)
     246
     247    local offset = 0
     248   
     249    local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title");
     250    window:addChildWindow(descriptionTitle)
     251    descriptionTitle:setProperty("HorzFormatting", "HorzCentred")
     252    descriptionTitle:setProperty("VertFormatting", "TopAligned")
     253    descriptionTitle:setText("Description:")
     254    descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     255    descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     256    height = getStaticTextWindowHeight(descriptionTitle)
     257    descriptionTitle:setHeight(CEGUI.UDim(0, height))
     258    offset = offset + height
     259
     260    local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description");
     261    window:addChildWindow(description)
     262    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
     263    description:setProperty("VertFormatting", "TopAligned")
     264    description:setText(orxonox.QuestManager:getInstance():getDescription(hint):getDescription())
     265    description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
     266    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     267    height = getStaticTextWindowHeight(description)
     268    description:setHeight(CEGUI.UDim(0, height))
     269
     270    local window = winMgr:getWindow("orxonox/QuestGUI/Background")
     271    window:addChildWindow(details)
     272end
     273
     274function P.closeHintDetails_clicked(e)
     275    local we = CEGUI.toWindowEventArgs(e)
     276    local name = we.window:getName()
     277    local match = string.gmatch(name, "%d+")
     278    match()
     279    match()
     280    match()
     281    local detailsNr = tonumber(match())
     282
     283    winMgr:destroyWindow(P.detailsWindows[detailsNr])
     284    P.detailsWindows[detailsNr] = nil
    17285end
    18286
  • code/branches/presentation3/data/levels/Quest_PirateAttack.oxw

    r7036 r7072  
    158158                                        <attached>
    159159                                                <Billboard position="0,0,0" scale=3 colour="1.0,1.0,0" material="Examples/Flare" />
    160                                                 <DistanceTrigger name=questbeacon2  targetname=Me position="0,0,0" distance=400 target="Pawn" />
     160                                                <DistanceTrigger name=questbeacon2 targetname=Me position="0,0,0" target=DistanceTriggerBeacon distance=400 />
    161161                                        </attached>
    162162                                        <effects>
  • code/branches/presentation3/data/levels/pickups.oxw

    r7038 r7072  
    66<?lua
    77  include("templates/spaceship_assff.oxt")
    8   include("templates/spaceship_pirate.oxt")
    98  include("templates/pickup_representation_templates.oxt")
    109  include("templates/lodinformation.oxt")
  • code/branches/presentation3/src/libraries/core/GUIManager.h

    r7012 r7072  
    9797        inline void setPlayer(const std::string& guiname, PlayerInfo* player)
    9898            { this->players_[guiname] = player; }
    99         inline PlayerInfo* getPlayer(const std::string& guiname) const
    100             { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; }
     99        inline orxonox::PlayerInfo* getPlayer(const std::string& guiname) const { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; } // tolua_export
    101100
    102101        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
  • 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;
  • code/branches/presentation3/src/orxonox/CMakeLists.txt

    r7009 r7072  
    6262    controllers/HumanController.h
    6363    interfaces/Pickupable.h
     64    infos/PlayerInfo.h
    6465    sound/SoundManager.h
    6566  DEFINE_SYMBOL
  • code/branches/presentation3/src/orxonox/infos/PlayerInfo.h

    r6417 r7072  
    3535#include "core/SubclassIdentifier.h"
    3636
    37 namespace orxonox
    38 {
    39     class _OrxonoxExport PlayerInfo : public Info
    40     {
     37namespace orxonox // tolua_export
     38{ // tolua_export
     39    class _OrxonoxExport PlayerInfo // tolua_export
     40        : public Info
     41    { // tolua_export
    4142        public:
    4243            PlayerInfo(BaseObject* creator);
     
    103104            const GametypeInfo* gtinfo_;
    104105            unsigned int gtinfoID_;
    105     };
    106 }
     106    }; // tolua_export
     107} // tolua_export
    107108
    108109#endif /* _PlayerInfo_H__ */
Note: See TracChangeset for help on using the changeset viewer.