/* * Copyright 2007-2008 Ben Boeckel * * 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 . */ // Header include #include "SpeciesAbility.h" // Sigmod includes #include "Macros.h" #include "Sigmod.h" #include "Species.h" Sigmod::SpeciesAbility::SpeciesAbility(const SpeciesAbility& ability) : Object(ability.parent(), ability.id()) { *this = ability; } Sigmod::SpeciesAbility::SpeciesAbility(const Species* parent, const int id) : Object(parent, id), m_ability(INT_MAX), m_weight(1) { } Sigmod::SpeciesAbility::SpeciesAbility(const SpeciesAbility& ability, const Species* parent, const int id) : Object(parent, id) { *this = ability; } Sigmod::SpeciesAbility::SpeciesAbility(const QDomElement& xml, const Species* parent, const int id) : Object(parent, id) { LOAD_ID(); load(xml); } void Sigmod::SpeciesAbility::validate() { TEST_BEGIN(); TEST(ability); TEST(weight); TEST_END(); } void Sigmod::SpeciesAbility::load(const QDomElement& xml) { LOAD_BEGIN(); LOAD(ability); LOAD(weight); } QDomElement Sigmod::SpeciesAbility::save() const { SAVE_CREATE(); SAVE(ability); SAVE(weight); return xml; } SETTER(SpeciesAbility, int, Ability, ability) SETTER(SpeciesAbility, int, Weight, weight) GETTER(SpeciesAbility, int, ability) GETTER(SpeciesAbility, int, weight) CHECK_INDEX(SpeciesAbility, int, ability, sigmod(), ability) CHECK_BOUNDS(SpeciesAbility, int, weight, 1, INT_MAX) Sigmod::SpeciesAbility& Sigmod::SpeciesAbility::operator=(const SpeciesAbility& rhs) { if (this == &rhs) return *this; COPY(ability); COPY(weight); return *this; }