Skip to content

Commit

Permalink
Refactor|DMU: Use de::MapElement
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 14, 2013
1 parent 3517eca commit 4c69ba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 0 additions & 8 deletions doomsday/engine/include/map/p_dmu.h
Expand Up @@ -110,14 +110,6 @@ void DMU_SetValue(valuetype_t valueType, void *dst, setargs_t const *args, uint
*/
void DMU_GetValue(valuetype_t valueType, void const *src, setargs_t *args, uint index);

#ifndef NDEBUG
# define ASSERT_DMU_TYPE(ptr, dmuType) \
if(!ptr || ((runtime_mapdata_header_t *)ptr)->type != dmuType) \
Con_Error("ASSERT_DMU_TYPE failure on line %i in "__FILE__". " #ptr " is not %s.\n", __LINE__, DMU_Str(dmuType));
#else
# define ASSERT_DMU_TYPE(ptr, dmuType)
#endif

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
7 changes: 4 additions & 3 deletions doomsday/engine/src/map/p_dmu.cpp
Expand Up @@ -150,17 +150,18 @@ char const *DMU_Str(uint prop)
return propStr;
}

#undef DMU_GetType
int DMU_GetType(void const *ptr)
{
if(!ptr) return DMU_NONE;

int type = P_DummyType((void *)ptr);
if(type != DMU_NONE) return type;

type = ((runtime_mapdata_header_t const *)ptr)->type;
de::MapElement const *elem = reinterpret_cast<de::MapElement const *>(ptr);

// Make sure it's valid.
switch(type)
switch(elem->type())
{
case DMU_VERTEX:
case DMU_HEDGE:
Expand All @@ -171,7 +172,7 @@ int DMU_GetType(void const *ptr)
case DMU_PLANE:
case DMU_BSPNODE:
case DMU_MATERIAL:
return type;
return elem->type();

default: break; // Unknown.
}
Expand Down

0 comments on commit 4c69ba3

Please sign in to comment.