diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-25 22:25:05 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-25 22:25:05 +0000 |
| commit | f444f5a45e9325644a360f656176d47d7f540f52 (patch) | |
| tree | 9206d27c3ed1d0bcf6fe70560f7b22fe98f4d880 /pokemod/Pokemod.cpp | |
| parent | e13073c4357b2b85eba8a015f38e9f69f4d1799c (diff) | |
| download | sigen-f444f5a45e9325644a360f656176d47d7f540f52.tar.gz sigen-f444f5a45e9325644a360f656176d47d7f540f52.tar.xz sigen-f444f5a45e9325644a360f656176d47d7f540f52.zip | |
[FIX] Matrix edge case when size is (0,0)
[FIX] TypeChart mess fixed
[FIX] Test code for RootModel added
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@110 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
| -rw-r--r-- | pokemod/Pokemod.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index 4dc3d014..1d84fffc 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -1952,27 +1952,40 @@ int Pokemod::typeCount() const Type* Pokemod::newType() { - int i; - m_types.append(new Type(this, i = newTypeId())); - m_typeChart.addColumn(Fraction(1, 1)); - m_typeChart.addRow(Fraction(1, 1)); + if (typeCount()) + { + m_typeChart.addColumn(Fraction(1, 1)); + m_typeChart.addRow(Fraction(1, 1)); + } + else + m_typeChart.addColumn(Fraction(1, 1)); + m_types.append(new Type(this, newTypeId())); return m_types[typeCount() - 1]; } Type* Pokemod::newType(const QDomElement& xml) { - int i; - m_types.append(new Type(xml, this, i = newTypeId())); - m_typeChart.addColumn(Fraction(1, 1)); - m_typeChart.addRow(Fraction(1, 1)); + if (typeCount()) + { + m_typeChart.addColumn(Fraction(1, 1)); + m_typeChart.addRow(Fraction(1, 1)); + } + else + m_typeChart.addColumn(Fraction(1, 1)); + m_types.append(new Type(xml, this, newTypeId())); return m_types[typeCount() - 1]; } Type* Pokemod::newType(const Type& type) { + if (typeCount()) + { + m_typeChart.addColumn(Fraction(1, 1)); + m_typeChart.addRow(Fraction(1, 1)); + } + else + m_typeChart.addColumn(Fraction(1, 1)); m_types.append(new Type(type, this, newTypeId())); - m_typeChart.addColumn(Fraction(1, 1)); - m_typeChart.addRow(Fraction(1, 1)); return m_types[typeCount() - 1]; } @@ -1981,8 +1994,13 @@ void Pokemod::deleteType(const int index) throw(IndexException) if (typeCount() <= index) error<IndexException>("type"); delete m_types[index]; - m_typeChart.deleteColumn(index); - m_typeChart.deleteRow(index); + if (typeCount() == 1) + m_typeChart.deleteColumn(index); + else + { + m_typeChart.deleteColumn(index); + m_typeChart.deleteRow(index); + } m_types.removeAt(index); } |
