mirror of https://github.com/AxioDL/metaforce.git
WeaponCommon: Use string_view with get_asset_id_from_name()
Internal functions expect a std::string_view, so we can just make the parameter a string_view as well to push the responsibility outwards into the caller.
This commit is contained in:
parent
ff6c1fdd3d
commit
fa0dcf5b12
|
@ -134,10 +134,11 @@ void do_sound_event(std::pair<u16, CSfxHandle>& sfxHandle, float& pitch, bool do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CAssetId get_asset_id_from_name(const char* name) {
|
CAssetId get_asset_id_from_name(std::string_view name) {
|
||||||
const SObjectTag* tag = g_ResFactory->GetResourceIdByName(name);
|
const SObjectTag* tag = g_ResFactory->GetResourceIdByName(name);
|
||||||
if (!tag)
|
if (!tag) {
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
return tag->id;
|
return tag->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
|
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
|
||||||
|
@ -83,7 +84,7 @@ void get_token_vector(const CAnimData& animData, int animIdx, std::vector<CToken
|
||||||
void do_sound_event(std::pair<u16, CSfxHandle>& sfxHandle, float& pitch, bool doPitchBend, u32 soundId, float weight,
|
void do_sound_event(std::pair<u16, CSfxHandle>& sfxHandle, float& pitch, bool doPitchBend, u32 soundId, float weight,
|
||||||
u32 flags, float falloff, float maxDist, float minVol, float maxVol,
|
u32 flags, float falloff, float maxDist, float minVol, float maxVol,
|
||||||
const zeus::CVector3f& posToCam, const zeus::CVector3f& pos, TAreaId aid, CStateManager& mgr);
|
const zeus::CVector3f& posToCam, const zeus::CVector3f& pos, TAreaId aid, CStateManager& mgr);
|
||||||
CAssetId get_asset_id_from_name(const char* name);
|
CAssetId get_asset_id_from_name(std::string_view name);
|
||||||
CPlayerState::EPlayerSuit get_current_suit(const CStateManager& mgr);
|
CPlayerState::EPlayerSuit get_current_suit(const CStateManager& mgr);
|
||||||
CSfxHandle play_sfx(u16 sfx, bool underwater, bool looped, float pan);
|
CSfxHandle play_sfx(u16 sfx, bool underwater, bool looped, float pan);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue