[ogs-changes] dist/c++/ogs/feats Alertness.cpp,1.5,1.6 Alertness.h,1.4,1.5 ShieldProficiency.h,1.3,1
Status: Alpha
Brought to you by:
elemings
From: <ele...@us...> - 2003-04-18 01:41:36
|
Update of /cvsroot/ogs/dist/c++/ogs/feats In directory sc8-pr-cvs1:/tmp/cvs-serv25962/c++/ogs/feats Modified Files: Alertness.cpp Alertness.h ShieldProficiency.h Log Message: See C++ ChangeLog (Apr 17) for details. Index: Alertness.cpp =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Alertness.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Alertness.cpp 15 Apr 2003 16:58:41 -0000 1.5 --- Alertness.cpp 18 Apr 2003 01:41:03 -0000 1.6 *************** *** 26,30 **** --- 26,35 ---- #include "ogs/skills/CommonSkills.h" + using ogs::core::Creature; + using ogs::core::Modifiers; + using ogs::core::SkillPtr; + using ogs::core::Skills; using ogs::feats::Alertness; + using ogs::skills::CommonSkills; /** *************** *** 62,66 **** if (attached) { ! addSkillModifier (object); } --- 67,71 ---- if (attached) { ! changeSkills (dynamic_cast<Creature*> (&object)); } *************** *** 69,89 **** /** ! * Add modifier of this feat to Listen and Spot skills. * ! * @param object Object to add skill modifier to. */ ! void Alertness::addSkillModifier (Object& object) { ! using ogs::core::Creature; ! Creature* creature = dynamic_cast<Creature*> (&object); ! if (creature != NULL) { - using ogs::core::Skills; Skills skills = creature->getSkills (); Skills::iterator itor = skills.begin (); while (itor != skills.end ()) { - using ogs::core::SkillPtr; - using ogs::core::Modifiers; - using ogs::skills::CommonSkills; SkillPtr skillPtr = *itor++; --- 74,88 ---- /** ! * Add or remove bonus to Listen and Spot skill checks. * ! * @param creature Creature to change skills of. ! * @param add True if bonus is added, false if removed. */ ! void Alertness::changeSkills (Creature* creature, bool add) { if (creature != NULL) { Skills skills = creature->getSkills (); Skills::iterator itor = skills.begin (); while (itor != skills.end ()) { SkillPtr skillPtr = *itor++; *************** *** 91,95 **** skillPtr->getType () == CommonSkills::SPOT) { Modifiers& modifiers = skillPtr->getModifiers (); ! modifiers.addModifier (this->_modifier); } } --- 90,98 ---- skillPtr->getType () == CommonSkills::SPOT) { Modifiers& modifiers = skillPtr->getModifiers (); ! if (add) { ! modifiers.addModifier (this->_modifier); ! } else { ! modifiers.removeModifier (this->_modifier); ! } } } *************** *** 97,100 **** } ! // TODO: Define detachObject and removeSkillModifier functions. --- 100,118 ---- } ! /** ! * Detach this feat from an object. This function removes the bonus ! * added to Listen and Spot skill checks by the attachObject() function. ! * ! * @return True if this feat is detached from object. ! */ ! bool Alertness::detachObject () { ! Creature* creature = getCreature (); ! bool detached = canDetach (); ! ! if (detached) { ! changeSkills (creature, false); ! } ! ! return (detached); ! } Index: Alertness.h =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/feats/Alertness.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Alertness.h 15 Apr 2003 16:58:41 -0000 1.4 --- Alertness.h 18 Apr 2003 01:41:03 -0000 1.5 *************** *** 32,37 **** --- 32,41 ---- OGS_BEGIN_FEATS_NAMESPACE + class ogs::core::Creature; + /** * A feat that adds a +2 bonus to all Listen and Spot skill checks. + * + * @todo Make the data member static? */ class Alertness: public ogs::core::Feat { *************** *** 40,44 **** bool attachObject (Object& object); ! bool dettachObject (); private: --- 44,48 ---- bool attachObject (Object& object); ! bool detachObject (); private: *************** *** 46,50 **** bool canAttach (const Object& object) const; ! void addSkillModifier (Object& object); }; --- 50,54 ---- bool canAttach (const Object& object) const; ! void changeSkills (ogs::core::Creature* creature, bool add = true); }; Index: ShieldProficiency.h =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/feats/ShieldProficiency.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ShieldProficiency.h 15 Apr 2003 16:58:45 -0000 1.3 --- ShieldProficiency.h 18 Apr 2003 01:41:03 -0000 1.4 *************** *** 48,52 **** * Create a new Shield Proficiency feat. */ ! inline ShieldProficiency::ShieldProficiency (), Feat (EXCLUSIVE) { // empty constructor body --- 48,52 ---- * Create a new Shield Proficiency feat. */ ! inline ShieldProficiency::ShieldProficiency (): Feat (EXCLUSIVE) { // empty constructor body |