From e6bd0fad66fcce1a81d5b61ba6afd856d8f84d67 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 19 May 2008 03:27:00 +0000 Subject: [FIX] general is now merged into pokemod [FIX] Added ItemEffect widget code git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@153 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- Changelog | 8 + general/Flag.cpp | 58 ----- general/Flag.h | 66 ------ general/Fraction.cpp | 35 --- general/Fraction.h | 87 ------- general/Hat.h | 90 -------- general/Matrix.h | 210 ----------------- general/Point.h | 78 ------- general/TODO | 1 - general/general.pro | 29 --- pokegen.pro | 7 +- pokemod/AbilityEffect.cpp | 1 + pokemod/AbilityEffect.h | 4 +- pokemod/Badge.cpp | 1 + pokemod/Badge.h | 4 +- pokemod/Dialog.cpp | 3 +- pokemod/Flag.cpp | 58 +++++ pokemod/Flag.h | 66 ++++++ pokemod/Fraction.cpp | 35 +++ pokemod/Fraction.h | 87 +++++++ pokemod/Hat.h | 90 ++++++++ pokemod/Item.cpp | 1 + pokemod/ItemEffect.cpp | 1 + pokemod/ItemEffect.h | 4 +- pokemod/Map.h | 4 +- pokemod/MapEffect.h | 6 +- pokemod/MapTrainer.cpp | 1 + pokemod/MapTrainer.h | 6 +- pokemod/MapTrainerTeamMember.cpp | 1 + pokemod/MapWarp.h | 6 +- pokemod/MapWildListEncounter.cpp | 1 + pokemod/Matrix.h | 210 +++++++++++++++++ pokemod/Move.cpp | 1 + pokemod/Move.h | 4 +- pokemod/MoveEffect.h | 4 +- pokemod/Nature.cpp | 1 + pokemod/Nature.h | 4 +- pokemod/Point.h | 78 +++++++ pokemod/Pokemod.cpp | 1 + pokemod/Pokemod.h | 8 +- pokemod/Rules.h | 4 +- pokemod/Species.cpp | 1 + pokemod/Species.h | 4 +- pokemod/SpeciesEvolution.cpp | 1 + pokemod/SpeciesMove.cpp | 1 + pokemod/Tile.h | 4 +- pokemod/Type.h | 4 +- pokemod/pokemod.pro | 15 +- pokemodr/AbilityEffectUI.cpp | 1 + pokemodr/BadgeUI.cpp | 1 + pokemodr/FlagWidget.h | 4 +- pokemodr/FractionWidget.h | 4 +- pokemodr/ItemEffectUI.cpp | 443 ++++++++++++++++++++++++++++++++++++ pokemodr/ItemEffectUI.h | 58 +++++ pokemodr/ItemUI.cpp | 1 + pokemodr/MapTrainerTeamMemberUI.cpp | 1 + pokemodr/MapTrainerUI.cpp | 1 + pokemodr/MapWildListEncounterUI.cpp | 3 +- pokemodr/MoveUI.cpp | 3 +- pokemodr/NatureUI.cpp | 1 + pokemodr/PointWidget.h | 4 +- pokemodr/SpeciesEvolutionUI.cpp | 1 + pokemodr/SpeciesMoveUI.cpp | 1 + pokemodr/SpeciesUI.cpp | 1 + pokemodr/TilemapModel.h | 4 +- pokemodr/TypechartWidgetItem.h | 4 +- pokemodr/pokemodr.pro | 5 +- 67 files changed, 1202 insertions(+), 733 deletions(-) delete mode 100644 general/Flag.cpp delete mode 100644 general/Flag.h delete mode 100644 general/Fraction.cpp delete mode 100644 general/Fraction.h delete mode 100644 general/Hat.h delete mode 100644 general/Matrix.h delete mode 100644 general/Point.h delete mode 100644 general/TODO delete mode 100644 general/general.pro create mode 100644 pokemod/Flag.cpp create mode 100644 pokemod/Flag.h create mode 100644 pokemod/Fraction.cpp create mode 100644 pokemod/Fraction.h create mode 100644 pokemod/Hat.h create mode 100644 pokemod/Matrix.h create mode 100644 pokemod/Point.h create mode 100644 pokemodr/ItemEffectUI.cpp create mode 100644 pokemodr/ItemEffectUI.h diff --git a/Changelog b/Changelog index a30f6e90..984ce825 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,11 @@ +----------------- +Rev: 153 +Date: 18 May 2008 +User: MathStuf +----------------- +[FIX] general is now merged into pokemod +[FIX] Added ItemEffect widget code + ----------------- Rev: 152 Date: 18 May 2008 diff --git a/general/Flag.cpp b/general/Flag.cpp deleted file mode 100644 index e08ba9f0..00000000 --- a/general/Flag.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -// Header include -#include "Flag.h" - -const QStringList Flag::ValueStr = QStringList() << "Off" << "On" << "Ignore"; - -Flag::Flag(const int flag, const int status) : - m_flag(flag) -{ - setStatus(status); -} - -void Flag::set(const int flag, const int status) -{ - setFlag(flag); - setStatus(status); -} - -void Flag::setFlag(const int flag) -{ - m_flag = flag; -} - -void Flag::setStatus(const int status) -{ - if (End <= status) - { - m_status = Ignore; - return; - } - m_status = status; -} - -int Flag::flag() const -{ - return m_flag; -} - -int Flag::status() const -{ - return m_status; -} diff --git a/general/Flag.h b/general/Flag.h deleted file mode 100644 index 55b3a73d..00000000 --- a/general/Flag.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __FLAG__ -#define __FLAG__ - -// Qt includes -#include - -class Flag -{ - public: - enum - { - Off, - On, - Ignore, - End - }; - static const QStringList ValueStr; - - Flag(const int flag = 0, const int status = Off); - - void set(const int flag, const int status); - void setFlag(const int flag); - void setStatus(const int status); - - int flag() const; - int status() const; - - inline Flag& operator=(const Flag& rhs) - { - if (this == &rhs) - return *this; - m_flag = rhs.m_flag; - m_status = rhs.m_status; - return *this; - } - inline bool operator==(const Flag& rhs) const - { - return ((m_flag == rhs.m_flag) && (m_status == rhs.m_status)); - } - inline bool operator!=(const Flag& rhs) const - { - return !(*this == rhs); - } - private: - int m_flag; - int m_status; -}; - -#endif diff --git a/general/Fraction.cpp b/general/Fraction.cpp deleted file mode 100644 index a4a41e7d..00000000 --- a/general/Fraction.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -// Header include -#include "Fraction.h" - -void Fraction::set(const int numerator, const int denominator) -{ - m_numerator = numerator; - m_denominator = denominator; -} - -void Fraction::reduce() -{ - int i = m_numerator; - int j = m_denominator; - while (i - j) - (i > j) ? (i -= j) : (j -= i); - m_numerator /= i; - m_denominator /= i; -} diff --git a/general/Fraction.h b/general/Fraction.h deleted file mode 100644 index 2c1dc663..00000000 --- a/general/Fraction.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __FRAC__ -#define __FRAC__ - -// Qt includes -#include - -class Fraction -{ - public: - inline Fraction() - { - set(1, 1); - } - inline Fraction(const int numerator, const int denominator) - { - set(numerator, denominator); - } - - void set(const int numerator, const int denominator); - inline void setNumerator(const int numerator) - { - set(numerator, m_denominator); - } - inline void setDenominator(const int denominator) - { - set(m_numerator, denominator); - } - - inline int numerator() const - { - return m_numerator; - } - inline int denominator() const - { - return m_denominator; - } - - void reduce(); - - inline operator double() const - { - return (double(m_numerator) / m_denominator); - } - inline Fraction operator*(const Fraction& rhs) const - { - return Fraction(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator); - } - inline Fraction& operator=(const Fraction& rhs) - { - if (this == &rhs) - return *this; - m_numerator = rhs.m_numerator; - m_denominator = rhs.m_denominator; - return *this; - } - inline bool operator==(const Fraction& rhs) const - { - return ((m_numerator == rhs.m_numerator) && (m_denominator == rhs.m_denominator)); - } - inline bool operator!=(const Fraction& rhs) const - { - return !(*this == rhs); - } - private: - int m_numerator; - int m_denominator; -}; -Q_DECLARE_METATYPE(Fraction) - -#endif diff --git a/general/Hat.h b/general/Hat.h deleted file mode 100644 index 2b7fccea..00000000 --- a/general/Hat.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __HAT__ -#define __HAT__ - -// Qt includes -#include -#include -#include - -template class Hat -{ - public: - Hat() : - m_count(0) - { - qsrand(QDateTime().toTime_t()); - } - - T pick() const - { - int choice = qrand() % m_count; - foreach (T key, m_objects.keys()) - { - choice -= m_objects[key]; - if (choice < 0) - break; - } - return key; - } - T take() - { - T chosen = pick(); - if (!(--m_objects[chosen])) - m_objects.erase(chosen); - --m_count; - return chosen; - } - void setCount(const T& key, const unsigned weight) - { - if (m_objects.contains(key)) - m_count -= m_objects[key]; - m_objects[key] = weight; - m_count += weight; - } - void add(const T& key, const unsigned weight) - { - m_objects[key] += weight; - m_count += weight; - } - unsigned count() const - { - return m_count; - } - unsigned count(const T& key) const - { - if (m_objects.contains(key)) - return m_objects[key]; - return 0; - } - double chance(const T& key) const - { - return (double(count(key)) / m_count); - } - - unsigned operator[](const T& key) const - { - return count(key); - } - private: - QMap m_objects; - unsigned m_count; -}; - -#endif diff --git a/general/Matrix.h b/general/Matrix.h deleted file mode 100644 index 8d714f9d..00000000 --- a/general/Matrix.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __MATRIX__ -#define __MATRIX__ - -// General includes -#include "Point.h" - -// Qt includes -#include - -template class Matrix -{ - public: - Matrix() : - m_width(0), - m_height(0) - { - } - Matrix(const int height, const int width, const T& value = T()) - { - resize(height, width, value); - } - Matrix(const Matrix& rhs) - { - *this = rhs; - } - - void addRow(const T& value = T()) - { - m_width += !m_width; - m_matrix.append(QVector(m_width, value)); - ++m_height; - } - void addColumn(const T& value = T()) - { - if (!m_height) - { - m_matrix.append(QVector(1)); - ++m_height; - } - foreach (QVector row, m_matrix) - row.append(value); - ++m_width; - } - void insertRow(const int row, const T& value = T()) - { - if (m_height < row) - return; - m_width += !m_width; - m_matrix.insert(row, QVector(m_width, value)); - ++m_height; - } - void insertColumn(const int column, const T& value = T()) - { - if (m_width < column) - return; - if (!m_height) - { - m_matrix.append(QVector(1)); - ++m_height; - } - foreach (QVector row, m_matrix) - row.insert(column, value); - ++m_width; - } - void deleteRow(const int row) - { - if (m_height <= row) - return; - m_matrix.remove(row); - if (!(--m_height)) - m_width = 0; - } - void deleteColumn(const int column) - { - if (m_width <= column) - return; - foreach (QVector row, m_matrix) - row.remove(column); - if (!(--m_width)) - m_height = 0; - } - void clear() - { - m_width = 0; - m_height = 0; - m_matrix.clear(); - } - - void set(const int row, const int column, const T& value) - { - if ((m_height <= row) || (m_width <= column)) - return; - (m_matrix[row])[column] = value; - } - void resize(const int height, const int width, const T& value = T()) - { - clear(); - m_width = width; - m_height = height; - if (!m_width ^ !m_height) - { - if (m_width) - ++m_height; - if (m_height) - ++m_width; - } - m_matrix = QVector< QVector >(m_height, QVector(m_width, value)); - } - - T at(const int row, const int column) const - { - if ((m_height <= row) || (m_width <= column)) - return T(); - return m_matrix.at(row).at(column); - } - QVector row(const int row) const - { - if (height <= row) - return QVector(); - return m_matrix.at(row); - } - QVector column(const int column) const - { - if (m_width <= column) - return QVector(); - QVector col; - foreach (QVector row, m_matrix) - col.append(row.at(column)); - return col; - } - int height() const - { - return m_height; - } - int width() const - { - return m_width; - } - Point size() const - { - return Point(m_width, m_height); - } - - T& operator()(const int row, const int column) - { - // FIXME: compile error if used :( - if ((m_height <= row) || (m_width <= column)) - return T(); - return m_matrix[row][column]; - } - T operator()(const int row, const int column) const - { - return at(row, column); - } - Matrix& operator=(const Matrix& rhs) - { - if (this == &rhs) - return *this; - resize(rhs.m_height, rhs.m_width); - for (int i = 0; i < m_height; ++i) - { - for (int j = 0; j < m_width; ++j) - m_matrix[i][j] = rhs.m_matrix[i][j]; - } - return *this; - } - bool operator==(const Matrix& rhs) const - { - if (this == &rhs) - return true; - if ((m_height != rhs.m_height) || (m_width == rhs.m_width)) - return false; - for (int i = 0; i < m_height; ++i) - { - for (int j = 0; j < m_width; ++j) - { - if (m_matrix[i][j] != rhs.m_matrix[i][j]) - return false; - } - } - return true; - } - bool operator!=(const Matrix& rhs) const - { - return !(*this == rhs); - } - protected: - int m_width; - int m_height; - QVector< QVector > m_matrix; -}; - -#endif diff --git a/general/Point.h b/general/Point.h deleted file mode 100644 index 0525f85b..00000000 --- a/general/Point.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef __POINT__ -#define __POINT__ - -class Point -{ - public: - inline Point(const int x = 0, const int y = 0) : - m_x(x), - m_y(y) - { - } - inline Point(const Point& rhs) - { - *this = rhs; - } - - inline void set(const int x, const int y) - { - m_x = x; - m_y = y; - } - inline void setX(const int x) - { - m_x = x; - } - inline void setY(const int y) - { - m_y = y; - } - - inline int x() const - { - return m_x; - } - inline int y() const - { - return m_y; - } - - Point& operator=(const Point& rhs) - { - if (this == &rhs) - return *this; - m_x = rhs.m_x; - m_y = rhs.m_y; - return *this; - } - inline bool operator==(const Point& rhs) const - { - return ((m_x == rhs.m_x) && (m_y == rhs.m_y)); - } - inline bool operator!=(const Point& rhs) const - { - return !(*this == rhs); - } - private: - int m_x; - int m_y; -}; - -#endif diff --git a/general/TODO b/general/TODO deleted file mode 100644 index ccc403c1..00000000 --- a/general/TODO +++ /dev/null @@ -1 +0,0 @@ -FlagWidget diff --git a/general/general.pro b/general/general.pro deleted file mode 100644 index 71c61d60..00000000 --- a/general/general.pro +++ /dev/null @@ -1,29 +0,0 @@ -include(../version.pro) -TEMPLATE = lib -OBJECTS_DIR = .obj -DESTDIR = ../bin - -CONFIG += qt \ - warn_on \ - dll -!win32 { - CONFIG += debug -} - -SOURCES += Flag.cpp \ - Fraction.cpp - -HEADERS += Flag.h \ - Fraction.h \ - Hat.h \ - Matrix.h \ - Point.h - -isEmpty(PREFIX) { - PREFIX = $$(PREFIX) -} -isEmpty(PREFIX) { - PREFIX = /usr -} -target.path = $$PREFIX/lib$$system(kde4-config --libsuffix) -INSTALLS += target diff --git a/pokegen.pro b/pokegen.pro index f3357f56..a8c04a55 100755 --- a/pokegen.pro +++ b/pokegen.pro @@ -8,13 +8,10 @@ CONFIG += ordered \ CONFIG += debug } -SUBDIRS = general \ - pokemod \ +SUBDIRS = pokemod \ pokemodr -pokemod.depends = general -pokemodr.depends = pokemod \ - general +pokemodr.depends = pokemod distsrc.target = distsrc distsrc.commands = ./make-tarball.sh $${VERSION} diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp index b7532e2d..df33be3b 100644 --- a/pokemod/AbilityEffect.cpp +++ b/pokemod/AbilityEffect.cpp @@ -22,6 +22,7 @@ #include "Ability.h" #include "Type.h" #include "Pokemod.h" +#include "Rules.h" const QStringList AbilityEffect::EffectStr = QStringList() << "Damage to HP" << "Prevent Damage" << "Auto Heal" << "Deal Damage" << "Wilds" << "Stat" << "Status" << "Ability" << "Accuracy/Power Trade" << "Bullseye" << "Item Effect" << "Type" << "Fast Hatch" << "Weather"; const QStringList AbilityEffect::TriggerStr = QStringList() << "Anything" << "Contact" << "Weather" << "Damage" << "Type" << "HP Boundary" << "Stat Change" << "Status"; diff --git a/pokemod/AbilityEffect.h b/pokemod/AbilityEffect.h index 17b6d027..d855cdc8 100644 --- a/pokemod/AbilityEffect.h +++ b/pokemod/AbilityEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_ABILITYEFFECT__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp index f4518f0d..75df4b73 100644 --- a/pokemod/Badge.cpp +++ b/pokemod/Badge.cpp @@ -17,6 +17,7 @@ // Header include #include "Badge.h" +#include "Rules.h" // Qt includes #include diff --git a/pokemod/Badge.h b/pokemod/Badge.h index 70b5c528..988fea9a 100644 --- a/pokemod/Badge.h +++ b/pokemod/Badge.h @@ -19,12 +19,10 @@ #define __POKEMOD_BADGE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp index 15607831..a755fbf2 100644 --- a/pokemod/Dialog.cpp +++ b/pokemod/Dialog.cpp @@ -26,8 +26,9 @@ #include "MapTrainer.h" #include "MapWarp.h" #include "Move.h" -#include "Species.h" #include "Pokemod.h" +#include "Rules.h" +#include "Species.h" const QStringList Dialog::CommandStr = QStringList() << "Flip Flag" << "Set Flag" << "Unset Flag" << "Randomize Flag" << "Test Flag" << "Dialog" << "Yes/No" << "Item Shop" << "Give Item" << "Take Item" << "Check Item" << "Coin List" << "Teach Move" << "Delete Move" << "Give Pokemon" << "Take Pokemon" << "Show Pokemon" << "View Pokemon" << "Give Money" << "Take Money" << "Move Effect" << "Turn Effect" << "Check Direction" << "Check Roster" << "Check Levels" << "Check Species" << "Check Held Items" << "Check Money" << "Trade" << "Daycare" << "Battle" << "Badge" << "Warp" << "Name" << "Music" << "Sound Effect" << "Timer" << "Map Sign" << "Wild Scope" << "Safari" << "Heal Party" << "Refresh" << "Clear" << "Pause" << "New Line" << "Exit" << "Menu"; const QStringList Dialog::CommandAbbrStr = QStringList() << "FF" << "SF" << "UF" << "RF" << "TF" << "D" << "YN" << "ItS" << "GIt" << "TIt" << "CIt" << "CL" << "TMv" << "DMv" << "GPk" << "TPk" << "SPk" << "VPk" << "G$" << "T$" << "MvEf" << "TEf" << "CD" << "CR" << "CLv" << "CS" << "CHIt" << "C$" << "T" << "Dc" << "Bat" << "Bdg" << "W" << "N" << "Ms" << "SFX" << "Tmr" << "MS" << "WS" << "S" << "HP" << "R" << "C" << "P" << "NL" << "X" << "M"; diff --git a/pokemod/Flag.cpp b/pokemod/Flag.cpp new file mode 100644 index 00000000..e08ba9f0 --- /dev/null +++ b/pokemod/Flag.cpp @@ -0,0 +1,58 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +// Header include +#include "Flag.h" + +const QStringList Flag::ValueStr = QStringList() << "Off" << "On" << "Ignore"; + +Flag::Flag(const int flag, const int status) : + m_flag(flag) +{ + setStatus(status); +} + +void Flag::set(const int flag, const int status) +{ + setFlag(flag); + setStatus(status); +} + +void Flag::setFlag(const int flag) +{ + m_flag = flag; +} + +void Flag::setStatus(const int status) +{ + if (End <= status) + { + m_status = Ignore; + return; + } + m_status = status; +} + +int Flag::flag() const +{ + return m_flag; +} + +int Flag::status() const +{ + return m_status; +} diff --git a/pokemod/Flag.h b/pokemod/Flag.h new file mode 100644 index 00000000..55b3a73d --- /dev/null +++ b/pokemod/Flag.h @@ -0,0 +1,66 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __FLAG__ +#define __FLAG__ + +// Qt includes +#include + +class Flag +{ + public: + enum + { + Off, + On, + Ignore, + End + }; + static const QStringList ValueStr; + + Flag(const int flag = 0, const int status = Off); + + void set(const int flag, const int status); + void setFlag(const int flag); + void setStatus(const int status); + + int flag() const; + int status() const; + + inline Flag& operator=(const Flag& rhs) + { + if (this == &rhs) + return *this; + m_flag = rhs.m_flag; + m_status = rhs.m_status; + return *this; + } + inline bool operator==(const Flag& rhs) const + { + return ((m_flag == rhs.m_flag) && (m_status == rhs.m_status)); + } + inline bool operator!=(const Flag& rhs) const + { + return !(*this == rhs); + } + private: + int m_flag; + int m_status; +}; + +#endif diff --git a/pokemod/Fraction.cpp b/pokemod/Fraction.cpp new file mode 100644 index 00000000..a4a41e7d --- /dev/null +++ b/pokemod/Fraction.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +// Header include +#include "Fraction.h" + +void Fraction::set(const int numerator, const int denominator) +{ + m_numerator = numerator; + m_denominator = denominator; +} + +void Fraction::reduce() +{ + int i = m_numerator; + int j = m_denominator; + while (i - j) + (i > j) ? (i -= j) : (j -= i); + m_numerator /= i; + m_denominator /= i; +} diff --git a/pokemod/Fraction.h b/pokemod/Fraction.h new file mode 100644 index 00000000..2c1dc663 --- /dev/null +++ b/pokemod/Fraction.h @@ -0,0 +1,87 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __FRAC__ +#define __FRAC__ + +// Qt includes +#include + +class Fraction +{ + public: + inline Fraction() + { + set(1, 1); + } + inline Fraction(const int numerator, const int denominator) + { + set(numerator, denominator); + } + + void set(const int numerator, const int denominator); + inline void setNumerator(const int numerator) + { + set(numerator, m_denominator); + } + inline void setDenominator(const int denominator) + { + set(m_numerator, denominator); + } + + inline int numerator() const + { + return m_numerator; + } + inline int denominator() const + { + return m_denominator; + } + + void reduce(); + + inline operator double() const + { + return (double(m_numerator) / m_denominator); + } + inline Fraction operator*(const Fraction& rhs) const + { + return Fraction(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator); + } + inline Fraction& operator=(const Fraction& rhs) + { + if (this == &rhs) + return *this; + m_numerator = rhs.m_numerator; + m_denominator = rhs.m_denominator; + return *this; + } + inline bool operator==(const Fraction& rhs) const + { + return ((m_numerator == rhs.m_numerator) && (m_denominator == rhs.m_denominator)); + } + inline bool operator!=(const Fraction& rhs) const + { + return !(*this == rhs); + } + private: + int m_numerator; + int m_denominator; +}; +Q_DECLARE_METATYPE(Fraction) + +#endif diff --git a/pokemod/Hat.h b/pokemod/Hat.h new file mode 100644 index 00000000..2b7fccea --- /dev/null +++ b/pokemod/Hat.h @@ -0,0 +1,90 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __HAT__ +#define __HAT__ + +// Qt includes +#include +#include +#include + +template class Hat +{ + public: + Hat() : + m_count(0) + { + qsrand(QDateTime().toTime_t()); + } + + T pick() const + { + int choice = qrand() % m_count; + foreach (T key, m_objects.keys()) + { + choice -= m_objects[key]; + if (choice < 0) + break; + } + return key; + } + T take() + { + T chosen = pick(); + if (!(--m_objects[chosen])) + m_objects.erase(chosen); + --m_count; + return chosen; + } + void setCount(const T& key, const unsigned weight) + { + if (m_objects.contains(key)) + m_count -= m_objects[key]; + m_objects[key] = weight; + m_count += weight; + } + void add(const T& key, const unsigned weight) + { + m_objects[key] += weight; + m_count += weight; + } + unsigned count() const + { + return m_count; + } + unsigned count(const T& key) const + { + if (m_objects.contains(key)) + return m_objects[key]; + return 0; + } + double chance(const T& key) const + { + return (double(count(key)) / m_count); + } + + unsigned operator[](const T& key) const + { + return count(key); + } + private: + QMap m_objects; + unsigned m_count; +}; + +#endif diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index 777f5856..d76d74ec 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "ItemEffect.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp index cd9266a3..eed64e62 100644 --- a/pokemod/ItemEffect.cpp +++ b/pokemod/ItemEffect.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "MapWildList.h" #include "Pokemod.h" +#include "Rules.h" const QStringList ItemEffect::EffectStr = QStringList() << "HP Cure" << "Revive" << "Cure Status" << "Level Boost" << "Stat Boost" << "Flinch" << "Go First" << "Keep Alive" << "Modify Stat (Battle Only)" << "Shield (Battle Only)" << "Run (Battle Only)" << "PP Boost" << "Type Boost" << "PP Restore" << "Experience Share" << "Fishing Rod" << "Repel" << "Escape" << "TM" << "HM" << "Map" << "Ball" << "Itemfinder" << "Bike" << "Scope" << "Coin" << "Coin Case" << "Berry" << "Acorn"; const QStringList ItemEffect::RelativeStr = QStringList() << "Absolute" << "Relative"; diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h index 456ef3ad..5ce5af21 100644 --- a/pokemod/ItemEffect.h +++ b/pokemod/ItemEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_ITEMEFFECT__ // Pokemod include +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/Map.h b/pokemod/Map.h index 355257f4..09280a69 100644 --- a/pokemod/Map.h +++ b/pokemod/Map.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAP__ // Pokemod includes +#include "Matrix.h" #include "Object.h" -// General includes -#include "../general/Matrix.h" - // Qt includes #include diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h index d9cc2383..1d84d09e 100644 --- a/pokemod/MapEffect.h +++ b/pokemod/MapEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAPEFFECT__ // Pokemod includes +#include "Flag.h" #include "Object.h" - -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" +#include "Point.h" // Qt includes #include diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index ad0da7bc..8eb93ebd 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -23,6 +23,7 @@ #include "Map.h" #include "MapTrainerTeamMember.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h index 4bfaf3bc..f7dea954 100644 --- a/pokemod/MapTrainer.h +++ b/pokemod/MapTrainer.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAPTRAINER__ // Pokemod includes +#include "Flag.h" #include "Object.h" - -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" +#include "Point.h" // Qt includes #include diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp index f95ae7e0..ce8cddae 100644 --- a/pokemod/MapTrainerTeamMember.cpp +++ b/pokemod/MapTrainerTeamMember.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "MapTrainer.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" // Qt includes diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h index a25c60c1..6395e3ef 100644 --- a/pokemod/MapWarp.h +++ b/pokemod/MapWarp.h @@ -19,13 +19,11 @@ #define __POKEMOD_MAPWARP__ // Pokemod includes +#include "Flag.h" #include "Object.h" +#include "Point.h" #include "Pokemod.h" -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" - class MapWarp : public Object { Q_OBJECT diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp index 5918df09..3ce241a8 100644 --- a/pokemod/MapWildListEncounter.cpp +++ b/pokemod/MapWildListEncounter.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "MapWildList.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter) : diff --git a/pokemod/Matrix.h b/pokemod/Matrix.h new file mode 100644 index 00000000..8d714f9d --- /dev/null +++ b/pokemod/Matrix.h @@ -0,0 +1,210 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __MATRIX__ +#define __MATRIX__ + +// General includes +#include "Point.h" + +// Qt includes +#include + +template class Matrix +{ + public: + Matrix() : + m_width(0), + m_height(0) + { + } + Matrix(const int height, const int width, const T& value = T()) + { + resize(height, width, value); + } + Matrix(const Matrix& rhs) + { + *this = rhs; + } + + void addRow(const T& value = T()) + { + m_width += !m_width; + m_matrix.append(QVector(m_width, value)); + ++m_height; + } + void addColumn(const T& value = T()) + { + if (!m_height) + { + m_matrix.append(QVector(1)); + ++m_height; + } + foreach (QVector row, m_matrix) + row.append(value); + ++m_width; + } + void insertRow(const int row, const T& value = T()) + { + if (m_height < row) + return; + m_width += !m_width; + m_matrix.insert(row, QVector(m_width, value)); + ++m_height; + } + void insertColumn(const int column, const T& value = T()) + { + if (m_width < column) + return; + if (!m_height) + { + m_matrix.append(QVector(1)); + ++m_height; + } + foreach (QVector row, m_matrix) + row.insert(column, value); + ++m_width; + } + void deleteRow(const int row) + { + if (m_height <= row) + return; + m_matrix.remove(row); + if (!(--m_height)) + m_width = 0; + } + void deleteColumn(const int column) + { + if (m_width <= column) + return; + foreach (QVector row, m_matrix) + row.remove(column); + if (!(--m_width)) + m_height = 0; + } + void clear() + { + m_width = 0; + m_height = 0; + m_matrix.clear(); + } + + void set(const int row, const int column, const T& value) + { + if ((m_height <= row) || (m_width <= column)) + return; + (m_matrix[row])[column] = value; + } + void resize(const int height, const int width, const T& value = T()) + { + clear(); + m_width = width; + m_height = height; + if (!m_width ^ !m_height) + { + if (m_width) + ++m_height; + if (m_height) + ++m_width; + } + m_matrix = QVector< QVector >(m_height, QVector(m_width, value)); + } + + T at(const int row, const int column) const + { + if ((m_height <= row) || (m_width <= column)) + return T(); + return m_matrix.at(row).at(column); + } + QVector row(const int row) const + { + if (height <= row) + return QVector(); + return m_matrix.at(row); + } + QVector column(const int column) const + { + if (m_width <= column) + return QVector(); + QVector col; + foreach (QVector row, m_matrix) + col.append(row.at(column)); + return col; + } + int height() const + { + return m_height; + } + int width() const + { + return m_width; + } + Point size() const + { + return Point(m_width, m_height); + } + + T& operator()(const int row, const int column) + { + // FIXME: compile error if used :( + if ((m_height <= row) || (m_width <= column)) + return T(); + return m_matrix[row][column]; + } + T operator()(const int row, const int column) const + { + return at(row, column); + } + Matrix& operator=(const Matrix& rhs) + { + if (this == &rhs) + return *this; + resize(rhs.m_height, rhs.m_width); + for (int i = 0; i < m_height; ++i) + { + for (int j = 0; j < m_width; ++j) + m_matrix[i][j] = rhs.m_matrix[i][j]; + } + return *this; + } + bool operator==(const Matrix& rhs) const + { + if (this == &rhs) + return true; + if ((m_height != rhs.m_height) || (m_width == rhs.m_width)) + return false; + for (int i = 0; i < m_height; ++i) + { + for (int j = 0; j < m_width; ++j) + { + if (m_matrix[i][j] != rhs.m_matrix[i][j]) + return false; + } + } + return true; + } + bool operator!=(const Matrix& rhs) const + { + return !(*this == rhs); + } + protected: + int m_width; + int m_height; + QVector< QVector > m_matrix; +}; + +#endif diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 5567947d..b69dc373 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "MoveEffect.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include diff --git a/pokemod/Move.h b/pokemod/Move.h index ca70c7fb..c2080b7e 100644 --- a/pokemod/Move.h +++ b/pokemod/Move.h @@ -19,11 +19,9 @@ #define __POKEMOD_MOVE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h index bbc0f322..adadaeb5 100644 --- a/pokemod/MoveEffect.h +++ b/pokemod/MoveEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_MOVEEFFECT__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index db571d00..30f5a779 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" Nature::Nature(const Nature& nature) : Object("Nature", nature.parent(), nature.id()) diff --git a/pokemod/Nature.h b/pokemod/Nature.h index 82cb361f..1ef8bdee 100644 --- a/pokemod/Nature.h +++ b/pokemod/Nature.h @@ -19,12 +19,10 @@ #define __POKEMOD_NATURE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - class Nature : public Object { Q_OBJECT diff --git a/pokemod/Point.h b/pokemod/Point.h new file mode 100644 index 00000000..0525f85b --- /dev/null +++ b/pokemod/Point.h @@ -0,0 +1,78 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __POINT__ +#define __POINT__ + +class Point +{ + public: + inline Point(const int x = 0, const int y = 0) : + m_x(x), + m_y(y) + { + } + inline Point(const Point& rhs) + { + *this = rhs; + } + + inline void set(const int x, const int y) + { + m_x = x; + m_y = y; + } + inline void setX(const int x) + { + m_x = x; + } + inline void setY(const int y) + { + m_y = y; + } + + inline int x() const + { + return m_x; + } + inline int y() const + { + return m_y; + } + + Point& operator=(const Point& rhs) + { + if (this == &rhs) + return *this; + m_x = rhs.m_x; + m_y = rhs.m_y; + return *this; + } + inline bool operator==(const Point& rhs) const + { + return ((m_x == rhs.m_x) && (m_y == rhs.m_y)); + } + inline bool operator!=(const Point& rhs) const + { + return !(*this == rhs); + } + private: + int m_x; + int m_y; +}; + +#endif diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index f19bb6c1..b33d8175 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -30,6 +30,7 @@ #include "Map.h" #include "Move.h" #include "Nature.h" +#include "Rules.h" #include "Sound.h" #include "Species.h" #include "Store.h" diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index 702314ea..7166f397 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -19,13 +19,12 @@ #define __POKEMOD_POKEMOD__ // Pokemod includes +#include "Fraction.h" +#include "Matrix.h" #include "Object.h" -#include "Rules.h" +#include "Point.h" // General includes -#include "../general/Fraction.h" -#include "../general/Matrix.h" -#include "../general/Point.h" // Qt includes #include @@ -43,6 +42,7 @@ class ItemType; class Map; class Move; class Nature; +class Rules; class Sound; class Species; class Store; diff --git a/pokemod/Rules.h b/pokemod/Rules.h index 87562774..3b2b3e5a 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -19,11 +19,9 @@ #define __POKEMOD_RULES__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 91ba0720..2867b401 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" #include "SpeciesAbility.h" #include "SpeciesEvolution.h" #include "SpeciesItem.h" diff --git a/pokemod/Species.h b/pokemod/Species.h index 704a6d29..c0d93460 100644 --- a/pokemod/Species.h +++ b/pokemod/Species.h @@ -19,12 +19,10 @@ #define __POKEMOD_SPECIES__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp index b57f3715..060cc8de 100644 --- a/pokemod/SpeciesEvolution.cpp +++ b/pokemod/SpeciesEvolution.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "ItemEffect.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" const QStringList SpeciesEvolution::StyleStr = QStringList() << "Level" << "Happiness" << "Stat" << "Item" << "Trade" << "TradeItem" << "Personality" << "Spare Slot"; diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp index d5042414..c013c9de 100644 --- a/pokemod/SpeciesMove.cpp +++ b/pokemod/SpeciesMove.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" #include "Species.h" SpeciesMove::SpeciesMove(const SpeciesMove& move) : diff --git a/pokemod/Tile.h b/pokemod/Tile.h index c0ebc44d..12efe6f5 100644 --- a/pokemod/Tile.h +++ b/pokemod/Tile.h @@ -19,12 +19,10 @@ #define __POKEMOD_TILE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/Type.h b/pokemod/Type.h index 8f492039..06a7cdaf 100644 --- a/pokemod/Type.h +++ b/pokemod/Type.h @@ -19,12 +19,10 @@ #define __POKEMOD_TYPE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro index 2a90538d..158233b9 100644 --- a/pokemod/pokemod.pro +++ b/pokemod/pokemod.pro @@ -3,8 +3,6 @@ TEMPLATE = lib OBJECTS_DIR = .obj MOC_DIR = .moc DESTDIR = ../bin -LIBS += -L../bin \ - -lgeneral CONFIG += qt \ warn_on \ @@ -14,12 +12,6 @@ QT += xml CONFIG += debug } -win32 { - TARGETDEPS += $${DESTDIR}/general.dll -} else { - TARGETDEPS += $${DESTDIR}/libgeneral.so -} - SOURCES += Ability.cpp \ AbilityEffect.cpp \ Author.cpp \ @@ -28,6 +20,8 @@ SOURCES += Ability.cpp \ CoinListObject.cpp \ Dialog.cpp \ EggGroup.cpp \ + Flag.cpp \ + Fraction.cpp \ Item.cpp \ ItemEffect.cpp \ ItemType.cpp \ @@ -64,6 +58,9 @@ HEADERS += AbilityEffect.h \ CoinListObject.h \ Dialog.h \ EggGroup.h \ + Flag.h \ + Fraction.h \ + Hat.h \ ItemEffect.h \ Item.h \ ItemType.h \ @@ -74,10 +71,12 @@ HEADERS += AbilityEffect.h \ MapWarp.h \ MapWildListEncounter.h \ MapWildList.h \ + Matrix.h \ MoveEffect.h \ Move.h \ Nature.h \ Object.h \ + Point.h \ Pokemod.h \ Rules.h \ Sound.h \ diff --git a/pokemodr/AbilityEffectUI.cpp b/pokemodr/AbilityEffectUI.cpp index 58033344..638ed6fe 100644 --- a/pokemodr/AbilityEffectUI.cpp +++ b/pokemodr/AbilityEffectUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Ability.h" #include "../pokemod/AbilityEffect.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Type.h" AbilityEffectUI::AbilityEffectUI(AbilityEffect* effect, QWidget* parent) : diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp index a07943a2..27666eb9 100644 --- a/pokemodr/BadgeUI.cpp +++ b/pokemodr/BadgeUI.cpp @@ -24,6 +24,7 @@ // Pokemod includes #include "../pokemod/Badge.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" BadgeUI::BadgeUI(Badge* badge, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/FlagWidget.h b/pokemodr/FlagWidget.h index 34e5ed1b..7e749179 100644 --- a/pokemodr/FlagWidget.h +++ b/pokemodr/FlagWidget.h @@ -18,8 +18,8 @@ #ifndef __FLAGWIDGET__ #define __FLAGWIDGET__ -// General includes -#include "../general/Flag.h" +// Pokemod includes +#include "../pokemod/Flag.h" // Qt includes #include diff --git a/pokemodr/FractionWidget.h b/pokemodr/FractionWidget.h index a79221c5..38990c72 100644 --- a/pokemodr/FractionWidget.h +++ b/pokemodr/FractionWidget.h @@ -18,8 +18,8 @@ #ifndef __FRACTIONWIDGET__ #define __FRACTIONWIDGET__ -// General includes -#include "../general/Fraction.h" +// Pokemod includes +#include "../pokemod/Fraction.h" // Qt includes #include diff --git a/pokemodr/ItemEffectUI.cpp b/pokemodr/ItemEffectUI.cpp new file mode 100644 index 00000000..bece9c10 --- /dev/null +++ b/pokemodr/ItemEffectUI.cpp @@ -0,0 +1,443 @@ +/* + * Copyright 2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +// Header include +#include "ItemEffectUI.h" + +// Pokemod includes +#include "../pokemod/ItemEffect.h" +#include "../pokemod/MapWildList.h" +#include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Time.h" +#include "../pokemod/Type.h" + +ItemEffectUI::ItemEffectUI(ItemEffect* effect, QWidget* parent) : + ObjectUI(parent), + m_lastEffect(-1), + m_lastValue2(-1), + m_lastValue4(-1) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + setObjects(effect, new ItemEffect(*effect)); + init(); +} + +ItemEffectUI::~ ItemEffectUI() +{ +} + +void ItemEffectUI::initGui() +{ + varEffect->addItems(ItemEffect::EffectStr); +} + +void ItemEffectUI::setGui() +{ + const bool resetEffect = (static_cast(modified())->effect() == m_lastEffect); + const bool resetValue2 = ((static_cast(modified())->value2() == m_lastValue2) || m_lastEffect); + const bool resetValue4 = ((static_cast(modified())->value4() == m_lastValue4) || m_lastEffect); + const bool isSplit = static_cast(original()->pokemod())->rules()->specialSplit(); + varOverworld->setChecked(static_cast(modified())->overworld() ? Qt::Checked : Qt::Unchecked); + varBattle->setChecked(static_cast(modified())->battle() ? Qt::Checked : Qt::Unchecked); + varHeld->setChecked(static_cast(modified())->held() ? Qt::Checked : Qt::Unchecked); + varEffect->setCurrentIndex(static_cast(modified())->effect()); + m_lastEffect = static_cast(modified())->effect(); + if (resetEffect) + { + switch (m_lastEffect) + { + case ItemEffect::E_Revive: + case ItemEffect::E_LevelBoost: + case ItemEffect::E_StatBoost: + case ItemEffect::E_PPBoost: + case ItemEffect::E_Fish: + case ItemEffect::E_Repel: + case ItemEffect::E_Escape: + case ItemEffect::E_TM: + case ItemEffect::E_HM: + case ItemEffect::E_Map: + case ItemEffect::E_Itemfinder: + case ItemEffect::E_Bike: + case ItemEffect::E_Scope: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + case ItemEffect::E_Acorn: + case ItemEffect::E_Evolution: + case ItemEffect::E_Flinch: + case ItemEffect::E_First: + case ItemEffect::E_KeepAlive: + case ItemEffect::E_ModifyStatBattle: + case ItemEffect::E_ShieldBattle: + case ItemEffect::E_RunBattle: + case ItemEffect::E_TypeBoost: + case ItemEffect::E_ExpShare: + case ItemEffect::E_Ball: + case ItemEffect::E_Berry: + varOverworld->setEnabled(false); + break; + default: + varOverworld->setEnabled(true); + break; + } + varValue1->setEnabled(true); + varValue2->clear(); + varValue2->setEnabled(true); + varValue3->clear(); + varValue3->setEnabled(true); + varValue4->setEnabled(true); + varValue4->setBehavior(((ItemEffect::E_TypeBoost == m_lastEffect) || (ItemEffect::E_PPBoost == m_lastEffect)) ? -1 : 1); + switch (m_lastEffect) + { + case ItemEffect::E_HPCure: + case ItemEffect::E_Revive: + // Value 4 dependent + case ItemEffect::E_Ball: + // Value 2 dependent + break; + case ItemEffect::E_LevelBoost: + case ItemEffect::E_ShieldBattle: + case ItemEffect::E_PPBoost: + case ItemEffect::E_Repel: + varValue1->setRange(1, INT_MAX); + break; + case ItemEffect::E_StatBoost: + case ItemEffect::E_Acorn: + varValue1->setRange(0, 65535); + break; + case ItemEffect::E_ModifyStatBattle: + varValue1->setRange(-12, 12); + break; + case ItemEffect::E_Fish: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + varValue1->setRange(0, INT_MAX); + break; + default: + varValue1->setEnabled(false); + break; + } + switch (m_lastEffect) + { + // TODO: Value2 code +// case ItemEffect::E_HPCure: +// case ItemEffect::E_Revive: +// if (ItemEffect::R_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_CureStatus: +// if (Pokemod::STS_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_StatBoost: +// if ((value2 <= 0) || (65536 <= value2)) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_ModifyStatBattle: +// if (Pokemod::ST_End_Battle <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_ShieldBattle: +// if (ItemEffect::SP_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_TypeBoost: +// if (static_cast(pokemod())->typeIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_PPRestore: +// if (ItemEffect::A_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Repel: +// if (ItemEffect::RP_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Escape: +// if (ItemEffect::ES_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_TM: +// case ItemEffect::E_HM: +// if (static_cast(pokemod())->moveIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Ball: +// if (ItemEffect::B_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Scope: +// break; +// case ItemEffect::E_Berry: +// if (ItemEffect::B2_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Coin: +// case ItemEffect::E_CoinCase: +// if (value2 <= 0) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Acorn: +// if (static_cast(pokemod())->itemIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// default: +// varValue2->setEnabled(false); +// break; + } + switch (m_lastEffect) + { + case ItemEffect::E_StatBoost: + for (int i = 0; i < (isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY); ++i) + varValue3->addItem((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[i], i); + break; + case ItemEffect::E_Ball: + // Value 2 dependent + case ItemEffect::E_Berry: + // Value 2 dependent + break; + default: + varValue3->setEnabled(false); + break; + } + switch (m_lastEffect) + { + case ItemEffect::E_CureStatus: + case ItemEffect::E_LevelBoost: + case ItemEffect::E_StatBoost: + case ItemEffect::E_ModifyStatBattle: + case ItemEffect::E_Fish: + case ItemEffect::E_Escape: + case ItemEffect::E_TM: + case ItemEffect::E_HM: + case ItemEffect::E_Map: + case ItemEffect::E_Itemfinder: + case ItemEffect::E_Bike: + case ItemEffect::E_Scope: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + case ItemEffect::E_Acorn: + case ItemEffect::E_Evolution: + varValue4->setEnabled(false); + break; + case ItemEffect::E_Ball: + if (m_lastValue2 == ItemEffect::B_Master) + varValue4->setEnabled(false); + break; + case ItemEffect::E_Berry: + if (m_lastValue2 != ItemEffect::B2_HPCure) + varValue4->setEnabled(false); + break; + } + } + varValue2->setCurrentIndex(varValue2->findData(static_cast(modified())->value2())); + m_lastValue2 = static_cast(modified())->value2(); + if (resetValue2) + { + if (m_lastEffect == ItemEffect::E_Ball) + { + switch (m_lastValue2) + { + case ItemEffect::B_Regular: + varValue1->setRange(0, 255); + break; + case ItemEffect::B_Level: + varValue1->setRange(0, static_cast(original()->pokemod())->rules()->maxLevel()); + break; + case ItemEffect::B_Master: + case ItemEffect::B_Love: + case ItemEffect::B_Area: + case ItemEffect::B_Time: + case ItemEffect::B_Battle: + case ItemEffect::B_Friend: + case ItemEffect::B_Stat: + case ItemEffect::B_Type: + case ItemEffect::B_Weight: + break; + default: + varValue1->setEnabled(false); + break; + } + switch (m_lastValue2) + { + case ItemEffect::B_Level: + case ItemEffect::B_Friend: + case ItemEffect::B_Weight: + // TODO: ??? + break; + case ItemEffect::B_Area: + varValue3->addItems(MapWildList::ControlStr); + for (int i = 0; i < MapWildList::End; ++i) + varValue3->setItemData(i, i); + break; + case ItemEffect::B_Time: + for (int i = 0; i < static_cast(original()->pokemod())->timeCount(); ++i) + { + const Time* time = static_cast(original()->pokemod())->time(i); + varValue3->addItem(time->name(), time->id()); + } + break; + case ItemEffect::B_Stat: + for (int i = 0; i < (isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY); ++i) + varValue3->addItem((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[i], i); + break; + case ItemEffect::B_Type: + for (int i = 0; i < static_cast(original()->pokemod())->typeCount(); ++i) + { + const Type* type = static_cast(original()->pokemod())->type(i); + varValue3->addItem(type->name(), type->id()); + } + break; + case ItemEffect::B_Regular: + case ItemEffect::B_Master: + case ItemEffect::B_Love: + case ItemEffect::B_Battle: + varValue3->setEnabled(false); + break; + } + } + else if (m_lastEffect == ItemEffect::E_Berry) + { + switch (m_lastValue2) + { + case ItemEffect::B2_HPCure: + varValue3->addItems(Pokemod::RelativeStr); + for (int i = 0; i < Pokemod::REL_End; ++i) + varValue3->setItemData(i, i); + break; + case ItemEffect::B2_StatusCure: + varValue3->addItems(Pokemod::StatusStr); + for (int i = 0; i < Pokemod::STS_End; ++i) + varValue3->setItemData(i, i); + break; + default: + varValue3->setEnabled(false); + break; + } + } + } + varValue4->setValue(static_cast(modified())->value4()); + m_lastValue4 = static_cast(modified())->value4(); + if (resetValue4) + { + if ((m_lastValue4 == ItemEffect::E_HPCure) || (m_lastValue4 == ItemEffect::E_Revive)) + { + if (m_lastValue4 == ItemEffect::R_Absolute) + varValue1->setRange(1, INT_MAX); + else + varValue1->setEnabled(false); + } + } + varValue1->setValue(static_cast(modified())->value1()); + varValue3->setCurrentIndex(varValue3->findData(static_cast(modified())->value3())); +} + +void ItemEffectUI::apply() +{ + *static_cast(original()) = *static_cast(modified()); + emit(changed(false)); +} + +void ItemEffectUI::discard() +{ + *static_cast(modified()) = *static_cast(original()); + setGui(); + emit(changed(false)); +} + +void ItemEffectUI::on_varOverworld_toggled(const bool overworld) +{ + static_cast(modified())->setOverworld(overworld); +} + +void ItemEffectUI::on_varBattle_toggled(const bool battle) +{ + static_cast(modified())->setBattle(battle); +} + +void ItemEffectUI::on_varHeld_toggled(const bool held) +{ + static_cast(modified())->setHeld(held); +} + +void ItemEffectUI::on_varEffect_currentIndexChanged(const int effect) +{ + static_cast(modified())->setEffect(effect); +} + +void ItemEffectUI::on_varValue1_valueChanged(const int value1) +{ + static_cast(modified())->setValue1(value1); +} + +void ItemEffectUI::on_varValue2_currentIndexChanged(const int value2) +{ + static_cast(modified())->setValue2(varValue2->itemData(value2).toInt()); +} + +void ItemEffectUI::on_varValue3_currentIndexChanged(const int value3) +{ + static_cast(modified())->setValue3(varValue3->itemData(value3).toInt()); +} + +void ItemEffectUI::on_varValue4_valueChanged(const Fraction& value4) +{ + static_cast(modified())->setValue4(value4); +} diff --git a/pokemodr/ItemEffectUI.h b/pokemodr/ItemEffectUI.h new file mode 100644 index 00000000..5a428fe6 --- /dev/null +++ b/pokemodr/ItemEffectUI.h @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Ben Boeckel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __POKEMODR_ITEMEFFECTUI__ +#define __POKEMODR_ITEMEFFECTUI__ + +// PokeModr includes +#include "ObjectUI.h" + +// Form include +#include "ui_itemeffect.h" + +// Forward declarations +class ItemEffect; + +class ItemEffectUI : public ObjectUI, private Ui::formItemEffect +{ + Q_OBJECT + + public: + ItemEffectUI(ItemEffect* effect, QWidget* parent); + ~ItemEffectUI(); + public slots: + void apply(); + void discard(); + protected slots: + void on_varOverworld_toggled(const bool overworld); + void on_varBattle_toggled(const bool battle); + void on_varHeld_toggled(const bool held); + void on_varEffect_currentIndexChanged(const int effect); + void on_varValue1_valueChanged(const int value1); + void on_varValue2_currentIndexChanged(const int value2); + void on_varValue3_currentIndexChanged(const int value3); + void on_varValue4_valueChanged(const Fraction& value4); + private slots: + void initGui(); + void setGui(); + private: + int m_lastEffect; + int m_lastValue2; + int m_lastValue4; +}; + +#endif diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp index 6e7945a7..771ba979 100644 --- a/pokemodr/ItemUI.cpp +++ b/pokemodr/ItemUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Item.h" #include "../pokemod/ItemType.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" ItemUI::ItemUI(Item* item, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp index d2489dc9..5664b05b 100644 --- a/pokemodr/MapTrainerTeamMemberUI.cpp +++ b/pokemodr/MapTrainerTeamMemberUI.cpp @@ -23,6 +23,7 @@ #include "../pokemod/MapTrainerTeamMember.h" #include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember, QWidget* parent) : diff --git a/pokemodr/MapTrainerUI.cpp b/pokemodr/MapTrainerUI.cpp index 69ac68fe..d8993130 100644 --- a/pokemodr/MapTrainerUI.cpp +++ b/pokemodr/MapTrainerUI.cpp @@ -24,6 +24,7 @@ #include "../pokemod/MapTrainer.h" #include "../pokemod/MapTrainerTeamMember.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/Trainer.h" diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp index d8421a26..d8352c50 100644 --- a/pokemodr/MapWildListEncounterUI.cpp +++ b/pokemodr/MapWildListEncounterUI.cpp @@ -20,8 +20,9 @@ // Pokemod includes #include "../pokemod/MapWildListEncounter.h" -#include "../pokemod/Species.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Species.h" MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp index 0582e095..cea2e6a5 100644 --- a/pokemodr/MoveUI.cpp +++ b/pokemodr/MoveUI.cpp @@ -20,8 +20,9 @@ // Pokemod includes #include "../pokemod/Move.h" -#include "../pokemod/Type.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Type.h" MoveUI::MoveUI(Move* move, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp index 3a71fcbf..4f289859 100644 --- a/pokemodr/NatureUI.cpp +++ b/pokemodr/NatureUI.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" NatureUI::NatureUI(Nature* nature, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/PointWidget.h b/pokemodr/PointWidget.h index 4ff72148..8f303f18 100644 --- a/pokemodr/PointWidget.h +++ b/pokemodr/PointWidget.h @@ -18,8 +18,8 @@ #ifndef __POINTWIDGET__ #define __POINTWIDGET__ -// General includes -#include "../general/Point.h" +// Pokemod includes +#include "../pokemod/Point.h" // Qt includes #include diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp index bb4a8e38..d8eca1c2 100644 --- a/pokemodr/SpeciesEvolutionUI.cpp +++ b/pokemodr/SpeciesEvolutionUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Item.h" #include "../pokemod/ItemEffect.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/SpeciesEvolution.h" diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp index d8021c74..7fa4a8c9 100644 --- a/pokemodr/SpeciesMoveUI.cpp +++ b/pokemodr/SpeciesMoveUI.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "../pokemod/Move.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/SpeciesMove.h" SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) : diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp index 7c754afe..09d17e53 100644 --- a/pokemodr/SpeciesUI.cpp +++ b/pokemodr/SpeciesUI.cpp @@ -24,6 +24,7 @@ // Pokemod includes #include "../pokemod/EggGroup.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/Type.h" diff --git a/pokemodr/TilemapModel.h b/pokemodr/TilemapModel.h index 98d585f2..5b1fe46d 100644 --- a/pokemodr/TilemapModel.h +++ b/pokemodr/TilemapModel.h @@ -19,11 +19,9 @@ #define __POKEMODR_TILEMAPMODEL__ // Pokemod includes +#include "../pokemod/Matrix.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/Matrix.h" - // Qt includes #include #include diff --git a/pokemodr/TypechartWidgetItem.h b/pokemodr/TypechartWidgetItem.h index 86c612fb..5e1890c2 100644 --- a/pokemodr/TypechartWidgetItem.h +++ b/pokemodr/TypechartWidgetItem.h @@ -18,8 +18,8 @@ #ifndef __TYPECHARTWIDGETITEM__ #define __TYPECHARTWIDGETITEM__ -// General includes -#include "../general/Fraction.h" +// Pokemod includes +#include "../pokemod/Fraction.h" // Qt includes #include diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index 62b12a0d..b06e331a 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -6,7 +6,6 @@ MOC_DIR = .moc DOC_DIR = ../doc DESTDIR = ../bin LIBS += -L../bin \ - -lgeneral \ -lpokemod \ -lphonon \ -lkdecore \ @@ -24,9 +23,9 @@ QT += xml RESOURCES += overlays/overlays.qrc win32 { - TARGETDEPS += $${DESTDIR}/pokemod.dll $${DESTDIR}/general.dll + TARGETDEPS += $${DESTDIR}/pokemod.dll } else { - TARGETDEPS += $${DESTDIR}/libpokemod.so $${DESTDIR}/libgeneral.so + TARGETDEPS += $${DESTDIR}/libpokemod.so } include(../latex.inc) -- cgit