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

« back to all changes in this revision

Viewing changes to src/QKillHero.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) 2003, 2004, 2005 Ulf Lorenz
 
2
// Copyright (C) 2004 Andrea Paternesi
 
3
// Copyright (C) 2007, 2008 Ben Asselstine
 
4
// Copyright (C) 2008 Ole Laursen
 
5
//
1
6
//  This program is free software; you can redistribute it and/or modify
2
7
//  it under the terms of the GNU General Public License as published by
3
8
//  the Free Software Foundation; either version 2 of the License, or
10
15
//
11
16
//  You should have received a copy of the GNU General Public License
12
17
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
19
//  02110-1301, USA.
14
20
 
15
 
#ifndef __QUEST_KILL_HERO_H
16
 
#define __QUEST_KILL_HERO_H
 
21
#ifndef QUEST_KILL_HERO_H
 
22
#define QUEST_KILL_HERO_H
17
23
 
18
24
#include <sigc++/trackable.h>
19
25
 
23
29
#include "playerlist.h"
24
30
 
25
31
 
26
 
/** Kill hero quest
27
 
  * 
28
 
  * This specific quest demands a certain hero to be killed.
29
 
  */
30
 
 
 
32
//! A Quest to kill another Player's Hero.
 
33
/**
 
34
 * A hero that receives this quest has to kill a particular Hero.  The Quest 
 
35
 * is completed when this happens, or the quest is expired if enemy Hero dies.
 
36
 */
31
37
class QuestKillHero : public Quest, public sigc::trackable
32
38
{
33
39
    public:
34
40
 
 
41
        //! Default constructor.
 
42
        /**
 
43
         * Make a new kill-hero quest.
 
44
         *
 
45
         * @param q_mgr  The quests manager to associate this quest with.
 
46
         * @param hero   The Id of the Hero who is responsible for the quest.
 
47
         */
35
48
        QuestKillHero(QuestsManager& q_mgr, Uint32 hero);
36
49
 
37
 
        /** \brief Constructor - create a new quest from
38
 
                   saved data */
 
50
        //! Loading constructor.
 
51
        /**
 
52
         * @param q_mgr   The quests manager to associate this quest with.
 
53
         * @param helper  The opened saved-game file to load this quest from.
 
54
         */
39
55
        QuestKillHero(QuestsManager& q_mgr, XML_Helper* helper);
40
56
 
 
57
        // Construct from remote action.
 
58
        QuestKillHero(QuestsManager& q_mgr, Uint32 hero, Uint32 victim);
 
59
        
 
60
        //! Returns whether or not this quest is impossible.
41
61
        /**
42
 
         * \brief Return whether quest is possible at all
 
62
         * Checks to see if any Players have a Hero to target.
 
63
         *
 
64
         * @param heroId  The Id of the Hero responsible for the kill-hero
 
65
         *                quest.
 
66
         *
 
67
         * @return Whether or not the quest is possible.
43
68
         */
44
69
        static bool isFeasible(Uint32 heroId);
45
70
 
46
 
        //! Saves the data
 
71
        //! Saves the kill-hero quest data to an opened saved-game file.
47
72
        bool save(XML_Helper* helper) const;
48
73
        
49
 
        /**
50
 
         * \brief Get progress information 
51
 
         *
52
 
         * \param s here we append the progress information
53
 
         */
 
74
        //! Return a description of how well the quest to kill a hero is going.
54
75
        std::string getProgress() const;
55
76
 
56
 
        /**
57
 
         * \brief Provide the lines of the message describing
58
 
                  the quest completion.
59
 
         */
 
77
        //! Return a queue of strings to show when the quest is compeleted.
60
78
         void getSuccessMsg(std::queue<std::string>& msgs) const;
61
79
 
62
 
        /**
63
 
         * \brief Provide the lines of the message describing
64
 
                  the quest expiration.
65
 
         */
66
 
         void getExpiredMsg(std::queue<std::string>& msgs) const;
67
 
 
68
 
         //! Returns the hunted hero
69
 
         Uint32 getVictim() const {return d_victim;}
70
 
 
 
80
        //! Return a queue of strings to show when the quest has expired.
 
81
        void getExpiredMsg(std::queue<std::string>& msgs) const;
 
82
 
 
83
        //! Returns the Id of the hunted hero object.
 
84
        Uint32 getVictim() const {return d_victim;}
 
85
 
 
86
        //! Callback for when an Army object is killed.
 
87
        /**
 
88
         * This method is used to check when the Hero responsible for the 
 
89
         * quest kills the Hero that is the target of this quest.
 
90
         *
 
91
         * @param army           A pointer to the Army object that has been
 
92
         *                       killed.
 
93
         * @param heroIsCulprit  Whether or not the Hero object responsible for
 
94
         *                       this Quest was involved with the killing of
 
95
         *                       the given Army object.
 
96
         */
71
97
        void armyDied(Army *a, bool heroIsCulprit);
72
98
 
 
99
        //! Callback for when a City is defeated.
 
100
        /**
 
101
         * @note This method is not used.
 
102
         */
73
103
        void cityAction(City *c, CityDefeatedAction action, 
74
104
                        bool heroIsCulprit, int gold);
75
105
    private:
76
106
 
77
 
        //! Initializes the description string
 
107
        //! Generate a description of the Quest.
78
108
        void initDescription();
79
109
 
80
 
        /** \brief Choose a hero to be killed */
 
110
        //! Choose a hero to be killed.
 
111
        /**
 
112
         * @return A pointer to the Hero object to be the target for this
 
113
         *         quest.
 
114
         */
81
115
        static Hero* chooseToKill();
82
116
        
83
 
        /** hero id (the target) to be searched by the hero */
 
117
        //! The Id of the Hero object to be hunted and killed.
84
118
        Uint32 d_victim;
85
119
};
86
120