1 // Copyright (C) 2008 Ben Asselstine
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //! Tallies of the kinds of army units that have been killed.
32 //! The xml tag of this object in a saved-game file.
33 static std::string d_tag;
35 //! Every player keeps a tally of frags.
37 //! Kills we've made of an opponent's Hero army units.
39 //! Kills we've made of an opponent's awardable Army units.
41 //! Kills we've made of an opponents other Army units.
43 //! Kills we've made of an opponent's Army units on the water.
45 //! Kills we've made of opponent's Heroes who carry a standard Item.
49 //! Standard constructor.
52 //! Loading constructor.
54 * Load the triumph tallies from a file.
55 * Triumphs are stored in the saved-game file at:
56 * lordsawar.playerlist.player.triumphs.
58 * @param helper The opened saved-game file to load the tallies from.
60 Triumphs (XML_Helper* helper);
63 Triumphs(const Triumphs&);
69 // Methods that operate on the class data but do not modify the class.
71 //! Save the triumph tallies to a file.
73 * @param helper The opened saved-game file to save the tallies to.
75 * @return True if saving went well, false otherwise.
77 bool save(XML_Helper* helper) const;
80 * The player's triumphs are tallied as opponent's armies die.
81 * This method gets a tally for certain kind of triumph.
82 * See TriumphsDialog for a caller of this method.
84 * @param player The player to obtain a tally for.
85 * @param type The kind of kills to tally (Player::TriumphType).
87 * @return Zero or more number of armies killed.
89 //! Returns a number of armies killed.
90 guint32 getTriumphTally(Player *player, TriumphType type) const
91 {return d_triumph[player->getId()][type];}
94 // Methods the operate on the class data, and modify the class.
96 //! Tally up a kill for the given player.
97 void tallyTriumph(Player *p, TriumphType type);
101 //! A set of tally statistics for frags of army units.
103 * 5 is max TriumphType + 1.
105 guint32 d_triumph[MAX_PLAYERS][5];