Commit graph

27 commits

Author SHA1 Message Date
Gunter Labes
9b70484b4f
Fix an indent inconsistency and add missing final newlines 2024-08-21 21:48:04 +02:00
Celtic Minstrel
b9ff0c51fe Schema: Fix declaring guard_x/y/loc as required keys in stationed_guard MicroAI (they are optional) 2024-01-06 21:35:40 -05:00
Gunter Labes
8cd0410754
Add missing keys and tags in [micro_ai] 2023-08-29 15:15:59 +02:00
Steve Cotton
cc8dddea6e Support negative numbers in ranges
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.
2023-08-11 21:59:06 +02:00
mattsc
ce9ba142bc Add new AI aspect allow_ally_villages 2022-06-22 08:00:50 -07:00
Celtic Minstrel
477a871c21 AI: Support [side][ai][micro_ai]
Closes #5910
2021-09-04 22:20:28 -04:00
Celtic Minstrel
59c9be1238 Schema: Add [candidate_action][filter_own] 2021-09-04 22:20:28 -04:00
Celtic Minstrel
0c42cdc038
Enable translation mark validation by the schema (#5800)
- The t_string type is now a schema built-in type and no longer attempts a regex match.
- You can also specify that non-t_string types may be optionally-translatable; this case supports a regex match on the string (but note that the translation mark is not part of the match).
- Error messages involving keys with very large values ( > 128 characters) will now truncate the value.
- To account for occasional cases where the schema is intentionally violated, the --validate command-line option now automatically defines the SCHEMA_VALIDATION preprocessor define.

A key validates as type t_string if one of the following is true:
- The key is not present
- The key has at least one segment with a translation mark
- The key is blank (an empty string)

Any type other than t_string is not allowed to be translatable by default, unless you specify allow_translatable=yes in the [type] tag.

An optionally-translatable string could also be defined as a union of t_string and some other type.
2021-06-14 23:59:52 -04:00
Celtic Minstrel
d5b8d96118
Schema: Add lua_goal support (#5833)
Also add an else to the goal validation cases, which will produce an error in the event of an invalid name value
2021-06-05 23:20:20 -04:00
mattsc
fe316aec3a Add new AI aspect retreat_enemy_weight 2021-02-26 13:57:13 -08:00
mattsc
efe5a4d497 Add new AI aspect retreat_factor 2021-02-25 20:25:16 -08:00
mattsc
cf3be040ca Schema validation: add missing AI aspect 2018-12-03 18:19:44 -08:00
mattsc
dca3fe71bb Schema validation: add new AI keys 2018-12-03 18:19:37 -08:00
mattsc
f53e3b9565 Schema validation: remove attack_depth aspect
It's been removed from the AI.
2018-11-16 06:45:40 -08:00
Celtic Minstrel
52c4dc0e3d Add a validator subclass specialized for validating WML schemas against the WML schema schema 2018-11-03 17:09:25 -04:00
Celtic Minstrel
4674e97eb6 Schema: Add a macro for links (and make use of it) 2018-10-23 22:49:53 -04:00
Celtic Minstrel
d70fee5afc Schema: Fix issue with matching [modify_ai] for attacks aspect 2018-10-23 22:49:32 -04:00
Celtic Minstrel
67c6de0a4e Schema: Accept variable substitution in most aspect values 2018-10-23 22:39:53 -04:00
Celtic Minstrel
9b9fdf2c52 Schema: Simplify the simple non-scalar aspect definitions 2018-10-23 22:39:52 -04:00
Celtic Minstrel
151a1fb66c Schema: Forgot id key in [leader_goal] 2018-10-23 22:39:51 -04:00
Celtic Minstrel
17b1127175 Schema: Fixup [goal] definition 2018-10-23 22:39:48 -04:00
Celtic Minstrel
9a966a46f5 Schema: Support omitting the final index in [modify_ai] paths
Also mark the subtags in [modify_ai] as required
2018-10-23 22:39:47 -04:00
Celtic Minstrel
da7fcaa5e1 Schema: Definition of [modify_ai] tag
Also reorder some things in [aspect] for better matching
2018-10-23 22:37:42 -04:00
Celtic Minstrel
644ff73c92 Schema: Add feature to [switch] to allow a [case] to match the absence of the key
Use this to support the default [goal] name
2018-10-23 22:37:38 -04:00
Celtic Minstrel
6d4b789e5b Schema: Use the new globbing feature to improve [aspect] definition
Also fix [engine] switch
2018-10-23 22:37:37 -04:00
Celtic Minstrel
c2716728e5 A few more missing pieces to the AI schema 2018-10-23 22:37:36 -04:00
Celtic Minstrel
faa8decdc8 WIP Schema for the AI WML
Pretty much all working, except for the [aspect] tag
Also, [modify_ai] is not yet specified (needs new schema features)
2018-10-23 22:37:33 -04:00