[ogs-changes] dist/c++/ogs/skills CommonSkills.cpp,1.1,1.2 CommonSkills.h,1.1,1.2 SkillFactory.h,1.1
Status: Alpha
Brought to you by:
elemings
From: <ele...@us...> - 2003-04-15 16:59:23
|
Update of /cvsroot/ogs/dist/c++/ogs/skills In directory sc8-pr-cvs1:/tmp/cvs-serv20206/c++/ogs/skills Modified Files: CommonSkills.cpp CommonSkills.h SkillFactory.h Spot.cpp Spot.h Log Message: See C++ ChangeLog (Apr 15) for details. Index: CommonSkills.cpp =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/skills/CommonSkills.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CommonSkills.cpp 13 Apr 2003 05:26:28 -0000 1.1 --- CommonSkills.cpp 15 Apr 2003 16:58:48 -0000 1.2 *************** *** 35,46 **** /** * Create a new common skill of a specified type. If the skill type is ! * unknown, this function will return an empty pointer. * * @param skillType Type of skill to create. ! * @return A skill pointer or an empty pointer. */ ! SkillFactory::SkillPtr ! CommonSkills::createSkill (Skill::Type skillType) { ! SkillFactory::SkillPtr skillPtr; const bool trainedOnly = false; const bool useUntrained = true; --- 35,47 ---- /** * Create a new common skill of a specified type. If the skill type is ! * unknown, this function will return a NULL pointer. * * @param skillType Type of skill to create. ! * @param cclassPoints Points spent for cclass skill. ! * @return A skill pointer or a NULL pointer if skill type is invalid. */ ! Skill* ! CommonSkills::createSkill (Skill::Type skillType, ! Skill::Points cclassPoints) const { const bool trainedOnly = false; const bool useUntrained = true; *************** *** 50,156 **** switch (skillType) { case APPRAISE: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty)); ! break; case BLUFF: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty)); ! break; case CLIMB: ! skillPtr.reset (new Skill (skillType, Ability::STR, ! useUntrained, useArmorPenalty)); ! break; case CRAFT: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty)); ! break; case DIPLOMACY: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty)); ! break; case DISABLE_DEVICE: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty)); ! break; case DISGUISE: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty)); ! break; case ESCAPE_ARTIST: ! skillPtr.reset (new Skill (skillType, Ability::DEX, ! useUntrained, useArmorPenalty)); ! break; case FORGERY: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty)); ! break; case GATHER_INFORMATION: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty)); ! break; case HANDLE_ANIMAL: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! trainedOnly, noArmorPenalty)); ! break; case HIDE: ! skillPtr.reset (new Skill (skillType, Ability::WIS, ! useUntrained, useArmorPenalty)); ! break; case INTIMIDATE: ! skillPtr.reset (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty)); ! break; case JUMP: ! skillPtr.reset (new Skill (skillType, Ability::STR, ! useUntrained, useArmorPenalty)); ! break; case KNOWLEDGE: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty)); ! break; case LISTEN: ! skillPtr.reset (new Skill (skillType, Ability::WIS, ! useUntrained, noArmorPenalty)); ! break; case MOVE_SILENTLY: ! skillPtr.reset (new Skill (skillType, Ability::DEX, ! useUntrained, useArmorPenalty)); ! break; case PROFESSION: ! skillPtr.reset (new Skill (skillType, Ability::WIS, ! trainedOnly, noArmorPenalty)); ! break; case RIDE: ! skillPtr.reset (new Skill (skillType, Ability::DEX, ! useUntrained, noArmorPenalty)); ! break; case SEARCH: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty)); ! break; case SENSE_MOTIVE: ! skillPtr.reset (new Skill (skillType, Ability::WIS, ! useUntrained, noArmorPenalty)); ! break; case SPEAK_LANGUAGE: ! skillPtr.reset (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty)); ! break; case SPOT: ! skillPtr.reset (new Spot ()); ! break; case SWIM: ! skillPtr.reset (new Skill (skillType, Ability::STR, ! useUntrained, noArmorPenalty)); ! break; case TUMBLE: ! skillPtr.reset (new Skill (skillType, Ability::DEX, ! trainedOnly, useArmorPenalty)); ! break; default: ! break; } - - return (skillPtr); } --- 51,131 ---- switch (skillType) { case APPRAISE: ! return (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty, cclassPoints)); case BLUFF: ! return (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty, cclassPoints)); case CLIMB: ! return (new Skill (skillType, Ability::STR, ! useUntrained, useArmorPenalty, cclassPoints)); case CRAFT: ! return (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty, cclassPoints)); case DIPLOMACY: ! return (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty, cclassPoints)); case DISABLE_DEVICE: ! return (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty, cclassPoints)); case DISGUISE: ! return (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty, cclassPoints)); case ESCAPE_ARTIST: ! return (new Skill (skillType, Ability::DEX, ! useUntrained, useArmorPenalty, cclassPoints)); case FORGERY: ! return (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty, cclassPoints)); case GATHER_INFORMATION: ! return (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty, cclassPoints)); case HANDLE_ANIMAL: ! return (new Skill (skillType, Ability::CHA, ! trainedOnly, noArmorPenalty, cclassPoints)); case HIDE: ! return (new Skill (skillType, Ability::DEX, ! useUntrained, useArmorPenalty, cclassPoints)); case INTIMIDATE: ! return (new Skill (skillType, Ability::CHA, ! useUntrained, noArmorPenalty, cclassPoints)); case JUMP: ! return (new Skill (skillType, Ability::STR, ! useUntrained, useArmorPenalty, cclassPoints)); case KNOWLEDGE: ! return (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty, cclassPoints)); case LISTEN: ! return (new Skill (skillType, Ability::WIS, ! useUntrained, noArmorPenalty, cclassPoints)); case MOVE_SILENTLY: ! return (new Skill (skillType, Ability::DEX, ! useUntrained, useArmorPenalty, cclassPoints)); case PROFESSION: ! return (new Skill (skillType, Ability::WIS, ! trainedOnly, noArmorPenalty, cclassPoints)); case RIDE: ! return (new Skill (skillType, Ability::DEX, ! useUntrained, noArmorPenalty, cclassPoints)); case SEARCH: ! return (new Skill (skillType, Ability::INT, ! useUntrained, noArmorPenalty, cclassPoints)); case SENSE_MOTIVE: ! return (new Skill (skillType, Ability::WIS, ! useUntrained, noArmorPenalty, cclassPoints)); case SPEAK_LANGUAGE: ! return (new Skill (skillType, Ability::INT, ! trainedOnly, noArmorPenalty, cclassPoints)); case SPOT: ! return (new Spot (cclassPoints)); case SWIM: ! return (new Skill (skillType, Ability::STR, ! useUntrained, noArmorPenalty, cclassPoints)); case TUMBLE: ! return (new Skill (skillType, Ability::DEX, ! trainedOnly, useArmorPenalty, cclassPoints)); ! default: ! return (NULL); } } Index: CommonSkills.h =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/skills/CommonSkills.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CommonSkills.h 13 Apr 2003 05:26:28 -0000 1.1 --- CommonSkills.h 15 Apr 2003 16:58:48 -0000 1.2 *************** *** 111,115 **** static const ogs::core::Skill::Type TUMBLE = 42; ! SkillPtr createSkill (ogs::core::Skill::Type skillType); }; --- 111,117 ---- static const ogs::core::Skill::Type TUMBLE = 42; ! ogs::core::Skill* ! createSkill (ogs::core::Skill::Type skillType, ! ogs::core::Skill::Points cclassPoints = 0) const; }; Index: SkillFactory.h =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/skills/SkillFactory.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SkillFactory.h 13 Apr 2003 05:26:29 -0000 1.1 --- SkillFactory.h 15 Apr 2003 16:58:49 -0000 1.2 *************** *** 26,31 **** # define OGS_SKILLS_SKILL_FACTORY_H - # include <boost/shared_ptr.hpp> - # include <ogs/core/Skill.h> # include <ogs/skills/Namespace.h> --- 26,29 ---- *************** *** 37,50 **** */ struct SkillFactory { - /** A smart pointer for a skill object. */ - typedef boost::shared_ptr<ogs::core::Skill> SkillPtr; - /** * Create a new skill of a specified type. * ! * @param skillType Type of skill to create. * @return A new skill of the specified type. */ ! virtual SkillPtr createSkill (ogs::core::Skill::Type skillType) = 0; }; --- 35,48 ---- */ struct SkillFactory { /** * Create a new skill of a specified type. * ! * @param skillType Type of skill. ! * @param cclassPoints Points spent on cclass skill. * @return A new skill of the specified type. */ ! virtual ogs::core::Skill* ! createSkill (ogs::core::Skill::Type skillType, ! ogs::core::Skill::Points cclassPoints = 0) const = 0; }; Index: Spot.cpp =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/skills/Spot.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Spot.cpp 13 Apr 2003 05:26:29 -0000 1.3 --- Spot.cpp 15 Apr 2003 16:58:49 -0000 1.4 *************** *** 42,50 **** * default. * * @param distance Distance of the target from the spotter. * @param distracted True if the spotter is distracted. */ ! Spot::Spot (float distance, bool distracted): ! Skill (CommonSkills::SPOT, Ability::WIS, true, false), _distance (distance), _distanceModifier (), --- 42,51 ---- * default. * + * @param cclassPoints Points spent for cclass skill. * @param distance Distance of the target from the spotter. * @param distracted True if the spotter is distracted. */ ! Spot::Spot (Points cclassPoints, float distance, bool distracted): ! Skill (CommonSkills::SPOT, Ability::WIS, true, false, cclassPoints), _distance (distance), _distanceModifier (), Index: Spot.h =================================================================== RCS file: /cvsroot/ogs/dist/c++/ogs/skills/Spot.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Spot.h 13 Apr 2003 05:26:29 -0000 1.4 --- Spot.h 15 Apr 2003 16:58:49 -0000 1.5 *************** *** 38,42 **** class Spot: public ogs::core::Skill { public: ! Spot (float distance = 0.0, bool distracted = false); float getDistance () const; --- 38,43 ---- class Spot: public ogs::core::Skill { public: ! Spot (Points cclassPoints = 0, float distance = 0.0, ! bool distracted = false); float getDistance () const; |