Skip to content

Commit

Permalink
libhexen: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Feb 8, 2014
1 parent 44cb574 commit 0dd755f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/fi_lib.c
Expand Up @@ -105,7 +105,7 @@ static void initStateConditions(fi_state_t *s)
{
Uri *nextMapUri = G_ComposeMapUri(gameEpisode, nextMap);

mapinfo_t *curMapInfo = P_CurrentMapInfo();
mapinfo_t *curMapInfo = P_MapInfo(0/*current map*/);
mapinfo_t *nextMapInfo = P_MapInfo(nextMapUri);
if(curMapInfo && nextMapInfo)
{
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -1155,7 +1155,7 @@ static void printMapBanner(void)
{
char buf[64];
#if __JHEXEN__
mapinfo_t const *mapInfo = P_CurrentMapInfo();
mapinfo_t const *mapInfo = P_MapInfo(0/*current map*/);
int warpNum = (mapInfo? mapInfo->warpTrans : -1);
dd_snprintf(buf, 64, "Map %u (%u): " DE2_ESC(b) "%s", warpNum + 1, gameMap + 1, title);
#else
Expand Down Expand Up @@ -1256,7 +1256,7 @@ static void initFogForMap(ddmapinfo_t *mapInfo)

#if __JHEXEN__
{
mapinfo_t const *mapInfo = P_CurrentMapInfo();
mapinfo_t const *mapInfo = P_MapInfo(0/*current map*/);
if(mapInfo)
{
int fadeTable = mapInfo->fadeTable;
Expand Down Expand Up @@ -1766,7 +1766,7 @@ void G_PlayerLeaveMap(int player)
{
Uri *nextMapUri = G_ComposeMapUri(gameEpisode, nextMap);

newCluster = (P_CurrentMapInfo()->cluster != P_MapInfo(nextMapUri)->cluster);
newCluster = (P_MapInfo(0/*current map*/)->cluster != P_MapInfo(nextMapUri)->cluster);

Uri_Delete(nextMapUri);
}
Expand Down Expand Up @@ -2602,7 +2602,7 @@ void G_DoLeaveMap(void)
// Same cluster?
{
Uri *nextMapUri = G_ComposeMapUri(gameEpisode, nextMap);
if(P_CurrentMapInfo()->cluster == P_MapInfo(nextMapUri)->cluster)
if(P_MapInfo(0/*current map*/)->cluster == P_MapInfo(nextMapUri)->cluster)
{
if(!gameRules.deathmatch)
{
Expand Down
10 changes: 4 additions & 6 deletions doomsday/plugins/hexen/include/p_mapinfo.h
Expand Up @@ -55,15 +55,13 @@ extern "C" {
void MapInfoParser(Str const *path);

/**
* Returns MAPINFO data for the specified @a mapUri; otherwise @c 0 (not found).
* @param mapUri Identifier of the map to lookup info for. Can be @c 0 in which
* case the info for the @em current map will be returned (if set).
*
* @return MAPINFO data for the specified @a mapUri; otherwise @c 0 (not found).
*/
mapinfo_t *P_MapInfo(Uri const *mapUri);

/**
* Returns MAPINFO data for the @em current map.
*/
mapinfo_t *P_CurrentMapInfo(void);

#define P_INVALID_LOGICAL_MAP 0xffffffff

/**
Expand Down
8 changes: 2 additions & 6 deletions doomsday/plugins/hexen/src/p_mapinfo.cpp
Expand Up @@ -245,7 +245,8 @@ void MapInfoParser(Str const *path)

mapinfo_t *P_MapInfo(Uri const *mapUri)
{
DENG_ASSERT(mapUri != 0);
if(!mapUri) mapUri = gameMapUri;

std::string mapPath(Str_Text(Uri_Compose(mapUri)));
MapInfos::iterator found = mapInfos.find(mapPath);
if(found != mapInfos.end())
Expand All @@ -255,11 +256,6 @@ mapinfo_t *P_MapInfo(Uri const *mapUri)
return 0;
}

mapinfo_t *P_CurrentMapInfo()
{
return P_MapInfo(gameMapUri);
}

uint P_TranslateMapIfExists(uint map)
{
uint matchedWithoutCluster = P_INVALID_LOGICAL_MAP;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/hexen/src/p_spec.c
Expand Up @@ -1072,7 +1072,7 @@ void P_ForceLightning(void)
void P_InitLightning(void)
{
int i, secCount;
mapinfo_t const *mapInfo = P_CurrentMapInfo();
mapinfo_t const *mapInfo = P_MapInfo(0/*current map*/);

if(!mapInfo || !mapInfo->lightning)
{
Expand Down

0 comments on commit 0dd755f

Please sign in to comment.