mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use C++11 constructs for for-each loops (#8432)
parent
9add62796c
commit
f66baa444f
|
@ -87,8 +87,8 @@ struct AIListWindow : public Window {
|
||||||
if (GetConfig(slot)->HasScript()) {
|
if (GetConfig(slot)->HasScript()) {
|
||||||
ScriptInfo *info = GetConfig(slot)->GetInfo();
|
ScriptInfo *info = GetConfig(slot)->GetInfo();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ScriptInfoList::const_iterator it = this->info_list->begin(); it != this->info_list->end(); it++, i++) {
|
for (const auto &item : *this->info_list) {
|
||||||
if ((*it).second == info) {
|
if (item.second == info) {
|
||||||
this->selected = i;
|
this->selected = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -127,10 +127,11 @@ struct AIListWindow : public Window {
|
||||||
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, this->slot == OWNER_DEITY ? STR_AI_CONFIG_NONE : STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_ORANGE);
|
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, this->slot == OWNER_DEITY ? STR_AI_CONFIG_NONE : STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_ORANGE);
|
||||||
y += this->line_height;
|
y += this->line_height;
|
||||||
}
|
}
|
||||||
ScriptInfoList::const_iterator it = this->info_list->begin();
|
int i = 1;
|
||||||
for (int i = 1; it != this->info_list->end(); i++, it++) {
|
for (const auto &item : *this->info_list) {
|
||||||
|
i++;
|
||||||
if (this->vscroll->IsVisible(i)) {
|
if (this->vscroll->IsVisible(i)) {
|
||||||
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, (*it).second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_ORANGE);
|
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, item.second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_ORANGE);
|
||||||
y += this->line_height;
|
y += this->line_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,9 +139,10 @@ struct AIListWindow : public Window {
|
||||||
}
|
}
|
||||||
case WID_AIL_INFO_BG: {
|
case WID_AIL_INFO_BG: {
|
||||||
AIInfo *selected_info = nullptr;
|
AIInfo *selected_info = nullptr;
|
||||||
ScriptInfoList::const_iterator it = this->info_list->begin();
|
int i = 1;
|
||||||
for (int i = 1; selected_info == nullptr && it != this->info_list->end(); i++, it++) {
|
for (const auto &item : *this->info_list) {
|
||||||
if (this->selected == i - 1) selected_info = static_cast<AIInfo *>((*it).second);
|
i++;
|
||||||
|
if (this->selected == i - 1) selected_info = static_cast<AIInfo *>(item.second);
|
||||||
}
|
}
|
||||||
/* Some info about the currently selected AI. */
|
/* Some info about the currently selected AI. */
|
||||||
if (selected_info != nullptr) {
|
if (selected_info != nullptr) {
|
||||||
|
@ -334,11 +336,10 @@ struct AISettingsWindow : public Window {
|
||||||
{
|
{
|
||||||
visible_settings.clear();
|
visible_settings.clear();
|
||||||
|
|
||||||
ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
|
for (const auto &item : *this->ai_config->GetConfigList()) {
|
||||||
for (; it != this->ai_config->GetConfigList()->end(); it++) {
|
bool no_hide = (item.flags & SCRIPTCONFIG_DEVELOPER) == 0;
|
||||||
bool no_hide = (it->flags & SCRIPTCONFIG_DEVELOPER) == 0;
|
|
||||||
if (no_hide || _settings_client.gui.ai_developer_tools) {
|
if (no_hide || _settings_client.gui.ai_developer_tools) {
|
||||||
visible_settings.push_back(&(*it));
|
visible_settings.push_back(&item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ void AIScannerInfo::RegisterAPI(class Squirrel *engine)
|
||||||
AIInfo *AIScannerInfo::SelectRandomAI() const
|
AIInfo *AIScannerInfo::SelectRandomAI() const
|
||||||
{
|
{
|
||||||
uint num_random_ais = 0;
|
uint num_random_ais = 0;
|
||||||
for (ScriptInfoList::const_iterator it = this->info_single_list.begin(); it != this->info_single_list.end(); it++) {
|
for (const auto &item : info_single_list) {
|
||||||
AIInfo *i = static_cast<AIInfo *>((*it).second);
|
AIInfo *i = static_cast<AIInfo *>(item.second);
|
||||||
if (i->UseAsRandomAI()) num_random_ais++;
|
if (i->UseAsRandomAI()) num_random_ais++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,11 +121,10 @@ AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool fo
|
||||||
|
|
||||||
/* See if there is a compatible AI which goes by that name, with the highest
|
/* See if there is a compatible AI which goes by that name, with the highest
|
||||||
* version which allows loading the requested version */
|
* version which allows loading the requested version */
|
||||||
ScriptInfoList::iterator it = this->info_list.begin();
|
for (const auto &item : this->info_list) {
|
||||||
for (; it != this->info_list.end(); it++) {
|
AIInfo *i = static_cast<AIInfo *>(item.second);
|
||||||
AIInfo *i = static_cast<AIInfo *>((*it).second);
|
|
||||||
if (strcasecmp(ai_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
|
if (strcasecmp(ai_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
|
||||||
version = (*it).second->GetVersion();
|
version = item.second->GetVersion();
|
||||||
info = i;
|
info = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,8 +157,8 @@ AILibrary *AIScannerLibrary::FindLibrary(const char *library, int version)
|
||||||
strtolower(library_name);
|
strtolower(library_name);
|
||||||
|
|
||||||
/* Check if the library + version exists */
|
/* Check if the library + version exists */
|
||||||
ScriptInfoList::iterator iter = this->info_list.find(library_name);
|
ScriptInfoList::iterator it = this->info_list.find(library_name);
|
||||||
if (iter == this->info_list.end()) return nullptr;
|
if (it == this->info_list.end()) return nullptr;
|
||||||
|
|
||||||
return static_cast<AILibrary *>((*iter).second);
|
return static_cast<AILibrary *>((*it).second);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,10 @@ GameInfo *GameScannerInfo::FindInfo(const char *nameParam, int versionParam, boo
|
||||||
|
|
||||||
/* See if there is a compatible Game script which goes by that name, with the highest
|
/* See if there is a compatible Game script which goes by that name, with the highest
|
||||||
* version which allows loading the requested version */
|
* version which allows loading the requested version */
|
||||||
ScriptInfoList::iterator it = this->info_list.begin();
|
for (const auto &item : this->info_list) {
|
||||||
for (; it != this->info_list.end(); it++) {
|
GameInfo *i = static_cast<GameInfo *>(item.second);
|
||||||
GameInfo *i = static_cast<GameInfo *>((*it).second);
|
|
||||||
if (strcasecmp(game_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
|
if (strcasecmp(game_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
|
||||||
version = (*it).second->GetVersion();
|
version = item.second->GetVersion();
|
||||||
info = i;
|
info = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,8 +96,8 @@ GameLibrary *GameScannerLibrary::FindLibrary(const char *library, int version)
|
||||||
strtolower(library_name);
|
strtolower(library_name);
|
||||||
|
|
||||||
/* Check if the library + version exists */
|
/* Check if the library + version exists */
|
||||||
ScriptInfoList::iterator iter = this->info_list.find(library_name);
|
ScriptInfoList::iterator it = this->info_list.find(library_name);
|
||||||
if (iter == this->info_list.end()) return nullptr;
|
if (it == this->info_list.end()) return nullptr;
|
||||||
|
|
||||||
return static_cast<GameLibrary *>((*iter).second);
|
return static_cast<GameLibrary *>((*it).second);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,9 @@ ScriptController::ScriptController(CompanyID company) :
|
||||||
|
|
||||||
ScriptController::~ScriptController()
|
ScriptController::~ScriptController()
|
||||||
{
|
{
|
||||||
for (LoadedLibraryList::iterator iter = this->loaded_library.begin(); iter != this->loaded_library.end(); iter++) {
|
for (const auto &item : this->loaded_library) {
|
||||||
free((*iter).second);
|
free(item.second);
|
||||||
free((*iter).first);
|
free(item.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->loaded_library.clear();
|
this->loaded_library.clear();
|
||||||
|
@ -129,9 +129,9 @@ ScriptController::~ScriptController()
|
||||||
|
|
||||||
char fake_class[1024];
|
char fake_class[1024];
|
||||||
|
|
||||||
LoadedLibraryList::iterator iter = controller->loaded_library.find(library_name);
|
LoadedLibraryList::iterator it = controller->loaded_library.find(library_name);
|
||||||
if (iter != controller->loaded_library.end()) {
|
if (it != controller->loaded_library.end()) {
|
||||||
strecpy(fake_class, (*iter).second, lastof(fake_class));
|
strecpy(fake_class, (*it).second, lastof(fake_class));
|
||||||
} else {
|
} else {
|
||||||
int next_number = ++controller->loaded_library_count;
|
int next_number = ++controller->loaded_library_count;
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ void ScriptConfig::Change(const char *name, int version, bool force_exact_match,
|
||||||
if (_game_mode == GM_NORMAL && this->info != nullptr) {
|
if (_game_mode == GM_NORMAL && this->info != nullptr) {
|
||||||
/* If we're in an existing game and the Script is changed, set all settings
|
/* If we're in an existing game and the Script is changed, set all settings
|
||||||
* for the Script that have the random flag to a random value. */
|
* for the Script that have the random flag to a random value. */
|
||||||
for (ScriptConfigItemList::const_iterator it = this->info->GetConfigList()->begin(); it != this->info->GetConfigList()->end(); it++) {
|
for (const auto &item : *this->info->GetConfigList()) {
|
||||||
if ((*it).flags & SCRIPTCONFIG_RANDOM) {
|
if (item.flags & SCRIPTCONFIG_RANDOM) {
|
||||||
this->SetSetting((*it).name, InteractiveRandomRange((*it).max_value + 1 - (*it).min_value) + (*it).min_value);
|
this->SetSetting(item.name, InteractiveRandomRange(item.max_value + 1 - item.min_value) + item.min_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->AddRandomDeviation();
|
this->AddRandomDeviation();
|
||||||
|
@ -49,8 +49,8 @@ ScriptConfig::ScriptConfig(const ScriptConfig *config)
|
||||||
this->config_list = nullptr;
|
this->config_list = nullptr;
|
||||||
this->is_random = config->is_random;
|
this->is_random = config->is_random;
|
||||||
|
|
||||||
for (SettingValueList::const_iterator it = config->settings.begin(); it != config->settings.end(); it++) {
|
for (const auto &item : config->settings) {
|
||||||
this->settings[stredup((*it).first)] = (*it).second;
|
this->settings[stredup(item.first)] = item.second;
|
||||||
}
|
}
|
||||||
this->AddRandomDeviation();
|
this->AddRandomDeviation();
|
||||||
}
|
}
|
||||||
|
@ -79,24 +79,24 @@ const ScriptConfigItemList *ScriptConfig::GetConfigList()
|
||||||
|
|
||||||
void ScriptConfig::ClearConfigList()
|
void ScriptConfig::ClearConfigList()
|
||||||
{
|
{
|
||||||
for (SettingValueList::iterator it = this->settings.begin(); it != this->settings.end(); it++) {
|
for (const auto &item : this->settings) {
|
||||||
free((*it).first);
|
free(item.first);
|
||||||
}
|
}
|
||||||
this->settings.clear();
|
this->settings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptConfig::AnchorUnchangeableSettings()
|
void ScriptConfig::AnchorUnchangeableSettings()
|
||||||
{
|
{
|
||||||
for (ScriptConfigItemList::const_iterator it = this->GetConfigList()->begin(); it != this->GetConfigList()->end(); it++) {
|
for (const auto &item : *this->GetConfigList()) {
|
||||||
if (((*it).flags & SCRIPTCONFIG_INGAME) == 0) {
|
if ((item.flags & SCRIPTCONFIG_INGAME) == 0) {
|
||||||
this->SetSetting((*it).name, this->GetSetting((*it).name));
|
this->SetSetting(item.name, this->GetSetting(item.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptConfig::GetSetting(const char *name) const
|
int ScriptConfig::GetSetting(const char *name) const
|
||||||
{
|
{
|
||||||
SettingValueList::const_iterator it = this->settings.find(name);
|
const auto it = this->settings.find(name);
|
||||||
if (it == this->settings.end()) return this->info->GetSettingDefaultValue(name);
|
if (it == this->settings.end()) return this->info->GetSettingDefaultValue(name);
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ void ScriptConfig::SetSetting(const char *name, int value)
|
||||||
|
|
||||||
value = Clamp(value, config_item->min_value, config_item->max_value);
|
value = Clamp(value, config_item->min_value, config_item->max_value);
|
||||||
|
|
||||||
SettingValueList::iterator it = this->settings.find(name);
|
const auto it = this->settings.find(name);
|
||||||
if (it != this->settings.end()) {
|
if (it != this->settings.end()) {
|
||||||
(*it).second = value;
|
(*it).second = value;
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,17 +121,17 @@ void ScriptConfig::SetSetting(const char *name, int value)
|
||||||
|
|
||||||
void ScriptConfig::ResetSettings()
|
void ScriptConfig::ResetSettings()
|
||||||
{
|
{
|
||||||
for (SettingValueList::iterator it = this->settings.begin(); it != this->settings.end(); it++) {
|
for (const auto &item : this->settings) {
|
||||||
free((*it).first);
|
free(item.first);
|
||||||
}
|
}
|
||||||
this->settings.clear();
|
this->settings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptConfig::AddRandomDeviation()
|
void ScriptConfig::AddRandomDeviation()
|
||||||
{
|
{
|
||||||
for (ScriptConfigItemList::const_iterator it = this->GetConfigList()->begin(); it != this->GetConfigList()->end(); it++) {
|
for (const auto &item : *this->GetConfigList()) {
|
||||||
if ((*it).random_deviation != 0) {
|
if (item.random_deviation != 0) {
|
||||||
this->SetSetting((*it).name, InteractiveRandomRange((*it).random_deviation * 2 + 1) - (*it).random_deviation + this->GetSetting((*it).name));
|
this->SetSetting(item.name, InteractiveRandomRange(item.random_deviation * 2 + 1) - item.random_deviation + this->GetSetting(item.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,16 +186,16 @@ void ScriptConfig::SettingsToString(char *string, const char *last) const
|
||||||
{
|
{
|
||||||
char *s = string;
|
char *s = string;
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
for (SettingValueList::const_iterator it = this->settings.begin(); it != this->settings.end(); it++) {
|
for (const auto &item : this->settings) {
|
||||||
char no[10];
|
char no[10];
|
||||||
seprintf(no, lastof(no), "%d", (*it).second);
|
seprintf(no, lastof(no), "%d", item.second);
|
||||||
|
|
||||||
/* Check if the string would fit in the destination */
|
/* Check if the string would fit in the destination */
|
||||||
size_t needed_size = strlen((*it).first) + 1 + strlen(no);
|
size_t needed_size = strlen(item.first) + 1 + strlen(no);
|
||||||
/* If it doesn't fit, skip the next settings */
|
/* If it doesn't fit, skip the next settings */
|
||||||
if (string + needed_size > last) break;
|
if (string + needed_size > last) break;
|
||||||
|
|
||||||
s = strecat(s, (*it).first, last);
|
s = strecat(s, item.first, last);
|
||||||
s = strecat(s, "=", last);
|
s = strecat(s, "=", last);
|
||||||
s = strecat(s, no, last);
|
s = strecat(s, no, last);
|
||||||
s = strecat(s, ",", last);
|
s = strecat(s, ",", last);
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
ScriptInfo::~ScriptInfo()
|
ScriptInfo::~ScriptInfo()
|
||||||
{
|
{
|
||||||
/* Free all allocated strings */
|
/* Free all allocated strings */
|
||||||
for (ScriptConfigItemList::iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
|
for (const auto &item : this->config_list) {
|
||||||
free((*it).name);
|
free(item.name);
|
||||||
free((*it).description);
|
free(item.description);
|
||||||
if (it->labels != nullptr) {
|
if (item.labels != nullptr) {
|
||||||
for (auto &lbl_map : *(*it).labels) {
|
for (auto &lbl_map : *item.labels) {
|
||||||
free(lbl_map.second);
|
free(lbl_map.second);
|
||||||
}
|
}
|
||||||
delete it->labels;
|
delete item.labels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->config_list.clear();
|
this->config_list.clear();
|
||||||
|
@ -232,8 +232,8 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
|
||||||
ValidateString(setting_name);
|
ValidateString(setting_name);
|
||||||
|
|
||||||
ScriptConfigItem *config = nullptr;
|
ScriptConfigItem *config = nullptr;
|
||||||
for (ScriptConfigItemList::iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
|
for (auto &item : this->config_list) {
|
||||||
if (strcmp((*it).name, setting_name) == 0) config = &(*it);
|
if (strcmp(item.name, setting_name) == 0) config = &item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config == nullptr) {
|
if (config == nullptr) {
|
||||||
|
@ -284,22 +284,22 @@ const ScriptConfigItemList *ScriptInfo::GetConfigList() const
|
||||||
|
|
||||||
const ScriptConfigItem *ScriptInfo::GetConfigItem(const char *name) const
|
const ScriptConfigItem *ScriptInfo::GetConfigItem(const char *name) const
|
||||||
{
|
{
|
||||||
for (ScriptConfigItemList::const_iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
|
for (const auto &item : this->config_list) {
|
||||||
if (strcmp((*it).name, name) == 0) return &(*it);
|
if (strcmp(item.name, name) == 0) return &item;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptInfo::GetSettingDefaultValue(const char *name) const
|
int ScriptInfo::GetSettingDefaultValue(const char *name) const
|
||||||
{
|
{
|
||||||
for (ScriptConfigItemList::const_iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
|
for (const auto &item : this->config_list) {
|
||||||
if (strcmp((*it).name, name) != 0) continue;
|
if (strcmp(item.name, name) != 0) continue;
|
||||||
/* The default value depends on the difficulty level */
|
/* The default value depends on the difficulty level */
|
||||||
switch (GetGameSettings().script.settings_profile) {
|
switch (GetGameSettings().script.settings_profile) {
|
||||||
case SP_EASY: return (*it).easy_value;
|
case SP_EASY: return item.easy_value;
|
||||||
case SP_MEDIUM: return (*it).medium_value;
|
case SP_MEDIUM: return item.medium_value;
|
||||||
case SP_HARD: return (*it).hard_value;
|
case SP_HARD: return item.hard_value;
|
||||||
case SP_CUSTOM: return (*it).custom_value;
|
case SP_CUSTOM: return item.custom_value;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,14 +103,12 @@ void ScriptScanner::RescanDir()
|
||||||
|
|
||||||
void ScriptScanner::Reset()
|
void ScriptScanner::Reset()
|
||||||
{
|
{
|
||||||
ScriptInfoList::iterator it = this->info_list.begin();
|
for (const auto &item : this->info_list) {
|
||||||
for (; it != this->info_list.end(); it++) {
|
free(item.first);
|
||||||
free((*it).first);
|
delete item.second;
|
||||||
delete (*it).second;
|
|
||||||
}
|
}
|
||||||
it = this->info_single_list.begin();
|
for (const auto &item : this->info_single_list) {
|
||||||
for (; it != this->info_single_list.end(); it++) {
|
free(item.first);
|
||||||
free((*it).first);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->info_list.clear();
|
this->info_list.clear();
|
||||||
|
@ -171,9 +169,8 @@ char *ScriptScanner::GetConsoleList(char *p, const char *last, bool newest_only)
|
||||||
{
|
{
|
||||||
p += seprintf(p, last, "List of %s:\n", this->GetScannerName());
|
p += seprintf(p, last, "List of %s:\n", this->GetScannerName());
|
||||||
const ScriptInfoList &list = newest_only ? this->info_single_list : this->info_list;
|
const ScriptInfoList &list = newest_only ? this->info_single_list : this->info_list;
|
||||||
ScriptInfoList::const_iterator it = list.begin();
|
for (const auto &item : list) {
|
||||||
for (; it != list.end(); it++) {
|
ScriptInfo *i = item.second;
|
||||||
ScriptInfo *i = (*it).second;
|
|
||||||
p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription());
|
p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription());
|
||||||
}
|
}
|
||||||
p += seprintf(p, last, "\n");
|
p += seprintf(p, last, "\n");
|
||||||
|
@ -273,16 +270,16 @@ static bool IsSameScript(const ContentInfo *ci, bool md5sum, ScriptInfo *info, S
|
||||||
|
|
||||||
bool ScriptScanner::HasScript(const ContentInfo *ci, bool md5sum)
|
bool ScriptScanner::HasScript(const ContentInfo *ci, bool md5sum)
|
||||||
{
|
{
|
||||||
for (ScriptInfoList::iterator it = this->info_list.begin(); it != this->info_list.end(); it++) {
|
for (const auto &item : this->info_list) {
|
||||||
if (IsSameScript(ci, md5sum, (*it).second, this->GetDirectory())) return true;
|
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ScriptScanner::FindMainScript(const ContentInfo *ci, bool md5sum)
|
const char *ScriptScanner::FindMainScript(const ContentInfo *ci, bool md5sum)
|
||||||
{
|
{
|
||||||
for (ScriptInfoList::iterator it = this->info_list.begin(); it != this->info_list.end(); it++) {
|
for (const auto &item : this->info_list) {
|
||||||
if (IsSameScript(ci, md5sum, (*it).second, this->GetDirectory())) return (*it).second->GetMainScript();
|
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return item.second->GetMainScript();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue