Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7489 for code/trunk/src


Ignore:
Timestamp:
Sep 24, 2010, 4:01:04 PM (14 years ago)
Author:
dafrick
Message:

Mostly more documentation.

Location:
code/trunk/src/modules
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/notifications/Notification.cc

    r7488 r7489  
    3535
    3636#include "core/CoreIncludes.h"
    37 #include "network/NetworkFunction.h"
    38 #include "network/Host.h"
    3937#include "NotificationManager.h"
    4038
     
    4442    /**
    4543    @brief
    46         Default constructor. Initializes the object.
    47     */
    48     Notification::Notification()
    49     {
    50         RegisterRootObject(Notification);
    51         this->initialize();
    52     }
    53 
    54     /**
    55     @brief
    56         Constructor. Creates a Notification with the input message.
    57     @param creator
    58         The creator.
     44        Constructor. Creates a Notification with the input message and sender.
    5945    @param message
    6046        The message of the Notification.
     47    @param sender
     48        The sender of the Notification.
    6149    */
    6250    Notification::Notification(const std::string& message, const std::string& sender)
  • code/trunk/src/modules/notifications/Notification.h

    r7488 r7489  
    3939
    4040#include <string>
    41 #include "core/BaseObject.h"
     41#include "core/OrxonoxClass.h"
    4242
    4343namespace orxonox
     
    4646    /**
    4747    @brief
    48         A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper @ref orxonox::NotificationQueue "NotificationQueue" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueue" accepts).
     48        A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts).
     49
     50        A Notification is just a datastructure that is used internally by the Notifications module.
    4951    @author
    5052        Damian 'Mozork' Frick
     
    5355    {
    5456        public:
    55             Notification();
    5657            Notification(const std::string& message, const std::string& sender);
    5758            virtual ~Notification();
    5859
    5960            /**
    60             @brief Returns the message of the Notification.
     61            @brief Get the message of the Notification.
    6162            @return Returns the message of the Notification.
    6263            */
     
    6465                { return this->message_; }
    6566
     67            /**
     68            @brief Get the sender of the Notification.
     69            @return Returns the sender of the Notification.
     70            */
    6671            inline const std::string & getSender(void) const
    6772                { return this->sender_; }
  • code/trunk/src/modules/notifications/NotificationDispatcher.cc

    r7488 r7489  
    4444#include "worldentities/pawns/Pawn.h"
    4545
    46 #include "Notification.h"
    4746#include "NotificationManager.h"
    4847
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r7488 r7489  
    104104        // Destroys all NotificationQueues that have been registered with the NotificationManager.
    105105        for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++)
    106         {
    107106            it->second->destroy(true);
    108         }
     107
    109108        this->queues_.clear();
    110109    }
     
    343342    void NotificationManager::enterEditMode(void)
    344343    {
    345         GUIManager::getInstance().hideGUI("NotificationLayer");
    346         GUIManager::getInstance().showGUI("NotificationLayer", false, false);
    347         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
     344        if(GameMode::showsGraphics())
     345        {
     346            GUIManager::getInstance().hideGUI("NotificationLayer");
     347            GUIManager::getInstance().showGUI("NotificationLayer", false, false);
     348            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
     349        }
    348350    }
    349351
  • code/trunk/src/modules/notifications/NotificationManager.h

    r7486 r7489  
    5252        The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners".
    5353        It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners".
    54         It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox>>NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
     54        It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
    5555    @author
    5656        Damian 'Mozork' Frick
  • code/trunk/src/modules/notifications/NotificationQueue.cc

    r7488 r7489  
    9090        this->create(); // Creates the NotificationQueue in lua.
    9191
    92         // register the NotificationQueue as NotificationListener with the NotificationManager.
     92        // Register the NotificationQueue as NotificationListener with the NotificationManager.
    9393        bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
    9494        if(!listenerRegistered) // If the registration has failed.
     
    9696            this->registered_ = false;
    9797            // Remove the NotificationQueue in lua.
    98             GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
     98            if(GameMode::showsGraphics())
     99                GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
    99100            NotificationManager::getInstance().unregisterQueue(this);
    100101            COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
     
    210211    void NotificationQueue::update(Notification* notification, const std::time_t & time)
    211212    {
     213        assert(notification);
     214
    212215        this->push(notification, time);
    213216
     
    226229    void NotificationQueue::push(Notification* notification, const std::time_t & time)
    227230    {
     231        assert(notification);
     232
    228233        NotificationContainer* container = new NotificationContainer;
    229234        container->notification = notification;
     
    254259        // Get all the NotificationContainers that were sent the same time the NotificationContainer we want to pop was sent.
    255260        std::pair<std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator, std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator> iterators = this->ordering_.equal_range(container);
    256         // Iterate thourgh all suspects and remove the container as soon as we find it.
     261        // Iterate through all suspects and remove the container as soon as we find it.
    257262        for(std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = iterators.first; it != iterators.second; it++)
    258263        {
     
    311316
    312317        this->notifications_.clear();
    313 
    314318        this->size_ = 0;
    315319
  • code/trunk/src/modules/notifications/NotificationQueue.h

    r7488 r7489  
    4343#include <vector>
    4444
     45#include "NotificationManager.h"
     46
    4547#include "tools/interfaces/Tickable.h"
    46 
    4748#include "interfaces/NotificationListener.h"
    48 #include "NotificationManager.h"
    4949
    5050namespace orxonox // tolua_export
     
    5454    struct NotificationContainer
    5555    {
    56         Notification* notification; // The Notification displayed.
    57         time_t time; // The time the Notification was sent and thus first displayed.
     56        Notification* notification; //!< The Notification displayed.
     57        time_t time; //!< The time the Notification was sent and thus first displayed.
    5858    };
    5959
     
    6161    struct NotificationContainerCompare {
    6262        bool operator() (const NotificationContainer* const & a, const NotificationContainer* const & b) const
    63             { return a->time < b->time; } // Ordered by time.
     63            { return a->time < b->time; } //!< Ordering by time.
    6464    };
    6565
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc

    r7484 r7489  
    6464    CommandNotification::~CommandNotification()
    6565    {
    66        
     66
    6767    }
    6868
     
    114114        Returns a human readable version of the input binding.
    115115    */
     116    //TODO: Move to KeyBinderManager...
    116117    const std::string& CommandNotification::bindingNiceifyer(const std::string& binding)
    117118    {
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.h

    r7488 r7489  
    4646    @brief
    4747        This class implements a method of displaying a Notification with information to an input command and the key the command is mapped to.
    48         The message that is displayed is a string made out uf the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
     48        The message that is displayed is a string made out of the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
    4949
    5050        In use it would like this:
     
    120120                 { this->postMessage_ = message; }
    121121
    122             const std::string& bindingNiceifyer(const std::string& binding);
     122            const std::string& bindingNiceifyer(const std::string& binding); //!< Transforms the input binding into a human readable form.
    123123
    124124    };
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.h

    r7456 r7489  
    5656    @brief
    5757        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number of @ref orxonox::QuestEffect "QuestEffects" on players meeting the condition(s).
    58         The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref oroxnox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.
     58        The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref orxonox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.
    5959        A QuestEffectBeacon can be executed a defined number of times.
    6060        A QuestEffectBeacon can be inactive or active. While inactive it can't be executed.
Note: See TracChangeset for help on using the changeset viewer.