36237 Commits

Author SHA1 Message Date
pentarctagon
c00cfe2a05 Add an environment variable to disable logging to file
Fixes #8527
2024-03-17 12:23:31 -05:00
Hejnewar
c25d87bc9a
Improve default settings for the timer
Action bonus - is often thought as inconsisnent and generally not very well understood not only by new players but aslo by players with mid tier experience, so removing it from initial setting should improve overall experience of a new player.
Turn bonus - 60 seconds is way too low and initial 270 is also not much for the whole game. 240/240 does better job at keeping the game in good pace while not being too opressive in my opinion, 360 reserve is aslo ok if you can save some time for more intensive turns.
2024-03-17 00:51:18 +01:00
Iris Morelle
19d8eeb5e9 Fix "implicit conversion turns floating-point number into integer" warnings
Found with Xcode 15.3:

  /Users/iris/Projects/wesnoth/src/game_config.cpp:551:18 Implicit conversion turns floating-point number into integer: 'double' to 'const int'
2024-03-17 00:42:25 +01:00
Iris Morelle
854b812ed4 gui/unit_recruit: Add unit type level number as a filtering criterion
The Recall dialog already did this, but Recruit did not.
2024-03-16 00:13:16 -03:00
Iris Morelle
df4039d593 gui/unit_recruit: Add alignment and race hints for filtering
This adds the human-readable version of each unit's alignment and
their (gendered) race name and plural race name as hints for the
filter box functionality, so that players can enter keywords such as
"liminal", "dwarves", "mermaid" and get what they expect even if those
words are not literally part of the unit type names.
2024-03-16 00:13:16 -03:00
Iris Morelle
3a8c234df7 gui/unit_recruit: Restructure filter criteria checks
This makes it easier to add any number of text criteria for filtering
without making the conditional increasingly unwieldy. Criteria that
shouldn't count because of conditions disabling them (such as the unit
type id only being considered when debug mode is eanbled) can just
become empty strings which will never match.
2024-03-16 00:13:16 -03:00
Iris Morelle
9f5e61b803 gui/unit_recall: Add alignment and race hints for filtering
This adds the human-readable version of each unit's alignment and
their (gendered) race name and plural race name as hints for the
filter box functionality, so that players can enter keywords such as
"liminal", "dwarves", "mermaid" and get what they expect even if those
words are not literally part of the unit type names.
2024-03-16 00:13:16 -03:00
pentarctagon
07100d0759 validate addon name when first entered as well 2024-03-14 22:03:45 -05:00
pentarctagon
b4f988a220 fix tags and secondary_author for pbl editor 2024-03-14 22:03:45 -05:00
newfrenchy83
24a75ba95c
fix math include necessary in game_config.cpp for compile file. (#8542) 2024-03-12 13:12:15 -04:00
shijie.chen
d88ddec6f1
Remove unnecessary header files (#8531)
Co-authored-by: shijie.chen <shijie.chen@goland.cn>
2024-03-12 00:07:48 -04:00
Charles Dang
5b05815d5c
Disambiguate operator<< for optimer (#8532) 2024-03-11 16:39:45 -04:00
Steve Cotton
8974d04147 Revert "GUI2/Outro: don't keep unnecessary copy of current text"
It's necessary, because text_index isn't always in-bounds for
the text_ vector. See 987827b475393104c47412fefb937ca1fe614211
for the bug number.

Note: the build of campaignd is currently broken by commit
3f61aaa8f4689d4e368089a7b4000168c2417cef, but there's a PR which
should merge shortly to fix that.

This reverts commit 82fa0742a12e8a44ea9094a344600232aa169a9e.
2024-03-11 20:37:18 +01:00
Charles Dang
82fa0742a1 GUI2/Outro: don't keep unnecessary copy of current text 2024-03-11 13:14:42 -04:00
Charles Dang
3f61aaa8f4 Move optimer to utils namespace for consistency 2024-03-11 12:54:58 -04:00
pentarctagon
195f630637 fix accidental conditional inversion
fixes #8525
fixes #8524
2024-03-10 12:11:51 -05:00
pentarctagon
1074ba704e Make sure animations are skipped when skipping animations in replays
Fixes #8227
2024-03-08 12:47:45 -06:00
gfgtdf
851c909cd3
Fix #8460 [effect] apply_to=variation (#8475)
* Fix #8460 [effect] apply_to=variation

Previously the code could apply the variation effects
last, so that codes like
```
[effect]
  apply_to=variation
  ..
[/effect]
[effect]
  apply_to=hitpoints
  heal_full=yes
[/effect]
```
Would not set the unit hitpoints to the new variations
hitpoints because the variation effect was applied after
the healing effect.

In 1.16 this worked because healing was applied a little
too often but that lead also to bugs like #8342

* f prev

* f prev

* f prev

* f prev

* f prev

* Create modification_effect_type_variation.cfg

* Update wml_test_schedule
2024-03-07 01:25:59 +01:00
pentarctagon
c9a343da9d use the currently selected map's path when opening a new file
currently the editor defaults to its maps directory even when you open a map file somewhere without it being in an "add-on", for example opening a map in a mainline campaign's maps folder.
2024-03-05 19:54:28 -06:00
Iris Morelle
f8c4bf2130 gui/outro: New clock-based timing logic for the text fading
This version uses SDL_GetTicks() as a monotonic source to avoid the
previous version's pitfalls, namely the fact that the game's framerate
may not necessarily be a constant, and in particular, the old code
assumed a completely different framerate than what we ended up with
after the texture-based rendering changes in 1.17.x, resulting in an
almost-unnoticeable text fade due to the update() function being
called WAY more often than before.

Note that the reliance on SDL_GetTicks() means the timings break
at some point after 49 days of game runtime, exactly once. This
should result in a visible "jitter" effect if the 32-bits ticks value
wraps around in the middle of a fade sequence, but other than that
it's not that big of a deal to warrant requiring SDL 2.0.18+ for the
64-bit version.

(cherry picked from commit db30ca53ae32eee37f805aa4aefb3e08de65de9c)
2024-03-05 10:56:50 +01:00
Iris Morelle
17bd58dd79 gui/addon_manager: Show server identification after the address
This enables the client to show the [server_id] info (for 1.16+
campaignd instances that provide the relevant fields) in the UI so
the user can more easily know which instance they are connected to
in case they do not handle that information directly themselves (e.g.
when entering a port number of their own).

The server info shown in the bottom left is changed from "<encryption
status> <server address>" to add "— <server id> (<server version>)"
right after it, with the server version in parentheses being included
only if debug mode is enabled to avoid redundancy or confusing values
(such as "wesnoth.org — 1.18 (1.17.19+dev)").
2024-03-01 22:33:31 -05:00
Iris Morelle
597a64701c addon: Add getters for the server identification 2024-03-01 22:33:31 -05:00
Steve Cotton
f7038a0b27 Use missing_mandatory_wml_tag instead of extra translatable strings
The logic is that the strings included the names of WML tags, but
weren't clear that they were WML tags, and so the tag names are
being translated.

This reverts almost all of the string changes of PR #7600, which
were in commit f5be4cffb7b34fdd2ac875cf0f76fc8db7e23cef, as well
as a few similar strings which weren't in 1.16.x.

(cherry picked from commit fb758041cab9f0d6bc79755668e0ac002bd57975)
2024-03-02 00:04:28 +01:00
pentarctagon
ef972bb0a0 The method is static, but these variables can't be.
static variables are only initialized the first time they are encountered, even if they are only defined in the body of the method. therefore their value here is set to the first language used when this method is called, but won't change later if the language changes because they've already been initialized.

Fixes #8393
2024-03-01 12:41:05 +01:00
gfgtdf
5711277a02 replays: also make 'play single move' stop on end turn
previously it would excute the end turn and the next move
which made it very hard to get into the state directly
after a turn was started, epsecially in sp that often uses
side turn events this is imo desirable
2024-02-29 00:18:46 +01:00
gfgtdf
7401beb3b4 Fix replay not automatically stopping at end
The deleted line was only reached when do_replay() found an end of a replay when at_end() returned false, which can only happen in the rare case that the last replay command was a chat command
2024-02-29 00:18:46 +01:00
gfgtdf
68f1a8c8db remove unneeded map_start_ = {}
in case that we are not reloading a game map_start_ is already invalid
2024-02-29 00:18:46 +01:00
gfgtdf
713e3b05e6 dont call after_human_turn() in linger() 2024-02-29 00:18:46 +01:00
gfgtdf
a1286479f4 move victory_when_enemies_defeated around 2024-02-29 00:18:46 +01:00
Wedge009
1c78750176 Set gold laurel first in case of only one difficulty setting.
Also use dense formatting as per existing code.
2024-02-28 14:03:52 +11:00
Wedge009
c25321b713 Remove spurious if condition. 2024-02-28 14:03:52 +11:00
Wedge009
a84561390a Keep laurel decorations consistent with difficulty level (resolves #8442). 2024-02-28 14:03:52 +11:00
pentarctagon
422fef3f3e update text post logging fix 2024-02-27 10:42:23 -06:00
Rafael Fillipe Silva
96ebe8a693 add tests for link cycle validation
Signed-off-by: Rafael Fillipe Silva <rfsc.mori@gmail.com>
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
e24c13a1b7 implement cycle detection for type aliases (links)
Since the detection happens after loading the config tree, it is necessary to expose the links and subtypes of the types alias and composite, respectively.

This implementation builds a graph of all links to detect cycles, ignoring all other types.

To handle links in elements of lists, all subtypes of composite types are visited, keeping the type name of the parent composite type.

Signed-off-by: Rafael Fillipe Silva <rfsc.mori@gmail.com>
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
c925737f54 format changes related super mandatory keys validation with clang-format 2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
0f78777dee add tests for mandatory key validations considering super tags 2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
c421d7e8be verify if all mandatory keys are specified, including the ones from the super tags
This pattern presents the same infinite loop issue as the find_key and find_tag calls on wml_tag. The solution is the same, to use a helper to keep track of the already seen tags and stop when a cycle is detected.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
be3724a003 add tests to missing super detection 2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
4600043492 detect when a super defined in the schema doesn't exist
Note that this is only detected if the tag referencing the missing super is used in a .cfg file. The super element itself doesn't need to be used for the detection to work.

The schema self validator should already catch this, but it deserves a warning of its own as the schema self validator can be disabled.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
40e7dff3ad add tests to cover super cycle detection while validating a .cfg file 2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
1c36153f06 detect schema super cycles while validating a .cfg file
Note that if the .cfg file does not use the tags that causes a cycle, those won't be detected.

This change exposes the super_refs_ so the schema validator does not need to reinvent wml_tag::expand when detecting super cycles.

The super dependency graph is built during the validation of each tag, finishing and reporting cycles at the end of the root tag.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
a3672ba509 add the super's full path to the tag's super_list
This allows for better diagonistic when the specified super doesn't exist and when super cycles are detected.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
c7e643bffd add a test to cover the fix to find_key's infinite loop/crash
Adds a test with a schema example containing a super cycle and a .cfg file containing an unknown key to this schema. Previously, this would cause an infinite loop or crash. Now an exception for invalid key should be thrown.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
c64416bbb6 handle super cycles while searching for a key or for a tag
A super cycle may be found during the validation, leading to an infinite loop. For example, calling find_key on an unknown key defined in the .cfg file may trigger this behavior if a cycle exists.

To handle this, a new version of these functions was introduced, keeping the original in the class' private scope. During the search there is a bookkeeping helper that will cause the routine to return nullptr if the search goes back to the initial tag context.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
f7511ea731 fix wml_tag::iterator CRTP parameter
Forwards the Map type parameter instead of defaulting to `std::map<string, T>`.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
fd6cd7c2a2 add tests for super cycle detection on schema self validator
Add test for the already existing validation where a tag shouldn't set itself as its own super.

Add test for the new cycle detection when validating a schema.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
dafb78cdf1 implement super cycle detection for the schema self validator
The super tag dependency forms a directed graph. Boost Graph's depth first search implementation was used with a back edge detector to find the cycles.

This is a preparation for enumerating all keys that a tag can use, including the keys from the super tags. If cycles aren't handled, it is impossible to validate mandatory keys without entering an infinite loop.
2024-02-26 10:12:43 -06:00
pentarctagon
bfdbaaf423 Multiply help portait scaling by the pixel multiplier.
Fixes #8275
2024-02-26 00:27:15 -06:00
Celtic Minstrel
04b5315b0b Lua: Make sure unit type is built before returning it from iteration
Fixes #8456
2024-02-25 16:13:29 -05:00