]> ruin.nu Git - hbs.git/blob - bs/bsdoc.cpp
some changes
[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"].setRace("Planet");
62         m_Battles[name]["Friendly"]["Home Fleet"];
63         m_Battles[name]["Hostile"];
64
65         modified = true;
66         emit documentChanged();
67         return 0;
68 }
69
70 /////////////////////////////////////////////////////////////////////////
71 //
72
73 const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& BSDoc::battles() const
74 {
75         return m_Battles;
76 }
77
78 //////////////////////////////////////////////////////////////////////////
79 //
80 Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const
81 {
82         for (map<QString, map<QString, map<QString, Fleet> > >::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
83         {
84                 if (i->first == battle)
85                 {
86                         for (map<QString, map<QString, Fleet> >::const_iterator j = i->second.begin(); j != i->second.end(); j++)
87                         {
88                                 if (j->first == group)
89                                 {
90                                         for (map<QString, Fleet>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
91                                         {
92                                                 if (k->first == fleet)
93                                                 {
94                                                         return k->second;
95                                                 }
96                                         }
97                                 }
98                         }
99                 }
100         }
101         return Fleet();
102 }
103
104