Add more const correctness

#2467
This commit is contained in:
Wojtek Figat
2024-04-22 22:53:27 +02:00
parent 515ee96a31
commit b92fbcb3bc
17 changed files with 28 additions and 28 deletions

View File

@@ -840,7 +840,7 @@ void ScriptingObjectReferenceBase::OnDeleted(ScriptingObject* obj)
}
}
ScriptingObject* Scripting::FindObject(Guid id, MClass* type)
ScriptingObject* Scripting::FindObject(Guid id, const MClass* type)
{
if (!id.IsValid())
return nullptr;
@@ -894,7 +894,7 @@ ScriptingObject* Scripting::FindObject(Guid id, MClass* type)
return nullptr;
}
ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type)
ScriptingObject* Scripting::TryFindObject(Guid id, const MClass* type)
{
if (!id.IsValid())
return nullptr;
@@ -930,7 +930,7 @@ ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type)
return result;
}
ScriptingObject* Scripting::TryFindObject(MClass* type)
ScriptingObject* Scripting::TryFindObject(const MClass* type)
{
if (type == nullptr)
return nullptr;
@@ -1000,7 +1000,7 @@ bool Scripting::IsEveryAssemblyLoaded()
return true;
}
bool Scripting::IsTypeFromGameScripts(MClass* type)
bool Scripting::IsTypeFromGameScripts(const MClass* type)
{
const auto binaryModule = ManagedBinaryModule::GetModule(type ? type->GetAssembly() : nullptr);
return binaryModule && binaryModule != GetBinaryModuleCorlib() && binaryModule != GetBinaryModuleFlaxEngine();

View File

@@ -133,14 +133,14 @@ public:
/// <param name="id">The object unique identifier.</param>
/// <param name="type">The type of the object to find (optional).</param>
/// <returns>The found object or null if missing.</returns>
static ScriptingObject* FindObject(Guid id, MClass* type = nullptr);
static ScriptingObject* FindObject(Guid id, const MClass* type = nullptr);
/// <summary>
/// Tries to find the object by the given class.
/// </summary>
/// <param name="type">The type of the object to find.</param>
/// <returns>The found object or null if missing.</returns>
static ScriptingObject* TryFindObject(MClass* type);
static ScriptingObject* TryFindObject(const MClass* type);
/// <summary>
/// Tries to find the object by the given identifier.
@@ -159,7 +159,7 @@ public:
/// <param name="id">The object unique identifier.</param>
/// <param name="type">The type of the object to find (optional).</param>
/// <returns>The found object or null if missing.</returns>
static ScriptingObject* TryFindObject(Guid id, MClass* type = nullptr);
static ScriptingObject* TryFindObject(Guid id, const MClass* type = nullptr);
/// <summary>
/// Finds the object by the given managed instance handle. Searches only registered scene objects.
@@ -189,7 +189,7 @@ public:
/// <summary>
/// Returns true if given type is from one of the game scripts assemblies.
/// </summary>
static bool IsTypeFromGameScripts(MClass* type);
static bool IsTypeFromGameScripts(const MClass* type);
static void ProcessBuildInfoPath(String& path, const String& projectFolderPath);