Commit graph

42 commits

Author SHA1 Message Date
josteph
d26c2a2290 Draw ellipses and bars during draw/sheath animations
Issue #1527
2019-09-16 22:16:02 +00: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
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
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
josteph
fc2c0e7ee4 Unit Display: When a recruiting unit is visible but the recruited unit is not, scroll to the recruiting unit and show the recruit animation.
Fixes #3577.
2018-10-19 19:30:54 +00:00
josteph
0f129f2d10 Units: Add is_visible_to_team() overload and use it to improve the previous commit. 2018-10-14 17:56:49 +00:00
josteph
180971da2b Unit Display: When a unit teleports, don't scroll to the source or destination hex if the unit is invisible there. 2018-10-14 17:55:33 +00:00
josteph
50c85f4691 Unit Display: When the recruiting or recruited units is invisible, don't scroll to it.
When the enemy leader and the unit it recruits are both invisible,
scrolling to them would leak their location to the player.

(cherry-picked from commit 4db974431d)
2018-10-07 03:25:21 +00:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0
(cherry-picked from commit bc4d22dc72)
2018-10-07 03:23:36 +00:00
Charles Dang
2b65a8c5c8 Units: refactor display_context parameter out of ability functions
This was essentially only needed for the affects_side() helper. THAT'S IT. All this code just for
one single line... Anyway...

Utilized the display singleton's display_context getter instead. This also means fewer explicit
uses of resources::gameboard as the display_context object, meaning more compatibility with the
editor (not that that's relevant for most of the changed usecases, such as the AI, but it does
affect unit::get_abilities, which might be useful there in the future).

This also removes the display_context parameter from unit::invisible() since it was only passed to
unit::get_ability_bool().

unit::is_visible_to_team() also had its display_context parameter removed. It was used once as an
argument for invisible() and the other case was replaced with display::get_map().

(cherry-picked from commit 7e442cbb54)
2018-10-07 03:19:34 +00:00
Charles Dang
baf02ebf1d Units/Display: minor code cleanup
(cherry-picked from commit 882aba3349)
2018-10-07 03:19:33 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f693)
2018-10-07 03:17:59 +00:00
Celtic Minstrel
afc60b9cc6 Rename the unit copy function (and make it non-static) 2018-03-11 01:36:17 -05:00
gfgtdf
a32f6aaf64 make sure units are always stored in unit_ptr step2
previously the unit ctor could invoke arbitrary umc lua code, for
example via advance_to -> add_modification ->
resources::lua_kernel->apply_effect and during that call the unit was
not owned by a unit_ptr, so the code could not use unit_ptr objects at
several places because the unit might not be owned by a unit_ptr object.
2018-03-11 01:36:16 -05:00
Charles Dang
ae53a38835 Use std::array for adjacent map_location arrays
I left the implementation of get_adjacent_tiles using messy C ptr arithmetic
since it most simply accounts for a few cases using arrays that are larger than
6 (such as in tod_manager) or underlying vector storage.

Also made use of std::array::size where applicable, and one case of std::array
iterators.

aspect_attacks_base::analyze_targets was changed to take a adjacent_loc_array_t
reference.
2018-02-20 11:33:51 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
eba94b3e22 Cleaned up unnecessary drawing calls
After testing, it seems these calls to raise_draw_event and display/game_display::draw()
were unnecessary - or at least, became unnecessary at some point. One or two are definitely
still needed, but removing these doesn't seem to cause anything to to glitch out. Likely
explanation is anything that needs updating just gets updated either immediately or on the
next play_slice loop.
2017-11-28 06:38:19 +11:00
David Mikos
ecb51029d7 Fix for jumpy movements in bug #1565
Add a new max_animation_time_ variable that checks whether the time
for the movement animation exceeds the potential time. This will
restrict the time interval to match the offset 0~1:200,0~1:200,etc.
as the unit is moving.
2017-07-19 20:06:33 +09:30
David Mikos
b244db3b18 Partial fix bug #1565, unit movement artifacts
Returns code for unit_mover:wait_for_anims to
invalidate hexes on unit movements. This removes
artifacts being left on screen after large animated
units have moved.
2017-06-25 13:45:17 +09:30
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00
Charles Dang
06199650e6 Deployed more display_context::get_team (cont. f9a021e and 921bbc2) 2017-04-26 05:13:17 +11:00
Celtic Minstrel
fcc0da5bd4 Some cleanup of attack_type usage for enable_shared_from_this safety
- Call shared_from_this() instead of taking the address
- Don't use raw pointers to attack_type
- Change some cases of attack_type objects that weren't owned by a shared_ptr
  (either owned by another object or allocated directly on the stack)

