Merge branch 'master' into jgrpp

# Conflicts:
#	cmake/CompileFlags.cmake
#	src/cargomonitor.cpp
#	src/core/CMakeLists.txt
#	src/economy.cpp
#	src/landscape.cpp
#	src/linkgraph/flowmapper.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/linkgraphschedule.cpp
#	src/misc_gui.cpp
#	src/newgrf_generic.cpp
#	src/newgrf_storage.cpp
#	src/rail_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/station_sl.cpp
#	src/script/script_gui.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/string_func.h
#	src/terraform_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2023-06-07 21:28:46 +01:00
129 changed files with 2080 additions and 2061 deletions

View File

@@ -21,6 +21,7 @@
#include "../script_gui.h"
#include "../../settings_type.h"
#include "../../network/network.h"
#include "../../3rdparty/fmt/format.h"
#include "../../safeguards.h"
@@ -75,16 +76,6 @@ ScriptController::ScriptController(CompanyID company) :
ScriptObject::SetCompany(company);
}
ScriptController::~ScriptController()
{
for (const auto &item : this->loaded_library) {
free(item.second);
free(item.first);
}
this->loaded_library.clear();
}
/* static */ uint ScriptController::GetTick()
{
return ScriptObject::GetActiveInstance()->GetController()->ticks;
@@ -124,24 +115,22 @@ ScriptController::~ScriptController()
}
/* Internally we store libraries as 'library.version' */
char library_name[1024];
seprintf(library_name, lastof(library_name), "%s.%d", library, version);
strtolower(library_name);
std::string library_name = fmt::format("{}.{}", library, version);
/* Get the current table/class we belong to */
HSQOBJECT parent;
sq_getstackobj(vm, 1, &parent);
char fake_class[1024];
std::string fake_class;
LoadedLibraryList::iterator it = controller->loaded_library.find(library_name);
if (it != controller->loaded_library.end()) {
strecpy(fake_class, (*it).second, lastof(fake_class));
fake_class = (*it).second;
} else {
int next_number = ++controller->loaded_library_count;
/* Create a new fake internal name */
seprintf(fake_class, lastof(fake_class), "_internalNA%d", next_number);
fake_class = fmt::format("_internalNA{}", next_number);
/* Load the library in a 'fake' namespace, so we can link it to the name the user requested */
sq_pushroottable(vm);
@@ -157,7 +146,7 @@ ScriptController::~ScriptController()
sq_newslot(vm, -3, SQFalse);
sq_pop(vm, 1);
controller->loaded_library[stredup(library_name)] = stredup(fake_class);
controller->loaded_library[library_name] = fake_class;
}
/* Find the real class inside the fake class (like 'sets.Vector') */

View File

@@ -11,7 +11,7 @@
#define SCRIPT_CONTROLLER_HPP
#include "script_types.hpp"
#include "../../core/string_compare_type.hpp"
#include "../../string_func.h"
#include <map>
/**
@@ -55,11 +55,6 @@ public:
*/
ScriptController(CompanyID company);
/**
* Destructor of the ScriptController.
*/
~ScriptController();
#else
/**
* This function is called to start your script. Your script starts here. If you
@@ -215,7 +210,7 @@ public:
static HSQOBJECT Import(const char *library, const char *class_name, int version);
private:
typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList; ///< The type for loaded libraries.
typedef std::map<std::string, std::string, CaseInsensitiveComparator> LoadedLibraryList; ///< The type for loaded libraries.
uint ticks; ///< The amount of ticks we're sleeping.
LoadedLibraryList loaded_library; ///< The libraries we loaded.

View File

@@ -171,7 +171,7 @@
if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL && GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return -1;
if (IsWagon(engine_id)) return -1;
return ::Engine::Get(engine_id)->GetDisplayMaxTractiveEffort();
return ::Engine::Get(engine_id)->GetDisplayMaxTractiveEffort() / 1000;
}
/* static */ ScriptDate::Date ScriptEngine::GetDesignDate(EngineID engine_id)

View File

@@ -564,9 +564,9 @@ void ScriptList::AddList(ScriptList *list)
this->modifications++;
} else {
ScriptListMap *list_items = &list->items;
for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
this->AddItem((*iter).first);
this->SetValue((*iter).first, (*iter).second);
for (auto &it : *list_items) {
this->AddItem(it.first);
this->SetValue(it.first, it.second);
}
}
}

View File

