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 "armyprotobase.h"
26 #include "xmlhelper.h"
29 //#define debug(x) {std::cerr<<__FILE__<<": "<<__LINE__<<": "<<x<<std::endl<<std::flush;}
32 ArmyProtoBase::ArmyProtoBase(const ArmyProtoBase& a)
33 :ArmyBase(a), d_name(a.d_name),
34 d_type_id(a.d_type_id),
35 d_description(a.d_description), d_production_cost(a.d_production_cost),
36 d_new_production_cost(a.d_new_production_cost),
37 d_production(a.d_production), d_armyset(a.d_armyset)
41 ArmyProtoBase::ArmyProtoBase()
42 :ArmyBase(), d_name(_("Untitled")), d_type_id(0),
43 d_description(""), d_production_cost(0), d_new_production_cost(0),
44 d_production(0), d_armyset(0)
48 ArmyProtoBase::ArmyProtoBase(XML_Helper* helper)
49 :ArmyBase(helper), d_name(""), d_type_id(0),
50 d_description(""), d_production_cost(0), d_new_production_cost(0),
51 d_production(0), d_armyset(0)
54 helper->getData(d_name, "name");
55 helper->getData(d_production_cost, "production_cost");
56 helper->getData(d_new_production_cost, "new_production_cost");
57 helper->getData(d_production, "production");
58 helper->getData(d_description, "description");
61 ArmyProtoBase::~ArmyProtoBase()
65 bool ArmyProtoBase::saveData(XML_Helper* helper) const
69 retval &= helper->saveData("name", d_name);
70 retval &= helper->saveData("description", d_description);
71 retval &= helper->saveData("production_cost", d_production_cost);
72 retval &= helper->saveData("new_production_cost", d_new_production_cost);
73 retval &= helper->saveData("production", d_production);
74 retval &= ArmyBase::saveData(helper);