[10863] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
[10885] | 23 | * Gani Aliguzhinov |
---|
[10863] | 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "Actionpoint.h" |
---|
| 30 | |
---|
[11699] | 31 | #include "core/CoreIncludes.h" |
---|
| 32 | #include "core/XMLPort.h" |
---|
| 33 | |
---|
[10863] | 34 | namespace orxonox |
---|
| 35 | { |
---|
| 36 | RegisterClass(Actionpoint); |
---|
| 37 | |
---|
| 38 | Actionpoint::Actionpoint(Context* context) : StaticEntity(context) |
---|
| 39 | { |
---|
| 40 | RegisterObject(Actionpoint); |
---|
[10868] | 41 | |
---|
| 42 | this->actionName_ = ""; |
---|
| 43 | this->name_ = ""; |
---|
| 44 | |
---|
| 45 | this->bLoopStart_ = false; |
---|
| 46 | this->bLoopEnd_ = false; |
---|
| 47 | this->bProtectMe_ = false; |
---|
[10863] | 48 | } |
---|
| 49 | |
---|
| 50 | void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 51 | { |
---|
| 52 | SUPER(Actionpoint, XMLPort, xmlelement, mode); |
---|
| 53 | |
---|
[10868] | 54 | XMLPortParam(Actionpoint, "action", setActionXML, getActionXML, xmlelement, mode); |
---|
| 55 | XMLPortParam(Actionpoint, "protect", setProtectXML, getProtectXML, xmlelement, mode); |
---|
| 56 | XMLPortParam(Actionpoint, "attack", setAttackXML, getAttackXML, xmlelement, mode); |
---|
| 57 | XMLPortParam(Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML, xmlelement, mode).defaultValues(false); |
---|
| 58 | XMLPortParam(Actionpoint, "loopStart", setLoopStart, getLoopStart, xmlelement, mode).defaultValues(false); |
---|
| 59 | XMLPortParam(Actionpoint, "loopEnd", setLoopEnd, getLoopEnd, xmlelement, mode).defaultValues(false); |
---|
[10863] | 60 | } |
---|
[10868] | 61 | /** |
---|
| 62 | @brief |
---|
| 63 | action is ATTACK -> returns name of object to attack |
---|
| 64 | action is PROTECT -> returns name of object to protect |
---|
| 65 | if asked to protect human, returns a special string. |
---|
| 66 | @return |
---|
| 67 | name of an object to interact with. |
---|
| 68 | @note |
---|
| 69 | never use more than one of following arguments for XMLPort: |
---|
| 70 | attack, protect, protectMe or |
---|
| 71 | loopStart and loopEnd. |
---|
| 72 | */ |
---|
| 73 | std::string Actionpoint::getName() const |
---|
[10863] | 74 | { |
---|
[10868] | 75 | if (this->name_ != "") |
---|
| 76 | { |
---|
| 77 | return this->name_; |
---|
| 78 | } |
---|
| 79 | else if (this->bProtectMe_) |
---|
| 80 | { |
---|
| 81 | return "reservedKeyword:human"; |
---|
| 82 | } |
---|
| 83 | else |
---|
| 84 | { |
---|
| 85 | return ""; |
---|
| 86 | } |
---|
| 87 | } |
---|
[10863] | 88 | } |
---|