Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2015, 10:40:59 PM (8 years ago)
Author:
gania
Message:

first stable version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc

    r10863 r10868  
    2929#include "Actionpoint.h"
    3030
    31 #include "core/CoreIncludes.h"
    32 #include "core/XMLPort.h"
    33 
    3431namespace orxonox
    3532{
     
    3936    {
    4037        RegisterObject(Actionpoint);
    41 
     38       
     39        this->actionName_ = "";
     40        this->name_ = "";
     41       
     42        this->bLoopStart_ = false;
     43        this->bLoopEnd_ = false;
     44        this->bProtectMe_ = false;
    4245    }
    4346   
     
    4649        SUPER(Actionpoint, XMLPort, xmlelement, mode);
    4750       
    48         XMLPortParam( Actionpoint, "action", setActionXML, getActionXML,  xmlelement, mode );
    49         XMLPortParam( Actionpoint, "protect", setProtectXML, getProtectXML,  xmlelement, mode );
    50         XMLPortParam( Actionpoint, "attack", setAttackXML, getAttackXML,  xmlelement, mode );
    51         XMLPortParam( Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML,  xmlelement, mode ).defaultValues(false);
    52         XMLPortParam( Actionpoint, "loopStart", setLoopStart, getLoopStart,  xmlelement, mode ).defaultValues(false);
    53         XMLPortParam( Actionpoint, "loopEnd", setLoopEnd, getLoopEnd,  xmlelement, mode ).defaultValues(false);
    54 
     51        XMLPortParam(Actionpoint, "action", setActionXML, getActionXML,  xmlelement, mode);
     52        XMLPortParam(Actionpoint, "protect", setProtectXML, getProtectXML,  xmlelement, mode);
     53        XMLPortParam(Actionpoint, "attack", setAttackXML, getAttackXML,  xmlelement, mode);
     54        XMLPortParam(Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML,  xmlelement, mode).defaultValues(false);
     55        XMLPortParam(Actionpoint, "loopStart", setLoopStart, getLoopStart,  xmlelement, mode).defaultValues(false);
     56        XMLPortParam(Actionpoint, "loopEnd", setLoopEnd, getLoopEnd,  xmlelement, mode).defaultValues(false);
    5557    }
    56     void Actionpoint::setActionXML( std::string val)
     58    /**
     59    @brief
     60        action is ATTACK -> returns name of object to attack
     61        action is PROTECT -> returns name of object to protect
     62        if asked to protect human, returns a special string.
     63    @return
     64        name of an object to interact with.
     65    @note
     66        never use more than one of following arguments for XMLPort:
     67        attack, protect, protectMe or
     68        loopStart and loopEnd.
     69    */
     70    std::string Actionpoint::getName() const
    5771    {
    58         this->actionName_ = getUppercase( val );
    59         orxout(internal_error) << "action = " << this->actionName_ << endl;
    60     }
    61 
    62     std::string Actionpoint::getActionXML()
    63     {
    64         return this->actionName_;
    65     }
    66     void Actionpoint::setProtectXML( std::string val)
    67     {
    68         this->protectName_ = val;
    69     }
    70 
    71     std::string Actionpoint::getProtectXML()
    72     {
    73         return this->protectName_;
    74     }
    75     void Actionpoint::setAttackXML( std::string val)
    76     {
    77         this->attackName_ = val;
    78     }
    79 
    80     std::string Actionpoint::getAttackXML()
    81     {
    82         return this->attackName_;
    83     }
    84    
    85     void Actionpoint::setTargetPosition(const Vector3& target)
    86     {
    87         this->targetPosition_ = target;
    88     }
    89     Vector3 Actionpoint::getTargetPosition ()
    90     {
    91         return this->targetPosition_;
    92     }
    93    
     72        if (this->name_ != "")
     73        {
     74            return this->name_;
     75        }
     76        else if (this->bProtectMe_)
     77        {
     78            return "reservedKeyword:human";
     79        }
     80        else
     81        {
     82            return "";
     83        }
     84    }   
    9485}
Note: See TracChangeset for help on using the changeset viewer.