diff options
Diffstat (limited to 'sigmod/Sigmod.cpp')
| -rw-r--r-- | sigmod/Sigmod.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
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); |
