Skip to content

Commit

Permalink
Merge branch 'stable' into protobreak
Browse files Browse the repository at this point in the history
  • Loading branch information
bcahue committed Dec 13, 2024
2 parents adaf6f0 + 3194b07 commit e2ab057
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/g_umapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ int ParseStandardUmapInfoProperty(OScanner& os, level_pwad_info_t* mape)
else
{
const std::string actor_name = os.getToken();
const mobjtype_t i = P_NameToMobj(actor_name);
const mobjtype_t i = P_INameToMobj(actor_name);
if (i == MT_NULL)
{
os.error("Unknown thing type %s", os.getToken().c_str());
Expand Down
20 changes: 20 additions & 0 deletions common/infomap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,26 @@ mobjtype_t P_NameToMobj(const std::string& name)
return it->second;
}

/**
* @brief Convert a UMAPINFO/ZDoom class name to a MT Mobj index. Case insensitive for UMAPINFO
*/
mobjtype_t P_INameToMobj(const std::string& name)
{
if (::g_MonsterMap.empty())
{
InitMap();
}

for (MobjMap::iterator it = ::g_MonsterMap.begin(); it != ::g_MonsterMap.end(); ++it)
{
if (iequals(it->first, name))
{
return it->second;
}
}
return MT_NULL;
}

std::string P_MobjToName(const mobjtype_t name)
{
if (::g_MonsterMap.empty())
Expand Down
1 change: 1 addition & 0 deletions common/infomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
#include "info.h"

mobjtype_t P_NameToMobj(const std::string& name);
mobjtype_t P_INameToMobj(const std::string& name);
weapontype_t P_NameToWeapon(const std::string& name);
std::string P_MobjToName(const mobjtype_t name);

0 comments on commit e2ab057

Please sign in to comment.