CGameTemplate: Mark getter functions as const

These don't modify internal class state, so we can mark them as const.
This commit is contained in:
Lioncash 2020-06-14 18:58:03 -04:00
parent 15708b8624
commit f942ad6551
2 changed files with 14 additions and 14 deletions

View File

@ -159,7 +159,7 @@ CScriptTemplate* CGameTemplate::TemplateByIndex(uint32 Index)
return (std::next(it, Index))->second.pTemplate.get();
}
SState CGameTemplate::StateByID(uint32 StateID)
SState CGameTemplate::StateByID(uint32 StateID) const
{
const auto iter = mStates.find(StateID);
@ -169,19 +169,19 @@ SState CGameTemplate::StateByID(uint32 StateID)
return SState(iter->first, iter->second);
}
SState CGameTemplate::StateByID(const CFourCC& State)
SState CGameTemplate::StateByID(const CFourCC& State) const
{
return StateByID(State.ToLong());
}
SState CGameTemplate::StateByIndex(uint32 Index)
SState CGameTemplate::StateByIndex(uint32 Index) const
{
auto Iter = mStates.begin();
Iter = std::next(Iter, Index);
return SState(Iter->first, Iter->second);
}
SMessage CGameTemplate::MessageByID(uint32 MessageID)
SMessage CGameTemplate::MessageByID(uint32 MessageID) const
{
const auto iter = mMessages.find(MessageID);
@ -191,12 +191,12 @@ SMessage CGameTemplate::MessageByID(uint32 MessageID)
return SMessage(iter->first, iter->second);
}
SMessage CGameTemplate::MessageByID(const CFourCC& MessageID)
SMessage CGameTemplate::MessageByID(const CFourCC& MessageID) const
{
return MessageByID(MessageID.ToLong());
}
SMessage CGameTemplate::MessageByIndex(uint32 Index)
SMessage CGameTemplate::MessageByIndex(uint32 Index) const
{
auto Iter = mMessages.begin();
Iter = std::next(Iter, Index);
@ -225,7 +225,7 @@ IProperty* CGameTemplate::FindPropertyArchetype(const TString& kTypeName)
return Path.pTemplate.get();
}
TString CGameTemplate::GetPropertyArchetypeFilePath(const TString& kTypeName)
TString CGameTemplate::GetPropertyArchetypeFilePath(const TString& kTypeName) const
{
const auto it = mPropertyTemplates.find(kTypeName);
ASSERT(it != mPropertyTemplates.cend());

View File

@ -94,14 +94,14 @@ public:
CScriptTemplate* TemplateByID(uint32 ObjectID);
CScriptTemplate* TemplateByID(const CFourCC& ObjectID);
CScriptTemplate* TemplateByIndex(uint32 Index);
SState StateByID(uint32 StateID);
SState StateByID(const CFourCC& StateID);
SState StateByIndex(uint32 Index);
SMessage MessageByID(uint32 MessageID);
SMessage MessageByID(const CFourCC& MessageID);
SMessage MessageByIndex(uint32 Index);
SState StateByID(uint32 StateID) const;
SState StateByID(const CFourCC& StateID) const;
SState StateByIndex(uint32 Index) const;
SMessage MessageByID(uint32 MessageID) const;
SMessage MessageByID(const CFourCC& MessageID) const;
SMessage MessageByIndex(uint32 Index) const;
IProperty* FindPropertyArchetype(const TString& kTypeName);
TString GetPropertyArchetypeFilePath(const TString& kTypeName);
TString GetPropertyArchetypeFilePath(const TString& kTypeName) const;
bool RenamePropertyArchetype(const TString& kTypeName, const TString& kNewTypeName);
CScriptTemplate* FindMiscTemplate(const TString& kTemplateName);
TString GetGameDirectory() const;