summaryrefslogtreecommitdiff
path: root/src/object.h
diff options
context:
space:
mode:
authorHuynh Tran <nthuynh75@gmail.com>2005-06-29 08:43:55 +0000
committerHuynh Tran <nthuynh75@gmail.com>2005-06-29 08:43:55 +0000
commit202b03b2ad1160e119b74f7f50ded8de7464c40f (patch)
treeadd2ea0bc0a61ba121fd9dbc83a5d224ba672cd5 /src/object.h
parentf83980082a8ee69b1356f58159867e1313ebf868 (diff)
downloadmanaserv-202b03b2ad1160e119b74f7f50ded8de7464c40f.tar.gz
manaserv-202b03b2ad1160e119b74f7f50ded8de7464c40f.tar.bz2
manaserv-202b03b2ad1160e119b74f7f50ded8de7464c40f.tar.xz
manaserv-202b03b2ad1160e119b74f7f50ded8de7464c40f.zip
Fixed bugs, added new accessors and mutators to Object and Being, sync'd the rest of the code to take into account the changes.
Diffstat (limited to 'src/object.h')
-rw-r--r--src/object.h175
1 files changed, 99 insertions, 76 deletions
diff --git a/src/object.h b/src/object.h
index bba3af3e..a696ea51 100644
--- a/src/object.h
+++ b/src/object.h
@@ -4,33 +4,40 @@
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
+ * The Mana World is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * The Mana World is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
*
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with The Mana World; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
-#ifndef OBJECT_H
-#define OBJECT_H
+#ifndef _TMWSERV_OBJECT_H_
+#define _TMWSERV_OBJECT_H_
-#include <iostream>
-#include <vector>
-#include "script.h"
-//Usable Statistics Definition (not unsigned to allow for negative; used for
-//summative statistics)
+namespace tmwserv
+{
+
+
+/**
+ * Structure type for the statistics.
+ *
+ * Notes:
+ * - the structure can be used to define stats modifiers (i.e. how an
+ * object would modify the stats of a being when it is equipped) or
+ * computed stats of a being.
+ * - the attributes are not unsigned to allow negative values.
+ */
struct Statistics
{
int health;
@@ -41,84 +48,100 @@ struct Statistics
int speed;
};
-/*
- * Generic In-Game Object Definition
- * Base class for in-game objects
+
+/**
+ * Generic in-game object definition.
+ * Base class for in-game objects.
*/
class Object
{
- int x;
- int y;
- public:
- virtual ~Object() { }
- virtual void update() = 0;
-};
+ public:
+ /**
+ * Default constructor.
+ */
+ Object(void);
-/*
- * Generic Being (Living Object)
- * Used for Player & Monster (all animate objects)
- */
-class Being : public Object
-{
- //Being name
- std::string name;
- //Being gender
- unsigned int gender;
+ /**
+ * Destructor.
+ */
+ virtual
+ ~Object(void)
+ throw();
+
+
+ /**
+ * Set the x coordinate.
+ *
+ * @param x the new x coordinate.
+ */
+ void
+ setX(unsigned int x);
+
+
+ /**
+ * Get the x coordinate.
+ *
+ * @return the x coordinate.
+ */
+ unsigned int
+ getX(void) const;
+
- //Being level
- unsigned int level;
+ /**
+ * Set the y coordinate.
+ *
+ * @param y the new y coordinate.
+ */
+ void
+ setY(unsigned int y);
- //Being money
- unsigned int money;
- //Being statistics
- unsigned int strength;
- unsigned int agility;
- unsigned int vitality;
- unsigned int intelligence;
- unsigned int dexterity;
- unsigned int luck;
+ /**
+ * Get the y coordinate.
+ *
+ * @return the y coordinate.
+ */
+ unsigned int
+ getY(void) const;
- //Derived statistics (derived from above)
- Statistics stats;
- //Being inventory/equiped items
- //Inventory inventory;
- //Equipment equipment;
+ /**
+ * Set the statistics.
+ *
+ * @param stats the statistics.
+ */
+ void
+ setStatistics(const Statistics& stats);
-#ifdef SCRIPT_SUPPORT
- Script *script;
-#endif
- // disable default constructor (we don't want uninitialized Being's)
+ /**
+ * Get the statistics.
+ *
+ * @return the statistics.
+ */
+ Statistics&
+ getStatistics(void);
- public:
- Being() { };
- Being(const std::string &bName, unsigned int bGender,
- unsigned int bLevel, unsigned int bMoney,
- unsigned int bStrength, unsigned int bAgility,
- unsigned int bVitality, unsigned int bDexterity,
- unsigned int bLuck);
+ /**
+ * Update the internal status.
+ */
+ virtual void
+ update(void) = 0;
- virtual ~Being() { } //empty definition
- //update
- void update();
+ protected:
+ Statistics mStats; /**< stats modifiers or computed stats */
- //accessors
- const std::string& getName() { return name; }
- unsigned int getGender() { return gender; }
- unsigned int getLevel() { return level; }
- unsigned int getMoney() { return money; }
- //Get statistics information
- const Statistics& getStatistics() { return stats; }
+ private:
+ unsigned int mX; /**< x coordinate */
+ unsigned int mY; /**< y coordinate */
};
-typedef std::vector<Being*> Beings;
+} // namespace tmwserv
-#endif
+#endif // _TMWSERV_OBJECT_H_