diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-28 00:59:52 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-28 00:59:52 +0000 |
| commit | 4d705de01059eb04b19db68a11cea1c57084c57a (patch) | |
| tree | fa6deaba07d19041c21deca010b006931dc6abe0 /pokemod/Map.cpp | |
| parent | 8cbe19a3e1845657ccdfddbd3c4fffcaadb9ff55 (diff) | |
[FIX] Typechart now works
[FIX] Matrix fixed up
[FIX] Pokemod map widget fixed up
[FIX] FractionWidget sets stuff on ctor
[FIX] Assertion used in pokemod rather than returning NULL
[FIX] Fixed a bad compare in Type
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@180 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Map.cpp')
| -rw-r--r-- | pokemod/Map.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index d66552e6..8c388861 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -262,15 +262,13 @@ Point Map::size() const const MapEffect* Map::effect(const int index) const { - if (effectCount() <= index) - return NULL; + Q_ASSERT(index < effectCount()); return m_effects.at(index); } MapEffect* Map::effect(const int index) { - if (effectCount() <= index) - return NULL; + Q_ASSERT(index < effectCount()); return m_effects[index]; } @@ -322,8 +320,7 @@ MapEffect* Map::newEffect(MapEffect* effect) void Map::deleteEffect(const int index) { - if (effectCount() <= index) - return; + Q_ASSERT(index < effectCount()); delete m_effects[index]; m_effects.removeAt(index); } @@ -343,15 +340,13 @@ int Map::newEffectId() const const MapTrainer* Map::trainer(const int index) const { - if (trainerCount() <= index) - return NULL; + Q_ASSERT(index < trainerCount()); return m_trainers.at(index); } MapTrainer* Map::trainer(const int index) { - if (trainerCount() <= index) - return NULL; + Q_ASSERT(index < trainerCount()); return m_trainers[index]; } @@ -403,8 +398,7 @@ MapTrainer* Map::newTrainer(MapTrainer* trainer) void Map::deleteTrainer(const int index) { - if (trainerCount() <= index) - return; + Q_ASSERT(index < trainerCount()); delete m_trainers[index]; m_trainers.removeAt(index); } @@ -424,15 +418,13 @@ int Map::newTrainerId() const const MapWarp* Map::warp(const int index) const { - if (warpCount() <= index) - return NULL; + Q_ASSERT(index < warpCount()); return m_warps.at(index); } MapWarp* Map::warp(const int index) { - if (warpCount() <= index) - return NULL; + Q_ASSERT(index < warpCount()); return m_warps[index]; } @@ -484,8 +476,7 @@ MapWarp* Map::newWarp(MapWarp* warp) void Map::deleteWarp(const int index) { - if (warpCount() <= index) - return; + Q_ASSERT(index < warpCount()); delete m_warps[index]; m_warps.removeAt(index); } @@ -505,15 +496,13 @@ int Map::newWarpId() const const MapWildList* Map::wildList(const int index) const { - if (wildListCount() <= index) - return NULL; + Q_ASSERT(index < wildListCount()); return m_wildLists.at(index); } MapWildList* Map::wildList(const int index) { - if (wildListCount() <= index) - return NULL; + Q_ASSERT(index < wildListCount()); return m_wildLists[index]; } @@ -565,8 +554,7 @@ MapWildList* Map::newWildList(MapWildList* wildList) void Map::deleteWildList(const int index) { - if (wildListCount() <= index) - return; + Q_ASSERT(index < wildListCount()); delete m_wildLists[index]; m_wildLists.removeAt(index); } |
