summaryrefslogtreecommitdiff
path: root/src/story.cpp
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.cpp
parent869581eb238b820574d64cd8dabc9324cd7a0dd5 (diff)
downloadopenttd-847e5f33d4749568cda696b8940ec10b540bd6fb.tar.xz
Codechange: Replace story related FOR_ALL with range-based for loops
Diffstat (limited to 'src/story.cpp')
-rw-r--r--src/story.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/story.cpp b/src/story.cpp
index 86fd059dd..0d465fde8 100644
--- a/src/story.cpp
+++ b/src/story.cpp
@@ -157,8 +157,7 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
/* Allow at most 128 elements per page. */
uint16 element_count = 0;
- StoryPageElement *iter;
- FOR_ALL_STORY_PAGE_ELEMENTS(iter) {
+ for (StoryPageElement *iter : StoryPageElement::Iterate()) {
if (iter->page == page_id) element_count++;
}
if (element_count >= 128) return CMD_ERROR;
@@ -317,8 +316,7 @@ CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (flags & DC_EXEC) {
StoryPage *p = StoryPage::Get(page_id);
- StoryPageElement *pe;
- FOR_ALL_STORY_PAGE_ELEMENTS(pe) {
+ for (StoryPageElement *pe : StoryPageElement::Iterate()) {
if (pe->page == p->index) {
delete pe;
}