Fixes#4253.
The schema's validation of ranges now rejects negative numbers, because the C++
code doesn't support them (both before and after this commit):
* utils::parse_range("-7") will return {0,0}, because std::stoi("") throws invalid_argument.
* src/map/location.cpp will parse it as -7, but that will never match an on-map coordinate
since the recent changes to overlays= in particular 1a7724e547,
e71033374c and b2cd1cf6c [unit]overlays= is no longer the
recommended way to add an overlay and the use of the
apply_to=overlay effect is reccomended instead, so adding it
to the [trait] is the most natural option here.
this in particular fixes#4058 . Also people simply forgetting the
IS_LOYAL macro was a not-so-uncommon cause of bugs.
In some cases people want to give the LOYAL trait without giving the
loyal overlays for those cases i added a optional OVERLAY parameter to
the {TRAIT_LOYAL} macro, also heroes should now use {TRAIT_LOYAL_HERO}
instead which uses the hero overlay. The IS_LOYAL and IS_HERO macros are
no longer needed in combination with those traits.
This scenario uses the huge final map from THoT, with different situations
split across different rooms of the map. THoT's final scenario was redesigned
with a completely new map in 457d9d17f, so this gives the test code its own
copy of the map.
There's a one-hex change to the original: the test puts side 1's leader in a
wall, isolated from the action. To clarify that that's intentional, the map
copy changes that hex to be passable, still surrounded by wall.
The old syntax for using a custom cost function ignored teleports/tunnels. Using calculate= in the path options table allows also setting the ignore_teleports option (but in this syntax it defaults to 'false', so it does not need to be done specifically).
This parameter determines in which order the available AIs are shown in the MP computer player selection menu. This can be used for eras, modifications or cores to change which AI is first in the list.
There are rating contributions for hexes which heal (not all of which are villages) and others for hexes that provide income (villages). Previously only villages were considered for both types of hexes.
Ths is the enemy type list to be considered if the AI has no information about the enemies to expect, that is, if no enemy units are on the map and no enemy recruit lists can be found. It can be used to prepare AI recruiting for enemy sides that get added later during a scenario.
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
This is a generalized version of ai_helper.get_reachable_unocc(). It can include or exclude hexes with own units with moves > 0. It also allows passing an optional location set 'avoid_map' with hexes to be excluded.
In principle, this makes get_reachable_unocc() unnecessary, but we keep that function for backward compatibility.
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
This is done for consistency with similar functions in mainline, and so that the function actual returns what it name says. This breaks backward compatibility, but note that the only practical difference for that is the order in which the arguments are returned, as both 'closest_enemy' and 'location' contain the enemy location in .x/.y format.
This is done for consistency with similar functions in mainline. In principle this breaks backward compatibility. However, while it is theoretically possible for this to happen, this function will generally always return at least the hex the unit is on, so it is very unlikely that this actually makes a difference somewhere.