Commit graph

443 commits

Author SHA1 Message Date
Celtic Minstrel
d090f91bce Alter the special notes syntax in EffectWML so that the note macros can be reused in that context 2019-10-04 23:49:05 -04:00
josteph
c72f1dc07a Abilities: Revert an unintentional change of the behavior of affect_allies.
Fixes #4257
2019-10-01 19:33:24 +00:00
josteph
a7fc184ccd unit_recall: Show unrecallable units grayed out.
Part of issue #1282.
2019-09-26 16:07:44 +00:00
josteph
e306af9ae4 Attack Dialog: Show the name_inactive of an inactive weapon special.
Fixes #4352
2019-09-26 15:54:29 +00:00
josteph
d26c2a2290 Draw ellipses and bars during draw/sheath animations
Issue #1527
2019-09-16 22:16:02 +00:00
Steve Cotton
af91654e26 Fix the build
Explicitly use t_str() to avoid an ambiguous construction from
7bee8ee157, which made GCC9 error out because it
could alternatively use t_string::t_string(const string &).

Resolve the merge conflict from 26d1ca7a7d
2019-09-15 22:55:05 +02:00
Celtic Minstrel
7bee8ee157 Add special note support in [unit] and [effect]. 2019-09-15 13:19:17 -04:00
Celtic Minstrel
15f431785a Add [special_note] tag in [unit_type] as a neater way of specifying special notes for the unit's description 2019-09-12 08:51:05 -04:00
josteph
d513c499f1 SUF: Fix infinite recursion in [hides][filter_self][filter_vision]
Fixes #1389
2019-09-07 12:55:49 +00:00
gfgtdf
f4e7f417e4 reset ellipse on unit advancing
same reason as for the overlays= change, in particular this fixes
remove_object of objects that set ellipses.
2019-08-24 22:21:25 +02:00
gfgtdf
398ba56f77 formatting 2019-08-24 22:19:58 +02:00
newfrenchy83
95a941b923 resolveHttT, Konrad's portrait is not used after he is lvl 2 (bug #4248)
pr #4250

resolves https://github.com/wesnoth/wesnoth/issues/4248 which was broken before in  66a282a96b
2019-08-18 15:49:47 +02:00
Steve Cotton
41101a2d67 Change the deprecation of [unit]overlays= to 1.17
As discussed post-merge in PR#4211.
2019-08-17 20:13:19 +02:00
Steve Cotton
b2cd1cf6c3 Handle unit overlays as modifications, allow [effect] to remove them
Possible fix for #4058, with the following logic:

* If non-empty, [unit]overlay= is handled by adding modifications
* unit::write will always output an empty overlay=
* The Lua API's get_units() will still provide the list of overlays
* [effect]apply_to=overlay can now remove as well as add overlays
* [remove_unit_overlay] is implemented with [effect]apply_to=overlay

Using [object]s with durations hasn't been tested, but expected effects:
* An expired add= followed by a non-expired remove= will simply cause the remove=
    to have no effect when std::remove(overlays_ ...) is called.
* A remove= followed by [remove_unit_overlay] cause the [remove_unit_overlay] to be a no-op,
    and the overlay will reappear when the first remove= expires. This edge case is already
	documented as unsupported on the wiki.
2019-08-10 23:25:04 +02:00
Charles Dang
4a3be684f4 Removed trailing tabs and whitespaces from C++ source
[ci skip]

I ran the same command from 9b7b1751fd.

