mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 19:23:53 +00:00

Adds support for using these in the weapons and ability filters: * "-1", which was previously treated as an parse error (no number before the separator). * "-3--1" * "-infinity" as the lower number in the range, provided a different upper number is given. This treats "-infinity" (with no other number), "-infinity--infinity", "infinity" (with no other number) and "infinity-infinity" as errors. It seems unlikely that someone would intend to use a filter that can't match any reasonable number. The range "-infinity-infinity" will be parsed successfully. I don't see a use case for that, but nor do I see a reason to add extra C++ to reject it. However, it's not added to the schema, as I think it's good for the schema to give a warning when someone creates a filter which will accept every value (including accepting the default, so "-infinity-infinity" accepts the unset value too). Includes new unit tests for the C++ and the Lua stringx.parse_range functions. The next commit adds more WML tests, but is kept separate to credit the author. This started as a change to move common filter functions from unit.cpp to somewhere that they could be reused for other config-based filters. In the process a missing feature was found and added, the move is still included in a single Git commit because the move was required in order to make these functions accessible to the Boost unit tests. Two CodeBlocks project files additionally get src/utils/any.hpp added, which was in one of them but missing from the other two. I noticed because these are alphabetically at the start of the src/utils file list. Thanks to @CelticMinstrel for the review comments and Xcode project updates.