List of files that currently call attack_type constructors:
- game_events/conditional_wml.cpp
- gui/dialogs/unit_attack.cpp
- scripting/lua_unit_attacks.cpp
- units/types.cpp
- units/unit.cpp

Each of these has been individually considered and made safe for use with
enable_shared_from_this. (Most of them already were safe.)
2017-04-11 17:15:38 -04:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
f815c2272a Pass strings by constref when possible
These instances were found by cppcheck.
Thanks matthiaskrgr for running it.
2017-03-16 17:07:04 -04:00
Celtic Minstrel
8822dacd92 Merge branch 'wml_tag_porting' 2017-02-26 19:32:44 -05:00
Charles Dang
e22c8967ee Cleaned up global.hpp includes 2016-12-17 15:21:04 +11:00
Celtic Minstrel
010acd870d Properly port [animate_unit] to Lua 2016-12-11 18:08:08 -05:00
Charles Dang
f2d730bd86 Convert unit animation code to use color_t
boost::optional was used for certain colors in frame.*pp since there isn't a good way to convert
a color_t to an "is present" bool.
2016-12-07 11:10:30 +11:00
Charles Dang
ed15163b95 Convert uses of resources::units to resources::gameboard->units()
This mirrors the similar conversion of resources::teams in 6235e18bbd.
2016-12-02 12:00:08 +11:00
Celtic Minstrel
e7e5ca5fa2 Fix Travis 2016-12-01 15:06:25 +02:00
Charles Dang
a60433356d Refactored out display::rgb, red, blue, green, and blend_rgb 2016-11-30 14:46:22 +11:00
Charles Dang
1fa6a2d4b2 Convert uses of abs to std::abs 2016-11-07 11:30:21 +11:00
Jyrki Vesterinen
af733360a8 Fix a bunch of MSVC2015 compiler warnings about hiding declarations
This commit still doesn't fix all of them. I decided to leave alone
cases where variables with the same name are assigned in multiple
conditions of the same if...else if...else statement, and cases where a
scope logging macro is used multiple times in the same scope. In any
case, this commit greatly reduces the warning count on MSVC2015 and makes
new warnings much easier to spot.
2016-10-06 00:11:56 +03:00
Jyrki Vesterinen
7573678201 Fix crash on placing a unit with the scenario editor
The unit::get_ability_bool() function accessed resources::gameboard that
is not set in the editor. Now the function receives the display context
as a parameter instead.

I also fixed two crashes on editor startup in MSVC debug builds (both
caused by indexing the teams vector when there aren't any teams), and the
GUI2 unit list dialog showing wrong status icons.
2016-09-06 23:03:09 +03:00
Celtic Minstrel
b143ea4397 Use intrusive pointers for unit attacks
This is primarily for the purpose of the Lua API, to enable attack data to persist
even if a unit no longer owns the attack.
2016-08-28 00:24:23 -04:00
Charles Dang
6235e18bbd Replace resources::teams with resources::gameboard->teams() 2016-08-11 07:27:48 +11:00
Charles Dang
24577e117d Merge pull request #716 from wesnoth/boost_trimming
Boost-related cleanups
2016-07-30 15:51:30 +11:00
Charles Dang
05092ba2f6 Refactor most boost pointer related stuff to use their stdlib counterparts
This constitutes drop-in replacements for:

* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast

This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.
2016-07-25 09:28:42 +11:00
Celtic Minstrel
63081cac46 Simplify enum output with std::transform 2016-07-19 17:20:21 -04:00
Celtic Minstrel
ca382018b7 BOOST_FOREACH -> range for 2016-04-02 09:38:29 -04:00
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04:00
Celtic Minstrel
bc711f5f43 Consolidate related files into subdirectories 2016-03-20 16:20:09 -04:00
Renamed from src/unit_display.cpp (Browse further)