37147 Commits

Author SHA1 Message Date
Subhraman Sarkar
d5d20b9305 units_dialog: more fixes related to recruitability (#9813) 2025-02-07 22:12:05 +05:30
Subhraman Sarkar
e94f577d9a units_dialog: move item erase from filter (#9839)
moved before `selected_index_` gets changed to -1 due to
`list_item_clicked()`
2025-02-07 21:37:10 +05:30
Subhraman Sarkar
0e2b92e210 units_dialog: properly show messages and grey out (#9813) 2025-02-07 21:37:10 +05:30
Subhraman Sarkar
084dcda2ed addon/install_dependencies: remove unnecessary include 2025-02-07 16:04:00 +05:30
Subhraman Sarkar
df3b48f4d4 units_dialog: move item erase from filter (#9839)
moved before `selected_index_` gets changed to -1 due to
`list_item_selected()`
2025-02-07 16:04:00 +05:30
Subhraman Sarkar
3d0785305a menu events: use using namespace gui2::dialogs
since this acts as a launcher for many gui2 dialogs, this allows for some simplification.
2025-02-07 16:04:00 +05:30
Gunter Labes
c433beeba6
Only load the specified image type and add webp support 2025-02-05 23:55:28 +01:00
gfgtdf
0fd40d286c
Fix #9834 error after reloading after taking village (#9842)
* Fix #9834 error after reloading after taking village

* improve error handling in case of an invalid undo action type

* f p

* f p
2025-02-04 15:34:01 +11:00
Subhraman Sarkar
43b4d57009 canvas: add parse_text_as_formula key to [text]
This key toggles parsing of `text` key as formula or not. Default: true.
2025-02-03 07:25:41 +05:30
Descacharrado
98aa84ff41
Polishing the visual highlighting of reachable hexes (#9542) 2025-02-02 13:48:10 -05:00
newfrenchy83
0dce4e4731
Have [filter_attack/weapon]type= pick the type which does more damage (#8936)
resolve [filter_attack/weapon]type= can check both type when it wait only effective type.

* add 'base_type' filter for detect original type of attack reagrdless of [damage_type] modifications

if for some reason the original type must be filtered instead of effective type, this attribute is here for that.

* add effective_type in formulas
2025-02-01 10:36:55 -06:00
Subhraman Sarkar
adc95a06cd tests: call set_main_thread 2025-01-31 07:35:10 +05:30
Subhraman Sarkar
814553229d charconv fixes
without these changes, wesnoth will not compile if USE_FALLBACK_CHARCONV is defined.
also typofixed assert.
2025-01-30 22:07:04 +05:30
Subhraman Sarkar
c9b54a5eda events: set main thread in main() 2025-01-30 22:06:48 +05:30
Gunter Labes
9bd6b47036
Improve error wording 2025-01-30 10:47:25 +01:00
Subhraman Sarkar
f43cb9b451 advanced prefs: clear list everytime advanced prefs are reloaded. (#9581) 2025-01-28 22:35:49 +01:00
Subhraman Sarkar
7d01f994e8 types: readd include to gettext 2025-01-28 18:57:34 +05:30
Subhraman Sarkar
eebefcf72a race, types: fix inconsistent & placement and minor cleanup 2025-01-28 18:08:17 +05:30
Gunter Labes
fa238045b1
Remove unnecessary template and optional use 2025-01-28 09:22:31 +01:00
Yoruma
bb07f533ed
Fix invalid WFL crashes Wesnoth (#9437)
Handle case of unquesionably empty expression between brackets & Catch error when evaluating formula

Fix #9249
2025-01-27 21:24:17 -05:00
newfrenchy83
e092acb30f
Do not truncate ability value calculation
Use the floating point ability/weapon special value in damage calculation. Change some more internal calculations from truncation to rounding.

Fixes #9467.
2025-01-28 00:02:40 +01:00
newfrenchy83
3421fe81bf revert Unit/Type: drop bar_scaling keys as well
revert fc8e8eb09e (diff-dc56bda7f509dc7a0a91fbd69d289b59257ae33e16556cff72e86598172f788f) because scaling keys used in TSG and TDG
2025-01-27 11:16:42 -05:00
Charles Dang
0ffc4d4c6f Display: remove unnecessary capture 2025-01-26 22:36:57 -05:00
Charles Dang
fc8e8eb09e Unit/Type: drop bar_scaling keys as well
As suggested by soliton in #9806
2025-01-26 22:36:17 -05:00
Charles Dang
428f77f624 Unit: remove bar scaling overrides
See #7292, closes #2913. Apparently, this has never worked, and based on discussion in #7292, it's not even particularly useful. Plus, since it was removed from the schema two years ago, has been functionally deprecated since then.

The keys in unit_type remain untouched.
2025-01-26 15:19:09 -05:00
Celtic Minstrel
88db38a406 Fix [message] with two images.
Fix #8770
2025-01-26 15:17:30 -05:00
Charles Dang
3cf56d8ff1 entity_location: better validity check in get_unit (resolves #9803) 2025-01-26 12:41:04 -05:00
JJ Marr
38b3a3b7ba Remove config::append_children(config&& cfg)
Move semantics imply that an r-value parameter is no longer useful once
it is passed into a function. However, this function is used as a helper
function that only partially moves from cfg, so that the rest of cfg
can be reused by the caller.

I don't believe this is a good mechanism for a function call. This
overload is only used in one place: append(config&& cfg), so this commit
moves the relevant logic there. This ensures there's no re-use of a
moved-from object.

Splitting this out separately since it's a special case and API change.
2025-01-25 08:58:45 -05:00
JJ Marr
0b46bd3044 Enable performance-no-automatic-move
Variables can be automatically moved when a function returns. However,
declaring a variable as const prevents that move from occuring (as the
move modifies the moved-from variable).
2025-01-25 08:58:45 -05:00
JJ Marr
15acd0c00a Lint for performance-move-constructor-init
This checks when a move constructor for an object copy constructs its
member classes or parent classes. Copying unnecessary as all of the
members of the moved-from object can be clobbered by the move.
2025-01-25 08:58:45 -05:00
JJ Marr
259160e1e4 Lint for performance-move-const-arg
These are cases in which something is std::moved and no move actually
occurs.
2025-01-25 08:58:45 -05:00
JJ Marr
c34d689726 Warn against not moving rvalue parameter
If a function takes in an rvalue, it's taking ownership of the object
that's being moved into it. If the object never moves that rvalue param,
then there was no point to moving it into the function.

As an example of a problem this catches, in context_manager.cpp,
replace_map_context_with took in an rvalue unique_ptr "mc" to a map
context. The function then swapped it with a given value in
map_contexts_. This swap was unnecessary because "mc" expired after the
function call was complete. It is more optimal to std::move(mc) into
the value in map_context_ that we were previously swapping with.
2025-01-25 08:58:45 -05:00
JJ Marr
af82672ca9 Add bugprone-use-after-move
It's generally bad practice to use something after it's been std::moved
from.
2025-01-25 08:58:45 -05:00
Subhraman Sarkar
5c97754115 lua: expose rich_label link handling mechanism
Adds `on_link_click` setter. The function set to this will be called with the target of the clicked link.
2025-01-23 09:14:54 +05:30
Charles Dang
8ee2a26634 Fix width weirdness with add_overlay_text
Closes #9633
Fixes #9591

This could also have been fixed by simply adjust the clip rect origin on left alignment (such an adjustment was present for the other alignments), but honestly there's no reason to be messing with the clip rect here when we can set the width directly. The floating_label internals would set the maximum text width to clip rect if no max with was otherwise specified.
2025-01-22 03:15:33 -05:00
Charles Dang
3f746900fe
Refactor unit bar drawing (#9763)
This fixes an issue where the bar borders would always be one pixel wide, regardless of the zoom level or game render scaling which made the bars stand out badly amongst the pixel art. This brings us closer to the old look from the surface-drawn days.

This is also an experiment with using normalized, fractional coordinates for rendering instead of absolute screen coordinates. I'd like to take this approach in more places, so this is a good proof of concept.
2025-01-21 01:04:50 -05:00
Gunter Labes
b784157f68
Fix query parameter handling 2025-01-19 19:22:43 +01:00
pentarctagon
29d949ba4b 1.19.8+dev 2025-01-19 11:55:40 -06:00
pentarctagon
11523799e8 1.19.8 2025-01-19 11:53:14 -06:00
pentarctagon
8920489f54 Revert "remove unused handler"
I'm not sure how it's possibly useful, but apparently this can be sent by the python client

This reverts commit fdc8d92fe6c38c995e0ef02c7fd219841da41ad8.
2025-01-19 09:48:05 -06:00
pentarctagon
fdc8d92fe6 remove unused handler 2025-01-19 09:36:31 -06:00
pentarctagon
cd8e88db7b add manpage documentation
rename some lambdas

fix the admin delete checking against the add-on's username/password information
2025-01-19 09:31:28 -06:00
Gunter Labes
19d957e925
Avoid logging sensitive data 2025-01-19 12:59:54 +01:00
Charles Dang
0c8d528dce Rect: replace subrect with precise_subrect
Turns out the loss of precision over subsequent uses of subrect results in incorrect rendering, even if you round in point_at.

This makes it a non-member function so it can work with both rect and SDL_FRect as input.
2025-01-18 21:39:52 -05:00
Charles Dang
5dabb53088 GUI2/Units Dialog: simplify header handling
Any column with a sorter will automatically be shown. Also removes the show_header config option from the Lua wrapper.
2025-01-17 22:55:42 -05:00
Charles Dang
2371b8cc0d GUI2/Listbox: explicitly show header toggle when setting sorter
This is mainly for the units dialog code, which hides all the sorters beforehand. I decided to put it here, but in future we might want it to be more targeted, in case it becomes an unexpected side effect.
2025-01-17 22:53:35 -05:00
Charles Dang
a6afd31632 Don't bind lambdas 2025-01-17 21:02:15 -05:00
Charles Dang
3aaa93a65a Clear window backbuffer before rendering
Even though we direct all intermediate rendering to our own backbuffer, SDL recommends clearing the window backbuffer before drawing to it. I don't know if this changes anything with our usecase, but best to follow their recommendations, since SDL interacts with the underlying display driver.
2025-01-17 21:00:47 -05:00
Subhraman Sarkar
939ba4f7b4
texture: use size instead of w/h pair and reduce direct SDL calls (#9754)
Co-authored-by: Charles Dang <exodia339@gmail.com>
2025-01-17 13:58:02 -05:00
Pentarctagon
d8abcff103
wesnothd: use lambdas instead of rs_base (#9747) 2025-01-15 21:14:00 -05:00