initial commit, lordsawar source, slightly modified
[lordsawar] / src / questmap.h
1 //  Copyright (C) 2007, 2008, 2009 Ben Asselstine
2 //
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.
7 //
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.
12 //
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 
16 //  02110-1301, USA.
17
18 #ifndef QUESTMAP_H
19 #define QUESTMAP_H
20
21 #include <sigc++/signal.h>
22
23 #include "overviewmap.h"
24 #include "input-events.h"
25 #include "player.h"
26
27 class Quest;
28
29 //! Draw a Quest objective onto a miniature map graphic.
30 /** 
31  * This is a map where you can depict a Quest.
32  * The depiction is different for each kind of Quest (Quest::Type).
33  *
34  * @note This class is also used in a special case to depict the quest 
35  * completion when the reward is a hidden ruin (Reward::RUIN).
36  */
37 class QuestMap : public OverviewMap
38 {
39  public:
40
41      //! Default constructor.  Make a new QuestMap.
42      /**
43       * @param quest  The quest to depict on the miniature map graphic.
44       */
45     QuestMap(Quest *quest);
46
47
48     // Set Methods
49
50     //! Point to another position on the miniature map graphic.
51     /**
52      * @note This is used to point to a hidden map Reward after a Quest has
53      * been completed.
54      */
55     void set_target(Vector<int>target){ d_target = target;}
56
57
58     // Signals
59
60     //! Emitted when the quest is finished being drawn on the map surface.
61     /**
62      * Classes that use QuestMap must catch this signal to display the map.
63      */
64     sigc::signal<void, Glib::RefPtr<Gdk::Pixmap> > map_changed;
65     
66  private:
67
68     //! Draw the given positions on the map in the colour of the given player.
69     void draw_stacks(Player *p, std::list< Vector<int> > targets);
70
71     //! Draw a line to a boxed target.
72     void draw_target(Vector<int> start, Vector<int> target);
73
74     //! Draw a box around a target.
75     void draw_target();
76     
77     //! Draw the Quest onto the miniature map graphic.
78     /**
79      * This method is automatically called by the QuestMap::draw method.
80      * Either draws the given stacks, a line to a target with a target, or a 
81      * target, or nothing at all depending on the kind of Quest.
82      */
83     virtual void after_draw();
84
85     // DATA
86
87     //! The Quest to depict on the miniature map graphic.
88     Quest *quest;
89
90     //! The new position to point to on the miniature map graphic.
91     Vector<int> d_target;
92
93 };
94
95 #endif