mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 20:53:51 +00:00

This commit adds a dedicated recall list manager class. The purpose of this is to - Simplify the code that interacts with the recall list. Prior to the commit most such code was based on iteration with explicit iterators, and called global helper functions implemented in unit.cpp to wrap the code that finds a unit in a vector. It turns out that interacting with the recall list was the *only* use of that code, so we make it a member function of the recall list manager and take it out of unit.cpp. Most of the code that touches the recall list was previously 7 or 8 lines with a for loop, now it tends to be 1 or 2 lines, although further refactor may be possible. - Improve encapsulation. This makes it possible to track how other classes are interacting with the recall list, and may make it easier to debug recall list problems by adding debugging output to the class.