summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-08-16 21:11:26 +0000
committerfrosch <frosch@openttd.org>2014-08-16 21:11:26 +0000
commita03ad12322e2e79ef423fe2d1737a3331e33afad (patch)
treec3499b29b495eebe3284f02f2402386ab75ab53f /src/script
parent0d561bcf572d75b0a0ef6f6c2721713f54a1693d (diff)
downloadopenttd-a03ad12322e2e79ef423fe2d1737a3331e33afad.tar.xz
(svn r26743) -Codechange: Simplify ScriptList iterators.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_list.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index e0dba50bc..84f2b937c 100644
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -175,13 +175,13 @@ public:
this->has_no_more_items = false;
/* Go to the end of the bucket-list */
- this->bucket_iter = this->list->buckets.begin();
- for (size_t i = this->list->buckets.size(); i > 1; i--) this->bucket_iter++;
+ this->bucket_iter = this->list->buckets.end();
+ --this->bucket_iter;
this->bucket_list = &(*this->bucket_iter).second;
/* Go to the end of the items in the bucket */
- this->bucket_list_iter = this->bucket_list->begin();
- for (size_t i = this->bucket_list->size(); i > 1; i--) this->bucket_list_iter++;
+ this->bucket_list_iter = this->bucket_list->end();
+ --this->bucket_list_iter;
this->item_next = *this->bucket_list_iter;
int32 item_current = this->item_next;
@@ -214,8 +214,8 @@ public:
this->bucket_iter--;
this->bucket_list = &(*this->bucket_iter).second;
/* Go to the end of the items in the bucket */
- this->bucket_list_iter = this->bucket_list->begin();
- for (size_t i = this->bucket_list->size(); i > 1; i--) this->bucket_list_iter++;
+ this->bucket_list_iter = this->bucket_list->end();
+ --this->bucket_list_iter;
} else {
this->bucket_list_iter--;
}
@@ -339,8 +339,8 @@ public:
if (this->list->items.empty()) return 0;
this->has_no_more_items = false;
- this->item_iter = this->list->items.begin();
- for (size_t i = this->list->items.size(); i > 1; i--) this->item_iter++;
+ this->item_iter = this->list->items.end();
+ --this->item_iter;
this->item_next = (*this->item_iter).first;
int32 item_current = this->item_next;