Excludes:
* lua/
* spirit_po/
2019-08-04 22:31:10 +11:00
Steve Cotton
86f430c2dd Refactoring movetype and terrain_costs (#2486)
Simplify the public interface for movement, vision and jamming costs to only
the movetype class and a read-only interface called "terrain_costs".  Changes
to terrain_costs now need to be done through the movetype instance, so logic
about how movement, vision and jamming interact with each other can be handled
in movetype.  This fixes a possible dangling-pointer issue: the default
copy/move implementation in movetype::terrain_info would have copied raw
pointers, without ensuring that those pointers remained valid.

This feels too complex, but also feels like time to merge it and do any further
cleanup as a separate commit.  For example, there's only one place that calls
make_data_unique, and one place that calls make_data_shareable. Merging the
functions should make it clearer.

The terrain_info class is now a private class implementing the terrain_costs
interface, previously it was a public class with raw pointers to other
instances of itself, and a copy constructor which copied the raw-pointers
as-is. One of the raw pointers is still there, but it's only non-null when both
instances involved are owned by one instance of movetype.

=== To cherry-pick back to 1.14 ===

Cherry-pick the tests from 358f564301.

* units.cpp: needs a manual merge. Remove the `set_attr_changed(UA_MOVEMENT_TYPE)`
  call from the master version.
* movetype.cpp: take the changes in this commit, in each case the conflict is
  the change of std::shared_ptr::unique() to std::shared_ptr::count(), which
  has been replaced with make_data_shareable() and make_data_writable().
* movetype.hpp: take the changes in this commit, deleting the old terrain_costs
  class and adding functions to movetype.
2019-07-31 11:39:39 +02:00
gfgtdf
4741b0037b fix unit_type_fix on variations
previously it would not apply the changes to the variations,in particular the genders
2019-07-23 19:31:34 +02:00
gfgtdf
1fafa76962 remove unused argument 2019-07-23 19:31:34 +02:00
Charles Dang
ee35f6ac9a Cleaned up various surface-related backend things
* Removed create_neutral_surface in favor of a surface ctor that takes w/h dimensions.

* Removed make_neutral_surface in favor of a surface::make_neutral function. Most usecases of this were
  to make a copy of a surface anyway, so I added a new surface::clone function

* Moved the pixel format validation and conversion to the surface class. Now *all* surfaces should be
  guaranteed to be in the 'neutral' format. Any new surface that is created (with clone() or the dimension
  ctor will be in that format, and any time a raw SDL_Surface* ptr is assigned, it is also converted. This
  applies both to the ctor and assignment operators.

* Removed create_compatible_surface. All surfaces should be compatible in the first place.

* Removed surface::assign was in favor of simple assignment operators. The existing assignment operators
  already just called assign().

* Removed surface::null in favor of the implicit SDL_Surface* conversion operator for consistency. We were
  already using null and implicit pointer bool conversion, so I decided to go with the latter. I was going
  to add an operator bool(), but it was ambiguous in surface-to-surface comparisons.
2019-07-22 15:39:00 +11:00
Jyrki Vesterinen
671f32aa62 Fix a Visual Studio compiler warning
Two variables called "name" were in scope simultaneously and one
shadowed the other.
2019-04-18 21:48:35 +03:00
jostephd
e3728be0ea
Unhide recruited unit when both the recruiter and recruitee are invisible to the viewing team (#4003)
This looks wrong, as though it would be a regression introduced by
83ba09a5a9 (#3559), but I found no difference in my testing.
2019-03-30 16:20:00 +00:00
josteph
f18e24caf0 Document hiddenness. 2019-03-27 22:19:07 +00:00
gfgtdf
e4c4ca7572 add [unit_type_fix] in [scenario], [era] etc
fixes #1451

Currently advancements can be changed in two ways:
1) Via [advancefrom], this causes OOS in multiplayer
2) Via certain campaign etra defines, this has other disadvantages see

The new [unit_type_fix] that is accepted in [scenario], [multiplayer],
[era], [modification] , [campaign] and [ressource] changes the advancement
of a unit type only for one game and has non of the disadvantages of
the other two methods.

We should also deprecate the other two methods.
2019-03-20 20:27:59 +01:00
jostephd
25957e3f63
UI: Highlight enemy units in "Show Enemy Moves" mode (#3961)
Fixes #1989
2019-03-05 17:09:13 +00:00
josteph
7186e30803 Typo fixes
In Caves of the Basilisk, give the monsters names so their descriptions
would show in-game.  The descriptions show in the tooltip, so
a non-empty name is required in order for players to be able to summon
th tooltip.
2019-03-03 15:36:54 +00:00
newfrenchy83
00ef295c1b resolve https://github.com/wesnoth/wesnoth/issues/3771
now, filter_opponent usable for backstab abilities
2019-02-19 22:24:25 -05:00
blaf
845978dc9c Fix #3912: Abilities display in sidebar should use the mouseover hex (#3929)
Show ability of a selected unit as active/inactive with respect to
mouseover hex. For example, selecting an Elvish Ranger that stands on a
forest and highlighting a water hex should show the "ambush" ability in
gray.
2019-02-18 19:45:25 +02:00
Maximilian Fricke
2b975e65a7 unit: Fix bug in unit movement animation
Do not tag unit appearance as changed when calling set_facing() and the
unit facing did not actually change
2019-02-10 22:09:15 +01:00
Sean Yeh
ef37e84fe1 Make defender's "first strike" inactive if the attacker also has "first strike" 2019-02-08 22:17:58 -06:00
jostephd
40fbb6dc43
Merge pull request #3731 from jostephd/sidebar-changes
Several sidebar changes
2019-01-07 21:05:39 +00:00
newfrenchy83
7114174789 Fix #3811 negative value in heals ability
When multiple negative heal abilities are present, the game now
chooses the ability with the lowest value. The leadership ability
now also uses the same get_composite_value function that is also
used by most other abilities
2019-01-02 20:29:52 +01:00
gfgtdf
e71033374c
fix apply_to=overlay effect
previously [unit] overlays= would overwrite it, even when no overlays= is given.
2019-01-01 01:37:16 +01:00
Wedge009
f6a32792d0 Use explicit casts to accommodate changes to boost's tribool in 1.69.
(fixes #3646)
2018-12-27 08:15:10 +11:00
newfrenchy83
f264dc6c86 fix lowest sub used instead of highest
if heals with sub =8 and another heals with sub=4 it is sub=4 who is used. i changed this rule in effect for highest sub was used
2018-12-16 19:06:34 +01:00
Celtic Minstrel
16927f9508 add filter_attacker and filter_defender to abilities
To complete the resemblance to the real weapon specials, I add these two tags

Closes #3743
2018-12-02 10:21:47 -05:00
josteph
5d175eb493 Healing: Display healing animation if the healer is visible but the patient is not (due to fog, shroud, nightstalk...) 2018-11-30 17:18:23 +00:00
josteph
3c9f425a6c Attack Enemy: Inactive weapon specials are now shown muted, rather than elided altogether. 2018-11-30 16:39:54 +00:00
josteph
e569d896d8 Refine unplagueable/unpoisonable checks as in battle_context_unit_stats. 2018-11-30 16:39:54 +00:00
josteph
526d22648e Attack Enemy: Don't show "poison" in the attacks list if the enemy is unpoisonable. 2018-11-30 16:39:54 +00:00
josteph
c7e5ad3a8f Sidebar: Reformat trait tooltip
In the case of strong and resilient, the tooltip should now be easier
for players to understand.

Old:
	"+4 HP and +1 HP per level"

New:
	"+4 HP
	+1 HP per level"

Old:
	"battle axe and hammer: +1 damage and +1 HP"

New:
	"battle axe and hammer: +1 damage
	+1 HP"
2018-11-18 12:26:07 +00:00
gfgtdf
3bfe5c2041 fix movement loss after expire_modification
previously when the unit had a movement effect, expire_modifications
could remove movement via the `movement_ = max_movement_;` line in
the movement effect implementation.
2018-11-10 22:29:35 +01:00
gfgtdf
66a282a96b do not write unchanged unit attributes
This should make savefiles smaller. Note that this does not effect all
games since some wml codes will disable this optimisation.
2018-11-10 22:27:02 +01:00
newfrenchy83
73a331b952
Fix bug in teleport animation
temp_unit.set_location necessary else pre and post teleport animation is played at the same place(arrival).

Closes #3684
2018-11-06 14:55:17 -06:00
Charles Dang
00a1edd149 Convert a bunch more C-style casts I missed in 0dc5656 to static_cast
(cherry picked from commit cb43d8b35f)
2018-10-28 02:53:11 +00:00
Jyrki Vesterinen
d5a4946aaa Fix build 2018-10-27 20:14:15 +03:00
gfgtdf
6c696cd127 experience modifer no longer applies to [effect]
now experience_modifer only changes the unit types xp, it no
longer has an effect on [effect]s that change xp, in particular
it fixes #1796 where a apply_to,increase=max_experience,2 [effect]
added one or two max_experience to a unit dependend on how much
max_experience it had before. This was in particular a problem
because this effect would only behave like this during unit
construction, not when an object is added ([object]).
2018-10-27 17:43:12 +02:00
gfgtdf
7111887535 [unit] moves=-1 no longer removes attacks
there is no reason why it should, also this behaviour was not documented.
2018-10-27 17:43:12 +02:00
gfgtdf
e634198a5e make unit filters a little more safe against nullptr access. 2018-10-27 17:43:12 +02:00
gfgtdf
cc5aac7009 replace impossible check with assert.
since we refactored gamestate construction to initialize units last, it is no longer possible that resources::filter_con is a nullptr here.
2018-10-27 17:43:11 +02:00
gfgtdf
783dc0767b more modifiable attributes to lua units 2018-10-27 17:43:11 +02:00