summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-25 19:38:18 +0100
committerGitHub <noreply@github.com>2020-12-25 19:38:18 +0100
commitf66baa444ff5575b2b40e3bfd514cdb463f6f560 (patch)
treef0977f8443106be749dac7a84fb01c2eebaedd45 /src/script/api
parent9add62796c91c8eb7dd971cb21c8cdeba49cadfa (diff)
downloadopenttd-f66baa444ff5575b2b40e3bfd514cdb463f6f560.tar.xz
Codechange: use C++11 constructs for for-each loops (#8432)
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_controller.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index adfcf2acd..e74f27e4a 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -77,9 +77,9 @@ ScriptController::ScriptController(CompanyID company) :
ScriptController::~ScriptController()
{
- for (LoadedLibraryList::iterator iter = this->loaded_library.begin(); iter != this->loaded_library.end(); iter++) {
- free((*iter).second);
- free((*iter).first);
+ for (const auto &item : this->loaded_library) {
+ free(item.second);
+ free(item.first);
}
this->loaded_library.clear();
@@ -129,9 +129,9 @@ ScriptController::~ScriptController()
char fake_class[1024];
- LoadedLibraryList::iterator iter = controller->loaded_library.find(library_name);
- if (iter != controller->loaded_library.end()) {
- strecpy(fake_class, (*iter).second, lastof(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));
} else {
int next_number = ++controller->loaded_library_count;