mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 04:48:39 +00:00
Fix dangling reference warnings about refs to iterators
These are causing warnings with GCC-14. An iterator can often be a struct containing a single pointer, so creating a reference to such a small struct doesn't make sense. The structure returned by child_range is likely to be exactly two pointers, so it's not a burden to keep it even though back() has already finished accessing the child_iterator. (cherry picked from commit 087fa65dc5ee34ce82a747935ceb11a4b327ea25)
This commit is contained in:
parent
791eed42cf
commit
1c9e3f220c
@ -63,7 +63,8 @@ void unit_advance::pre_show(window& window)
|
||||
// This checks if we've finished iterating over the last unit type advancements
|
||||
// and are into the modification-based advancements.
|
||||
if(i >= last_real_advancement_) {
|
||||
const auto& back = sample.get_modifications().child_range("advancement").back();
|
||||
const auto range = sample.get_modifications().child_range("advancement");
|
||||
const auto& back = range.back();
|
||||
|
||||
if(back.has_attribute("image")) {
|
||||
image_string = back["image"].str();
|
||||
|
@ -1313,7 +1313,7 @@ const topic *find_topic(const section &sec, const std::string &id)
|
||||
|
||||
const section *find_section(const section &sec, const std::string &id)
|
||||
{
|
||||
const auto &sit =
|
||||
const auto sit =
|
||||
std::find_if(sec.sections.begin(), sec.sections.end(), has_id(id));
|
||||
if (sit != sec.sections.end()) {
|
||||
return &*sit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user