Skip to content

Commit

Permalink
feat: add locate command functions (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix authored Sep 28, 2023
1 parent c87c3b3 commit d1eb276
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CommonLibSF/include/RE/S/Script.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,28 @@ namespace RE
return std::span{ *chunk };
}

inline static SCRIPT_FUNCTION* LocateConsoleCommand(const std::string_view a_longName)
{
for (auto& command : GetConsoleCommands()) {
if (std::strlen(command.functionName) == a_longName.size())
if (_strnicmp(command.functionName, a_longName.data(), a_longName.size()) == 0)
return std::addressof(command);
}

return nullptr;
}

inline static SCRIPT_FUNCTION* LocateScriptCommand(const std::string_view a_longName)
{
for (auto& command : GetScriptCommands()) {
if (std::strlen(command.functionName) == a_longName.size())
if (_strnicmp(command.functionName, a_longName.data(), a_longName.size()) == 0)
return std::addressof(command);
}

return nullptr;
}

// members
SCRIPT_HEADER header; // 00
char* text; // 14
Expand Down

0 comments on commit d1eb276

Please sign in to comment.