[ogs-changes] dist/c++/ogs/core Abilities.cpp,1.5,1.6 Ability.cpp,1.7,1.8 Ability.h,1.6,1.7 BodyPart
Status: Alpha
Brought to you by:
elemings
|
From: <ele...@us...> - 2003-04-18 01:41:36
|
Update of /cvsroot/ogs/dist/c++/ogs/core
In directory sc8-pr-cvs1:/tmp/cvs-serv25962/c++/ogs/core
Modified Files:
Abilities.cpp Ability.cpp Ability.h BodyPart.cpp BodyPart.h
Character.cpp Creature.cpp Creature.h Entity.h Experience.h
Feat.cpp Item.cpp Saves.h Skill.cpp Skill.h Types.h
Log Message:
See C++ ChangeLog (Apr 17) for details.
Index: Abilities.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Abilities.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Abilities.cpp 8 Apr 2003 21:43:06 -0000 1.5
--- Abilities.cpp 18 Apr 2003 01:41:01 -0000 1.6
***************
*** 64,72 ****
/**
! * Cteate a set of abilities using a direct method.
*
! * @param directMethod A direct method.
*/
! Abilities::Abilities (PartialMethod& directMethod) {
PtrMap& map = *this;
--- 64,72 ----
/**
! * Create a set of abilities using a direct method.
*
! * @param partialMethod A partial method.
*/
! Abilities::Abilities (PartialMethod& partialMethod) {
PtrMap& map = *this;
***************
*** 74,81 ****
Ability::Type type = types [i];
! if (directMethod.hasAbility (type)) {
Ability* ability = type == Ability::STR?
! new Strength (directMethod):
! new Ability (type, directMethod);
map [type] = AbilityPtr (ability);
}
--- 74,81 ----
Ability::Type type = types [i];
! if (partialMethod.hasAbility (type)) {
Ability* ability = type == Ability::STR?
! new Strength (partialMethod):
! new Ability (type, partialMethod);
map [type] = AbilityPtr (ability);
}
Index: Ability.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Ability.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Ability.cpp 13 Apr 2003 05:25:51 -0000 1.7
--- Ability.cpp 18 Apr 2003 01:41:01 -0000 1.8
***************
*** 92,97 ****
* function.
*
! * @param increaseCount Number of ability increases available.
! * @return Required experience level of character.
*/
XP::Level Ability::getIncreaseCountLevel (unsigned increaseCount) {
--- 92,97 ----
* function.
*
! * @param increaseCount Number of ability increases needed.
! * @return Experience level required for increase count.
*/
XP::Level Ability::getIncreaseCountLevel (unsigned increaseCount) {
Index: Ability.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Ability.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Ability.h 13 Apr 2003 05:25:51 -0000 1.6
--- Ability.h 18 Apr 2003 01:41:02 -0000 1.7
***************
*** 115,119 ****
static bool isValidType (int i);
static unsigned getIncreaseCount (XP::Level xpLevel);
! static XP::Level getIncreaseCountLevel (unsigned count);
Ability (Type type);
--- 115,119 ----
static bool isValidType (int i);
static unsigned getIncreaseCount (XP::Level xpLevel);
! static XP::Level getIncreaseCountLevel (unsigned increaseCount);
Ability (Type type);
***************
*** 124,127 ****
--- 124,128 ----
Modifiers& getModifiers ();
Score getCurrentScore () const;
+ const Modifier& getModifier () const;
Modifier& getModifier ();
***************
*** 220,223 ****
--- 221,225 ----
*/
struct Ability::DirectMethod: public Ability::Method {
+ /** The score generated by a direct method. */
Ability::Score score;
***************
*** 280,283 ****
--- 282,295 ----
/**
+ * Determine the type of this ability.
+ *
+ * @return Type of this ability (STR, DEX, ...).
+ */
+ inline Ability::Type
+ Ability::getType () const {
+ return (this->_type);
+ }
+
+ /**
* Determine the original (unmodified) ability score.
*
***************
*** 309,312 ****
--- 321,336 ----
Ability::getCurrentScore () const {
return (this->_originalScore + this->_modifiers.getValue ());
+ }
+
+ /**
+ * Determine the ability modifier for this ability. The ability
+ * modifier can be added to other modifier lists (such as saving throws
+ * and skill checks).
+ *
+ * @return Modifier for this ability.
+ */
+ inline const Modifier&
+ Ability::getModifier () const {
+ return (this->_modifier);
}
Index: BodyPart.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/BodyPart.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BodyPart.cpp 13 Apr 2003 05:25:51 -0000 1.2
--- BodyPart.cpp 18 Apr 2003 01:41:02 -0000 1.3
***************
*** 31,37 ****
* @param item Item to be equipped on this body part.
* @return True if item is equipped.
*/
bool BodyPart::equipItem (Item& item) {
! return (false); // TODO: Implement this function.
}
--- 31,50 ----
* @param item Item to be equipped on this body part.
* @return True if item is equipped.
+ * @todo Implement this function.
*/
bool BodyPart::equipItem (Item& item) {
! return (false);
! }
!
! /**
! * Remove an equipped or carried item from this body part.
! *
! * @param item An item to be unequipped from this body part.
! * @return True if item is unequipped from this body part.
! * @todo Implement this function.
! */
! inline bool
! BodyPart::unequipItem (Item& item) {
! return (false);
}
Index: BodyPart.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/BodyPart.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BodyPart.h 13 Apr 2003 05:25:51 -0000 1.2
--- BodyPart.h 18 Apr 2003 01:41:02 -0000 1.3
***************
*** 30,33 ****
--- 30,34 ----
# include <ogs/support/Object.h>
# include <ogs/core/Namespace.h>
+ # include <ogs/core/Types.h>
OGS_BEGIN_CORE_NAMESPACE
***************
*** 77,81 ****
};
! typedef std::list<Item*> Items;
BodyPart (Creature& creature, Type type);
--- 78,86 ----
};
! /**
! * A list of items. The list represents the items equipped or
! * carried on this part of the body.
! */
! typedef std::list<ItemPtr> Items;
BodyPart (Creature& creature, Type type);
Index: Character.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Character.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Character.cpp 13 Apr 2003 05:25:51 -0000 1.7
--- Character.cpp 18 Apr 2003 01:41:02 -0000 1.8
***************
*** 21,34 ****
*/
#include "ogs/core/CClass.h"
#include "ogs/core/Character.h"
! using ogs::core::Abilities;
! using ogs::core::Ability;
! using ogs::core::CClass;
! using ogs::core::Character;
! using ogs::core::Creature;
! using ogs::core::Modifiers;
! using ogs::core::Skill;
/**
--- 21,30 ----
*/
+ #include "ogs/support/Event.h"
#include "ogs/core/CClass.h"
#include "ogs/core/Character.h"
! using ogs::support::Event;
! using namespace ogs::core;
/**
***************
*** 48,51 ****
--- 44,59 ----
// TODO: Add bonuses and other features from cclass to creature.
+ }
+
+ /**
+ * Change the experience points acquired by this character.
+ *
+ * @param xpPoints Experience points of this character.
+ * @todo Complete the implementation of this function.
+ */
+ void Character::setPoints (XP::Points xpPoints) {
+ Event event (*this);
+ this->_xpPoints = xpPoints;
+ notifyObservers (event);
}
Index: Creature.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Creature.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Creature.cpp 15 Apr 2003 16:58:34 -0000 1.11
--- Creature.cpp 18 Apr 2003 01:41:02 -0000 1.12
***************
*** 123,127 ****
}
! // TODO: Implement removeSkill() function.
/**
--- 123,144 ----
}
! /**
! * Remove a skill from this creature.
! *
! * @param skill A skill to be removed from this creature.
! * @return True if skill is removed from this creature.
! */
! bool Creature::removeSkill (Skill& skill) {
! SkillPtr skillPtr (&skill);
! Skills::iterator end = this->_skills.end ();
! Skills::iterator itor = std::find (this->_skills.begin (), end,
! skillPtr);
!
! if (itor != end) {
! this->_skills.erase (itor);
! }
!
! return (true);
! }
/**
***************
*** 169,175 ****
* @param item Item to be equipped on this body.
* @return True if item is equipped.
*/
bool Creature::equipItem (Item& item) {
! return (false); // TODO: Implement this function.
}
--- 186,193 ----
* @param item Item to be equipped on this body.
* @return True if item is equipped.
+ * @todo Implement this function.
*/
bool Creature::equipItem (Item& item) {
! return (false);
}
***************
*** 182,188 ****
* @param part BodyPart of the body to equip item.
* @return True if item is equipped.
*/
bool Creature::equipItem (Item& item, BodyPart& part) {
! return (false); // TODO: Implement this function.
}
--- 200,207 ----
* @param part BodyPart of the body to equip item.
* @return True if item is equipped.
+ * @todo Implement this function.
*/
bool Creature::equipItem (Item& item, BodyPart& part) {
! return (false);
}
***************
*** 194,200 ****
* @param item Item to be removed from this body.
* @return True if item is no longer equipped.
*/
bool Creature::unequipItem (Item& item) {
! return (true); // TODO: Impelement this function.
}
--- 213,220 ----
* @param item Item to be removed from this body.
* @return True if item is no longer equipped.
+ * @todo Implement this function.
*/
bool Creature::unequipItem (Item& item) {
! return (true);
}
Index: Creature.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Creature.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Creature.h 15 Apr 2003 16:58:34 -0000 1.10
--- Creature.h 18 Apr 2003 01:41:02 -0000 1.11
***************
*** 29,34 ****
# include <vector>
- # include <boost/shared_ptr.hpp>
-
# include <ogs/core/Abilities.h>
# include <ogs/core/BodyPart.h>
--- 29,32 ----
***************
*** 61,66 ****
typedef std::list<BodyPart> Body;
! Die getHitDice () const;
! void setHitDice (const Die& hitDice);
const Modifiers& getInitiative () const;
--- 59,64 ----
typedef std::list<BodyPart> Body;
! const Die& getHitDice () const;
! Die& getHitDice ();
const Modifiers& getInitiative () const;
***************
*** 127,131 ****
* @return Hit dice for this creature.
*/
! inline Die
Creature::getHitDice () const {
return (this->_hitDice);
--- 125,129 ----
* @return Hit dice for this creature.
*/
! inline const Die&
Creature::getHitDice () const {
return (this->_hitDice);
***************
*** 133,136 ****
--- 131,145 ----
/**
+ * Determine the hit dice for this creature. This function allows the
+ * caller to change the hit dice of this creature.
+ *
+ * @return Hit dice for this creature.
+ */
+ inline Die&
+ Creature::getHitDice () {
+ return (this->_hitDice);
+ }
+
+ /**
* Determine the initiative modifiers for this creature.
*
***************
*** 171,174 ****
--- 180,195 ----
* @return Ability scores.
*/
+ inline const Abilities&
+ Creature::getAbilities () const {
+ return (this->_abilities);
+ }
+
+ /**
+ * Determine the abilities for this character. This function allows the
+ * caller to add and remove modifiers to the ability scores of this
+ * creature.
+ *
+ * @return Ability scores.
+ */
inline Abilities&
Creature::getAbilities () {
***************
*** 178,181 ****
--- 199,214 ----
/**
* Determine the saving throws for this creature.
+ *
+ * @return Saving throws for this creature.
+ */
+ inline const Saves&
+ Creature::getSaves () const {
+ return (this->_saves);
+ }
+
+ /**
+ * Determine the saving throws for this creature. This function allows
+ * the caller to add and remove modifiers to saving throws for this
+ * creature.
*
* @return Saving throws for this creature.
Index: Entity.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Entity.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Entity.h 15 Apr 2003 16:58:35 -0000 1.7
--- Entity.h 18 Apr 2003 01:41:02 -0000 1.8
***************
*** 123,126 ****
--- 123,136 ----
/**
+ * Determine the current defense rating of this entity.
+ *
+ * @return Current defense rating of this entity.
+ */
+ inline const Defense&
+ Entity::getDefense () const {
+ return (this->_defense);
+ }
+
+ /**
* Determine the current defense rating of this entity. This function
* allows the caller to add and remove modifiers to the defense rating
Index: Experience.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Experience.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Experience.h 13 Apr 2003 05:25:51 -0000 1.4
--- Experience.h 18 Apr 2003 01:41:02 -0000 1.5
***************
*** 46,50 ****
--- 46,52 ----
class Experience {
public:
+ /** An unsigned integer type that represents experience points. */
typedef unsigned int Points;
+ /** An unsigned integer type that represents experience level. */
typedef unsigned short Level;
***************
*** 53,61 ****
static Modifier::Value getStrongAttack (Level level);
- static Level getStrongAttackLevel (Modifier::Value value);
static Modifier::Value getAverageAttack (Level level);
- static Level getAverageAttackLevel (Modifier::Value value);
static Modifier::Value getWeakAttack (Level level);
- static Level getWeakAttackLevel (Modifier::Value value);
static std::string formatLevel (Level level);
--- 55,60 ----
Index: Feat.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Feat.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Feat.cpp 13 Apr 2003 05:25:51 -0000 1.6
--- Feat.cpp 18 Apr 2003 01:41:02 -0000 1.7
***************
*** 29,34 ****
/**
* Determine experience level required for a given number of available
! * slots for feats. This method is the inverse of
! * {@link #getSlotCount(int)}.
*
* @param slotCount Number of slots available for feats.
--- 29,34 ----
/**
* Determine experience level required for a given number of available
! * slots for feats. This method is the inverse of the getSlotCount()
! * function.
*
* @param slotCount Number of slots available for feats.
Index: Item.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Item.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Item.cpp 13 Apr 2003 05:25:51 -0000 1.3
--- Item.cpp 18 Apr 2003 01:41:02 -0000 1.4
***************
*** 21,27 ****
--- 21,29 ----
*/
+ #include "ogs/support/Event.h"
#include "ogs/core/Entity.h"
#include "ogs/core/Item.h"
+ using ogs::support::Event;
using ogs::core::Entity;
using ogs::core::Item;
***************
*** 54,57 ****
--- 56,70 ----
return (equipped);
+ }
+
+ /**
+ * Change the worth of this item. Observers are notified of this change.
+ *
+ * @param worth Worth of this item.
+ */
+ void Item::setWorth (Worth worth) {
+ Event event (*this);
+ this->_worth = worth;
+ notifyObservers (event);
}
Index: Saves.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Saves.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Saves.h 15 Apr 2003 16:58:36 -0000 1.5
--- Saves.h 18 Apr 2003 01:41:02 -0000 1.6
***************
*** 46,51 ****
--- 46,54 ----
static Modifier::Value getWeakBonus (XP::Level xpLevel);
+ /** Modifiers added to a Fortitude saving throw. */
Modifiers fort;
+ /** Modifiers added to a Reflex saving throw. */
Modifiers ref;
+ /** Modifiers added to a Will saving throw. */
Modifiers will;
Index: Skill.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Skill.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Skill.cpp 15 Apr 2003 16:58:37 -0000 1.6
--- Skill.cpp 18 Apr 2003 01:41:02 -0000 1.7
***************
*** 74,87 ****
* the current points invested in this skill.
*
! * @param skillPoints Maximum points invested in this skill.
*/
! void Skill::setMaximumPoints (Points skillPoints) {
// Maybe this function should automatically lower the ccclassPoints
// and/or xclassPoints or change the maximum points to be the total
// of current points but this will do for now.
! if (this->_cclassPoints + this->_xclassPoints <= skillPoints) {
! this->_maxPoints = skillPoints;
!
! // TODO: Notify observers
}
}
--- 74,86 ----
* the current points invested in this skill.
*
! * @param points Maximum skill points invested in this skill.
! * @todo Notify observers.
*/
! void Skill::setMaximumPoints (Points points) {
// Maybe this function should automatically lower the ccclassPoints
// and/or xclassPoints or change the maximum points to be the total
// of current points but this will do for now.
! if (this->_cclassPoints + this->_xclassPoints <= points) {
! this->_maxPoints = points;
}
}
***************
*** 93,112 ****
* for this skill.
*
! * @param skillPoints Current skill points.
* @param cclassSkill True if points are for a cclass skill or
* false if points are for a cross-class skill.
*/
! void Skill::setCurrentPoints (Points skillPoints, bool cclassSkill) {
! if (! checkMaximumRanks (skillPoints, cclassSkill)) {
if (cclassSkill) {
! this->_cclassPoints = skillPoints;
} else {
! this->_xclassPoints = skillPoints;
}
this->_rankModifier.setValue (getCurrentRanks ());
-
- // TODO: Notify observers
}
}
--- 92,110 ----
* for this skill.
*
! * @param points Current number of skill points.
* @param cclassSkill True if points are for a cclass skill or
* false if points are for a cross-class skill.
+ * @todo Notify observers.
*/
! void Skill::setCurrentPoints (Points points, bool cclassSkill) {
! if (! checkMaximumRanks (points, cclassSkill)) {
if (cclassSkill) {
! this->_cclassPoints = points;
} else {
! this->_xclassPoints = points;
}
this->_rankModifier.setValue (getCurrentRanks ());
}
}
Index: Skill.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Skill.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Skill.h 15 Apr 2003 16:58:37 -0000 1.7
--- Skill.h 18 Apr 2003 01:41:02 -0000 1.8
***************
*** 96,100 ****
protected:
! static Ranks getRanks (Points cclass, Points xclass);
bool checkMaximumRanks (Points points, bool cclassSkill);
--- 96,100 ----
protected:
! static Ranks getRanks (Points cclassPoints, Points xclassPoints);
bool checkMaximumRanks (Points points, bool cclassSkill);
Index: Types.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/core/Types.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Types.h 13 Apr 2003 05:25:51 -0000 1.1
--- Types.h 18 Apr 2003 01:41:02 -0000 1.2
***************
*** 37,40 ****
--- 37,41 ----
class Feature;
class Feat;
+ class Item;
class Skill;
***************
*** 56,59 ****
--- 57,63 ----
/** A list of skill. */
typedef std::list<SkillPtr> Skills;
+
+ /** A smart pointer that holds an item object. */
+ typedef boost::shared_ptr<Item> ItemPtr;
OGS_END_CORE_NAMESPACE
|