1 // Copyright (C) 2004 John Farrell
2 // Copyright (C) 2004, 2005 Ulf Lorenz
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 /** Class which contains some threat-related information about a city. It is
28 * used by the smart AI.
30 * There are three important values:
31 * - danger is a rough estimate of the strength of the stacks that are close
33 * - reinforcements is an indicator of the strength of the troops that have
34 * been assigned to protect the city
35 * - the Threatlist contains a list of all threats (usually stacks) that
38 * See ai_smart.h for a comment about the smart AI.
47 //! record this threat as threatening this city
48 void addThreat(float dangerFromThisThreat, Threat *threat);
50 //! return the total danger to this city
51 float getDanger() const { return d_danger; }
53 //! return the total reinforcements allocated to this city
54 float getReinforcements() const { return d_reinforcements; }
56 //! advise that reinforcements have been sent to the city
57 void addReinforcements(float reinforcements) { d_reinforcements += reinforcements; }
59 //! return the threats to this city
60 Threatlist *getThreats() const { return d_threats; }
62 //! Returns the location of the city
63 Vector<int> getPos() const { return d_city->getPos(); }
65 //! Get the number of armies in the city
66 int getDefenderCount() const { return d_num_defenders; }
69 float d_reinforcements;
70 Threatlist *d_threats;
75 #endif // AICITYINFO_H