diff options
author | Huynh Tran <nthuynh75@gmail.com> | 2005-06-29 08:43:55 +0000 |
---|---|---|
committer | Huynh Tran <nthuynh75@gmail.com> | 2005-06-29 08:43:55 +0000 |
commit | 202b03b2ad1160e119b74f7f50ded8de7464c40f (patch) | |
tree | add2ea0bc0a61ba121fd9dbc83a5d224ba672cd5 /src/object.cpp | |
parent | f83980082a8ee69b1356f58159867e1313ebf868 (diff) | |
download | manaserv-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.cpp')
-rw-r--r-- | src/object.cpp | 131 |
1 files changed, 93 insertions, 38 deletions
diff --git a/src/object.cpp b/src/object.cpp index f67bae05..e8dd18ca 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -4,59 +4,114 @@ * * 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$ */ + #include "object.h" -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): - name(bName), - gender(bGender), - level(bLevel), - money(bMoney), - strength(bStrength), - agility(bAgility), - vitality(bVitality), - dexterity(bDexterity), - luck(bLuck) + +namespace tmwserv +{ + + +/** + * Default constructor. + */ +Object::Object(void) + : mX(0), + mY(0) +{ + mStats.health = 0; + mStats.attack = 0; + mStats.defense = 0; + mStats.magic = 0; + mStats.accuracy = 0; + mStats.speed = 0; +} + + +/** + * Destructor. + */ +Object::~Object(void) + throw() { - //std::cout << "New being create with name \"" + name + "\"" << std::endl; + // NOOP } -void Being::update() + +/** + * Set the x coordinate. + */ +void +Object::setX(unsigned int x) { - //Generate statistics - stats.health = 20 + (20 * vitality); - stats.attack = 10 + strength; - stats.defense = 10 + strength; - stats.magic = 10 + intelligence; - stats.accuracy = 50 + dexterity; - stats.speed = dexterity; + mX = x; +} - //Update scipt -#ifdef SCRIPT_SUPPORT - script->update(); -#endif + +/** + * Get the x coordinate. + */ +unsigned int +Object::getX(void) const +{ + return mX; } +/** + * Set the y coordinate. + */ +void +Object::setY(unsigned int y) +{ + mY = y; +} + + +/** + * Get the y coordinate. + */ +unsigned int +Object::getY(void) const +{ + return mY; +} + + +/** + * Set the statistics. + */ +void +Object::setStatistics(const Statistics& stats) +{ + mStats = stats; +} + + +/** + * Get the statistics. + */ +Statistics& +Object::getStatistics(void) +{ + return mStats; +} +} // namespace tmwserv |