From 2c0a3866e09140d8d5ff84178decddc22db15778 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 6 Oct 2008 00:50:02 +0000 Subject: [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 --- sigmod/Sigmod.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'sigmod/Sigmod.cpp') 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); -- cgit