1 // Copyright (C) 2007, 2008, Ole Laursen
2 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
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
19 #ifndef FIGHT_WINDOW_H
20 #define FIGHT_WINDOW_H
25 #include <sigc++/trackable.h>
26 #include <glibmm/main.h>
29 #include "game-parameters.h"
35 // window for displaying the course of a fight
36 class FightWindow: public sigc::trackable
39 FightWindow(Fight &fight);
42 void set_parent_window(Gtk::Window &parent);
45 void run(bool *quick);
49 static const int max_cols = 8;
55 Gtk::ProgressBar *bar;
60 typedef std::vector<ArmyItem> army_items_type;
61 army_items_type army_items;
63 typedef std::list<FightItem> actions_type;
66 typedef std::vector<Army *> armies_type; // for convenience
68 Glib::RefPtr<Glib::MainLoop> main_loop;
71 actions_type::iterator action_iterator;
73 // determine the max no. of rows in each column
74 int compute_max_rows(const armies_type &attackers,
75 const armies_type &defenders);
77 // add an army to the window
78 void add_army(Army *army, int initial_hp,
79 std::vector<Gtk::HBox *> &hboxes,
81 int current_no, int max_rows, Gtk::AlignmentEnum alignment);
83 void on_key_release_event(GdkEventKey* event);
87 int normal_round_speed;