554 Commits

Author SHA1 Message Date
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
Charles Dang
876710af8c Use std::to_string() or equivalent wherever possible
This commit removes the utility srt_cast() function and replaces its calls,
along with calls to lexical_cast<std::string>() (and its boost variant),
with std::to_string().

In a few cases where the input type isn't compatible with to_string,
lexical_cast<std::string> is still used.

In other cases where lexical_cast was operating on MAKE_ENUM enums, the
call has been replaced with ENUM::enum_to_string, which is faster.
2016-03-31 11:18:51 +11:00
gfgtdf
249792e08d fix segfault in loadingscreen when staring campaigns, 2016-03-30 21:08:31 +02:00
Celtic Minstrel
bc711f5f43 Consolidate related files into subdirectories 2016-03-20 16:20:09 -04:00
Andreas Löf
ea649ec0a2 Fix event-context related assertion failure at exit
This fixes an assertion failure at exit which was caused by the event
contexts being cleaned up before the dummy display. There is no need
for the dummy display implementation to ever receive events so the
functionality has been extended for it to not join an event context,
resolving the assertion failure.
2016-02-13 11:57:01 +13: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
Charles Dang
5813eb0aad Pass color value directly to game_display::float_label
This is to allow color values created using different util functions -
ie, create_color() or string_to_color().
2015-12-16 01:25:31 +11: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
gfgtdf
d7acb178d2 Revert "Added util function for converting an RGB string to color"
And also other commits that used that function.

This reverts commit 0d8c008018996c8a147051464a51925a265f7983.
This reverts commit 956e5f932259517fd45efa4fcdffa60542a95d45.
This reverts commit 8f35c4bfcfd3b029ef17d3a3626d5c013a8d0a5d.
This reverts commit dcb265ae701d14fecdc66097d7ee26cd05abb080.

This commit just contained too many bugs, including:
1) string_to_color not parsing any input correctly
2) string_to_color segfaulting on some input strings
3) missing backwards compability in [unstore_unit]
2015-12-10 21:26:39 +01:00
Charles Dang
8f35c4bfcf Pass color value directly to game_display::float_label
This is to allow color values created using different util functions -
ie, create_color() or string_to_color().
2015-12-10 22:06:33 +11: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
gfgtdf
ec8bf1e1f7 move reset_gamestate function (reset_replay) to play_controller 2015-09-09 17:46:10 +02:00
gfgtdf
e4962c47f8 refactor set_scontext_(un)synced classes
renamed set_scontext_local_choice to leave_synced_context and
set_scontext_leave_for_draw to set_scontext_unsynced.
The old names do not fit anymore because set_scontext_leave_for_draw is
also used for wml menu items.

Also simplified the implementation of set_scontext_leave_for_draw.
2015-07-12 21:56:05 +02:00
gfgtdf
33693f03f6 don't apply whiteboard during wesnoth.select_hex and similar. 2015-05-29 23:09:11 +02:00
Chris Beck
c10ddf275e fix uninitialized failure
caught by valgrind (probably inconsequential though)
2015-04-06 21:28:48 -04:00
Chris Beck
ea212b5bc2 move class floating_label from font.cpp to its own file
floating_label is essentially a primitive GUI1 widget, consisting
just of a text label and non-interacting. It's also used for the
map labels displayed in-game iiuc.
2015-03-07 21:22:03 -05:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Chris Beck
d02c376bd3 move "screen_needs_rebuild" from file scope to game_display object 2014-12-13 19:34:52 -05:00
Chris Beck
0459f8a574 make "reports" not a singleton object
This is necessary to make game_events not a singleton.
2014-12-13 01:28:57 -05:00
Chris Beck
b19af20165 clean up game_display (prefer local variables over global variables) 2014-12-12 19:38:35 -05:00
Chris Beck
ab62d9c75e split off terrain data caches from the gamemap object
This commit splits some of the functionality of the gamemap object
into a new class, the "terrain_type_data" object. This class is
intended to hold a record of known terrains and the terrain code ->
terrain type map. It handles merging in new terrain definitions,
and it is shared between map objects. It is also cached by the game
config manager, so that we only recalculate this data when we
change configs.

