diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
| commit | b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7 (patch) | |
| tree | 6609f31b1635d948cf7a216c7fea72cfb3c905a0 /pokemod/MapTrainerTeamMember.cpp | |
| parent | b99ffef4aa68dd5f0af64de9aec0f610e267d8cc (diff) | |
| download | sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.gz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.xz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.zip | |
[FIX] Moving stuff for the move to the new name, Sigma Game Engine (sigen for short)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@249 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapTrainerTeamMember.cpp')
| -rw-r--r-- | pokemod/MapTrainerTeamMember.cpp | 273 |
1 files changed, 0 insertions, 273 deletions
diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp deleted file mode 100644 index d69411a5..00000000 --- a/pokemod/MapTrainerTeamMember.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "MapTrainerTeamMember.h" - -// Pokemod includes -#include "Item.h" -#include "Macros.h" -#include "MapTrainer.h" -#include "Pokemod.h" -#include "Rules.h" -#include "Species.h" -#include "SpeciesMove.h" - -// Qt includes -#include <QtCore/QSet> - -Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainerTeamMember& teamMember) : - Object(teamMember.parent(), teamMember.id()) -{ - *this = teamMember; -} - -Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainer* parent, const int id) : - Object(parent, id), - m_species(INT_MAX), - m_level(INT_MAX) -{ -} - -Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainerTeamMember& teamMember, const MapTrainer* parent, const int id) : - Object(parent, id) -{ - *this = teamMember; -} - -Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const QDomElement& xml, const MapTrainer* parent, const int id) : - Object(parent, id) -{ - LOAD_ID(); - load(xml); -} - -void Pokemod::MapTrainerTeamMember::validate() -{ - TEST_BEGIN(); - TEST(setSpecies, species); - TEST(setLevel, level); - if (qobject_cast<const Pokemod*>(pokemod())->rules()->maxAbilities() < m_ability.size()) - emit(error("Too many abilities")); - TEST_LIST(setAbility, ability); - if (qobject_cast<const Pokemod*>(pokemod())->rules()->maxHeldItems() < m_item.size()) - emit(error("Too many held items")); - TEST_LIST(setItem, item); - if (qobject_cast<const Pokemod*>(pokemod())->rules()->maxMoves() < m_move.size()) - emit(error("Too many moves")); - TEST_LIST(setMove, move); - if (qobject_cast<const Pokemod*>(pokemod())->rules()->maxNatures() < m_nature.size()) - emit(error("Too many natures")); - TEST_LIST(setNature, nature); - TEST_END(); -} - -void Pokemod::MapTrainerTeamMember::load(const QDomElement& xml) -{ - LOAD_BEGIN(); - LOAD(species); - LOAD(level); - LOAD_LIST(ability); - LOAD_LIST(item); - LOAD_LIST(move); - LOAD_LIST(nature); -} - -QDomElement Pokemod::MapTrainerTeamMember::save() const -{ - SAVE_CREATE(); - SAVE(species); - SAVE(level); - SAVE_LIST(ability); - SAVE_LIST(item); - SAVE_LIST(move); - SAVE_LIST(nature); - return xml; -} - -void Pokemod::MapTrainerTeamMember::setSpecies(const int species) -{ - if (qobject_cast<const Pokemod*>(pokemod())->speciesIndex(species) == INT_MAX) - emit(error(bounds("species"))); - else - CHECK(species); -} - -void Pokemod::MapTrainerTeamMember::setLevel(const int level) -{ - if (qobject_cast<const Pokemod*>(pokemod())->rules()->maxLevel() < level) - emit(error(bounds("level"))); - else - CHECK(level); -} - -void Pokemod::MapTrainerTeamMember::setAbility(const int ability, const bool state) -{ - if (qobject_cast<const Pokemod*>(pokemod())->abilityIndex(ability) == INT_MAX) - emit(error(bounds("ability"))); - else if (state && !m_ability.contains(ability)) - { - if (m_ability.size() < qobject_cast<const Pokemod*>(pokemod())->rules()->maxAbilities()) - { - m_ability.append(ability); - emit(changed()); - } - else - emit(error("Cannot have any more abilities")); - } - else if (m_ability.contains(ability)) - { - m_ability.removeAll(ability); - emit(changed()); - } -} - -void Pokemod::MapTrainerTeamMember::setItem(const int item, const bool state) -{ - if (qobject_cast<const Pokemod*>(pokemod())->itemIndex(item) == INT_MAX) - emit(error(bounds("item"))); - else if (state && !m_item.contains(item)) - { - if (m_item.size() < qobject_cast<const Pokemod*>(pokemod())->rules()->maxHeldItems()) - { - m_item.append(item); - emit(changed()); - } - else - emit(error("Cannot hold any more items")); - } - else if (m_item.contains(item)) - { - m_item.removeAll(item); - emit(changed()); - } -} - -void Pokemod::MapTrainerTeamMember::setMove(const int move, const bool state) -{ - if (qobject_cast<const Pokemod*>(pokemod())->moveIndex(move) == INT_MAX) - emit(error(bounds("move"))); - else if (state && !m_move.contains(move)) - { - const Species* species = qobject_cast<const Pokemod*>(pokemod())->speciesById(move); - for (int i = 0; i < species->moveCount(); ++i) - { - const SpeciesMove* speciesMove = species->move(i); - if (speciesMove->move() == move) - { - if (m_move.size() < qobject_cast<const Pokemod*>(pokemod())->rules()->maxMoves()) - { - m_move.append(move); - emit(changed()); - return; - } - else - emit(error("Cannot know any more moves")); - } - } - emit(error("Cannot learn the move")); - } - else if (m_move.contains(move)) - { - m_move.removeAll(move); - emit(changed()); - } -} - -void Pokemod::MapTrainerTeamMember::setNature(const int nature, const bool state) -{ - if (qobject_cast<const Pokemod*>(pokemod())->natureIndex(nature) == INT_MAX) - emit(error(bounds("nature"))); - else if (state && !m_nature.contains(nature)) - { - if (m_nature.size() < qobject_cast<const Pokemod*>(pokemod())->rules()->maxNatures()) - { - m_nature.append(nature); - emit(changed()); - } - else - emit(error("Cannot have any more natures")); - } - else if (m_nature.contains(nature)) - { - m_nature.removeAll(nature); - emit(changed()); - } -} - -int Pokemod::MapTrainerTeamMember::species() const -{ - return m_species; -} - -int Pokemod::MapTrainerTeamMember::level() const -{ - return m_level; -} - -bool Pokemod::MapTrainerTeamMember::ability(const int ability) const -{ - return m_ability.contains(ability); -} - -QList<int> Pokemod::MapTrainerTeamMember::abilities() const -{ - return m_ability; -} - -bool Pokemod::MapTrainerTeamMember::item(const int item) const -{ - return m_item.contains(item); -} - -QList<int> Pokemod::MapTrainerTeamMember::items() const -{ - return m_item; -} - -bool Pokemod::MapTrainerTeamMember::move(const int move) const -{ - return m_move.contains(move); -} - -QList<int> Pokemod::MapTrainerTeamMember::moves() const -{ - return m_move; -} - -bool Pokemod::MapTrainerTeamMember::nature(const int nature) const -{ - return m_nature.contains(nature); -} - -QList<int> Pokemod::MapTrainerTeamMember::natures() const -{ - return m_nature; -} - -Pokemod::MapTrainerTeamMember& Pokemod::MapTrainerTeamMember::operator=(const MapTrainerTeamMember& rhs) -{ - if (this == &rhs) - return *this; - COPY(species); - COPY(level); - COPY(ability); - COPY(item); - COPY(move); - COPY(nature); - return *this; -} |
