Commit graph

592 commits

Author SHA1 Message Date
Chris Beck
5145c9422c display takes a pointer to whiteboard manager
It uses a shared_ptr, to prevent crashes during play_controller
initialization. But it only holds a weak_ptr, to preserve
previous behavior of skipping whiteboard ops when the ptr is
NULL.

It requires also for us to construct the whiteboard before
constructing the gui, so that we have a valid pointer to pass.

Most likely all of the managers will have to be moved forward,
in this commit we move forward the whiteboard and pathfinding
module, anticipating future commits.
2014-06-12 19:21:00 -04:00
Chris Beck
4406cdfae0 add accessors for selected, moused-over hex to class display 2014-06-12 18:54:42 -04:00
Chris Beck
43ade4615a display uses display_context internally, not 3 private pointers
Also refactor editor and game_display to use this.

To achieve this it turns out we also have to add a "dummy display
context" unique to the editor code, which it can use to initalize
editor display, because after refactor NULL doesn't cut it
anymore. This appears in src/editor/editor_display.?pp, might
want to branch into its own file later.
2014-06-10 18:29:03 -04:00
Chris Beck
4459277f77 only const unit_map in display, unit_attack fcn uses game_board
This commit makes all the necessary changes to allow
display::get_units() to return a const unit_map rather than non-
const, and to eliminate display::get_const_units(). This allows
us to eliminate a const cast introduced in prior commit.

In leader_scroll_dialog, unit_animation, and some places in
unit_display, we change the call display::get_const_units to
get_units, and mark the return type as const.

In unit_display::unit_attack, we can't do this because that fcn
also calls unit::take_hit which is part of the game logic and
should not become const. We make that function take a reference
to game_board instead and pass resources::game_board from the
caller. Also we pass display in as an argument from the caller,
to improve encapsulation marginally.
2014-06-10 12:59:23 -04:00
Chris Beck
fe92895bd0 display::change_units takes a const argument 2014-06-10 11:35:32 -04:00
Chris Beck
76907870dc display object uses a const unit_map * internally
This was made possible because const units may now be drawn and
animated. There are some clients of the display object that still
call display::get_units, which is a non const getter, and which
we support by a const cast. The next step of refactor is to get
rid of that, but in this step we have at least gotten rid of all
internal uses of the non-const unit map.
2014-06-10 09:46:13 -04:00
Chris Beck
829c66e6bc invalidate units fcn treats units as const
Since the relevant functions are const from previous commit.
2014-06-10 09:23:24 -04:00
Mark de Wever
954e068a54 Move create_rect to the sdl namespace.
This library dependency issues with CMake.
2014-05-31 22:04:36 +02:00
Chris Beck
c5838b9513 inline the definition map_location::null_location
If we decided it was worth it to inline map_location ==, then
surely this is also worth it to inline null_location, as the
compiler may be able to reduce tests for == null location to
"x == ... && y == ...", without having to move to a different
compilation unit.
2014-05-20 10:42:13 -04:00
Chris Beck
5e28b7c109 minimap does not draw units if blindfolded
display.show_everything() returns false if blindfolded
2014-02-23 22:27:14 -05:00
Chris Beck
491b1def74 implement blindfold by shroud 2014-02-23 22:27:14 -05:00
Chris Beck
e8fcf0bae0 create blindfold struct 2014-02-23 18:48:12 -05:00
Chris Beck
e9841da6f5 create display::blindfold accessors 2014-02-23 18:48:09 -05:00
Mark de Wever
a2b8589143 Adds -Wextra-semi to pedantic compilation.
Also fixes all warning messages.
2014-01-26 14:24:12 +01:00
Mark de Wever
afee909fcb Remove Doxygen comment for non-existing parameter.
The issue was found by Clang 3.4.
2014-01-05 15:43:41 +01:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
fendrin
9a44642689 Save villages and items. 2013-12-21 06:39:48 +01:00
Ignacio R. Morelle
3db69a7132 display: Implement public reinit_flags_for_side() method
This overwrites an existing flag animation for a side with a rebuilt
one, intended for use after changing a side's flag animation.

It does pretty much the same thing init_flags() does sans vector
allocation and TC configuration, which are supposed to have been done
already.
2013-12-18 23:05:23 -03:00
Ignacio R. Morelle
a0eea71691 display: Refactor flag animation build code into a separate private method
In order to implement functionality to change a side's flag imageset
after display initialization has taken place, we need to rerun this code
under different conditions.

The refactored code default-initializes the set of flag animations prior
to building them for individual sides; before this change, only the
memory allocation for the set was reserved in advance. Since the first
time init_flags() runs is during display initialization,
default-initializing the set shouldn't really make a noticeable
difference.

