diff options
Diffstat (limited to 'pokemod/Map.cpp')
-rw-r--r-- | pokemod/Map.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index 74101944..ea8ed60e 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -22,9 +22,9 @@ #include "Map.h" -const char* PokeGen::PokeMod::Map::TypeStr[PokeGen::PokeMod::Map::End] = {"Outdoor", "Dungeon", "Building"}; +const char* PokeMod::Map::TypeStr[PokeMod::Map::End] = {"Outdoor", "Dungeon", "Building"}; -PokeGen::PokeMod::Map::Map(const Pokemod& par, const unsigned _id) : +PokeMod::Map::Map(const Pokemod& par, const unsigned _id) : Object(par, _id), name(""), flyWarp(UINT_MAX), @@ -32,19 +32,19 @@ PokeGen::PokeMod::Map::Map(const Pokemod& par, const unsigned _id) : { } -PokeGen::PokeMod::Map::Map(const Pokemod& par, const Map& m, const unsigned _id) : +PokeMod::Map::Map(const Pokemod& par, const Map& m, const unsigned _id) : Object(par, _id) { *this = m; } -PokeGen::PokeMod::Map::Map(const Pokemod& par, const QString& fname, const unsigned _id) : +PokeMod::Map::Map(const Pokemod& par, const QString& fname, const unsigned _id) : Object(par, _id) { load(fname, _id); } -bool PokeGen::PokeMod::Map::validate() const +bool PokeMod::Map::validate() const { bool valid = true; pokemod.validationMsg(QString("---Map \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); @@ -222,7 +222,7 @@ bool PokeGen::PokeMod::Map::validate() const return valid; } -void PokeGen::PokeMod::Map::load(const QString& fname, const unsigned _id) throw(Exception) +void PokeMod::Map::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); if (_id == UINT_MAX) @@ -274,7 +274,7 @@ void PokeGen::PokeMod::Map::load(const QString& fname, const unsigned _id) throw } } -void PokeGen::PokeMod::Map::save() const throw(Exception) +void PokeMod::Map::save() const throw(Exception) { Ini ini; ini.addField("id", id); @@ -299,107 +299,107 @@ void PokeGen::PokeMod::Map::save() const throw(Exception) i.next().save(name); } -void PokeGen::PokeMod::Map::setName(const QString& n) +void PokeMod::Map::setName(const QString& n) { name = n; } -void PokeGen::PokeMod::Map::setFlyWarp(const unsigned f) throw(BoundsException) +void PokeMod::Map::setFlyWarp(const unsigned f) throw(BoundsException) { if (getWarpByID(f) == UINT_MAX) throw(BoundsException("Map", "warp")); flyWarp = f; } -void PokeGen::PokeMod::Map::setType(const unsigned t) throw(BoundsException) +void PokeMod::Map::setType(const unsigned t) throw(BoundsException) { if (End <= t) throw(BoundsException("Map", "type")); type = t; } -QString PokeGen::PokeMod::Map::getName() const +QString PokeMod::Map::getName() const { return name; } -unsigned PokeGen::PokeMod::Map::getFlyWarp() const +unsigned PokeMod::Map::getFlyWarp() const { return flyWarp; } -unsigned PokeGen::PokeMod::Map::getType() const +unsigned PokeMod::Map::getType() const { return type; } -void PokeGen::PokeMod::Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) +void PokeMod::Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) { if (pokemod.getTileByID(_id) == UINT_MAX) throw(BoundsException("Map", "tile")); tiles(x, y) = _id; } -void PokeGen::PokeMod::Map::insertColumn(unsigned x) +void PokeMod::Map::insertColumn(unsigned x) { tiles.insertCol(x, 0); } -void PokeGen::PokeMod::Map::insertRow(unsigned y) +void PokeMod::Map::insertRow(unsigned y) { tiles.insertRow(y, 0); } -void PokeGen::PokeMod::Map::addColumn() +void PokeMod::Map::addColumn() { tiles.addCol(0); } -void PokeGen::PokeMod::Map::addRow() +void PokeMod::Map::addRow() { tiles.addRow(0); } -void PokeGen::PokeMod::Map::deleteColumn(unsigned x) +void PokeMod::Map::deleteColumn(unsigned x) { tiles.deleteCol(x); } -void PokeGen::PokeMod::Map::deleteRow(unsigned y) +void PokeMod::Map::deleteRow(unsigned y) { tiles.deleteRow(y); } -unsigned PokeGen::PokeMod::Map::getTile(unsigned x, unsigned y) const +unsigned PokeMod::Map::getTile(unsigned x, unsigned y) const { return tiles(x, y); } -unsigned PokeGen::PokeMod::Map::getWidth() const +unsigned PokeMod::Map::getWidth() const { return tiles.getWidth(); } -unsigned PokeGen::PokeMod::Map::getHeight() const +unsigned PokeMod::Map::getHeight() const { return tiles.getHeight(); } -const PokeGen::PokeMod::MapEffect& PokeGen::PokeMod::Map::getEffect(const unsigned i) const throw(IndexException) +const PokeMod::MapEffect& PokeMod::Map::getEffect(const unsigned i) const throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); return effects.at(i); } -PokeGen::PokeMod::MapEffect& PokeGen::PokeMod::Map::getEffect(const unsigned i) throw(IndexException) +PokeMod::MapEffect& PokeMod::Map::getEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); return effects[i]; } -unsigned PokeGen::PokeMod::Map::getEffectByID(const unsigned _id) const +unsigned PokeMod::Map::getEffectByID(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { @@ -409,51 +409,51 @@ unsigned PokeGen::PokeMod::Map::getEffectByID(const unsigned _id) const return UINT_MAX; } -unsigned PokeGen::PokeMod::Map::getEffectCount() const +unsigned PokeMod::Map::getEffectCount() const { return effects.size(); } -PokeGen::PokeMod::MapEffect& PokeGen::PokeMod::Map::newEffect() +PokeMod::MapEffect& PokeMod::Map::newEffect() { effects.append(MapEffect(pokemod, getNewEffectId())); return effects[getEffectCount() - 1]; } -PokeGen::PokeMod::MapEffect& PokeGen::PokeMod::Map::newEffect(const QString& fname) +PokeMod::MapEffect& PokeMod::Map::newEffect(const QString& fname) { effects.append(MapEffect(pokemod, fname, getNewEffectId())); return effects[getEffectCount() - 1]; } -PokeGen::PokeMod::MapEffect& PokeGen::PokeMod::Map::newEffect(const MapEffect& e) +PokeMod::MapEffect& PokeMod::Map::newEffect(const MapEffect& e) { effects.append(MapEffect(pokemod, e, getNewEffectId())); return effects[getEffectCount() - 1]; } -void PokeGen::PokeMod::Map::deleteEffect(const unsigned i) throw(IndexException) +void PokeMod::Map::deleteEffect(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Map")); effects.removeAt(i); } -const PokeGen::PokeMod::MapTrainer& PokeGen::PokeMod::Map::getTrainer(const unsigned i) const throw(IndexException) +const PokeMod::MapTrainer& PokeMod::Map::getTrainer(const unsigned i) const throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); return trainers.at(i); } -PokeGen::PokeMod::MapTrainer& PokeGen::PokeMod::Map::getTrainer(const unsigned i) throw(IndexException) +PokeMod::MapTrainer& PokeMod::Map::getTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); return trainers[i]; } -unsigned PokeGen::PokeMod::Map::getTrainerByID(const unsigned _id) const +unsigned PokeMod::Map::getTrainerByID(const unsigned _id) const { for (unsigned i = 0; i < getTrainerCount(); ++i) { @@ -463,51 +463,51 @@ unsigned PokeGen::PokeMod::Map::getTrainerByID(const unsigned _id) const return UINT_MAX; } -unsigned PokeGen::PokeMod::Map::getTrainerCount() const +unsigned PokeMod::Map::getTrainerCount() const { return trainers.size(); } -PokeGen::PokeMod::MapTrainer& PokeGen::PokeMod::Map::newTrainer() +PokeMod::MapTrainer& PokeMod::Map::newTrainer() { trainers.append(MapTrainer(pokemod, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -PokeGen::PokeMod::MapTrainer& PokeGen::PokeMod::Map::newTrainer(const QString& fname) +PokeMod::MapTrainer& PokeMod::Map::newTrainer(const QString& fname) { trainers.append(MapTrainer(pokemod, fname, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -PokeGen::PokeMod::MapTrainer& PokeGen::PokeMod::Map::newTrainer(const MapTrainer& t) +PokeMod::MapTrainer& PokeMod::Map::newTrainer(const MapTrainer& t) { trainers.append(MapTrainer(pokemod, t, getNewTrainerId())); return trainers[getTrainerCount() - 1]; } -void PokeGen::PokeMod::Map::deleteTrainer(const unsigned i) throw(IndexException) +void PokeMod::Map::deleteTrainer(const unsigned i) throw(IndexException) { if (getTrainerCount() <= i) throw(IndexException("Map")); trainers.removeAt(i); } -const PokeGen::PokeMod::MapWarp& PokeGen::PokeMod::Map::getWarp(const unsigned i) const throw(IndexException) +const PokeMod::MapWarp& PokeMod::Map::getWarp(const unsigned i) const throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); return warps.at(i); } -PokeGen::PokeMod::MapWarp& PokeGen::PokeMod::Map::getWarp(const unsigned i) throw(IndexException) +PokeMod::MapWarp& PokeMod::Map::getWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); return warps[i]; } -unsigned PokeGen::PokeMod::Map::getWarpByID(const unsigned _id) const +unsigned PokeMod::Map::getWarpByID(const unsigned _id) const { for (unsigned i = 0; i < getWarpCount(); ++i) { @@ -517,44 +517,44 @@ unsigned PokeGen::PokeMod::Map::getWarpByID(const unsigned _id) const return UINT_MAX; } -unsigned PokeGen::PokeMod::Map::getWarpCount() const +unsigned PokeMod::Map::getWarpCount() const { return warps.size(); } -PokeGen::PokeMod::MapWarp& PokeGen::PokeMod::Map::newWarp() +PokeMod::MapWarp& PokeMod::Map::newWarp() { warps.append(MapWarp(pokemod, getNewWarpId())); return warps[getWarpCount() - 1]; } -PokeGen::PokeMod::MapWarp& PokeGen::PokeMod::Map::newWarp(const QString& fname) +PokeMod::MapWarp& PokeMod::Map::newWarp(const QString& fname) { warps.append(MapWarp(pokemod, fname, getNewWarpId())); return warps[getWarpCount() - 1]; } -PokeGen::PokeMod::MapWarp& PokeGen::PokeMod::Map::newWarp(const MapWarp& w) +PokeMod::MapWarp& PokeMod::Map::newWarp(const MapWarp& w) { warps.append(MapWarp(pokemod, w, getNewWarpId())); return warps[getWarpCount() - 1]; } -void PokeGen::PokeMod::Map::deleteWarp(const unsigned i) throw(IndexException) +void PokeMod::Map::deleteWarp(const unsigned i) throw(IndexException) { if (getWarpCount() <= i) throw(IndexException("Map")); warps.removeAt(i); } -const PokeGen::PokeMod::MapWildList& PokeGen::PokeMod::Map::getWildList(const unsigned i) const throw(IndexException) +const PokeMod::MapWildList& PokeMod::Map::getWildList(const unsigned i) const throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); return wildLists[i]; } -unsigned PokeGen::PokeMod::Map::getWildListByID(const unsigned _id) const +unsigned PokeMod::Map::getWildListByID(const unsigned _id) const { for (unsigned i = 0; i < getWildListCount(); ++i) { @@ -564,37 +564,37 @@ unsigned PokeGen::PokeMod::Map::getWildListByID(const unsigned _id) const return UINT_MAX; } -unsigned PokeGen::PokeMod::Map::getWildListCount() const +unsigned PokeMod::Map::getWildListCount() const { return wildLists.size(); } -PokeGen::PokeMod::MapWildList& PokeGen::PokeMod::Map::newWildList() +PokeMod::MapWildList& PokeMod::Map::newWildList() { wildLists.append(MapWildList(pokemod, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -PokeGen::PokeMod::MapWildList& PokeGen::PokeMod::Map::newWildList(const QString& fname) +PokeMod::MapWildList& PokeMod::Map::newWildList(const QString& fname) { wildLists.append(MapWildList(pokemod, fname, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -PokeGen::PokeMod::MapWildList& PokeGen::PokeMod::Map::newWildList(const MapWildList& w) +PokeMod::MapWildList& PokeMod::Map::newWildList(const MapWildList& w) { wildLists.append(MapWildList(pokemod, w, getNewWildListId())); return wildLists[getWildListCount() - 1]; } -void PokeGen::PokeMod::Map::deleteWildList(const unsigned i) throw(IndexException) +void PokeMod::Map::deleteWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); wildLists.removeAt(i); } -PokeGen::PokeMod::Map& PokeGen::PokeMod::Map::operator=(const Map& rhs) +PokeMod::Map& PokeMod::Map::operator=(const Map& rhs) { if (this == &rhs) return *this; |