~ubuntu-branches/ubuntu/raring/lordsawar/raring

« back to all changes in this revision

Viewing changes to src/ai_fast.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese, Gonéri Le Bouder
  • Date: 2008-06-17 11:15:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617111526-yjyvu9df50zmpdo0
Tags: 0.0.9-1
[ Barry deFreese ]
* New upstream release.
  + Fixes gcc-4.3 builds so drop ftbfs_gcc-4.3_fix.diff.
  + Add new build-dependency for libgnet-dev.
* Add simple man page for new lordsawar-tile-editor.
* Add desktop file for lordsawar-tile-editor.
* Remove French translation on install.

[ Gonéri Le Bouder ]
* bump Debian Policy to 3.8.0. No change needed.
* fix wording in the 0.0.8-3 entry of the Debian changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
 
2
// Copyright (C) 2003 Michael Bartl
 
3
// Copyright (C) 2004 Andrea Paternesi
 
4
// Copyright (C) 2007, 2008 Ben Asselstine
 
5
// Copyright (C) 2007, 2008 Ole Laursen
 
6
//
1
7
//  This program is free software; you can redistribute it and/or modify
2
8
//  it under the terms of the GNU General Public License as published by
3
9
//  the Free Software Foundation; either version 2 of the License, or
10
16
//
11
17
//  You should have received a copy of the GNU General Public License
12
18
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
20
//  02110-1301, USA.
14
21
 
15
22
#ifndef AI_FAST_H
16
23
#define AI_FAST_H
25
32
class XML_Helper;
26
33
 
27
34
 
28
 
/** Simple AI
29
 
  *
30
 
  * This AI has two modes. In normal modes it basically assembles stacks of
31
 
  * 8 units each and sends them to the next city, reinforcing them in own cities
32
 
  * if neccessary. In maniac mode, however (meant for wandering monsters etc.),
33
 
  * this AI will attack everything that is close up or take the nearest city if
34
 
  * no enemies are close. When it takes over an enemy city, it razes it.
35
 
  * 
36
 
  * See the Player class for the derivation scheme
37
 
  */
 
35
//! A simple artificial intelligence Player.
 
36
/** 
 
37
 * This AI has two modes. In normal modes it basically assembles stacks of
 
38
 * 8 units each and sends them to the next city, reinforcing them in own cities
 
39
 * if neccessary. In maniac mode, however (meant for wandering monsters etc.),
 
40
 * this AI will attack everything that is close up or take the nearest city if
 
41
 * no enemies are close. When it takes over an enemy city, it razes it.
 
42
 * 
 
43
 */
38
44
 
39
45
class AI_Fast : public RealPlayer
40
46
{
41
47
    public:
42
 
        /** Default constructor
43
 
          * 
44
 
          * @param name         the name of the player
45
 
          * @param armyset      the armyset of the player
46
 
          * @param color        the player's color
47
 
          */
48
 
        AI_Fast(std::string name, Uint32 armyset, SDL_Color color, int width, int height, int player_no = -1);
 
48
        /** 
 
49
         * Make a new AI_Fast player.
 
50
         * 
 
51
         * @param name         The name of the player.
 
52
         * @param armyset      The Id of the player's Armyset.
 
53
         * @param color        The player's colour.
 
54
         * @param width        The width of the player's FogMap.
 
55
         * @param height       The height of the player's FogMap.
 
56
         * @param player_no    The Id of the player.  If this value is -1,
 
57
         *                     the next free Id it used.
 
58
         */
 
59
        //! Default constructor.
 
60
        AI_Fast(std::string name, Uint32 armyset, SDL_Color color, 
 
61
                int width, int height, int player_no = -1);
49
62
 
50
 
        //! Copy constructor
 
63
        //! Copy constructor.
51
64
        AI_Fast(const Player&);
52
65
 
53
66
        //! Loading constructor. See XML_Helper for an explanation.
54
67
        AI_Fast(XML_Helper* helper);
 
68
 
 
69
        //! Destructor.
55
70
        ~AI_Fast();
56
71
        
57
 
        //! Saves data, the function is for saving additional data
 
72
        //! Saves data, the method is for saving additional data.
58
73
        bool save(XML_Helper* helper) const;
59
 
        
60
74
 
61
75
        //! Sets whether the ai joins close armies to make them stronger
62
76
        void setJoin(bool join) {d_join = join;}
71
85
        bool getManiac() const {return d_maniac;}
72
86
 
73
87
        
74
 
        /** This function is called whenever the player's turn starts. As soon
75
 
          * as it returns, the player's turn ends.
76
 
          */
77
 
        bool startTurn();
78
 
 
79
 
        //! Callback when the player invades a city
80
 
        bool invadeCity(City* c);
81
 
 
82
 
        //! Callback when a hero offers his services
83
 
        bool recruitHero(Hero* hero, City *city, int cost);
84
 
 
85
 
        //! Callback when an army of the player advances a level
86
 
        bool levelArmy(Army* a);
87
 
 
88
 
        //! Callback when we decide to perform treachery on another player
89
 
        bool treachery (Stack *stack, Player *player, Vector <int> pos, DiplomaticState state);
 
88
        virtual bool startTurn();
 
89
        virtual void invadeCity(City* c);
 
90
        virtual void levelArmy(Army* a);
 
91
        virtual bool treachery (Stack *stack, Player *player, Vector <int> pos, 
 
92
                                DiplomaticState state);
 
93
 
90
94
    private:
91
95
        //! The actual core function of the ai's logic.
92
96
        void computerTurn(); 
93
97
 
94
 
 
95
 
        // Data
96
 
        bool d_join;        //!< determines whether to join units or move them separately
97
 
        bool d_maniac;      //!< maniac mode: kill and raze everything you encounter
 
98
        //! Determines whether to join units or move them separately.
 
99
        bool d_join;
 
100
 
 
101
        //! Maniac mode: kill and raze everything you encounter.
 
102
        bool d_maniac;
 
103
 
98
104
        AI_Analysis* d_analysis;
99
105
        AI_Diplomacy* d_diplomacy;
100
106
};