summaryrefslogtreecommitdiff
path: root/src/story_base.h
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-17 21:21:33 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit847e5f33d4749568cda696b8940ec10b540bd6fb (patch)
tree1e61e1586e351722db89f537b9222a50f278abb0 /src/story_base.h
parent869581eb238b820574d64cd8dabc9324cd7a0dd5 (diff)
downloadopenttd-847e5f33d4749568cda696b8940ec10b540bd6fb.tar.xz
Codechange: Replace story related FOR_ALL with range-based for loops
Diffstat (limited to 'src/story_base.h')
-rw-r--r--src/story_base.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/story_base.h b/src/story_base.h
index 869a6b6a9..e82b9d696 100644
--- a/src/story_base.h
+++ b/src/story_base.h
@@ -60,9 +60,6 @@ struct StoryPageElement : StoryPageElementPool::PoolItem<&_story_page_element_po
inline ~StoryPageElement() { free(this->text); }
};
-#define FOR_ALL_STORY_PAGE_ELEMENTS_FROM(var, start) FOR_ALL_ITEMS_FROM(StoryPageElement, story_page_element_index, var, start)
-#define FOR_ALL_STORY_PAGE_ELEMENTS(var) FOR_ALL_STORY_PAGE_ELEMENTS_FROM(var, 0)
-
/** Struct about stories, current and completed */
struct StoryPage : StoryPagePool::PoolItem<&_story_page_pool> {
uint32 sort_value; ///< A number that increases for every created story page. Used for sorting. The id of a story page is the pool index.
@@ -82,8 +79,7 @@ struct StoryPage : StoryPagePool::PoolItem<&_story_page_pool> {
inline ~StoryPage()
{
if (!this->CleaningPool()) {
- StoryPageElement *spe;
- FOR_ALL_STORY_PAGE_ELEMENTS(spe) {
+ for (StoryPageElement *spe : StoryPageElement::Iterate()) {
if (spe->page == this->index) delete spe;
}
}
@@ -91,8 +87,5 @@ struct StoryPage : StoryPagePool::PoolItem<&_story_page_pool> {
}
};
-#define FOR_ALL_STORY_PAGES_FROM(var, start) FOR_ALL_ITEMS_FROM(StoryPage, story_page_index, var, start)
-#define FOR_ALL_STORY_PAGES(var) FOR_ALL_STORY_PAGES_FROM(var, 0)
-
#endif /* STORY_BASE_H */