]> ruin.nu Git - hbs.git/blob - bs/bsdoc.cpp
1c6e60bf24f4f31cfe50e29bbb66e983ecc77ba8
[hbs.git] / bs / bsdoc.cpp
1 /***************************************************************************
2                           bcdoc.cpp  -  description
3                              -------------------
4     begin                : Sun May 27 22:13:58 CEST 2001
5     copyright            : (C) 2001 by Michael Andreen
6     email                : whale@linux.nu
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #include "bsdoc.h"
19
20 using namespace std;
21
22 BSDoc::BSDoc()
23 {
24   modified = false;
25 }
26
27 BSDoc::~BSDoc()
28 {
29 }
30
31 void BSDoc::newDoc()
32 {
33 }
34
35 bool BSDoc::save()
36 {
37   return true;
38 }
39
40 bool BSDoc::saveAs(const QString &filename)
41 {
42   return true;
43 }
44
45 bool BSDoc::load(const QString &filename)
46 {
47   emit documentChanged();
48   return true;
49 }
50
51 bool BSDoc::isModified() const
52 {
53   return modified;
54 }
55
56 ///////////////////////////////////////////////////////////////////////////
57 //
58
59 int BSDoc::newBattle(QString name)
60 {
61         m_Battles[name]["Friendly"]["Home Planet"];
62         m_Battles[name]["Hostile"];
63
64         modified = true;
65         emit documentChanged();
66         return 0;
67 }
68
69 /////////////////////////////////////////////////////////////////////////
70 //
71
72 const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& BSDoc::battles() const
73 {
74         return m_Battles;
75 }
76
77 //////////////////////////////////////////////////////////////////////////
78 //
79 Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const
80 {
81         for (map<QString, map<QString, map<QString, Fleet> > >::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
82         {
83                 if (i->first == battle)
84                 {
85                         for (map<QString, map<QString, Fleet> >::const_iterator j = i->second.begin(); j != i->second.end(); j++)
86                         {
87                                 if (j->first == group)
88                                 {
89                                         for (map<QString, Fleet>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
90                                         {
91                                                 if (k->first == fleet)
92                                                 {
93                                                         return k->second;
94                                                 }
95                                         }
96                                 }
97                         }
98                 }
99         }
100         return Fleet();
101 }
102
103