From: Michael Andreen Date: Thu, 7 Mar 2002 19:24:12 +0000 (+0000) Subject: Some changes.. X-Git-Tag: HBS_0_1_0~48 X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=commitdiff_plain;h=4449ffee20fa04e3b865cbd37ba8027bae599018 Some changes.. --- diff --git a/bs/docs/devel/main.doc b/bs/docs/devel/main.doc index 8d5204f..37f70f7 100644 --- a/bs/docs/devel/main.doc +++ b/bs/docs/devel/main.doc @@ -1,4 +1,4 @@ -/*!\mainpage Testing testing +/*!\mainpage Harvalen's battlesystem \section intro Introduction Going to write something nice here.. (maybe ;) \section cvs Getting CVS access diff --git a/bs/fleet.cpp b/bs/fleet.cpp index a57d25e..35de49b 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -17,7 +17,51 @@ #include "fleet.h" -Fleet::Fleet(){ +using namespace std; + +Fleet::Fleet() +{ } Fleet::~Fleet(){ } + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::setName(string sName) +{ + m_sName = sName; +} + +////////////////////////////////////////////////////////////////////////// +// +string Fleet::Name() +{ + return m_sName; +} + +////////////////////////////////////////////////////////////////////////// +// +/** This function first sets the race, then it iterates through the the + * s_Races and checks if it finds the race it returns true, if it reaches + * the end without finding it it returns false. + */ +bool Fleet::setRace(std::string sRace) +{ + m_sRace = sRace; + s_Units.begin(); + for (map >::iterator i = s_Races.begin(); i != s_Races.end(); i++) + { + if (m_sRace == (*i).first) + return true; + } + return false; +} + +////////////////////////////////////////////////////////////////////////// +// +string Fleet::Race() +{ + return m_sRace; +} + + diff --git a/bs/fleet.h b/bs/fleet.h index 3bdd4ce..88c7884 100644 --- a/bs/fleet.h +++ b/bs/fleet.h @@ -20,6 +20,7 @@ #include #include +#include #include "unittype.h" @@ -29,19 +30,44 @@ *\todo LOTS (I think ;) *@author Michael Andreen */ - class Fleet { public: Fleet(); ~Fleet(); -private: - std::string m_Name; - std::string m_Race; + /**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, + * since it's up to the rest of the program to handle that part. + * \see Name + */ + void setName(std::string sName); + /**Returns the name of this fleet. + * \see setName + */ + std::string Name(); + + /**The race string decides what type of ships this fleet can have. + * The values must be feeded into this class. + * \param sRace This is just the name of the race. It's case-sensitive. + * \return If the race is available this function returns true, if not false is returned. The race is set in both cases though. + * \see Race + */ + bool setRace(std::string sRace); + /**Just returns what race this fleet belongs to.. + * \return The race, represented as a string. + * \see setRace + */ + std::string Race(); + + +protected: + std::string m_sName; + std::string m_sRace; std::map > m_Fleet; - static std::map m_Units; + static std::map s_Units; + static std::map > s_Races; }; #endif diff --git a/bs/unittype.h b/bs/unittype.h index 428588b..dc34516 100644 --- a/bs/unittype.h +++ b/bs/unittype.h @@ -27,6 +27,7 @@ /**This class contains a unittype, with all it's attributes + the number you got. * Maybe this actually should be a struct, since this class doen't have much to do, since i want it to be as generic as possible. * It got some data need need to be taken care of which makes me put it as a class. + * \todo need to add some more constructors.. *@author Michael Andreen *@see Fleet */ diff --git a/hbs.kdevses b/hbs.kdevses index 5ae0a7c..d2a0403 100644 --- a/hbs.kdevses +++ b/hbs.kdevses @@ -1,14 +1,8 @@ - - - + + + - - - - - -