Codechange: use std::string for getting a script's name

This commit is contained in:
Rubidium
2023-05-05 14:00:00 +02:00
committed by rubidium42
parent f1fb6c95fe
commit 72082aa7d3
6 changed files with 17 additions and 19 deletions

View File

@@ -97,12 +97,8 @@ void ScriptScanner::Reset()
void ScriptScanner::RegisterScript(ScriptInfo *info)
{
char script_original_name[1024];
this->GetScriptName(info, script_original_name, lastof(script_original_name));
strtolower(script_original_name);
char script_name[1024];
seprintf(script_name, lastof(script_name), "%s.%d", script_original_name, info->GetVersion());
std::string script_original_name = this->GetScriptName(info);
std::string script_name = fmt::format("{}.{}", script_original_name, info->GetVersion());
/* Check if GetShortName follows the rules */
if (strlen(info->GetShortName()) != 4) {

View File

@@ -99,7 +99,7 @@ protected:
/**
* Get the script name how to store the script in memory.
*/
virtual void GetScriptName(ScriptInfo *info, char *name, const char *last) = 0;
virtual std::string GetScriptName(ScriptInfo *info) = 0;
/**
* Get the filename to scan for this type of script.