There is in fact a *semantic* change going on here, which is that
when a scenario introduces a new terrain type by merging, this gets
added to the global cache. The alternative is to make a copy of the
global cache, only for the this scenario, as soon as we have to
dirty the cache. However since I didn't see any downside to putting
the merged terrains together and carrying them across scenarios,
I opted not to do that here.
2014-11-07 22:34:31 -05:00
Boldizsár Lipka
5f63af2049 Only redraw invalidated parts of the panel.
Fixes flickering buttons.
2014-07-22 18:53:35 +02:00
Boldizsár Lipka
e8f5a4eec1 Fix flickering panels. 2014-07-17 21:47:06 +02:00
Boldizsár Lipka
7d3535645f Rename ttexture to timage. 2014-07-17 21:47:04 +02:00
Boldizsár Lipka
0acb2e1529 Initial SDL_gpu support in the game display. 2014-07-17 21:47:04 +02:00
Chris Beck
31487bec26 move notifications into desktop namespace, rename folder also
We also move the desktop_utils files to desktop/open.?pp, and
update the project files appropriately.
2014-07-14 00:48:02 -04:00
Chris Beck
d2edec5921 move notifications files to their own folder 2014-06-27 18:14:45 -04:00
Chris Beck
33ae8d7398 move bar drawing code from display to unit_drawer
That's the only place it is used.
2014-06-27 17:53:48 -04:00
Chris Beck
cb5a9a0d28 add display chat manager, notifications support outside game_display
The functionality of tracking observers and displaying chat messages
is moved to a manager class, which the gui owns.

The functionality of displaying notifications is similarly moved out
of the game_display and to a private namespace. (Static singleton
pattern seems okay here since there really won't need to be more
than one of these for a single application, it seems.)
2014-06-27 15:57:57 -04:00
Chris Beck
b0e407ac66 move halo::manager from play_controller to display
Also this removes the need to have it in the editor.
2014-06-27 10:36:15 -04:00
Chris Beck
82c6b98907 halo uses handle-body instead of static singleton idiom 2014-06-26 18:45:45 -04:00
Chris Beck
e62553139c move is_observer to gameboard, with accessor in playcontroller 2014-06-26 00:40:53 -04:00
Chris Beck
cf2651b5a7 rename drawable_unit.?pp -> unit_drawer.?pp, b/c of new contents 2014-06-24 13:22:13 -04:00
Chris Beck
4bb55f4ab8 make fake_unit_manager foreachable, drop the "range" getter 2014-06-23 12:45:46 -04:00
Chris Beck
0f5876fe38 change fake_unit class to fake_unit_ptr
This is consistent with the introduction of the UnitPtr class.
fake_units really aren't different from units, the only difference
is their life time / allocation and ownership. Since we are trying
to use reference counting for all units (to make them safe to use
with animations), the fake units need to be managed by a reference
counted pointer also. This is the easiest way to achieve that.

I also remove some odd code the [move_units_fake] handler --
there was explicit code to remove the fake units from the fake
unit manager, but this is redundant as it is the responsibility
of the destructor.

Code Blocks and VC project files are updated, but
Code::Blocks Scons and Xcode are not.
2014-06-23 11:17:55 -04:00
Chris Beck
52c5bf44ab add unit drawer, remove drawable_unit
This avoids the casting to superclass, and it's also a bit faster,
in the refactor of the redraw_unit function we cache all the values
from display that we need locally.
2014-06-19 20:08:34 -04:00
Chris Beck
8481b90b96 move game_display::footsteps_images into game_display.cpp
It is not called by any other compilation unit, so it's better to
internalize it and avoid being forced to declare SDL surface in
the header if possible etc.
2014-06-18 18:36:17 -04:00
Chris Beck
44a0752cb4 fake unit manager returns a range rather than & to container 2014-06-18 17:52:24 -04:00
Chris Beck
a8a132692d remove unused member of game_display 2014-06-17 13:30:43 -04:00
Chris Beck
4ff77b84c8 redraw_unit takes display & as an argument 2014-06-16 23:31:36 -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
06f02b52c5 add fake_unit_manager, split off from game_display object
This commit adds two classes -- fake_unit, and fake_unit_manager,
both split off from code contained in game_display. The display
object is reconfigured to hold a pointer to the manager and
display the units it contains. The rest of the code is configured
to add fake units to the manager, not the display.

This improves encapsulation and helps to reduce the game_display
class.
2014-06-16 17:31:38 -04:00
Chris Beck
13155c4f41 separate fake units list from real units list
This is a first step before brnaching off to fake units manager
2014-06-16 15:19:24 -04:00
Chris Beck
926effb41a fixup segfaults in replay viewer
After this commit e4eb0a3ede83ee338994708ebd48257627b47242 the
replay viewer would segfault during prestart events. However, it
turns out that nothing in the replay viewer, or in that commit,
was directly causing the segault. Instead, the display object
was holding dangling pointers for no reason, when it could have.
been simply computing the correct value (very cheaply). We clean
up the code in the display objects to fix the segfault.
2014-06-14 22:05:07 -04:00
Chris Beck
74e1230b9a delete duplicated set_team fcn
game_display and display versions of set_team were identical, in
header and in implementation, so we simply delete the game_display
one, as a strict refactor.
2014-06-14 21:51:45 -04:00
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
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
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
Chris Beck
57cc44be64 game_display uses game_board in it's constructor 2014-06-08 14:59:20 -04:00