diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-10-06 00:50:02 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-10-06 00:50:02 +0000 |
| commit | 2c0a3866e09140d8d5ff84178decddc22db15778 (patch) | |
| tree | 8d780290c2b1738cb17cec832dd866b068b9a31f /sigmod | |
| parent | 61276d172306a14c110a7c3631b484ccf93f9ffa (diff) | |
[FIX] Added single player option to Sigmod
[FIX] Doxygen generation cleaned up
[FIX] Can no longer override variables in the Sigmod if not a single player game
[FIX] When checking for modified move priority, blean up afterwards
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@271 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigmod')
| -rw-r--r-- | sigmod/Ability.cpp | 4 | ||||
| -rw-r--r-- | sigmod/Ability.h | 137 | ||||
| -rw-r--r-- | sigmod/Author.cpp | 4 | ||||
| -rw-r--r-- | sigmod/Author.h | 78 | ||||
| -rw-r--r-- | sigmod/Badge.cpp | 4 | ||||
| -rw-r--r-- | sigmod/Badge.h | 49 | ||||
| -rw-r--r-- | sigmod/CMakeLists.txt | 20 | ||||
| -rw-r--r-- | sigmod/Sigmod.cpp | 29 | ||||
| -rw-r--r-- | sigmod/Sigmod.h | 3 |
9 files changed, 318 insertions, 10 deletions
diff --git a/sigmod/Ability.cpp b/sigmod/Ability.cpp index 36976e3e..1296418f 100644 --- a/sigmod/Ability.cpp +++ b/sigmod/Ability.cpp @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Ability.cpp + */ + // Header include #include "Ability.h" diff --git a/sigmod/Ability.h b/sigmod/Ability.h index 058cd9f4..5890362a 100644 --- a/sigmod/Ability.h +++ b/sigmod/Ability.h @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Ability.h + */ + #ifndef SIGMOD_ABILITY #define SIGMOD_ABILITY @@ -27,33 +31,166 @@ namespace Sigmod // Forward declarations class Sigmod; +/** + * \class Sigmod::Ability Ability.h sigmod/Ability.h + * \brief Class describing an ability. + * + * Abilities work as helpers in battle. Some common uses are: + * + * - Nullifying status effects + * - Manipulating the weather + * - Providing support in times of need + */ class SIGMOD_EXPORT Ability : public Object { Q_OBJECT public: + /** + * Copy constructor. + * + * \param ability The ability to copy. + */ Ability(const Ability& ability); + /** + * Create a new ability belonging to \p parent and id \p id. + * + * \param parent The parent of the ability. + * \param id The id number for the ability. + */ Ability(const Sigmod* parent, const int id); + /** + * Data copy constructor. Copies the data from \p ability and parents the new ability with \p parent and id \p id. + * + * \param ability The ability to copy the data from. + * \param parent The parent of the ability. + * \param id The id number for the ability. + */ Ability(const Ability& ability, const Sigmod* parent, const int id); + /** + * XML data constructor. + * + * \param xml The XML structure to extract the data from. + * \param parent The parent of the ability. + * \param id The id number for the ability. + */ Ability(const QDomElement& xml, const Sigmod* parent, const int id = -1); + /** + * Check to make sure the ability is valid. + * \note This does not check the scripts for anything. + * \todo Check scripts for syntax errors (require Kross). + */ void validate(); + /** + * Load data from XML. + * + * \param xml The XML structure to extract data from. + */ void load(const QDomElement& xml); + /** + * Get the data for the ability in XML format. + * + * \return The XML structure representing the ability. + */ QDomElement save() const; + /** + * Set the name of the ability used in the game. + * + * \param name The name of the ability. + */ void setName(const QString& name); + /** + * Set the priority of the ability. The priority is used by the battle engine determine which abilities get executed first. + * Lower values go before higher values. Use the \link Ability::setPriorityScript priority script \endlink for how to modify + * it based on the environment in the arena. + * + * \param priority The priority of the ability. + */ void setPriority(const int priority); + /** + * Set the description of the ability. The description should be a snippet of text describing the ability to the player. + * + * \param description The description of the ability. + */ void setDescription(const QString& description); + /** + * Set the script for the ability when in battle. This script defines the behavior of the ability when in a battle. + * The following objects are available: + * + * - \b owner -- The \link Sigbattle::TeamMember team member \endlink which owns the instance of the ability. + * - \b client -- The \link Sigbattle::Client client \endlink which is choosing the actions of the ability. + * - \b sigmod -- Wrapper for the \link Sigscript::SigmodWrapper Sigmod \endlink in use. + * - \b arena -- The \link Sigbattle::Arena arena \endlink the ability is being used in. + * + * \param battleScript The script for the ability when in battle. + */ void setBattleScript(const Script& battleScript); + /** + * Set the script for the ability when on the world map. This script defines the behavior of the ability when on the world map. + * The following objects are available: + * + * - \b owner -- The \link Sigbattle::TeamMember team member \endlink which owns the instance of the ability. + * - \b client -- The \link Sigbattle::Client client \endlink which is choosing the actions of the ability. + * - \b sigmod -- Wrapper for the \link Sigscript::SigmodWrapper Sigmod \endlink in use. + * - \b map -- The \link Sigmap::Map map \endlink the player is on. + * + * \param worldScript The script for the ability when on the world map. + */ void setWorldScript(const Script& worldScript); + /** + * Set the script that determines the priority of the ability. This script allows the ability to change its priority based on what + * is happening in the \link Sigbattle::Arena arena \endlink. The following objects are available: + * + * - \b owner -- The \link Sigbattle::TeamMember team member \endlink which owns the instance of the ability. + * - \b sigmod -- Wrapper for the \link Sigscript::SigmodWrapper Sigmod \endlink in use. + * - \b arena -- The \link Sigbattle::Arena arena \endlink the ability is being used in. + * + * To override the priority given by the ability, set the \p ability-priority-%name (where "%name" is the name of the ability) + * value in the \p owner. Setting it in the \link Sigscript::SigmodWrapper Sigmod \endlink will cause all instances of the + * ability to have the new priority. + * + * \param priorityScript The script that determines the priority of the ability. + */ void setPriorityScript(const Script& priorityScript); + /** + * \sa setName + * + * \return The name of the ability. + */ QString name() const; + /** + * \sa setPriority + * + * \return The priority of the ability. + */ int priority() const; + /** + * \sa setDescription + * + * \return The description of the ability. + */ QString description() const; + /** + * \sa setBattleScript + * + * \return The script that controls the ability in battle. + */ Script battleScript() const; + /** + * \sa setWorldScript + * + * \return The script that controls the ability on the world map. + */ Script worldScript() const; + /** + * \sa setPriorityScript + * + * \return The script that changes the priority when necessary. + */ Script priorityScript() const; Ability& operator=(const Ability& rhs); diff --git a/sigmod/Author.cpp b/sigmod/Author.cpp index 2cca635f..a8ee02fd 100644 --- a/sigmod/Author.cpp +++ b/sigmod/Author.cpp @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Author.cpp + */ + // Header include #include "Author.h" diff --git a/sigmod/Author.h b/sigmod/Author.h index 413fece6..b0b322a0 100644 --- a/sigmod/Author.h +++ b/sigmod/Author.h @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Author.h + */ + #ifndef SIGMOD_AUTHOR #define SIGMOD_AUTHOR @@ -26,27 +30,101 @@ namespace Sigmod // Forward declarations class Sigmod; +/** + * \class Sigmod::Author Author.h sigmod/Author.h + * \brief Class describing an author of the %Sigmod. + * + * Authors are used to allow scripts to create credits. + */ class SIGMOD_EXPORT Author : public Object { Q_OBJECT public: + /** + * Copy constructor. + * + * \param author The author to copy. + */ Author(const Author& author); + /** + * Create a new author belonging to \p parent and id \p id. + * + * \param parent The parent of the author. + * \param id The id number for the author. + */ Author(const Sigmod* parent, const int id); + /** + * Data copy constructor. Copies the data from \p author and parents the new author with \p parent and id \p id. + * + * \param author The author to copy the data from. + * \param parent The parent of the author. + * \param id The id number for the author. + */ Author(const Author& author, const Sigmod* parent, const int id); + /** + * XML data constructor. + * + * \param xml The XML structure to extract the data from. + * \param parent The parent of the author. + * \param id The id number for the author. + */ Author(const QDomElement& xml, const Sigmod* parent, const int id = -1); + /** + * Check to make sure the author is valid. + */ void validate(); + /** + * Load data from XML. + * + * \param xml The XML structure to extract data from. + */ void load(const QDomElement& xml); + /** + * Get the data for the author in XML format. + * + * \return The XML structure representing the author. + */ QDomElement save() const; + /** + * Set the name of the author. + * + * \param name The name of the author. + */ void setName(const QString& name); + /** + * Set the email of the author. It is not checked to be well-formed until the author is \link Author::validate \p validate \endlink is called. + * + * \param email The email of the author. + */ void setEmail(const QString& email); + /** + * Set what the author did for the %Sigmod. The default credits generator assumes that the roles are comma-separated. + * + * \param role The role(s) of the author. + */ void setRole(const QString& role); + /** + * \sa setName + * + * \return The name of the author. + */ QString name() const; + /** + * \sa setEmail + * + * \return The email address of the author. + */ QString email() const; + /** + * \sa setRole + * + * \return The role(s) of the author. + */ QString role() const; Author& operator=(const Author& rhs); diff --git a/sigmod/Badge.cpp b/sigmod/Badge.cpp index 231fba47..8a050520 100644 --- a/sigmod/Badge.cpp +++ b/sigmod/Badge.cpp @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Badge.cpp + */ + // Header include #include "Badge.h" diff --git a/sigmod/Badge.h b/sigmod/Badge.h index dda68ec8..debe7abe 100644 --- a/sigmod/Badge.h +++ b/sigmod/Badge.h @@ -15,6 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * \file sigmod/Badge.h + */ + #ifndef SIGMOD_BADGE #define SIGMOD_BADGE @@ -27,19 +31,64 @@ namespace Sigmod // Forward declarations class Sigmod; +/** + * \class Sigmod::Badge Badge.h sigmod/Badge.h + * \brief Class describing a badge. + * + * Badges are used to show a trainer's worthiness. Without them, team members that are too high leveled may not + * listen to its trainer. Some badges also boost stats (only with in-game battles). + */ class SIGMOD_EXPORT Badge : public Object { Q_OBJECT public: + /** + * Copy constructor. + * + * \param badge The badge to copy. + */ Badge(const Badge& badge); + /** + * Create a new badge belonging to \p parent and id \p id. + * + * \param parent The parent of the badge. + * \param id The id number for the badge. + */ Badge(const Sigmod* parent, const int id); + /** + * Data copy constructor. Copies the data from \p badge and parents the new badge with \p parent and id \p id. + * + * \param ability The badge to copy the data from. + * \param parent The parent of the badge. + * \param id The id number for the badge. + */ Badge(const Badge& badge, const Sigmod* parent, const int id); + /** + * XML data constructor. + * + * \param xml The XML structure to extract the data from. + * \param parent The parent of the badge. + * \param id The id number for the badge. + */ Badge(const QDomElement& xml, const Sigmod* parent, const int id = -1); + /** + * Check to make sure the badge is valid. + */ void validate(); + /** + * Load data from XML. + * + * \param xml The XML structure to extract data from. + */ void load(const QDomElement& xml); + /** + * Get the data for the badge in XML format. + * + * \return The XML structure representing the badge. + */ QDomElement save() const; void setName(const QString& name); diff --git a/sigmod/CMakeLists.txt b/sigmod/CMakeLists.txt index 674508fd..5a16e49e 100644 --- a/sigmod/CMakeLists.txt +++ b/sigmod/CMakeLists.txt @@ -111,14 +111,22 @@ TARGET_LINK_LIBRARIES(sigmod ${QT_QTXML_LIBRARY} ) +INCLUDE(../doxygen.cmake) + INSTALL( - TARGETS sigmod - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} - COMPONENT runtime + TARGETS + sigmod + DESTINATION + ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} + COMPONENT + runtime ) INSTALL( - FILES ${sigmod_DEVEL} - DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}/${PROJECT_NAME} - COMPONENT development + FILES + ${sigmod_DEVEL} + DESTINATION + ${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}/${PROJECT_NAME} + COMPONENT + development ) diff --git a/sigmod/Sigmod.cpp b/sigmod/Sigmod.cpp index 05149f9c..753847c3 100644 --- a/sigmod/Sigmod.cpp +++ b/sigmod/Sigmod.cpp @@ -52,6 +52,7 @@ Sigmod::Sigmod::Sigmod() : m_title(""), m_version(""), m_description(""), + m_singlePlayer(true), m_startMap(INT_MAX), m_startWarp(INT_MAX), m_typechart(0, 0), @@ -88,10 +89,13 @@ void Sigmod::Sigmod::validate() emit(error("Version is empty")); if (m_description.isEmpty()) emit(warning("Description is empty")); - if (mapIndex(m_startMap) == INT_MAX) - emit(error("Invalid starting map")); - else if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX) - emit(error("Invalid starting warp")); + if (m_singlePlayer) + { + if (mapIndex(m_startMap) == INT_MAX) + emit(error("Invalid starting map")); + else if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX) + emit(error("Invalid starting warp")); + } if ((m_typechart.width() != typeCount()) || (m_typechart.height() != typeCount())) emit(error("Type chart is invalid")); TEST_CHILD(m_rules); @@ -277,6 +281,7 @@ void Sigmod::Sigmod::load(const QDomElement& xml) LOAD(title); LOAD(version); LOAD(description); + LOAD(singlePlayer); LOAD(startMap); LOAD(startWarp); LOAD_Rules(); @@ -312,6 +317,7 @@ QDomElement Sigmod::Sigmod::save() const SAVE(title); SAVE(version); SAVE(description); + SAVE(singlePlayer); SAVE(startMap); SAVE(startWarp); SAVE_Rules(rules); @@ -356,8 +362,15 @@ void Sigmod::Sigmod::setDescription(const QString& description) CHECK(description); } +void Sigmod::Sigmod::setSinglePlayer(const bool singlePlayer) +{ + CHECK(singlePlayer); +} + void Sigmod::Sigmod::setStartMap(const int startMap) { + if (!m_singlePlayer) + emit(error(unused("startMap"))); if (mapIndex(startMap) == INT_MAX) emit(error(bounds("startMap"))); else @@ -366,6 +379,8 @@ void Sigmod::Sigmod::setStartMap(const int startMap) void Sigmod::Sigmod::setStartWarp(const int startWarp) { + if (!m_singlePlayer) + emit(error(unused("startWarp"))); if (mapIndex(m_startMap) == INT_MAX) emit(error(bounds("startMap"))); else if (mapById(m_startMap)->warpIndex(startWarp) == INT_MAX) @@ -404,6 +419,11 @@ QString Sigmod::Sigmod::description() const return m_description; } +bool Sigmod::Sigmod::singlePlayer() const +{ + return m_singlePlayer; +} + int Sigmod::Sigmod::startMap() const { return m_startMap; @@ -2165,6 +2185,7 @@ Sigmod::Sigmod& Sigmod::Sigmod::operator=(const Sigmod& rhs) COPY(title); COPY(version); COPY(description); + COPY(singlePlayer); COPY(startMap); COPY(startWarp); COPY(typechart); diff --git a/sigmod/Sigmod.h b/sigmod/Sigmod.h index cdd3f6f6..e902aaac 100644 --- a/sigmod/Sigmod.h +++ b/sigmod/Sigmod.h @@ -69,6 +69,7 @@ class SIGMOD_EXPORT Sigmod : public Object void setTitle(const QString& title); void setVersion(const QString& version); void setDescription(const QString& description); + void setSinglePlayer(const bool singlePlayer); void setStartMap(const int startMap); void setStartWarp(const int startWarp); void setTypechart(const int attack, const int defense, const Fraction& multiplier); @@ -78,6 +79,7 @@ class SIGMOD_EXPORT Sigmod : public Object QString title() const; QString version() const; QString description() const; + bool singlePlayer() const; int startMap() const; int startWarp() const; const Matrix<Fraction>* typechart() const; @@ -425,6 +427,7 @@ class SIGMOD_EXPORT Sigmod : public Object QString m_title; QString m_version; QString m_description; + bool m_singlePlayer; int m_startMap; int m_startWarp; Matrix<Fraction> m_typechart; |
