
Back in 515f450432cda01d4c I attempted to optimize this, but I didn't do it right. Since I didn't define a move ctor for canvas, that std::move call was useless and the copy ctor was being called anyway. Though, that change wasn't a total waste. It still reduced the number of canvases created from (I think) 3 to 2, since the code was no longer going default-construction and copy-assignment from the state struct. These new changes completely remove the canvas object from the state struct. Nothing particularity special was being done there, only a call to canvas::set_cfg. Instead, the canvas config is saved in the state objects and then styled_widget initializes the canvas itself. This does mean there's config copying going on here, sadly, but it's unavoidable given the current design. This also removes the definition_load_configuration function from styled_widget. Its contents were moved to the ctor. This ensures only the exact number of canvas objects needed are created. No copying from the state objects, no reallocations. This also means we can delete the copy ctor (see below). A move ctor was added to canvas (though it admittedly isn't needed now since no canvas moving occurs), and the copy ctor deleted.
About
The Battle for Wesnoth is an Open Source, turn-based tactical strategy game with a high fantasy theme, featuring both singleplayer and online/hotseat multiplayer combat. Fight a desperate battle to reclaim the throne of Wesnoth, or take hand in any number of other adventures.
License
Please see the wiki for information regarding The Battle for Wesnoth's licensing:
https://wiki.wesnoth.org/Wesnoth:Copyrights
Installing
See INSTALL for instructions on how to build the game from source code.
More Information
For extensive documentation about all aspects of the game, see the official Battle for Wesnoth web site.
A (translated) description of how to play the game can be found in doc/manual/manual.*.html, or online at:
https://wiki.wesnoth.org/WesnothManual
The official Battle for Wesnoth Forums (with over 400,000 posts from more than 20,000 registered members) can be found at: