1 // Copyright (C) 2000, 2001, 2003 Michael Bartl
2 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
3 // Copyright (C) 2004, 2005 Andrea Paternesi
4 // Copyright (C) 2007, 2008 Ben Asselstine
5 // Copyright (C) 2007, 2008 Ole Laursen
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Library General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include "armyprodbase.h"
26 #include "armyprotobase.h"
27 #include "xmlhelper.h"
28 #include "armysetlist.h"
30 std::string ArmyProdBase::d_tag = "armyprodbase";
32 //#define debug(x) {std::cerr<<__FILE__<<": "<<__LINE__<<": "<<x<<std::endl<<std::flush;}
35 ArmyProdBase::ArmyProdBase(const ArmyProdBase& a)
40 ArmyProdBase::ArmyProdBase(const ArmyProto& a)
45 ArmyProdBase::ArmyProdBase(XML_Helper* helper)
46 :ArmyProtoBase(helper)
48 helper->getData(d_armyset, "armyset");
49 helper->getData(d_type_id, "type");
52 ArmyProdBase::~ArmyProdBase()
56 bool ArmyProdBase::save(XML_Helper* helper) const
60 retval &= helper->openTag(ArmyProdBase::d_tag);
62 ArmyProtoBase::saveData(helper);
64 retval &= helper->saveData("type", d_type_id);
65 retval &= helper->saveData("armyset", d_armyset);
67 retval &= helper->closeTag();
72 void ArmyProdBase::morph(const ArmyProto *army)
74 setStrength(army->getStrength());
75 setMaxMoves(army->getMaxMoves());
76 setMoveBonus(army->getMoveBonus());
77 setArmyBonus(army->getArmyBonus());
78 setTypeId(army->getTypeId());
79 setArmyset(army->getArmyset());