2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 09:47:43 +00:00

string_view refactor

This commit is contained in:
Jack Andersen
2017-11-12 20:19:18 -10:00
parent 742ab2514f
commit f7ec7bdc0c
345 changed files with 907 additions and 921 deletions

View File

@@ -42,10 +42,10 @@ CStateMachine::CStateMachine(CInputStream& in)
#endif
}
s32 CStateMachine::GetStateIndex(const std::string& state) const
s32 CStateMachine::GetStateIndex(std::string_view state) const
{
auto it = std::find_if(x0_states.begin(), x0_states.end(), [&state](const CAiState& st) -> bool {
return (strncmp(st.GetName(), state.c_str(), 31) == 0);
return (strncmp(st.GetName(), state.data(), 31) == 0);
});
if (it == x0_states.end())
return 0;
@@ -61,7 +61,7 @@ void CStateMachineState::SetState(CStateManager &, CAi &, s32 idx)
{
}
void CStateMachineState::SetState(CStateManager& mgr, CAi& ai, const CStateMachine* machine, const std::string& state)
void CStateMachineState::SetState(CStateManager& mgr, CAi& ai, const CStateMachine* machine, std::string_view state)
{
if (!machine)
return;