41 Commits

Author SHA1 Message Date
Pentarctagon
340023921d
2022 copyright update. 2022-03-06 19:07:13 -06:00
Pentarctagon
57ce449af8
Re-add attribution to copyright notices.
These are mostly useless and outdated/wrong, but apparently it's probably illegal to remove them.
2021-07-27 20:21:38 -05:00
Pentarctagon
ba75e1af50
Copyright update.
This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
2021-07-26 11:38:03 -05:00
Steve Cotton
4a43d00522 Show a two-color tennis ball orb for the disengaged state (#5155)
As the disengaged state is part-way between the "partial" and "moved" states,
the orb has parts in each color. On the minimap these units are shown in the
partial color (which is also the color that would be used before this change).

This will match the mounted Quenoth units' "disengage" skill, when they
can still move but can't attack. It should also trigger for some UMC abilities
that get extra moves after a character attacks.

During testing, I found that TSG allows some of the bandits to attack on the
first turn of the bandit branch. There's no gameplay change there, but the orbs
make it much clearer that some units can still attack.

I think there are already too many preferences for orbs, so reused the existing
settings for the colors. A new "show disengaged orb" preference is added, which
when disabled shows the old partial orb instead.

Update the orb and ellipse sections of doc/manual/.

Notes about how I created the new orb image:

* create a color range to_ellipse_red with rgb=FF0000,FF0000,000000,FF0000
* wesnoth --render-image 'misc/orb.png~RC(magenta>to_ellipse_red)' images/misc/orb-ellipse-red.png
* open the orb.png and orb-ellipse-red.png images as layers in Gimp, add a layer mask to both of them
* use the layer mask to get each pixel from exactly one of the layers
2021-02-13 18:28:33 +01:00
Charles Dang
d65d12e89d Big cleanup of get_adjacent_tiles usage
This adds a new overload of get_adjacent_tiles that returns the array instead of taking the address of
the first element (a C paradigm). This also converts the use of the result to range-for loops when possible,
which is enabled b the fact that we're using std::array here instead of C arrays.
2021-01-16 20:38:24 +11:00
Pentarctagon
4c2b725ec0 Change all doxygen comments to the same format. 2020-12-31 23:59:28 -06:00
Steve Cotton
934cae6093 Refactoring the orb-coloring code, adding new units/orb_status.hpp
Instead of creating lots of image::locators and calling a family of
similarly-named preferences functions, this refactor encapsulates that logic
and uses an enum.

The new orb_status files still need adding to the MacOS build.

An assert has been added to `unit_drawer`'s constructor. There are two callers
- the `display` class guards it with an explicit check before constructing
unit_drawer. The `game_display` class doesn't have an explicit check, but it's
clear that other code in that class assumes the teams are already valid (and
would crash if they weren't).
2020-10-17 14:11:10 +02:00
Steve Cotton
1dadc397ce Remove incorrect docs about vilage_owner()
This comment was in both the .cpp file and the .hpp file. No need for two
copies of it, but more importantly the .cpp version wasn't updated for the
changes in c4a6b223f3db8ac3d6d7cc7fc162656e643f73d0.
2020-09-16 17:13:39 +02:00
gfgtdf
6d73033445
use shared_ptr for unit_ptr (#4985)
use shared_ptr for unit_ptr

This make the code a bit simpler, furthermore it
allows us to use weak_ptr to unit should we ever
need that.

Furthermore this adds a class shared_reference that wraps shared_ptr but can never be nullptr.
2020-08-07 14:30:40 +02:00
gfgtdf
c4a6b223f3 use 1-based side numbers in get_village_owner 2020-07-29 01:09:06 +02:00
Charles Dang
f60edbf6e0 Bad const_cast. Shoo. 2019-07-11 17:51:18 +11:00
Charles Dang
5320c7120d Refactor team_data usage and fix issue with Game Stats's Scroll To functionality
This removes unnecessary struct members that can be accessed directly from the team class and fixes an
issue where hidden teams could cause the Game Stats dialog to break when scrolling to leader (fixes #4029)
2019-07-04 15:47:23 +11:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0678f40a209797d72dfaba3e5e88545
(cherry-picked from commit bc4d22dc72e79c3d6a3364ac896e473afd298246)
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 7e442cbb541b0bfbc5f3511fd1510fea80a4d34e)
2018-10-07 03:19:34 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f6935176b70a035d3e1c03080f79687f94)
2018-10-07 03:17:59 +00:00
Charles Dang
950a156712 Addressed most of the remaining whitespace issues from #2613
[ci skip]
2018-03-11 14:59:37 +11: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
Charles Dang
b779c91df7 Display Context: enable bounds checking for get_team()
Also enabled it for the non-const version in game_board.
2018-01-28 00:20:31 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
06199650e6 Deployed more display_context::get_team (cont. f9a021e and 921bbc2) 2017-04-26 05:13:17 +11:00
Charles Dang
f9a021eaab Deploy display_context::get_team when possible
This replaces uses of teams()[side - 1] when appropriate. Doesn't touch usecases in other classes.
2017-04-26 02:39:03 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
c71b9306ed Remove redundant argument from display_context::calculate_team_data() 2016-12-09 20:03:02 -05:00
Jyrki Vesterinen
e82fc498ac Remove the map parameter from the unit::is_visible_to_team() function
Now when the function receives the entire display_context and can get the
map from there, passing the map separately is unnecessary.
2016-09-06 23:03:10 +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
5bcc7a07f7 Add get_team() to display_context for 1-indexed lookup 2016-08-20 02:52:11 -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
Chris Beck
ba51524f6e update copyright to year 2016
using this shell script:

find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
2016-01-02 23:59:31 -05:00
gfgtdf
7f13156c28 Revert "Rename team_name/user_team_name to team_id/team_name (old syntax still valid)"
And related commits.

This reverts commit 545253ec2b117b413e7ef40e06e65d358ce20f77.
This reverts commit 1215f65eb875cc3070e8d087ce699c0a2ff8d8b0.
This reverts commit 11664f4024cb760de7db5fec54661cd14fc05ac8.
This reverts commit e948df3424657c5843b1fb65a1319449bb6311bc.
This reverts commit 3781e7839f29915292a2452c37b08a1e1fce9841.

This commits were reverted to exclude them from wesnoth 1.13.2 release because:
1) We are still unsure about the best name oftthese attributes
2) This breaks multiple campaigns, including LoW and the tutorial.
Feel free to revert this revert after 1.13.2 when thse issues can be solved..
2015-12-10 21:29:52 +01:00
Charles Dang
3781e7839f Rename team_name/user_team_name to team_id/team_name (old syntax still valid) 2015-10-26 00:44:28 +11:00
Celtic Minstrel
819eab2f96 Add dialog to allow user to customize which label groups are displayed 2015-08-07 16:44:50 -04:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Chris Beck
74fe722119 move a helper function for unit invisibility to display_context 2014-07-24 18:31:37 -04:00
Chris Beck
8ecef3b6f0 move homeless statistics calc fcns from unit.?pp to display_context 2014-07-06 17:41:39 -04:00
Chris Beck
7fec227478 move is_observer from game_board to display_context, b/c editor uses 2014-07-06 15:26:11 -04:00
Chris Beck
f5a9de40d5 move village_owner function to display_context
I would have liked to put it in game_board, but it is needed for
reports so it can't go there
2014-06-25 22:22:07 -04:00
Chris Beck
0be1d731d5 add drawable unit class
drawable unit inherits from unit, and implements the draw function,
used only by the display. when the display wants to use the function,
it casts a unit pointer to a drawable_unit, and draws it. this
improves encapsulation.
2014-06-16 22:10:31 -04:00
Chris Beck
ab23b03b22 move actions::unit_can_move to be a method of display_context::
I would have put it in game board but it needs to be available
to display / drawing code... would be good to refactor to simplify
this.
2014-06-16 21:01:36 -04:00
Chris Beck
da552fc10e fixup segfaulting editor, favoring display_context over game_board
Currently, the editor does not generate game_board objects, and
leaves the pointer resources::gameboard null. This commit makes
map_location, reports, and tod_manager, three things used in
editor mode, use the display_context pointer instead of the
game_board pointer. We also move a function to display_context,
which finds a const unit * to a visible unit at a hex.
2014-06-11 01:28:15 -04:00