]> ruin.nu Git - hbs.git/commitdiff
changed my internal structure from Fleet to Fleet*
authorMichael Andreen <harv@ruin.nu>
Thu, 4 Apr 2002 20:00:56 +0000 (20:00 +0000)
committerMichael Andreen <harv@ruin.nu>
Thu, 4 Apr 2002 20:00:56 +0000 (20:00 +0000)
bs/bsconf.cpp
bs/bsdoc.cpp
bs/bsdoc.h
bs/bsview.cpp
bs/fleet.cpp
bs/fleet.h
bs/ui/infoview.ui
bs/ui/resourceview.ui
bs/ui/roidseditview.ui
bs/unittype.cpp
bs/unittype.h

index 97e3c7ccd4ba1c709d1eda4353e0daf52dc4ff9b..874d6b9e38d1f20ccf483af79696871797c77af4 100644 (file)
@@ -85,7 +85,7 @@ bool BSConf::loadStats()
                                t1 >> temp;
                                units[race].setRace(temp.toInt());
                                t1 >> temp;
-                               units[race].setClass((const char*) temp);
+                               units[race].setUnitClass((const char*) temp);
                                t1 >> temp;
                                units[race].addTarget((const char*) temp);
                                t1 >> temp;
index 47688a7bfd06e20b37cf312b818fcc8e676a973c..5bf5f46863c6c28ec325cabca60f5b99703449e5 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "bsdoc.h"
 
+#include "planet.h"
+
 using namespace std;
 
 BSDoc::BSDoc()
@@ -39,12 +41,14 @@ bool BSDoc::save()
 
 bool BSDoc::saveAs(const QString &filename)
 {
+       QString test = filename;
   return true;
 }
 
 bool BSDoc::load(const QString &filename)
 {
-  emit documentChanged();
+  QString test = filename;
+       emit documentChanged();
   return true;
 }
 
