1 // Copyright (C) 2004 John Farrell 2 // Copyright (C) 2004, 2005 Ulf Lorenz 3 // 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. 8 // 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. 13 // 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 17 // 02110-1301, USA. 18 19 #pragma once 20 #ifndef AICITYINFO_H 21 #define AICITYINFO_H 22 23 #include "city.h" 24 class Threatlist; 25 class Threat; 26 27 //! Artificial intelligence helper class for relating threats to a city. 28 /** Class which contains some threat-related information about a city. It is 29 * used by the smart AI. 30 * 31 * There are three important values: 32 * - danger is a rough estimate of the strength of the stacks that are close 33 * to the city 34 * - reinforcements is an indicator of the strength of the troops that have 35 * been assigned to protect the city 36 * - the Threatlist contains a list of all threats (usually stacks) that 37 * endanger the city 38 * 39 * See ai_smart.h for a comment about the smart AI. 40 */ 41 class AICityInfo 42 { 43 public: 44 // CREATORS 45 AICityInfo(City *c); 46 ~AICityInfo(); 47 48 //! record this threat as threatening this city 49 void addThreat(float dangerFromThisThreat, Threat *threat); 50 51 //! return the total danger to this city getDanger()52 float getDanger() const { return d_danger; } 53 54 //! return the total reinforcements allocated to this city getReinforcements()55 float getReinforcements() const { return d_reinforcements; } 56 57 //! advise that reinforcements have been sent to the city addReinforcements(float reinforcements)58 void addReinforcements(float reinforcements) { d_reinforcements += reinforcements; } 59 60 //! return the threats to this city getThreats()61 Threatlist *getThreats() const { return d_threats; } 62 63 //! Returns the location of the city getPos()64 Vector<int> getPos() const { return d_city->getPos(); } 65 66 //! Get the number of armies in the city getDefenderCount()67 int getDefenderCount() const { return d_num_defenders; } 68 private: 69 float d_danger; 70 float d_reinforcements; 71 Threatlist *d_threats; 72 City *d_city; 73 int d_num_defenders; 74 }; 75 76 #endif // AICITYINFO_H 77 78 // End of file 79