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.
for debugging purposes these are annoying since the OS usualy gives a better error message (stacktrace etc) on "crash" than on a catched exception + return.
from savefiles toplevel to savefiles [snapshot]/[replay_start]/[carryover_sides_start]
previously this was handled specialy at scenario toplevel sometimes and in those tags at some other times.
accoringly to that change we now set n_unit::id_manager at play_controller s constructor.
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.
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.
This commit makes the main unit animation accessor / mutator
functions applicable to const units, and makes the animation
state member variables mutable to allow this.
const'ed member functions:
set standning
idling
selecting
ghosted
disabed_ghosted
clear_haloes
refresh
invalidate
redraw
mutable member variables:
animation state enum
boost scoped pointer anim_ (can be reset in the redraw fcn)
next_idling_
frame_begin_time_
unit_halo_
refreshing_
draw_bars_
The purpose of this is to improve encapsulation of units, as now
we can use const units in the display functions, and reserve non-
const unit references for use in the game logic.
This copies the contents of the main display area to clipboard. The
button currently lacks a tooltip because the tooltip causes map labels
to glitch through the dialog when displayed (noticeable in e.g. the test
scenario). I'll file a bug for this issue later using a (commented-out)
line introduced by this commit as a test case.
The write() function from the WML parser is a dedicated WML
serialization mechanism that is also used to write saved games and such,
and thus it will output WML in the same format that the game would
normally use. The config::debug() method we were using here before,
instead, only implements a simplified strategy that will not produce
valid multiline attribute values, for example, or include any textdomain
directives applicable to the contents.
If we are to have a way to copy the inspect window's contents, it should
prove far more convenient for coders to see the generated WML in the
same format as it would normally be saved to disk.
Improves the gamestate inspection dialogue. It fixes a long-standing
assertion issue and also reduces the amount of redundant work done.
Note the dialogue can still be improved further, but the currently
shown dialogue is /a/ valid way to show its contents.
The merge fixes bug #22095, possibly #15615 and #21785.