@@ -58,10 +62,11 @@ bool BSDoc::isModified() const
 
 int BSDoc::newBattle(QString name)
 {
-       m_Battles[name]["Friendly"]["Home Planet"].setRace("Planet");
-       m_Battles[name]["Friendly"]["Home Fleet"];
+       m_Battles[name]["Friendly"]["Home Planet"] = new Planet();;
+       m_Battles[name]["Friendly"]["Home Fleet"] = new Fleet();
        m_Battles[name]["Hostile"];
 
+       //Planet* pl = dynamic_cast<Planet*>(m_Battles[name]["Friendly"]["Home Planet"]);
        modified = true;
        emit documentChanged();
        return 0;
@@ -70,24 +75,24 @@ int BSDoc::newBattle(QString name)
 /////////////////////////////////////////////////////////////////////////
 //
 
-const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& BSDoc::battles() const
+const BattleList& BSDoc::battles() const
 {
        return m_Battles;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const
+const Fleet* BSDoc::specificFleet(QString battle, QString group, QString fleet) const
 {
-       for (map<QString, map<QString, map<QString, Fleet> > >::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
+       for (BattleList::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
        {
                if (i->first == battle)
                {
-                       for (map<QString, map<QString, Fleet> >::const_iterator j = i->second.begin(); j != i->second.end(); j++)
+                       for (map<QString, map<QString, Fleet*> >::const_iterator j = i->second.begin(); j != i->second.end(); j++)
                        {
                                if (j->first == group)
                                {
-                                       for (map<QString, Fleet>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
+                                       for (map<QString, Fleet*>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
                                        {
                                                if (k->first == fleet)
                                                {
@@ -98,7 +103,7 @@ Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const
                        }
                }
        }
-       return Fleet();
+       return '\0';
 }
 
 
index b790dc628f4c06b454d8eeea198d3101249f4f57..977491d1b3dcab59d62245e84f7cd1b2dcbdbeef 100644 (file)
@@ -26,6 +26,7 @@
 // application specific includes
 #include "fleet.h"
 
+typedef std::map<QString, std::map<QString, std::map<QString, Fleet*> > > BattleList;
 //! The document class
 /** This class is holding all the data, handles the transportation of the
   * data to a couple of different mediums and informs users of the data
@@ -58,9 +59,15 @@ class BSDoc : public QObject
         * change it.
         * \todo remove this, and replace it with a better more closed interface.
         */
-       const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& battles() const;
+       const BattleList& battles() const;
 
-       Fleet specificFleet(QString battle, QString group, QString fleet) const;
+       
+       /**Looks for the fleet with the specified name, in the specified group in the
+        * specified battle.
+        * \return Returns '\0' (NULL) if the fleet isn't found, if it is found it
+        * returns a const pointer to the fleet.
+        */
+       const Fleet* specificFleet(QString battle, QString group, QString fleet) const;
 
   signals:
     void documentChanged();
@@ -75,7 +82,7 @@ class BSDoc : public QObject
         * -# The fleetname (Home Planet, coordinates, irc nicks and so on)
         * - and in the end you got the actual Fleet object with it's data.
         */
-       std::map<QString, std::map<QString, std::map<QString, Fleet> > > m_Battles;
+        BattleList m_Battles;
 };
 
 #endif
index 5ae770305468a68475a8c3b62b03ad02c4eed9d0..2dfe3f37f45263381c262a25b30c8dfc1f8169ca 100644 (file)
@@ -52,6 +52,7 @@ BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent)
        m_NumberView->addColumn("Name");
        m_NumberView->addColumn("Number");
        m_NumberView->addColumn("ETA");
+       m_NumberView->addColumn("Score");
        //addBattle("NO BATTLES");
 
        
@@ -83,9 +84,9 @@ BSView::BSView(QWidget *parent, BSDoc *doc) : QSplitter(parent)
        //the widget stack
        m_BattleSum = new BattleSum();
        m_FleetViews->addWidget(m_BattleSum, 0);
-       m_FleetView = new FleetView(fl1, true, true);
+       m_FleetView = new FleetView(&fl1, true);
        m_FleetViews->addWidget(m_FleetView, 1);
-       m_GenericFleetView = new FleetView(fl2, true, false);
+       m_GenericFleetView = new FleetView(&fl2, true);
        m_FleetViews->addWidget(m_GenericFleetView, 2);
        //m_FleetViews->raiseWidget(0);
        connect(m_NumberView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotFleetSelection(QListViewItem *))); 
@@ -114,29 +115,33 @@ void BSView::slotDocumentChanged()
 {
        m_NumberView->clear();
        
-       const map<QString, map<QString, map<QString, Fleet> > >& battles = m_doc->battles();    
+       const BattleList& battles = m_doc->battles();   
 
-       for (map<QString, map<QString, map<QString, Fleet> > >::const_iterator i = battles.begin(); i != battles.end(); ++i)
+       for (BattleList::const_iterator i = battles.begin(); i != battles.end(); ++i)
        {
                QString b = (*i).first;
                QListViewItem* battle = new QListViewItem(m_NumberView, b);
                battle->setOpen(m_TreeExpanded[b]["--"]);
                        
 
-               for (map<QString, map<QString, Fleet> >::const_iterator j = i->second.begin(); j != i->second.end(); ++j)
+               for (map<QString, map<QString, Fleet*> >::const_iterator j = i->second.begin(); j != i->second.end(); ++j)
                {
                        QString g = (*j).first;
                        QListViewItem* group = new QListViewItem(battle, g);
                        int groupShips = 0;
+                       unsigned groupScore = 0;
                        group->setOpen(m_TreeExpanded[b][g]);
 
-                       for (map<QString, Fleet>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
+                       for (map<QString, Fleet*>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
                        {       
-                               int ships = k->second.NumberOfShips();
+                               int ships = k->second->numberOfShips();
+                               unsigned score = k->second->score();
                                groupShips += ships;
-                               (void) new QListViewItem(group, (*k).first, QString("%1").arg(ships), QString("%1").arg(k->second.ETA()));
+                               groupScore += score;
+                               (void) new QListViewItem(group, (*k).first, QString("%1").arg(ships), QString("%1").arg(k->second->ETA()), QString("%1").arg(score));
                        }
                        group->setText(1, QString("%1").arg(groupShips));
+                       group->setText(3, QString("%1").arg(groupScore));
                }
        }
 }
@@ -170,24 +175,22 @@ void BSView::slotFleetSelection(QListViewItem *lvi)
        }
        else
        {
-               bool home = false;
                bool friendly = false;
+               bool home       = false;
                QString fleet = lvi->text(0);
                QString group = lvi->parent()->text(0);
                QString battle = lvi->parent()->parent()->text(0);
                if ( group == tr("Friendly"))
                {
                        friendly = true;
-                       if ( fleet == tr("Home Planet"))
-                       {
-                               home = true;
-                       }
+                       if(fleet == tr("Home Planet"))
+                               home=true;
                }
-               Fleet fl = m_doc->specificFleet(battle, group, fleet);
-               m_InfoView->setRace(fl.Race().c_str());
+               const Fleet* fl = m_doc->specificFleet(battle, group, fleet);
+               m_InfoView->setRace(fl->race().c_str());
                m_InfoView->setFleetName(fleet);
-               m_InfoView->setEta(fl.ETA());
-               if (fl.Race() == tr("Generic").latin1())
+               m_InfoView->setEta(fl->ETA());
+               if (fl->race() == tr("Generic").latin1())
                {
                        m_GenericFleetView->viewFleet(fl, friendly);
                        m_FleetViews->raiseWidget(2);
@@ -195,7 +198,7 @@ void BSView::slotFleetSelection(QListViewItem *lvi)
                }
                else 
                {
-                       if (fl.Race() == m_FleetView->fleet().Race() &&
+                       if (fl->race() == m_FleetView->fleet()->race() &&
                        m_FleetView->isHome() == home)
                        {
                                m_FleetView->viewFleet(fl, friendly);
@@ -203,7 +206,7 @@ void BSView::slotFleetSelection(QListViewItem *lvi)
                        else
                        {
                                m_FleetViews->removeWidget(m_FleetView);
-                               m_FleetView = new FleetView(fl, friendly, home);
+                               m_FleetView = new FleetView(fl, friendly);
                                m_FleetViews->addWidget(m_FleetView, 1);
                        }
                        m_FleetViews->raiseWidget(1);
index 2bd245ba29af67dfc1abadb6a4bdd33f12e35528..cb15df528c6bce726a0f7dd52db026f7d57f5a31 100644 (file)
@@ -41,7 +41,7 @@ void Fleet::setName(string sName)
 
 //////////////////////////////////////////////////////////////////////////
 //
-string Fleet::Name() const
+string Fleet::name() const
 {
        return m_sName;
 }
@@ -65,7 +65,7 @@ bool Fleet::setRace(string sRace)
 
 //////////////////////////////////////////////////////////////////////////
 //
-string Fleet::Race() const
+string Fleet::race() const
 {
        return m_sRace;
 }
@@ -75,7 +75,7 @@ string Fleet::Race() const
 /** This function iterates through m_Fleet and adds all numbers together to
  * produce a total.
  */
-int Fleet::NumberOfShips() const
+int Fleet::numberOfShips() const
 {
        int total = 0;
 
@@ -114,26 +114,29 @@ void Fleet::setUnits(UnitList& units)
 {
        s_Units = units;
 
+       /*
+
        for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); i++)
        {
                cerr << s_Units[(*i).first].Name() << "\t\t"
-                       << s_Units[(*i).first].Race() <<"\t"
-                       << s_Units[(*i).first].Class() << "\t"
-                       << s_Units[(*i).first].Target(0) << "\t"
-                       << s_Units[(*i).first].Target(1) << "\t"
-                       << s_Units[(*i).first].Target(2) << "\t"
-                       << s_Units[(*i).first].Initiative() << "\t"
-                       << s_Units[(*i).first].Agility() << "\t"
-                       << s_Units[(*i).first].WeaponSpeed() << "\t"
-                       << s_Units[(*i).first].Guns() << "\t"
-                       << s_Units[(*i).first].Power() << "\t"
-                       << s_Units[(*i).first].Armor() << "\t"
+                       << s_Units[(*i).first].race() <<"\t"
+                       << s_Units[(*i).first].unitClass() << "\t"
+                       << s_Units[(*i).first].target(0) << "\t"
+                       << s_Units[(*i).first].target(1) << "\t"
+                       << s_Units[(*i).first].target(2) << "\t"
+                       << s_Units[(*i).first].initiative() << "\t"
+                       << s_Units[(*i).first].agility() << "\t"
+                       << s_Units[(*i).first].weaponSpeed() << "\t"
+                       << s_Units[(*i).first].guns() << "\t"
+                       << s_Units[(*i).first].power() << "\t"
+                       << s_Units[(*i).first].armor() << "\t"
                        << s_Units[(*i).first].EMP() << "\t"
-                       << s_Units[(*i).first].TotRes() << "\t"
-                       << s_Units[(*i).first].Fuel() << "\t"
+                       << s_Units[(*i).first].totRes() << "\t"
+                       << s_Units[(*i).first].fuel() << "\t"
                        << s_Units[(*i).first].ETA() << "\t"
-                       << s_Units[(*i).first].Type() << endl;
+                       << s_Units[(*i).first].type() << endl;
        }
+       */
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -157,3 +160,17 @@ vector<int> Fleet::RacesAllowed() const
        return s_Races[m_sRace];
 }
 
+//////////////////////////////////////////////////////////////////////////
+//
+unsigned Fleet::score(int tick = 0) const
+{
+       unsigned tot_score = 0;
+
+       for (FleetList::const_iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i)
+       {
+               tot_score += i->second[tick] * s_Units[i->first].totRes() / 10;
+       }
+
+       return tot_score;
+}
+
index ca2fddfdc616dde9be124c5932b1c6e77c559df2..c156545971078d921634f96fddecc7c41dd87795 100644 (file)
@@ -25,8 +25,9 @@
 
 #include "unittype.h"
  template<typename T> class MyComp { public: bool operator()(T,T) { return false; } };
-
+typedef std::map<std::string, std::vector<int> > FleetList;
 typedef std::map<std::string, UnitType>        UnitList;
+typedef std::map<std::string, std::vector<int> > RaceList;
 //!This is the engine for the whole battlesystem.
 /**This is the engine for the whole battlesystem.
   *    One of the few parts that I plan make fully portable.
@@ -37,7 +38,7 @@ class Fleet
 {
 public: 
        Fleet();
-       ~Fleet();
+       virtual ~Fleet();
 
        /**Sets the name that represents this fleet. Might be different a name
         * like foobar or some coordinates like 1:1:1. The name doesn't have to be unique,
@@ -48,7 +49,7 @@ public:
        /**Returns the name of this fleet.
         * \see setName
         */
-       std::string Name() const;
+       std::string name() const;
 
        /**The race string decides what type of ships this fleet can have.
         * The values must be feeded into this class.
@@ -61,13 +62,13 @@ public:
         * \return The race, represented as a string.
         * \see setRace
         */
-       std::string Race() const;
+       std::string race() const;
 
        std::vector<int> RacesAllowed() const;
 
        /**Returns the total number of ships in this fleet
         */
-       int NumberOfShips() const;
+       int numberOfShips() const;
 
        /**Sets the estimated time of arrival. The time as a single integer,
         * in relation to the current time. For example if the current time is
@@ -78,20 +79,28 @@ public:
         */
        int  ETA() const;
 
-       static void setRaces(std::map<std::string, std::vector<int> >& races);
+
+       /**Returns the score. This value is the total resources spent on this fleet
+        * devided with 10.
+        * \param tick tells the function what tick you want the score from. 0 is 
+        * initial score before the fleet has landed.
+        */
+       virtual unsigned score(int tick = 0) const;
+
+       static void setRaces(RaceList& races);
        static void setUnits(UnitList& units);
 
-       static const std::map<std::string, std::vector<int> >& Races();
+       static const RaceList& Races();
        static const UnitList& Units();
 
 protected:
        std::string     m_sName;
        std::string     m_sRace;
        int         m_iETA;
-       std::map<std::string, std::vector<int> >        m_Fleet;
+       FleetList       m_Fleet;
 
        static UnitList s_Units;
-       static std::map<std::string, std::vector<int> > s_Races;
+       static RaceList s_Races;
 };
 
 #endif
index 6354911dd7506a4d1c6a671048dd96c81531ffcc..b4355774119af2ae82f6697ceaff1cbd57137ef6 100644 (file)
@@ -8,7 +8,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>263</width>
+            <width>293</width>
             <height>117</height>
         </rect>
     </property>
         <slot>RemoveButton_clicked()</slot>
     </connection>
 </connections>
+<tabstops>
+    <tabstop>NameLine</tabstop>
+    <tabstop>EtaSpin</tabstop>
+    <tabstop>RaceCombo</tabstop>
+    <tabstop>ApplyButton</tabstop>
+    <tabstop>CancelButton</tabstop>
+    <tabstop>NewButton</tabstop>
+    <tabstop>RemoveButton</tabstop>
+</tabstops>
 <includes>
     <include location="global" impldecl="in declaration">vector</include>
     <include location="local" impldecl="in implementation">infoview.ui.h</include>
index 6221366e10bcd157292bf733be147631801b9b0d..4bc7624f5cb86c3034da648618f53991198285db 100644 (file)
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>241</width>
-            <height>75</height>
+            <width>222</width>
+            <height>103</height>
         </rect>
     </property>
     <property name="maximumSize">
         <size>
             <width>32767</width>
-            <height>90</height>
+            <height>110</height>
         </size>
     </property>
     <property name="caption">
         <string>QGroupBoxForm</string>
     </property>
     <property name="title">
-        <string>Resources</string>
+        <string>Resources and Score</string>
     </property>
     <grid>
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
         <property name="margin">
-            <number>3</number>
+            <number>11</number>
         </property>
         <property name="spacing">
-            <number>0</number>
+            <number>6</number>
         </property>
-        <widget class="QLabel" row="0" column="3">
-            <property name="name">
-                <cstring>uninitLabel</cstring>
-            </property>
-            <property name="text">
-                <string>Uninit</string>
-            </property>
-        </widget>
         <widget class="QLabel" row="0" column="1">
             <property name="name">
                 <cstring>crystalLabel</cstring>
                 <string>Crystal</string>
             </property>
         </widget>
-        <widget class="QLabel" row="0" column="0">
+        <widget class="QLabel" row="0" column="2">
             <property name="name">
-                <cstring>metalLabel</cstring>
+                <cstring>eoniumLabel</cstring>
             </property>
             <property name="text">
-                <string>Metal</string>
+                <string>Eonium</string>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="0">
+        <widget class="QLineEdit" row="1" column="3">
             <property name="name">
-                <cstring>MetalLine</cstring>
+                <cstring>EoniumLine</cstring>
             </property>
             <property name="focusPolicy">
                 <enum>NoFocus</enum>
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLabel" row="0" column="2">
+        <widget class="QLabel" row="0" column="0">
             <property name="name">
-                <cstring>eoniumLabel</cstring>
+                <cstring>metalLabel</cstring>
             </property>
             <property name="text">
-                <string>Eonium</string>
+                <string>Metal</string>
             </property>
         </widget>
         <widget class="QLineEdit" row="1" column="2">
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLineEdit" row="1" column="3">
+        <widget class="QLineEdit" row="2" column="1">
             <property name="name">
-                <cstring>EoniumLine</cstring>
+                <cstring>ScoreEdit</cstring>
+            </property>
+            <property name="focusPolicy">
+                <enum>NoFocus</enum>
+            </property>
+            <property name="readOnly">
+                <bool>true</bool>
+            </property>
+        </widget>
+        <widget class="QLineEdit" row="1" column="0">
+            <property name="name">
+                <cstring>MetalLine</cstring>
+            </property>
+            <property name="focusPolicy">
+                <enum>NoFocus</enum>
+            </property>
+            <property name="readOnly">
+                <bool>true</bool>
+            </property>
+        </widget>
+        <widget class="QLabel" row="0" column="3">
+            <property name="name">
+                <cstring>uninitLabel</cstring>
+            </property>
+            <property name="text">
+                <string>Uninit</string>
+            </property>
+        </widget>
+        <widget class="QLabel" row="2" column="0">
+            <property name="name">
+                <cstring>ScoreLabel</cstring>
+            </property>
+            <property name="text">
+                <string>Score:</string>
+            </property>
+        </widget>
+        <widget class="QLabel" row="2" column="2">
+            <property name="name">
+                <cstring>ScoreLostLabel</cstring>
+            </property>
+            <property name="text">
+                <string>Lost</string>
+            </property>
+        </widget>
+        <widget class="QLineEdit" row="2" column="3">
+            <property name="name">
+                <cstring>ScoreLostEdit</cstring>
             </property>
             <property name="focusPolicy">
                 <enum>NoFocus</enum>
index 3199fddaabe123d41217ea0e674bbfc40bf8fd8c..c968a8ee4c31d0c26fc2e61195613445b9d21784 100644 (file)
@@ -9,28 +9,28 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>289</width>
-            <height>100</height>
+            <width>219</width>
+            <height>103</height>
         </rect>
     </property>
     <property name="maximumSize">
         <size>
             <width>32767</width>
-            <height>110</height>
+            <height>119</height>
         </size>
     </property>
     <property name="caption">
         <string>Roids</string>
     </property>
     <property name="title">
-        <string>Roids</string>
+        <string>Roids and Score</string>
     </property>
     <grid>
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
         <property name="margin">
-            <number>3</number>
+            <number>2</number>
         </property>
         <property name="spacing">
             <number>0</number>
                 <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLabel" row="2" column="0">
-            <property name="name">
-                <cstring>TextLabel6</cstring>
-            </property>
-            <property name="text">
-                <string>Lost</string>
-            </property>
-        </widget>
         <widget class="QLabel" row="0" column="4">
             <property name="name">
                 <cstring>uninitLabel</cstring>
                 <bool>true</bool>
             </property>
         </widget>
+        <widget class="QLabel" row="2" column="0">
+            <property name="name">
+                <cstring>TextLabel6</cstring>
+            </property>
+            <property name="text">
+                <string>Lost</string>
+            </property>
+        </widget>
+        <widget class="QLabel" row="3" column="0">
+            <property name="name">
+                <cstring>ScoreLine</cstring>
+            </property>
+            <property name="text">
+                <string>&amp;Score</string>
+            </property>
+            <property name="buddy" stdset="0">
+                <cstring>ScoreEdit</cstring>
+            </property>
+        </widget>
+        <widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="4">
+            <property name="name">
+                <cstring>ScoreEdit</cstring>
+            </property>
+        </widget>
     </grid>
 </widget>
+<tabstops>
+    <tabstop>LineEdit26</tabstop>
+    <tabstop>LineEdit29</tabstop>
+    <tabstop>LineEdit31</tabstop>
+    <tabstop>LineEdit32</tabstop>
+</tabstops>
 <includes>
     <include location="local" impldecl="in implementation">roidseditview.ui.h</include>
 </includes>
index 6f3ef82ed8b071c5c858b601fac94556555f16c8..20c30a39e7e87660cb8810ff6391dbac5e1687aa 100644 (file)
@@ -54,21 +54,21 @@ void UnitType::setRace(int iRace)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::Race() const
+int UnitType::race() const
 {
        return m_iRace;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-void UnitType::setClass(string sClass)
+void UnitType::setUnitClass(string sClass)
 {
        m_sClass = sClass;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-string UnitType::Class() const
+string UnitType::unitClass() const
 {
        return m_sClass;
 }
@@ -112,14 +112,14 @@ void UnitType::insTarget(string target, int index = 0)
 
 //////////////////////////////////////////////////////////////////////////
 //
-vector<string> UnitType::Target() const
+vector<string> UnitType::target() const
 {
        return m_vTarget;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-string UnitType::Target(int index) const
+string UnitType::target(int index) const
 {
        return m_vTarget[index];
 }
@@ -133,7 +133,7 @@ void UnitType::setInitiative(int iInit)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int     UnitType::Initiative() const
+int     UnitType::initiative() const
 {
        return m_iInitiative;
 }
@@ -147,7 +147,7 @@ void UnitType::setAgility (int iAgil)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Agility() const
+int  UnitType::agility() const
 {
        return m_iAgility;
 }
@@ -161,7 +161,7 @@ void UnitType::setWeaponSpeed(int iWPSP)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::WeaponSpeed() const
+int  UnitType::weaponSpeed() const
 {
        return m_iWeaponSpeed;
 }
@@ -175,7 +175,7 @@ void UnitType::setGuns(int iGuns)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::Guns() const
+int UnitType::guns() const
 {
        return m_iGuns;
 }
@@ -189,7 +189,7 @@ void UnitType::setPower(int iPower)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Power() const
+int  UnitType::power() const
 {
        return m_iPower;
 }
@@ -203,7 +203,7 @@ void UnitType::setArmor(int iArmor)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Armor() const
+int  UnitType::armor() const
 {
        return m_iArmor;
 }
@@ -231,7 +231,7 @@ void UnitType::setTotalResources(int iTR)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::TotRes() const
+int UnitType::totRes() const
 {
        return m_iTotalResources;
 }
@@ -245,7 +245,7 @@ void UnitType::setFuel(int iFuel)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Fuel() const
+int  UnitType::fuel() const
 {
        return m_iFuel;
 }
@@ -273,7 +273,7 @@ void UnitType::setType(string type)
 
 //////////////////////////////////////////////////////////////////////////
 //
-string  UnitType::Type() const
+string  UnitType::type() const
 {
        return m_sType;
 }
index 9bf008e83eeeb8e1294aa94b5f595db4f3b21e90..cbb73bac9ebdd4dfd2f21791bd1c1554d4b4ec1b 100644 (file)
@@ -46,11 +46,11 @@ public:
        /** This functions sets which race this unittype is, the race is represented with a integer. */
        void setRace(int iRace);
        /** Returns the race this unittype belongs to*/
-       int Race() const;
+       int race() const;
 
        /** Sets the class for the unittype, it's represented as a integer */
-       void setClass(std::string sClass);
-       std::string Class() const;
+       void setUnitClass(std::string sClass);
+       std::string unitClass() const;
 
        /** Sets the classes that this unittype targets. a vector is used. */
        void setTarget(std::vector<std::string> Target);
@@ -61,34 +61,34 @@ public:
         * \param index where to place the target. 0 being the default and first place. */
        void insTarget(std::string iTarget, int index = 0);
        /** Returns all targets from the target list */
-       std::vector<std::string> Target() const;
+       std::vector<std::string> target() const;
        /** Returns a specific target 
         * \param index An index value that represents the target. 0 being the first*/
-       std::string     Target(int index) const;
+       std::string     target(int index) const;
 
        /** Sets the initiatve, the lower it is the earlier the unit shots */
        void setInitiative(int iInit);
-       int      Initiative() const;
+       int      initiative() const;
 
        /** Sets the agility, the higher it is the harder it is to hit the unit */
        void setAgility (int iAgil);
-       int  Agility() const;
+       int  agility() const;
 
        /** Sets the weaponspeed.. just a simple integer that shows how good it is at hitting things */
        void setWeaponSpeed(int iWPSP);
-       int  WeaponSpeed() const;
+       int  weaponSpeed() const;
 
        /** Sets the number of guns. */
        void setGuns(int iGuns);
-       int Guns() const;
+       int guns() const;
 
        /** Sets the how much power the guns have.. or in other words: the damage they do. */
        void setPower(int iPower);
-       int  Power() const;
+       int  power() const;
 
        /** Sets the armor, this is how much damage the unittype can take before it's destroyed */
        void setArmor(int iArmor);
-       int  Armor() const;
+       int  armor() const;
 
        /** Sets the emp resistance, the lower value the easier it is to block it */
        void setEMP(int iEMP);
@@ -97,12 +97,12 @@ public:
        /** Sets the resource cost for this unittype. Used for example for score calculation and so on. */
        void setTotalResources(int iTR);
        /** Returns the number of total resources this unittype cost. */
-       int TotRes() const;
+       int totRes() const;
 
        /** Sets the fuelcost for this unittype */
        void setFuel(int iFuel);
        /** Returns the fuelcost */
-       int  Fuel() const;
+       int  fuel() const;
 
        /** Sets the ETA, the speed in a sort of inverted form.. the lower ETA, the faster is the unit */
        void setETA(int iETA);
@@ -112,7 +112,8 @@ public:
         * \param iType An integer to symbolise the type. */
        void setType(std::string type);
        /** What type of ship this is. */
-       std::string  Type() const;      
+       std::string  type() const;      
+
 protected:
        std::string             m_sName;
        int                     m_iRace;            //!< Not really the race, but an indiaction on what race can use it..