Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1857


Ignore:
Timestamp:
Sep 29, 2008, 9:25:27 AM (16 years ago)
Author:
rgrieder
Message:

Added comments to the TutorialShip

Location:
code/branches/orxonox_tutorial/src/orxonox/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc

    r1855 r1857  
    2929// for precompiled header files. Has to be first!
    3030#include "OrxonoxStableHeaders.h"
    31 // always include this class's header file first so that it compiles on its own too.
     31// always include this class's header file first so that
     32// it compiles on its own too.
    3233#include "TutorialShip.h"
    3334
    3435// Additional includes
    35 #include <OgreSceneNode.h>
    3636#include "util/Convert.h"
    3737#include "util/Debug.h"
     
    4545namespace orxonox
    4646{
    47     SetConsoleCommand(TutorialShip, fire, true).keybindMode(KeybindMode::OnHold);
     47    // Specify a console command that can be used in
     48    // the shell or as key binding.
     49    SetConsoleCommand(TutorialShip, fire, true)
     50        .keybindMode(KeybindMode::OnHold);
    4851
     52    // Make sure we can create an object of this class by XML
    4953    CreateFactory(TutorialShip);
    5054
     55    // Constructor
    5156    TutorialShip::TutorialShip()
    5257    {
     
    6065    }
    6166
    62     bool TutorialShip::create()
    63     {
    64         return true;
    65     }
    66 
     67    // Destructor
    6768    TutorialShip::~TutorialShip()
    6869    {
    6970    }
    70    
     71
     72    // Sets the configurable member variables.
     73    // They can be found later in orxonox.ini directly.
    7174    void TutorialShip::setConfigValues()
    7275    {
    73         SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
     76        SetConfigValue(reloadTime_, 0.125)
     77            .description("The reload time of the weapon in seconds");
    7478    }
    75 
    76     //void TutorialShip::registerAllVariables()
    77     //{
    78     //}
    7979   
    80     /**
    81         @brief XML loading and saving.
    82         @param xmlelement The XML-element
    83         @param loading Loading (true) or saving (false)
    84         @return The XML-element
    85     */
     80    // Called when loading an object of this class with XML
     81    // You don't have to know what exactly xmlelement is.
     82    // And mode is not important yet (load/save).
    8683    void TutorialShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    8784    {
    88         XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects, hasSpecialEffects, xmlelement, mode);
     85        // Load our parameter "specialEffects". Case sensitive!
     86        XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects,
     87            hasSpecialEffects, xmlelement, mode);
    8988
    90         // Calls SpaceShip::XMLPort
     89        // Calls SpaceShip::XMLPort so that the SpaceShip XML parameters
     90        // are loaded too.
    9191        SUPER(TutorialShip, XMLPort, xmlelement, mode);
    9292    }
    9393
     94    // XML save function. Also used by back end class SpaceShip
     95    // to show or hide the special effects.
    9496    bool TutorialShip::hasSpecialEffects()
    9597    {
     
    9799    }
    98100
     101    // XML load function. Called by the XML macro above.
    99102    void TutorialShip::setSpecialEffects(bool value)
    100103    {
     
    102105    }
    103106
    104     /**
    105         @brief Returns the weapon reload time. Used virtually by the base class.
    106     */
     107    // virtual function used by back end class SpaceShip.
    107108    float TutorialShip::getReloadTime()
    108109    {
     
    110111    }
    111112
    112    
     113    // run time update method. Gets called every frame with the delta time that
     114    // has passed since the last frame.
    113115    void TutorialShip::tick(float dt)
    114116    {
     117        // Also call the tick() method of the base clas.
    115118        SUPER(TutorialShip, tick, dt);
    116119    }
    117120
     121    // Fire a projectile. Delegated to the back end class SpaceShip.
     122    // Function content is insignificant for the tutorial.
    118123    void TutorialShip::fire()
    119124    {
  • code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.h

    r1855 r1857  
    4949            ~TutorialShip();
    5050
    51             bool create();
    5251            //void registerAllVariables();
    5352            void setConfigValues();
Note: See TracChangeset for help on using the changeset viewer.