@@ -14,6 +14,7 @@
#include "api/script_object.hpp"
#include "../textfile_gui.h"
#include "../string_func.h"
#include "../3rdparty/fmt/format.h"
#include "../safeguards.h"
@@ -24,8 +25,7 @@ void ScriptConfig::Change(const char *name, int version, bool force_exact_match,
this->info = (name == nullptr) ? nullptr : this->FindInfo(this->name, version, force_exact_match);
this->version = (info == nullptr) ? -1 : info->GetVersion();
this->is_random = is_random;
if (this->config_list != nullptr) delete this->config_list;
this->config_list = (info == nullptr) ? nullptr : new ScriptConfigItemList();
this->config_list.reset();
this->to_load_data.reset();
this->ClearConfigList();
@@ -48,12 +48,11 @@ ScriptConfig::ScriptConfig(const ScriptConfig *config)
this->name = (config->name == nullptr) ? nullptr : stredup(config->name);
this->info = config->info;
this->version = config->version;
this->config_list = nullptr;
this->is_random = config->is_random;
this->to_load_data.reset();
for (const auto &item : config->settings) {
this->settings[stredup(item.first)] = item.second;
this->settings[item.first] = item.second;
}
/* Virtual functions get called statically in constructors, so make it explicit to remove any confusion. */
@@ -64,7 +63,6 @@ ScriptConfig::~ScriptConfig()
{
free(this->name);
this->ResetSettings();
if (this->config_list != nullptr) delete this->config_list;
this->to_load_data.reset();
}
@@ -77,16 +75,13 @@ const ScriptConfigItemList *ScriptConfig::GetConfigList()
{
if (this->info != nullptr) return this->info->GetConfigList();
if (this->config_list == nullptr) {
this->config_list = new ScriptConfigItemList();
this->config_list = std::make_unique<ScriptConfigItemList>();
}
return this->config_list;
return this->config_list.get();
}
void ScriptConfig::ClearConfigList()
{
for (const auto &item : this->settings) {
free(item.first);
}
this->settings.clear();
}
@@ -99,14 +94,14 @@ void ScriptConfig::AnchorUnchangeableSettings()
}
}
int ScriptConfig::GetSetting(const char *name) const
int ScriptConfig::GetSetting(const std::string &name) const
{
const auto it = this->settings.find(name);
if (it == this->settings.end()) return this->info->GetSettingDefaultValue(name);
return (*it).second;
}
void ScriptConfig::SetSetting(const char *name, int value)
void ScriptConfig::SetSetting(const std::string &name, int value)
{
/* You can only set Script specific settings if an Script is selected. */
if (this->info == nullptr) return;
@@ -116,19 +111,11 @@ void ScriptConfig::SetSetting(const char *name, int value)
value = Clamp(value, config_item->min_value, config_item->max_value);
const auto it = this->settings.find(name);
if (it != this->settings.end()) {
(*it).second = value;
} else {
this->settings[stredup(name)] = value;
}
this->settings[name] = value;
}
void ScriptConfig::ResetSettings()
{
for (const auto &item : this->settings) {
free(item.first);
}
this->settings.clear();
}
@@ -144,7 +131,6 @@ void ScriptConfig::ResetEditableSettings(bool yet_to_start)
bool visible = _settings_client.gui.ai_developer_tools || (config_item->flags & SCRIPTCONFIG_DEVELOPER) == 0;
if (editable && visible) {
free(it->first);
it = this->settings.erase(it);
} else {
it++;
@@ -209,29 +195,16 @@ void ScriptConfig::StringToSettings(const std::string &value)
std::string ScriptConfig::SettingsToString() const
{
char string[1024];
char *last = lastof(string);
char *s = string;
*s = '\0';
if (this->settings.empty()) return {};
std::string result;
for (const auto &item : this->settings) {
char no[INT32_DIGITS_WITH_SIGN_AND_TERMINATION];
seprintf(no, lastof(no), "%d", item.second);
/* Check if the string would fit in the destination */
size_t needed_size = strlen(item.first) + 1 + strlen(no);
/* If it doesn't fit, skip the next settings */
if (s + needed_size > last) break;
s = strecat(s, item.first, last);
s = strecat(s, "=", last);
s = strecat(s, no, last);
s = strecat(s, ",", last);
fmt::format_to(std::back_inserter(result), "{}={},", item.first, item.second);
}
/* Remove the last ',', but only if at least one setting was saved. */
if (s != string) s[-1] = '\0';
return string;
/* Remove the last ','. */
result.resize(result.size() - 1);
return result;
}
const char *ScriptConfig::GetTextfile(TextfileType type, CompanyID slot) const

View File

@@ -13,7 +13,6 @@
#include <map>
#include <list>
#include "../core/smallmap_type.hpp"
#include "../core/string_compare_type.hpp"
#include "../company_type.h"
#include "../textfile_gui.h"
#include "script_instance.hpp"
@@ -30,26 +29,26 @@ enum ScriptConfigFlags {
SCRIPTCONFIG_DEVELOPER = 0x8, ///< This setting will only be visible when the Script development tools are active.
};
typedef SmallMap<int, char *> LabelMapping; ///< Map-type used to map the setting numbers to labels.
typedef std::map<int, std::string> LabelMapping; ///< Map-type used to map the setting numbers to labels.
/** Info about a single Script setting. */
struct ScriptConfigItem {
const char *name; ///< The name of the configuration setting.
const char *description; ///< The description of the configuration setting.
int min_value; ///< The minimal value this configuration setting can have.
int max_value; ///< The maximal value this configuration setting can have.
int custom_value; ///< The default value on custom difficulty setting.
int easy_value; ///< The default value on easy difficulty setting.
int medium_value; ///< The default value on medium difficulty setting.
int hard_value; ///< The default value on hard difficulty setting.
int random_deviation; ///< The maximum random deviation from the default value.
int step_size; ///< The step size in the gui.
ScriptConfigFlags flags; ///< Flags for the configuration setting.
LabelMapping *labels; ///< Text labels for the integer values.
bool complete_labels; ///< True if all values have a label.
std::string name; ///< The name of the configuration setting.
std::string description; ///< The description of the configuration setting.
int min_value = 0; ///< The minimal value this configuration setting can have.
int max_value = 1; ///< The maximal value this configuration setting can have.
int custom_value = 0; ///< The default value on custom difficulty setting.
int easy_value = 0; ///< The default value on easy difficulty setting.
int medium_value = 0; ///< The default value on medium difficulty setting.
int hard_value = 0; ///< The default value on hard difficulty setting.
int random_deviation = 0; ///< The maximum random deviation from the default value.
int step_size = 1; ///< The step size in the gui.
ScriptConfigFlags flags = SCRIPTCONFIG_NONE; ///< Flags for the configuration setting.
LabelMapping labels; ///< Text labels for the integer values.
bool complete_labels = false; ///< True if all values have a label.
};
typedef std::list<ScriptConfigItem> ScriptConfigItemList; ///< List of ScriptConfig items.
typedef std::vector<ScriptConfigItem> ScriptConfigItemList; ///< List of ScriptConfig items.
/**
* Script settings.
@@ -57,14 +56,13 @@ typedef std::list<ScriptConfigItem> ScriptConfigItemList; ///< List of ScriptCon
class ScriptConfig {
protected:
/** List with name=>value pairs of all script-specific settings */
typedef std::map<const char *, int, StringCompare> SettingValueList;
typedef std::map<std::string, int> SettingValueList;
public:
ScriptConfig() :
name(nullptr),
version(-1),
info(nullptr),
config_list(nullptr),
is_random(false),
to_load_data(nullptr)
{}
@@ -125,12 +123,12 @@ public:
* @return The (default) value of the setting, or -1 if the setting was not
* found.
*/
int GetSetting(const char *name) const;
int GetSetting(const std::string &name) const;
/**
* Set the value of a setting for this config.
*/
void SetSetting(const char *name, int value);
void SetSetting(const std::string &name, int value);
/**
* Reset all settings to their default value.
@@ -196,7 +194,7 @@ protected:
int version; ///< Version of the Script
class ScriptInfo *info; ///< ScriptInfo object for related to this Script version
SettingValueList settings; ///< List with all setting=>value pairs that are configure for this Script
ScriptConfigItemList *config_list; ///< List with all settings defined by this Script
std::unique_ptr<ScriptConfigItemList> config_list; ///< List with all settings defined by this Script
bool is_random; ///< True if the AI in this slot was randomly chosen.
std::unique_ptr<ScriptInstance::ScriptData> to_load_data; ///< Data to load after the Script start.

View File

@@ -176,9 +176,9 @@ struct ScriptListWindow : public Window {
if (this->selected == -1) {
GetConfig(slot)->Change(nullptr);
} else {
ScriptInfoList::const_iterator it = this->info_list->begin();
for (int i = 0; i < this->selected; i++) it++;
GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
ScriptInfoList::const_iterator it = this->info_list->cbegin();
std::advance(it, this->selected);
GetConfig(slot)->Change(it->second->GetName(), it->second->GetVersion());
if (_game_mode == GM_NORMAL && slot == OWNER_DEITY) Game::StartNew();
}
InvalidateWindowData(WC_GAME_OPTIONS, slot == OWNER_DEITY ? WN_GAME_OPTIONS_GS : WN_GAME_OPTIONS_AI);
@@ -392,7 +392,7 @@ struct ScriptSettingsWindow : public Window {
StringID str;
TextColour colour;
uint idx = 0;
if (StrEmpty(config_item.description)) {
if (config_item.description.empty()) {
str = STR_JUST_STRING;
colour = TC_ORANGE;
} else {
@@ -410,9 +410,11 @@ struct ScriptSettingsWindow : public Window {
} else {
DrawArrowButtons(br.left, y + button_y_offset, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, editable && current_value > config_item.min_value, editable && current_value < config_item.max_value);
}
if (config_item.labels != nullptr && config_item.labels->Contains(current_value)) {
auto config_iterator = config_item.labels.find(current_value);
if (config_iterator != config_item.labels.end()) {
SetDParam(idx++, STR_JUST_RAW_STRING);
SetDParamStr(idx++, config_item.labels->Find(current_value)->second);
SetDParamStr(idx++, config_iterator->second);
} else {
SetDParam(idx++, STR_JUST_INT);
SetDParam(idx++, current_value);
@@ -441,9 +443,7 @@ struct ScriptSettingsWindow : public Window {
int num = (pt.y - r.top) / this->line_height + this->vscroll->GetPosition();
if (num >= (int)this->visible_settings.size()) break;
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < num; i++) it++;
const ScriptConfigItem config_item = **it;
const ScriptConfigItem &config_item = *this->visible_settings[num];
if (!this->IsEditableItem(config_item)) return;
if (this->clicked_row != num) {
@@ -482,7 +482,7 @@ struct ScriptSettingsWindow : public Window {
DropDownList list;
for (int i = config_item.min_value; i <= config_item.max_value; i++) {
list.emplace_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
list.emplace_back(new DropDownListCharStringItem(config_item.labels.find(i)->second, i, false));
}
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
@@ -591,9 +591,7 @@ private:
void SetValue(int value)
{
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < this->clicked_row; i++) it++;
const ScriptConfigItem config_item = **it;
const ScriptConfigItem &config_item = *this->visible_settings[this->clicked_row];
if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
this->script_config->SetSetting(config_item.name, value);
this->SetDirty();

View File

@@ -19,19 +19,6 @@
ScriptInfo::~ScriptInfo()
{
/* Free all allocated strings */
for (const auto &item : this->config_list) {
free(item.name);
free(item.description);
if (item.labels != nullptr) {
for (auto &lbl_map : *item.labels) {
free(lbl_map.second);
}
delete item.labels;
}
}
this->config_list.clear();
free(this->author);
free(this->name);
free(this->short_name);
@@ -112,9 +99,6 @@ bool ScriptInfo::GetSettings()
SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm)
{
ScriptConfigItem config;
memset(&config, 0, sizeof(config));
config.max_value = 1;
config.step_size = 1;
uint items = 0;
/* Read the table, and find all properties we care about */
@@ -127,21 +111,17 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm)
if (strcmp(key, "name") == 0) {
const SQChar *sqvalue;
if (SQ_FAILED(sq_getstring(vm, -1, &sqvalue))) return SQ_ERROR;
char *name = stredup(sqvalue);
char *s;
StrMakeValidInPlace(name);
/* Don't allow '=' and ',' in configure setting names, as we need those
* 2 chars to nicely store the settings as a string. */
while ((s = strchr(name, '=')) != nullptr) *s = '_';
while ((s = strchr(name, ',')) != nullptr) *s = '_';
config.name = name;
auto replace_with_underscore = [](auto c) { return c == '=' || c == ','; };
config.name = StrMakeValid(sqvalue);
std::replace_if(config.name.begin(), config.name.end(), replace_with_underscore, '_');
items |= 0x001;
} else if (strcmp(key, "description") == 0) {
const SQChar *sqdescription;
if (SQ_FAILED(sq_getstring(vm, -1, &sqdescription))) return SQ_ERROR;
config.description = stredup(sqdescription);
StrMakeValidInPlace(const_cast<char *>(config.description));
config.description = StrMakeValid(sqdescription);
items |= 0x002;
} else if (strcmp(key, "min_value") == 0) {
SQInteger res;
@@ -218,7 +198,7 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm)
return SQ_ERROR;
}
this->config_list.push_back(config);
this->config_list.emplace_back(config);
return 0;
}
@@ -230,7 +210,7 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
ScriptConfigItem *config = nullptr;
for (auto &item : this->config_list) {
if (strcmp(item.name, setting_name) == 0) config = &item;
if (item.name == setting_name) config = &item;
}
if (config == nullptr) {
@@ -239,9 +219,7 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
this->engine->ThrowError(error);
return SQ_ERROR;
}
if (config->labels != nullptr) return SQ_ERROR;
config->labels = new LabelMapping;
if (!config->labels.empty()) return SQ_ERROR;
/* Read the table and find all labels */
sq_pushnull(vm);
@@ -262,8 +240,7 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
int key = atoi(key_string) * sign;
StrMakeValidInPlace(const_cast<char *>(label));
/* !Contains() prevents stredup from leaking. */
if (!config->labels->Contains(key)) config->labels->Insert(key, stredup(label));
config->labels[key] = label;
sq_pop(vm, 2);
}
@@ -272,7 +249,7 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
/* Check labels for completeness */
config->complete_labels = true;
for (int value = config->min_value; value <= config->max_value; value++) {
if (!config->labels->Contains(value)) {
if (config->labels.find(value) == config->labels.end()) {
config->complete_labels = false;
break;
}
@@ -286,18 +263,18 @@ const ScriptConfigItemList *ScriptInfo::GetConfigList() const
return &this->config_list;
}
const ScriptConfigItem *ScriptInfo::GetConfigItem(const char *name) const
const ScriptConfigItem *ScriptInfo::GetConfigItem(const std::string &name) const
{
for (const auto &item : this->config_list) {
if (strcmp(item.name, name) == 0) return &item;
if (item.name == name) return &item;
}
return nullptr;
}
int ScriptInfo::GetSettingDefaultValue(const char *name) const
int ScriptInfo::GetSettingDefaultValue(const std::string &name) const
{
for (const auto &item : this->config_list) {
if (strcmp(item.name, name) != 0) continue;
if (item.name != name) continue;
/* The default value depends on the difficulty level */
switch (GetGameSettings().script.settings_profile) {
case SP_EASY: return item.easy_value;

View File

@@ -122,7 +122,7 @@ public:
/**
* Get the description of a certain Script config option.
*/
const ScriptConfigItem *GetConfigItem(const char *name) const;
const ScriptConfigItem *GetConfigItem(const std::string &name) const;
/**
* Set a setting.
@@ -137,7 +137,7 @@ public:
/**
* Get the default value for a setting.
*/
int GetSettingDefaultValue(const char *name) const;
int GetSettingDefaultValue(const std::string &name) const;
/**
* Can this script be selected by developers only?

View File

@@ -653,7 +653,7 @@ bool ScriptInstance::IsPaused()
}
if (std::holds_alternative<std::string>(value)) {
sq_pushstring(vm, std::get<std::string>(value).c_str(), -1);
sq_pushstring(vm, std::get<std::string>(value), -1);
return true;
}

View File

@@ -20,6 +20,7 @@
#include "../network/network_content.h"
#include "../3rdparty/md5/md5.h"
#include "../tar_type.h"
#include "../3rdparty/fmt/format.h"
#include "../safeguards.h"
@@ -84,12 +85,8 @@ void ScriptScanner::RescanDir()
void ScriptScanner::Reset()
{
for (const auto &item : this->info_list) {
free(item.first);
delete item.second;
}
for (const auto &item : this->info_single_list) {
free(item.first);
}
this->info_list.clear();
this->info_single_list.clear();
@@ -97,12 +94,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) {
@@ -132,15 +125,16 @@ void ScriptScanner::RegisterScript(ScriptInfo *info)
return;
}
this->info_list[stredup(script_name)] = info;
this->info_list[script_name] = info;
if (!info->IsDeveloperOnly() || _settings_client.gui.ai_developer_tools) {
/* Add the script to the 'unique' script list, where only the highest version
* of the script is registered. */
if (this->info_single_list.find(script_original_name) == this->info_single_list.end()) {
this->info_single_list[stredup(script_original_name)] = info;
} else if (this->info_single_list[script_original_name]->GetVersion() < info->GetVersion()) {
auto it = this->info_single_list.find(script_original_name);
if (it == this->info_single_list.end()) {
this->info_single_list[script_original_name] = info;
} else if (it->second->GetVersion() < info->GetVersion()) {
it->second = info;
}
}
}

View File

@@ -12,9 +12,9 @@
#include <map>
#include "../fileio_func.h"
#include "../core/string_compare_type.hpp"
#include "../string_func.h"
typedef std::map<const char *, class ScriptInfo *, StringCompare> ScriptInfoList; ///< Type for the list of scripts.
typedef std::map<std::string, class ScriptInfo *, CaseInsensitiveComparator> ScriptInfoList; ///< Type for the list of scripts.
/** Scanner to help finding scripts. */
class ScriptScanner : public FileScanner {
@@ -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.