Now, we assign the flag animations later over the default-constructed
animations. Hopefully this shouldn't introduce any new interesting bugs.
It's not like there's any code accessing the animations at this point.
2013-12-18 23:05:22 -03:00
fendrin
c31a065340 Lifted the reach map data structure from game_display to display.
The reach map is useful in the editor as well.
For now the map is used to show the highlighted reach in the minimap if
a unit is selected.
2013-12-05 21:47:27 +01:00
Alexander van Gessel
38b224c1ff Revert "Revert "Merge branch 'master' of github.com:wesnoth/wesnoth-old""
This reverts commit 23b72d6956.
2013-08-09 00:13:46 +02:00
Thibault Févry
23b72d6956 Revert "Merge branch 'master' of github.com:wesnoth/wesnoth-old"
This reverts commit 5fa5c03411, reversing
changes made to 06374c64ba.
2013-08-08 18:50:46 +02:00
fendrin
7614195710 lifted parse_team_overlays from game_display to display.
This is part of makeing [item] and other overlays work in the editor.
2013-07-20 15:59:28 +02:00
fendrin
80b7d40bc2 Only update button states if zoom level changed. 2013-06-21 14:51:39 +02:00
fendrin
3b0469eed9 Fix spelling in comment. 2013-06-15 21:41:34 +02:00
fendrin
db9a469310 Implemented the editor item tool. 2013-05-24 05:44:58 +02:00
fendrin
e309a62043 Implemented a zoom slider for the editor gui. 2013-05-10 23:24:43 +02:00
fendrin
0a6c8c2a1f Made the read only get_teams() accessor const. 2013-05-06 16:37:24 +02:00
fendrin
3d3bbc3e2e Fix the spelling in a comment. 2013-05-03 21:51:19 +02:00
fendrin
a1861e2aa3 Tooltip support in GUI1 widgets. 2013-04-29 16:33:50 +02:00
fendrin
a759792595 Methods for getting the zoom state. 2013-04-01 04:29:31 +02:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
J. Tyne
f9f5110445 Remove some vestigial documentation from tinygui.
There is also a remnant in preferences_display.cpp, where
two resolution options below 800x480 are in a hardcoded
list (scr_modes), but I do not know if there might be a
reason to keep those.
2012-11-15 22:43:42 +00:00
J. Tyne
713372699d Optimization: Only generate reports if they will be shown somewhere. 2012-10-25 22:45:07 +00:00
Steven Panek
c2cb357a48 'favour' -> 'favor', 'colour' -> 'color', 'behaviour' -> 'behavior'...
...in the source code.
2012-09-23 22:16:02 +00:00
Jérémy Rosen
c0287b85ba fix bug #20098 you can't invalidate separately fake and real units,
...they need to be invalidated at the same time
2012-09-09 19:14:09 +00:00
J. Tyne
deebf67f5a Add a version of display::scroll_to_tiles() that takes iterators.
This saves creating a new vector when only part of a route needs
to be scrolled onscreen.
2012-08-13 02:01:56 +00:00
Fabian Müller
179c251d96 Implemented the village ownership editor tool. 2012-07-27 13:34:00 +00:00
Fabian Müller
6da230921a Enabled the side menu in the editor.
It allows side creation and switching for now.
2012-07-22 11:04:20 +00:00
Fabian Müller
a68f0ca12b The palette is now a part of theme WML...
...instead of being placed at hardcoded coordinates. Windows and Mac
build systems still have to be adjusted.
2012-07-22 09:10:21 +00:00
Ignacio R. Morelle
b12bb3524a display: Allow disabling viewport scrolling
This will later allow WML/Lua to lock the viewport so the user cannot
scroll away from the current viewport location. WML and Lua actions such
as [scroll], [scroll_to] and [scroll_to_unit] will always be able to
scroll the screen regardless of this setting.
2012-06-11 09:37:33 +00:00
Gabriel Morin
49851c2805 Changed the method for fading out units that have planned moves...
...to a somewhat safer one: I apply the "ghosted" animation right
before drawing happens and remove it afterwards. Fixes bug #19619.
2012-04-05 11:04:26 +00:00
Fabian Müller
72fc103fe9 Lifted unit drawing from game_display to display. 2012-03-31 18:16:27 +00:00
Ali El Gariani
a4fc0af7e2 Rename local ToD lighting WML key...
...in preference to reset the setting to the new default. This also
better reflects the option's name.
2012-01-07 12:52:06 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Ali El Gariani
98ec7151a2 Fix lingering dead code for brightened hexes.
It was disabled since the new golden hex cursor. Also rename
"semi-brightened" (still used for editor selection) as "brightened"
2011-12-11 17:04:30 +00:00
Ali El Gariani
0306759c54 Small optimization of ToD local light and code simplification.
Add a ToD color struct and operators to easily kill some wasteful
~CS(0,0,0) (which were common for some ToD cases)
2011-12-11 01:01:54 +00:00
Ignacio R. Morelle
9d5171482e Describe the major caveat for display::find_button() in a doxygen comment 2011-11-04 04:27:51 +00:00
Anonymissimus
d6ac51d4fb save and reload [color_adjust] values (fix for bug #18676) 2011-10-27 14:16:17 +00:00