Skip to content

Commit

Permalink
refactor 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-A-Rocha committed Oct 29, 2024
1 parent f182db2 commit cb928f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
19 changes: 19 additions & 0 deletions Shared/mods/deathmatch/logic/CLodModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,22 @@ std::unique_ptr<const std::map<std::uint32_t, std::uint32_t>> CLodModels::LOD_MO
{8255, 8159}, {8253, 8252}, {8249, 8248}, {8245, 8025}, {8219, 8222}, {8217, 8223}, {8215, 8226}, {7450, 7814}, {7482, 7771},
{7514, 7680}, {7546, 7732}, {8213, 8224}, {8201, 8239}, {5511, 5557}, {5503, 5534}
});


std::uint32_t CLodModels::GetObjectLODModel(std::uint32_t objectID)
{
const auto it = LOD_MODELS->find(objectID);
if (it != LOD_MODELS->end())
return it->second;
return 0;
}

std::uint32_t CLodModels::GetObjectModelOfLOD(std::uint32_t lodModelID)
{
for (const auto& [objectID, lodModel] : *LOD_MODELS)
{
if (lodModel == lodModelID)
return objectID;
}
return 0;
}
11 changes: 2 additions & 9 deletions Shared/mods/deathmatch/logic/CLodModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@
class CLodModels
{
public:
static std::uint32_t GetObjectLODModel(std::uint32_t objectID)
{
const auto it = LOD_MODELS->find(objectID);
if (it != LOD_MODELS->end())
{
return it->second;
}
return 0;
};
static std::uint32_t GetObjectLODModel(std::uint32_t objectID);
static std::uint32_t GetObjectModelOfLOD(std::uint32_t lodModelID);

private:
// Static pointer to a map that is initialized in the .cpp file
Expand Down

0 comments on commit cb928f1

Please sign in to comment.