diff options
Diffstat (limited to 'pokemod/Map.cpp')
| -rw-r--r-- | pokemod/Map.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index fda0a7e9..e3d90465 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -27,9 +27,9 @@ #include "Pokemod.h" #include "Map.h" -const QStringList PokeMod::Map::TypeStr = QStringList() << "Outdoor" << "Dungeon" << "Building"; +const QStringList Map::TypeStr = QStringList() << "Outdoor" << "Dungeon" << "Building"; -PokeMod::Map::Map(const Pokemod& par, const unsigned _id) : +Map::Map(const Pokemod& par, const unsigned _id) : Object(par, _id), name(""), flyWarp(UINT_MAX), @@ -37,19 +37,19 @@ PokeMod::Map::Map(const Pokemod& par, const unsigned _id) : { } -PokeMod::Map::Map(const Pokemod& par, const Map& m, const unsigned _id) : +Map::Map(const Pokemod& par, const Map& m, const unsigned _id) : Object(par, _id) { *this = m; } -PokeMod::Map::Map(const Pokemod& par, const QString& fname, const unsigned _id) : +Map::Map(const Pokemod& par, const QString& fname, const unsigned _id) : Object(par, _id) { load(fname, _id); } -bool PokeMod::Map::validate() const +bool Map::validate() const { bool valid = true; pokemod.validationMsg(QString("---Map \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); @@ -227,7 +227,7 @@ bool PokeMod::Map::validate() const return valid; } -unsigned PokeMod::Map::getNewEffectId() const +unsigned Map::getNewEffectId() const { unsigned i = 0; for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) @@ -235,7 +235,7 @@ unsigned PokeMod::Map::getNewEffectId() const return i; } -unsigned PokeMod::Map::getNewTrainerId() const +unsigned Map::getNewTrainerId() const { unsigned i = 0; for (; (i < getTrainerCount()) && (getTrainerIndex(i) != UINT_MAX); ++i) @@ -243,7 +243,7 @@ unsigned PokeMod::Map::getNewTrainerId() const return i; } -unsigned PokeMod::Map::getNewWarpId() const +unsigned Map::getNewWarpId() const { unsigned i = 0; for (; (i < getWarpCount()) && (getWarpIndex(i) != UINT_MAX); ++i) @@ -251,7 +251,7 @@ unsigned PokeMod::Map::getNewWarpId() const return i; } -unsigned PokeMod::Map::getNewWildListId() const +unsigned Map::getNewWildListId() const { unsigned i = 0; for (; (i < getWarpCount()) && (getWarpIndex(i) != UINT_MAX); ++i) @@ -259,7 +259,7 @@ unsigned PokeMod::Map::getNewWildListId() const return i; } -void PokeMod::Map::load(const QString& fname, const unsigned _id) throw(Exception) +void Map::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); if (_id == UINT_MAX) @@ -311,7 +311,7 @@ void PokeMod::Map::load(const QString& fname, const unsigned _id) throw(Exceptio } } -void PokeMod::Map::save() const throw(Exception) +void Map::save() const throw(Exception) { Ini ini; ini.addField("id", id); @@ -336,117 +336,117 @@ void PokeMod::Map::save() const throw(Exception) i.next().save(name); } -void PokeMod::Map::setName(const QString& n) +void Map::setName(const QString& n) { name = n; } -void PokeMod::Map::setFlyWarp(const unsigned f) throw(BoundsException) +void Map::setFlyWarp(const unsigned f) throw(BoundsException) { if (getWarpIndex(f) == UINT_MAX) throw(BoundsException("Map", "warp")); flyWarp = f; } -void PokeMod::Map::setType(const unsigned t) throw(BoundsException) +void Map::setType(const unsigned t) throw(BoundsException) { if (End <= t) throw(BoundsException("Map", "type")); type = t; } -QString PokeMod::Map::getName() const +QString Map::getName() const { return name; } -unsigned PokeMod::Map::getFlyWarp() const +unsigned Map::getFlyWarp() const { return flyWarp; } -unsigned PokeMod::Map::getType() const +unsigned Map::getType() const { return type; } -void PokeMod::Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) +void Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) { if (pokemod.getTileIndex(_id) == UINT_MAX) throw(BoundsException("Map", "tile")); tiles(x, y) = _id; } -void PokeMod::Map::insertColumn(unsigned x) +void Map::insertColumn(unsigned x) { tiles.insertCol(x, 0); } -void PokeMod::Map::insertRow(unsigned y) +void Map::insertRow(unsigned y) { tiles.insertRow(y, 0); } -void PokeMod::Map::addColumn() +void Map::addColumn() { tiles.addCol(0); } -void PokeMod::Map::addRow() +void Map::addRow() { tiles.addRow(0); } -void PokeMod::Map::deleteColumn(unsigned x) +void Map::deleteColumn(unsigned x) { tiles.deleteCol(x); } -void PokeMod::Map::deleteRow(unsigned y) +void Map::deleteRow(unsigned y) { tiles.deleteRow(y); } -unsigned PokeMod::Map::getTile(unsigned x, unsigned y) const +unsigned Map::getTile(unsigned x, unsigned y) const { return tiles(x, y); } -unsigned PokeMod::Map::getWidth() const +unsigned Map::getWidth() const { return tiles.getWidth(); } -unsigned PokeMod::Map::getHeight() const +unsigned Map::getHeight() const { return tiles.getHeight(); } -const PokeMod::MapEffect& PokeMod::Map::getEffect(const unsigned i) const throw(IndexException) +const MapEffect& Map::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); return effects.at(i); } -PokeMod::MapEffect& PokeMod::Map::getEffect(const unsigned i) throw(IndexException) +MapEffect& Map::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); return effects[i]; } -const PokeMod::MapEffect& PokeMod::Map::getEffectByID(const unsigned i) const throw(IndexException) +const MapEffect& Map::getEffectByID(const unsigned i) const throw(IndexException) { return getEffect(getEffectIndex(i)); } -PokeMod::MapEffect& PokeMod::Map::getEffectByID(const unsigned i) throw(IndexException) +MapEffect& Map::getEffectByID(const unsigned i) throw(IndexException) { return getEffect(getEffectIndex(i)); } -unsigned PokeMod::Map::getEffectIndex(const unsigned _id) const +unsigned Map::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { @@ -456,61 +456,61 @@ unsigned PokeMod::Map::getEffectIndex(const unsigned _id) const return UINT_MAX; } -unsigned PokeMod::Map::getEffectCount() const +unsigned Map::getEffectCount() const { return effects.size(); } -PokeMod::MapEffect& PokeMod::Map::newEffect() +MapEffect& Map::newEffect() { effects.append(MapEffect(pokemod, getNewEffectId())); return effects[getEffectCount() - 1]; } -PokeMod::MapEffect& PokeMod::Map::newEffect(const QString& fname) +MapEffect& Map::newEffect(const QString& fname) { effects.append(MapEffect(pokemod, fname, getNewEffectId())); return effects[getEffectCount() - 1]; } -PokeMod::MapEffect& PokeMod::Map::newEffect(const MapEffect& e) +MapEffect& Map::newEffect(const MapEffect& e) { effects.append(MapEffect(pokemod, e, getNewEffectId())); return effects[getEffectCount() - 1]; } -void PokeMod::Map::deleteEffect(const unsigned i) throw(IndexException) +void Map::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); effects.removeAt(i); } -const PokeMod::MapTrainer& PokeMod::Map::getTrainer(const unsigned i) const throw(IndexException) +const MapTrainer& Map::getTrainer(const unsigned i) const throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); return trainers.at(i); } -PokeMod::MapTrainer& PokeMod::Map::getTrainer(const unsigned i) throw(IndexException) +MapTrainer& Map::getTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); return trainers[i]; } -const PokeMod::MapTrainer& PokeMod::Map::getTrainerByID(const unsigned i) const throw(IndexException) +const MapTrainer& Map::getTrainerByID(const unsigned i) const throw(IndexException) { return getTrainer(getTrainerIndex(i)); } -PokeMod::MapTrainer& PokeMod::Map::getTrainerByID(const unsigned i) throw(IndexException) +MapTrainer& Map::getTrainerByID(const unsigned i) throw(IndexException) { return getTrainer(getTrainerIndex(i)); } -unsigned PokeMod::Map::getTrainerIndex(const unsigned _id) const +unsigned Map::getTrainerIndex(const unsigned _id) const { for (unsigned i = 0; i < getTrainerCount(); ++i) { @@ -520,61 +520,61 @@ unsigned PokeMod::Map::getTrainerIndex(const unsigned _id) const return UINT_MAX; } -unsigned PokeMod::Map::getTrainerCount() const +unsigned Map::getTrainerCount() const { return trainers.size(); } -PokeMod::MapTrainer& PokeMod::Map::newTrainer() +MapTrainer& Map::newTrainer() { trainers.append(MapTrainer(pokemod, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -PokeMod::MapTrainer& PokeMod::Map::newTrainer(const QString& fname) +MapTrainer& Map::newTrainer(const QString& fname) { trainers.append(MapTrainer(pokemod, fname, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -PokeMod::MapTrainer& PokeMod::Map::newTrainer(const MapTrainer& t) +MapTrainer& Map::newTrainer(const MapTrainer& t) { trainers.append(MapTrainer(pokemod, t, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -void PokeMod::Map::deleteTrainer(const unsigned i) throw(IndexException) +void Map::deleteTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); trainers.removeAt(i); } -const PokeMod::MapWarp& PokeMod::Map::getWarp(const unsigned i) const throw(IndexException) +const MapWarp& Map::getWarp(const unsigned i) const throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); return warps.at(i); } -PokeMod::MapWarp& PokeMod::Map::getWarp(const unsigned i) throw(IndexException) +MapWarp& Map::getWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); return warps[i]; } -const PokeMod::MapWarp& PokeMod::Map::getWarpByID(const unsigned i) const throw(IndexException) +const MapWarp& Map::getWarpByID(const unsigned i) const throw(IndexException) { return getWarp(getWarpIndex(i)); } -PokeMod::MapWarp& PokeMod::Map::getWarpByID(const unsigned i) throw(IndexException) +MapWarp& Map::getWarpByID(const unsigned i) throw(IndexException) { return getWarp(getWarpIndex(i)); } -unsigned PokeMod::Map::getWarpIndex(const unsigned _id) const +unsigned Map::getWarpIndex(const unsigned _id) const { for (unsigned i = 0; i < getWarpCount(); ++i) { @@ -584,61 +584,61 @@ unsigned PokeMod::Map::getWarpIndex(const unsigned _id) const return UINT_MAX; } -unsigned PokeMod::Map::getWarpCount() const +unsigned Map::getWarpCount() const { return warps.size(); } -PokeMod::MapWarp& PokeMod::Map::newWarp() +MapWarp& Map::newWarp() { warps.append(MapWarp(pokemod, getNewWarpId())); return warps[getWarpCount() - 1]; } -PokeMod::MapWarp& PokeMod::Map::newWarp(const QString& fname) +MapWarp& Map::newWarp(const QString& fname) { warps.append(MapWarp(pokemod, fname, getNewWarpId())); return warps[getWarpCount() - 1]; } -PokeMod::MapWarp& PokeMod::Map::newWarp(const MapWarp& w) +MapWarp& Map::newWarp(const MapWarp& w) { warps.append(MapWarp(pokemod, w, getNewWarpId())); return warps[getWarpCount() - 1]; } -void PokeMod::Map::deleteWarp(const unsigned i) throw(IndexException) +void Map::deleteWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); warps.removeAt(i); } -const PokeMod::MapWildList& PokeMod::Map::getWildList(const unsigned i) const throw(IndexException) +const MapWildList& Map::getWildList(const unsigned i) const throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); return wildLists.at(i); } -PokeMod::MapWildList& PokeMod::Map::getWildList(const unsigned i) throw(IndexException) +MapWildList& Map::getWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); return wildLists[i]; } -const PokeMod::MapWildList& PokeMod::Map::getWildListByID(const unsigned i) const throw(IndexException) +const MapWildList& Map::getWildListByID(const unsigned i) const throw(IndexException) { return getWildList(getWildListIndex(i)); } -PokeMod::MapWildList& PokeMod::Map::getWildListByID(const unsigned i) throw(IndexException) +MapWildList& Map::getWildListByID(const unsigned i) throw(IndexException) { return getWildList(getWildListIndex(i)); } -unsigned PokeMod::Map::getWildListIndex(const unsigned _id) const +unsigned Map::getWildListIndex(const unsigned _id) const { for (unsigned i = 0; i < getWildListCount(); ++i) { @@ -648,37 +648,37 @@ unsigned PokeMod::Map::getWildListIndex(const unsigned _id) const return UINT_MAX; } -unsigned PokeMod::Map::getWildListCount() const +unsigned Map::getWildListCount() const { return wildLists.size(); } -PokeMod::MapWildList& PokeMod::Map::newWildList() +MapWildList& Map::newWildList() { wildLists.append(MapWildList(pokemod, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -PokeMod::MapWildList& PokeMod::Map::newWildList(const QString& fname) +MapWildList& Map::newWildList(const QString& fname) { wildLists.append(MapWildList(pokemod, fname, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -PokeMod::MapWildList& PokeMod::Map::newWildList(const MapWildList& w) +MapWildList& Map::newWildList(const MapWildList& w) { wildLists.append(MapWildList(pokemod, w, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -void PokeMod::Map::deleteWildList(const unsigned i) throw(IndexException) +void Map::deleteWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); wildLists.removeAt(i); } -PokeMod::Map& PokeMod::Map::operator=(const Map& rhs) +Map& Map::operator=(const Map& rhs) { if (this == &rhs) return *this; |
