summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-04 19:06:59 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 19:06:59 +0300
commitb844884ba160f7a0204382cbbce4c98ecae1139b (patch)
tree6cc2e3a3c539a45563cf0986791817f5f44de3a0 /src/resources/mapreader.cpp
parent0a731a66a23061f24f83ce093f8d516497c17144 (diff)
downloadmv-b844884ba160f7a0204382cbbce4c98ecae1139b.tar.gz
mv-b844884ba160f7a0204382cbbce4c98ecae1139b.tar.bz2
mv-b844884ba160f7a0204382cbbce4c98ecae1139b.tar.xz
mv-b844884ba160f7a0204382cbbce4c98ecae1139b.zip
Move collisiontype into enums directory.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index d7e182cac..809e19e1f 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -30,6 +30,7 @@
#include "const/resources/map/map.h"
+#include "enums/resources/map/collisiontype.h"
#include "enums/resources/map/mapitemtype.h"
#include "enums/resources/map/maplayertype.h"
@@ -560,29 +561,41 @@ inline static void setTile(Map *const map,
{
if (map->getVersion() >= 1)
{
- switch (gid - set->getFirstGid())
+ const int collisionId = gid - set->getFirstGid();
+ CollisionTypeT type;
+ if (collisionId < 0 ||
+ collisionId >= CAST_S32(CollisionType::COLLISION_MAX))
{
- case Map::COLLISION_EMPTY:
+ type = CollisionType::COLLISION_EMPTY;
+ }
+ else
+ {
+ type = static_cast<CollisionTypeT>(collisionId);
+ }
+ switch (type)
+ {
+ case CollisionType::COLLISION_EMPTY:
map->addBlockMask(x, y, BlockType::GROUND);
break;
- case Map::COLLISION_WALL:
+ case CollisionType::COLLISION_WALL:
map->addBlockMask(x, y, BlockType::WALL);
break;
- case Map::COLLISION_AIR:
+ case CollisionType::COLLISION_AIR:
map->addBlockMask(x, y, BlockType::AIR);
break;
- case Map::COLLISION_WATER:
+ case CollisionType::COLLISION_WATER:
map->addBlockMask(x, y, BlockType::WATER);
break;
- case Map::COLLISION_GROUNDTOP:
+ case CollisionType::COLLISION_GROUNDTOP:
map->addBlockMask(x, y, BlockType::GROUNDTOP);
break;
- case Map::COLLISION_PLAYER_WALL:
+ case CollisionType::COLLISION_PLAYER_WALL:
map->addBlockMask(x, y, BlockType::PLAYERWALL);
break;
- case Map::COLLISION_MONSTER_WALL:
+ case CollisionType::COLLISION_MONSTER_WALL:
map->addBlockMask(x, y, BlockType::MONSTERWALL);
break;
+ case CollisionType::COLLISION_MAX:
default:
break;
}