Commit graph

107 commits

Author SHA1 Message Date
Severin Glöckner
d6d2a4f996 systemd: drop _ prefix from username
man 5 sysuses.d recommends:
It is strongly recommended to pick user and group names that are unlikely to clash with normal users created by the administrator.
A good scheme to guarantee this is by prefixing all system and group names with the underscore, and avoiding too generic names.

Looks better without underscore. wesnoth is unique enough to not clash, most daemons on Arch don't have an underscore either.

The group is created implicitely when the user is created.
2024-01-18 01:27:01 +01:00
P. J. McDermott
fc4d11b2cb systemd: Run as _wesnoth:_wesnoth
systemd 246+ logs a warning message, because running as "nobody" is
unsafe:
https://github.com/systemd/systemd/blob/v246/NEWS#L106-L113

Prefix names with underscore, as recommended by systemd documentation:
https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html
2024-01-15 21:33:26 +01:00
P. J. McDermott
13d5682487 Save horizontal scrolling inversion check in static variable
Avoids two to four function calls on each SDL_MouseWheelEvent.

Also update code comment and changelog entry based on @vgaming's report
of issue #3362 being fixed.

Slightly improves commit ab4001d.  Tested again with SDL 2.0.14 and
2.28.5.
2024-01-01 16:00:54 -06:00
P. J. McDermott
7453a942d6 Add changelog entry for horizontal scrolling fix (PR #8137) 2023-12-28 11:14:15 -06:00
pentarctagon
3c2c17f11c changelog_entries 2023-12-16 21:04:56 -06:00
Subhraman Sarkar
f1f67ae5df
Add functionality to Time Schedule Editor (#8066)
selected schedule will write to utils/schedule.cfg on scenario save

HOTKEY_EDITOR_CUSTOM_TODS is disabled unless user loads scenario

custom_tod:Preview button and associated callback added.

editor:translatable attributes now written with leading underscore

editor:support for multiple custom time schedules
2023-12-14 17:12:07 -06:00
Steve Cotton
30b91ad902 EI S04b: Avoid using a macro in a translatable string
The required number is already in a WML variable, herbs_needed. However, the
string is used in an `[objective]` tag, which means we're not necessarily in
an ActionWML block when it's shown, and thus can't use the Lua API to look up
plural strings. Instead, brute force it by making 6 separate strings.

Also, use the mainline `ALTERNATIVE_OBJECTIVE_CAPTION` macro instead
of a campaign-specific translatable string.
2023-12-10 22:53:14 +01:00
Steve Cotton
29d21434c1 EI S04b: use en_US spelling for the scenario id
* S04b start-of-scenario saves since 1.17.21 will be broken
* S03 mid-scenario saves since 1.17.21 will show a warning,
  and players will only be able to go west
* Saves from earlier versions are already broken by the campaign rewrite
2023-12-10 22:53:14 +01:00
Steve Cotton
85a3f8a2df Preprocessor: allow wesnoth --preprocess to work on files without the .cfg extension
The changed function is only called when using --preprocess, but calls itself
recursively. This moves the filename filter to be around the recursive call,
thus skipping the check for the top-level call.
2023-12-01 17:05:10 +01:00
pentarctagon
bf93e24572 changelog updates 2023-11-18 17:00:39 -06:00
newfrenchy83
9474525612
check alternative_type and replacement_type when filtering on type
Also move them from being attributes of [damage] to [damage_type], to avoid infinite recursion when determining what the damage type should be.
2023-11-10 16:35:57 -06:00
Steve Cotton
bf89dfb818 Help Browser: only show one image if male and female are the same
If a unit type has male and female versions, then two images of the unit are
displayed at the top-left of the help page. However, it did this even if the
two images were the same, which made the duplication look like a bug.

The Naga Fighter is one of the affected unit types.
2023-11-08 00:44:46 +01:00
newfrenchy83
3910817cf7
add a 'replacement_type' and 'alternative_type' attribute in [damage] special or ability who modify the type of attack used (#7865)
At the suggestion of @stevecotton, I propose a special 'replacement_type' and 'alternative_type' attribute capable of modifying the type of attack used when the conditions are met.

Also make Holy water combine arcane damage with native type of weapon

Like holy water imbued ordinary weapon, it's seem logic what arcane damage dominant what if more efficient what original type(water can't altered pierce or blading of spear or sword)
2023-10-25 08:10:52 -05:00
Steve Cotton
f5f76ade9a Avoid an assert in replay::add_start_if_not_there_yet with corrupt files
With this it puts the player back to the title screen after showing
an error dialog, so it's not much better, but at least it's not a
crash.

Fixes issue 7164. We weren't able to work out what caused the file corruption
reported, but I believe it's a race condition about saving while the AI is
recruiting. The file in the bug report has a `[snapshot]` tag with
`init_side_done=yes` but without a `playing_team` attribute, which must be the
result of `game_state::write()` when not in the `PLAY` phase. Loading such a
file causes `game_state::start_event_fired_ == false`, and triggers
`play_controller::start_game` to call `replay::add_start_if_not_there_yet`.

The i18n'd string is reused from `game_launcher.cpp`.
2023-10-21 20:31:21 +02:00
pentarctagon
75c4aeb65a changelog_entries 2023-10-16 23:13:10 -05:00
AugustVesterbacka
3127629f59
Mousing over a village shows the owner side in the UI (#7920)
Added village owner flag and side icon to terrain info field
2023-10-15 14:51:48 +02:00
Steve Cotton
d80e4a3b03 Update the changelog, merge changelog_entries files
I haven't merged all the details about the new tags, as that can
go in the documentation on the Wiki instead.
2023-10-15 14:07:14 +02:00
newfrenchy83
b5805eca8f
Add priority and filter to overwrite specials (#7746)
using overwrite_specials alone means that we have only two possibilities, either one_side is chosen and in this case if the ability used as a weapon carrying the attribute is applied to the unit (apply_to=self), the other abilities are the same type applied also to 'self' not carrying the attribute will be overwritten, but those of the opponent with apply_to=opponent will be kept in the list; or else both_sides is chosen and all abilities of the same type that do not carry the attribute will be overwritten. To be able to use the attribute in abilities like [damage] for example, it is necessary to be able to be even more selective as for a 'charge' type leadership with multiply=2.5 but which must not be combined with the classic charge and without overwriting the aute [damage] as backstab, [overwrite_filter] to only match damage with apply_to=both and active_on=offense is then interesting.

adding priority allows you to select that it ability can use its overwrite_specials attribute while the others can be overwritten in the same way as an ability without the attribute. Finally, this system makes it unnecessary to limit the use of the attribute to abilities used as weapons but also to special weapons.
2023-10-08 10:09:31 -05:00
newfrenchy83
a17369597c
give to abilitie support of halo or overlay (#7856)
give abilities support of halo or overlay so that the unit benefits from a second halo or overlay when conditions are matched

One of the things that bothers me is the permanent character of the halos of the Mage of Light and other units with the "illuminates" ability, which forces them to program only a permanent illumination applied only to the possessor of the ability.

Adding the halo attribute to ability does not change anything about the behavior of the unit, but can be used in several cases:

1 allowing the use of ""illuminates" whose activity would be variable, in this case encoding the halo in [illuminates] ability and not in the unit_type allows to modulate the appearance of the halo under the same conditions

2. Applying illumination to adjacent units, I know it's pretty cheesy but a set developer might consider it easier if the hlo display follows the same logic.

3 The halo used to illustrate the possession in the unit of a special weapon used as leadership, the halo would be used to raise the possessor of the ability.

for overlay, same logic for illustrate possession of a special weapon used as leadership, or influence on student

with the "halo_image" attribute, it is now possible to give Sun Sylph units an illumination ability with an activity depending on the incarnate sun attack instead of giving the ability and the halo via obect and therefore allowing the player to have access to the description of the ability even when it is inactive.
2023-09-25 11:06:41 -05:00
pentarctagon
c831976236 changelog_entries 2023-09-16 22:32:15 -05:00
Hejnewar
36822eca3f
Miscellaneous units changes (mostly) 2023-09-16 19:55:28 +02:00
Wedge009
4f3cde4750 LoW: Replace lingering instances of ‘old’ style gold carry over for S9, S11 and S14 (resolves #7862) 2023-08-24 15:04:25 +10:00
Pentarctagon
828251dc86 changelog_entries 2023-08-19 20:55:34 -05:00
Steve Cotton
1836530ba6 Fix a crash in :inspect when switching from page 2 to a different item
Switching to a different item cleared the data, but didn't clear the
cache of where the page breaks are located. The subsequent call to
`get_data_paged(int which_page)` has a bounds check for the page number,
so it's sufficient to just clear the page breaks, which is already ok
as it resets the object to the same state as a newly-created instance.

Forward-ported but currently untestable in master, as the page-selection
buttons are only shown when there's a large amount of text, which triggers
the known regression (the credits-crash bug).

(cherry picked from commit 7cb5f09bcf)
2023-08-19 19:02:26 +02:00
Hejnewar
07a64d4603
Arcane Resistances Rework
The basis for this rework is lowering the extremes in acrance resistances between units and factions. That allows for more free usage of arcane damage and helps with balance of games in which high levels are way more frequent than in standard default 1v1 or 2v2.
2023-08-17 14:25:59 +02:00
Steve Cotton
ec3c2af9e6 AToTB: Remove the instant-communication amulets
Having these in canon felt like a plot hole in other campaigns. If an
apprentice mage could make these amulets circa 350 YW then every village and
border-fort should have them, but Wesnoth's storylines work better if a
messenger on horseback is the usual method of long-distance communication. For
example, TSG is about a commander sent to discipline a lazy outpost, only to
find that they should have brought reinforcements. When it's the enemy trying
to communicate, DM S21 and UtBS S08 both involve stopping the messengers.

This changes the intro to have a beacons for communicating with the trade
caravans, I'm leaving it ambiguous whether it's a smoke signal or a fire
signal. Fire beacons might make more sense if the village sees the caravan's
campfires at night and, in normal usage, light the beacon to trade.

While this adds beacons to canon, they're an ancient technology with a limited
range and very limited bandwidth. There are easy plot reasons not to set
beacons up, such as the costs of having people watch for and maintain them,
there are easy plot reasons why they don't work on a given day, such as
weather, and there are easy plot reasons for attempted communication to be
ignored by assuming that it's a fire for a different purpose.

Previously suggested in https://r.wesnoth.org/p669889 .
2023-08-12 19:51:28 +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
Wedge009
22d27a15f7 UtBS S3: Resolve Garak's attacks only partially being converted to fire damage on turn 2 (resolves #7774). 2023-07-17 02:56:51 +02:00
Pentarctagon
880644f9a1 changelog_entries 2023-07-15 22:11:06 -05:00
Cody Burchell
71e83f7b85
Prevent duplicate advancements from being added to unit type (#7743)
* Add myself to Miscellaneous Contributors

* types: Add unit tests over adding advancements
2023-07-09 05:08:10 +02:00
Wedge009
fd744addcf
DiD S3: Resolved Darken Volk speaking from the darkness (#7763)
* DiD S3: Resolved Darken Volk speaking from the darkness at the end of the scenario (resolves #7758)

* Restore victory event changes for Darken Volk.

* Correct indentation.
2023-07-04 14:20:51 +10:00
Wedge009
9be683cbba
Liberty S5: Make the loss of Hans a lose-condition (#7756)
* Liberty S5: Make the loss of Hans a lose-condition (resolves #7750).

* Remove second line as per nemaara's review.
2023-07-04 13:15:46 +10:00
Pentarctagon
eb2147cd5d changelog_entries 2023-05-20 22:00:30 -05:00
newfrenchy83
f9a94e1312 [1.17] add [filter_ability] in [filter] events and [effect]remove_ability and [filter_ability_active] in [filter] events
see https://forums.wesnoth.org/viewtopic.php?p=681371#p681371 in forum

the type of ability used is also filtered.
2023-05-09 19:26:10 +02:00
Pentarctagon
61a40a5847 changelog update 2023-03-18 21:41:26 -05:00
Pentarctagon
9315079389 Add curl-based functionality to download files from a URL.
This is a complement to #7416 where it replaces opening the replay's download URL in a browser with directly downloading it into the player's save folder.
2023-03-15 14:49:16 -05:00
Steve Cotton
405e315f1e Add a CMake and SCons flag for GLIBCXX_ASSERTIONS without GLIBCXX_DEBUG
Turning GLIBCXX_ASSERTIONS adds some bounds checks, such as checking
in std::string::operator[]. It's a subset of the checks that GLIBCXX_DEBUG
adds, but has the advantage that it doesn't require a rebuild of the Boost
libraries.

None of the CI builds enable these assertions, as they slow down the code
which makes the unit tests time out.
2023-03-03 10:44:22 +01:00
Steve Cotton
cf4bcd1c4e Big changelog update
Most of this came from checking the commit log, changelog_entries hasn't
become part of the usual workflow yet.
2023-02-19 14:50:33 +01:00
Steve Cotton
3d13628bb8 Editor: let the help text switch between the top and bottom of the screen
If the northmost hexes of the map are visible, put the text on the bottom; if
the southmost are visible, put it on the top. Also, make the text smaller if
it's very wide.

It used to be fixed to the bottom of the screen, but this meant that it always
obscured the southmost hexes of the map, and the only way to avoid that is to
scroll east/west, or to add an extra row on the south. Similarly, having it at
the very top obscures the northmost hexes.

Moving it to any fixed location that isn't the edge of the screen makes it
possible to edit all the hexes, but also makes it more annoying when working
elsewhere on the map; that trade-off was rejected in review.

For very small maps, it will be at the bottom of the screen in the border
outside the map area. For any screen resolution there will be a specific
map-height that still has the old issue, but that's an improvement on it
happening for every map size.

Cherry-pick of 29d86d2c36.
2023-02-15 15:03:36 +01:00
Tahsin Jahin Khalid
b8b402722f Units: Giant Ant advances to Soldier Ant 2023-02-12 10:21:46 -06:00
Celtic Minstrel
cbbd34a79e
Add new attacks_used key to [attack] (#7351) 2023-02-04 19:55:04 +01:00
Tahsin Jahin Khalid
33ce739362 add changelog entry for PR7332 2023-01-30 00:52:04 +08:00
Steve Cotton
42baec931c Fix crash in scenario editor when placing units
The previous bugfix fixed a crash when loading savegames with units whose
abilities accessed the map while the display_context was still being
constructed, however it reintroduced a bug in the scenario editor. Using the
unit tool always crashed when adding any unit.

This commit uses 4d1fc268b1's code path whenever possible, however it falls
back to 6a21fdc675's code path when 4d1fc268b1 would assert. In practise one
path is used in game and the other is used in the scenario editor, but doing
the logic in this way ensures that any edge cases are going to affect the
scenario editor rather than the game itself.

Cherry picked from commit 1485cfd625,
with conflicts because code from attack_type::weapon_specials() has
moved to attack_type::weapon_specials_impl_adj().
2023-01-23 00:04:33 +01:00
Iris Morelle
3e3cd06121 units: Limit energy bar sizes to the game tile size
Because of the move to hardware rendering in commit
afd6baa7cf, some relevant info
was lost that was previously used to limit bar height in
particular.

This patch re-adds a dimension check and additionally ensures
that the bar width doesn't exceed the tile size either.

Fixes #7171.
2023-01-20 11:17:22 +01:00
Steve Cotton
686e35e0e3 Use two-color orbs for allies' units (configurable by preferences)
These orbs no longer look the same as the player's own orbs, so they
won't cause confusion in multiplayer.

The relevant part of the advanced preference now shows:

```
[ ] - Show ally orb
[ ] - During ally’s turn, use a two-color orb to show movement
Radio buttons for colors: ( )  ( )  ( )  ( )  ( )  ( )  ( )
```

That offers these choices:

* Don't show ally orbs at all
* Always use the one-color (with ally color, not status)
* Use the two-color when that ally is playing, single color at other times
* Use the two-color when that ally is playing, no orb at other times

Rename some `allied_orb` functions to be `ally_orb`. This makes them consistent
with both the names of the corresponding `enemy_orb` functions and the WML
attribute that's used in the preferences file.

This probably doesn't need a change to the in-game help, at least for the en_US
version of the documentation. The current text in data/core/help.cfg is:

* Blue for allied units, except during that ally's own turn.
* During the ally's own turn, their units will be shown with the colors showing
whether the units can still move and attack; however their moves, and the
corresponding orb changes, are delayed as explained in "Shroud and Fog of War'.
2023-01-17 18:06:46 +01:00
Pentarctagon
b08582209b 1.17.12 2023-01-14 18:27:55 -06:00
Steve Cotton
d35ea2f2dc Orb color preferences dialog layout and tooltip
Add some spacing to make it clearer what is grouped with what, move the
disengage orb's setting to be part of the partial orb's group, and add
a tooltip for it.

This dialog uses checkbox labels as section headers to indicate what the rows
of colors refer to. This commit doesn't change that, but it makes the grouping
clearer. Actual section headers would take additional space and probably not
look any better.
2023-01-14 18:10:14 +01:00
Steve Cotton
9f780903ab HttT S03: Rewrite intro, hint about training troops for S06
The island gives the player two fronts to progress on, and it's early enough
to give the player time to prepare for the SoE. Hint to them about improving
their recall list.

When trying to add that hint as a single-line change to the dialogue, I
reviewed the existing text and felt it didn't flow well. Reading the feedback
thread, Delfador should have more emotion about finding his childhood home
overrun; however I've gone for practical thoughts first.

The hint isn't #ifdef to only appear on easy, because the text wouldn't flow
without it - take that line out and it goes from "there are more orcs than I
thought" to "we must fight these orcs, who aren't the ones at the SoE". Also,
players who are already doing XP management can feel knowledgeable when they
see it.
2023-01-03 23:32:05 +01:00
Steve Cotton
7ddf691e13 Allow abilities.cpp to access units and teams earlier during play_controller::init
Partially reverts 6a21fdc675
Fixes #5643
Fixes #7238

There's a bunch of global things that can be accessed either via global
pointers in the `resource` namespace, or via `display::get_singleton()`. The
singleton and these global pointers are set up in `play_controller::init`,
however there's a section where things are available via the global pointers
but the `display` singleton doesn't exist yet. During that time, checking
whether an ability is active can crash the game.

Removing the global pointers is a good goal, but detouring through a GUI class
to access the data causes its own problems.

The "has already been confirmed valid by both callers" comment is replaced with
an assert, because there's currently at least three callers.
2022-12-30 22:08:32 +01:00
Pentarctagon
2921124c10 Forgot changelog_entries again... 2022-12-18 08:13:23 -06:00