[1992] | 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: |
---|
| 23 | * Damian 'Mozork' Frick |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "core/CoreIncludes.h" |
---|
| 30 | |
---|
| 31 | #include "LocalQuest.h" |
---|
| 32 | |
---|
| 33 | namespace orxonox { |
---|
| 34 | |
---|
| 35 | CreateFactory(LocalQuest); |
---|
| 36 | |
---|
[2021] | 37 | LocalQuest::LocalQuest() : Quest() |
---|
| 38 | { |
---|
| 39 | |
---|
| 40 | } |
---|
| 41 | |
---|
[1992] | 42 | /** |
---|
| 43 | @brief |
---|
| 44 | Constructor. |
---|
| 45 | @param id |
---|
| 46 | The unique identifier. |
---|
| 47 | @param title |
---|
| 48 | The title of the quest. |
---|
| 49 | @param description |
---|
| 50 | The description of the quest. |
---|
| 51 | */ |
---|
[2021] | 52 | LocalQuest::LocalQuest(std::string id, std::string title, std::string description) : Quest(id, title, description) |
---|
[1992] | 53 | { |
---|
| 54 | RegisterObject(LocalQuest); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | @brief |
---|
| 59 | Destructor. |
---|
| 60 | */ |
---|
| 61 | LocalQuest::~LocalQuest() |
---|
| 62 | { |
---|
| 63 | |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | @brief |
---|
[1996] | 68 | Checks whether the quest can be started. |
---|
| 69 | @param player |
---|
| 70 | The player for whom is to be checked. |
---|
| 71 | @return |
---|
| 72 | Returns true if the quest can be started, false if not. |
---|
| 73 | */ |
---|
[2021] | 74 | bool LocalQuest::isStartable(Player* player) |
---|
[1996] | 75 | { |
---|
| 76 | return this->isInactive(player); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | @brief |
---|
| 81 | Checks whether the quest can be failed. |
---|
| 82 | @param player |
---|
| 83 | The player for whom is to be checked. |
---|
| 84 | @return |
---|
| 85 | Returns true if the quest can be failed, false if not. |
---|
| 86 | */ |
---|
[2021] | 87 | bool LocalQuest::isFailable(Player* player) |
---|
[1996] | 88 | { |
---|
| 89 | return this->isActive(player); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | /** |
---|
| 93 | @brief |
---|
| 94 | Checks whether the quest can be completed. |
---|
| 95 | @param player |
---|
| 96 | The player for whom is to be checked. |
---|
| 97 | @return |
---|
| 98 | Returns true if the quest can be completed, false if not. |
---|
| 99 | */ |
---|
[2021] | 100 | bool LocalQuest::isCompletable(Player* player) |
---|
[1996] | 101 | { |
---|
| 102 | return this->isActive(player); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | @brief |
---|
[1992] | 107 | Returns the status of the quest for a specific player. |
---|
| 108 | @param player |
---|
[1996] | 109 | The player. |
---|
| 110 | @return |
---|
| 111 | Returns the status of the quest for the input player. |
---|
[1992] | 112 | */ |
---|
[2021] | 113 | questStatus::Enum LocalQuest::getStatus(const Player* player) |
---|
[1992] | 114 | { |
---|
[2021] | 115 | std::map<Player*, questStatus::Enum>::const_iterator it = this->playerStatus_.find((Player*)(void*)player); //Thx. to x3n for the (Player*)(void*) 'hack'. |
---|
[1996] | 116 | if (it != this->playerStatus_.end()) |
---|
| 117 | { |
---|
| 118 | return it->second; |
---|
| 119 | } |
---|
| 120 | return questStatus::inactive; |
---|
[1992] | 121 | } |
---|
| 122 | |
---|
| 123 | /** |
---|
| 124 | @brief |
---|
| 125 | Sets the status for a specific player. |
---|
| 126 | @param player |
---|
| 127 | The player. |
---|
| 128 | @param status |
---|
| 129 | The status. |
---|
| 130 | */ |
---|
[2021] | 131 | bool LocalQuest::setStatus(Player* player, const questStatus::Enum & status) |
---|
[1992] | 132 | { |
---|
[2021] | 133 | this->playerStatus_[player] = status; |
---|
| 134 | return true; |
---|
[1992] | 135 | } |
---|
| 136 | |
---|
| 137 | } |
---|