Commit graph

95 commits

Author SHA1 Message Date
Pentarctagon
4c2b725ec0 Change all doxygen comments to the same format. 2020-12-31 23:59:28 -06:00
Charles Dang
cb537f781b
Converted uses of boost::optional to utils::optional (#5329) 2020-12-02 08:16:05 +11:00
Steve Cotton
f3f1407ace
Show [race]help_taxonomy= as "This is a group of units, all of whom are $help_taxonomy" (#5143)
The code comments talk about both Dunefolk and Quenoth Elves - of these two, only the
Dunefolk's data is changed in this commit. All Quenoth unit are race=elf at the moment,
I intend to add [race]id=quenoth in a separate PR.

Draft documentation for the Wiki:

* '''help_taxonomy''': {{DevFeature1.15|?}} in the help browser, show this
race as a group of units from another race; the value of this attribute should
be the other race's '''id''' attribute. This only affects the help browser, for
all other purposes (such as WML filters) the two races are completely separate.

How this is visualised in the help browser is a GUI design decision, this attribute
merely tells the engine that the relationship exists.
2020-09-13 15:20:48 +02:00
Steve Cotton
e9603e6e01
Show the "loyal" trait in help (#5123)
Fixes #1935 for normal users, expanding on aac0941's fix which only showed
these abiities when Wesnoth was in debug mode.

The removed enum member "NON_REVEALING_DESCRIPTION" was unused, and all
existing callers effectively used description_type() as a boolean.

This does mean that the "aged" trait will be shown to all users, even if
they haven't played HttT, however that seems reasonable.
2020-09-11 06:18:08 +02:00
Steve Cotton
7b1d5bc19b
Help browser: fix behavior of clicking on icons of terrain sections (#5110)
This commit uses the UI's calculated indent for the UI's event handling, and
removes section::level. The code generating the help sections still has its own
"level", which is used to detect excessive recursion.

This fixes a UI quirk that I only noticed while working out what section::level
was for, while considering the subtopics needed for implementing a taxonomy
system. The help browser calculates indentation for its tree-view based on the
data tree given to it. However, the logic for deciding whether a mouse-click
was on the icon or the text used section::level, rather than any value
calculated in the UI classes. While section::level was often the correct
number, it was wrong for the terrain types' sections.
2020-08-30 17:19:21 +02:00
gfgtdf
93aa2ca409 deploy new game_config_view object
the game_config_view object offers const
access to the game_config object, furthermore
it allows the game_config config object to be
replaced by a vector of config objects which
is what we will do later.
2020-06-29 15:16:05 +02:00
Steve Cotton
c2ce47f6a3 Simplify help's logic for terrain_types that should be hidden in help
Even when a terrain has hide_help=yes, its help should still be shown if the
player right-clicks on a hex of that type and selects "Terrain description".

This commit changes lines that have inconsistent logic, and the main reason for
doing it was to work out whether that inconsistency was something that needed
to be kept when refactoring the terrain code.

The inconsistency was a bug, help would fail to open the topic.  However, the
bug is so obscure that I only found it when considering the edge case that the
commit is removing, and there's no terrain in core that would trigger it.  The
edge case requires a terrain to be:

* defined by a [terrain_type] tag, so is_combined()==false
* hide_help=yes
* hidden=no (or is the default value)

To replicate the bug, try changing the definition of Gg to have hide_help=yes.
2020-01-17 11:14:12 +01:00
Wedge009
0bba03dd02 Leave help_impl.cpp in wesnoth text domain
[ci skip]
2019-11-06 10:35:27 +11:00
Wedge009
da609b933a Use fixed-width alignment for time-of-day icons 2019-11-06 10:35:27 +11:00
Wedge009
771b1720db Add time-of-day alignment icons to Help 2019-11-06 10:35:27 +11:00
Wedge009
f749608e79 Help Time of Day Bonuses: Add text-domain and colouring 2019-11-06 10:35:27 +11:00
Wedge009
ab40d88a05 Add Time of Day Bonuses to Help
Also mark 'Time of Day Schedule' and bonus strings for translation, to synchronise with what 1.14 branch has.

Resolves #3064
2019-11-06 10:35:27 +11:00
Steve Cotton
3b36ada41e
Improve the terrain code's encapsulation (#4411)
Change terrain_type_data's documentation and some methods to avoid exposing
implementation details, for example renaming try_merge_terrains to is_known.

Move the code to load all the [terrain_types] in to the terrain_type_data
class's own .cpp file, and out of terrain.cpp.

Add documentation about "underlying", and why worst(best(a,b),c,d) terrains don't work
The commented-out code for merging pluses and minuses in the middle of an alias
was commented out in 1.5's d2edbe118a, but the
concept of pluses and minuses in the middle of an alias seems broken anyway
(see comments added to merge_alias_lists in this commit).

Descriptions are t_strings, avoid converting them to std::string and back.
2019-10-03 14:30:04 +02:00
josteph
13e40841fe help: Show topic id in debug log
Fixes #4353
2019-09-16 18:12:17 +00:00
Martin Hrubý (hrubymar10)
6f468a3757
Migrate links to https if available
Closes #3343
2019-09-08 07:53:28 +02:00
Steve Cotton
06f0776134 Refresh help_impl.cpp using ranged-for loops and avoiding raw pointers
The old copy-assignment code would have appended the topics and sections
without clearing those lists, while the new code does clear them. However, the
copy-assignment is only called after calling clear(), so this doesn't affect
the behavior.
2019-08-06 16:29:59 +02:00
Charles Dang
2470984af3 Prepend 'SDL2/' to all SDL includes
This was needed to get the build working with vcpkg's version of SDL, where all the SDL files are
in their own SDL folder. However, our cmake config also has a note saying it was a deliberate choice
to move our SDL files *out* of their SDL2 folder due to certain distros (FreeBSD is mentioned) not
putting the files in said folder in the first place.
2019-07-22 15:35:55 +11:00
Steve Cotton
469fcc9c52 Convert help_impl's ref-counting to std::shared_ptr
This is part of #4166, as topic_text wasn't consistent with
the Rule of Three.
2019-07-15 16:51:12 +02:00
Jyrki Vesterinen
6b0ef7e3ce Replace strcmp() with string comparison operator
This isn't C.
2019-05-11 15:11:38 +03:00
josteph
d25463e445 Help: In debug mode, show unit type id's in their help topics.
Useful when multiple unit types have the same name.
2019-05-11 10:19:14 +00:00
josteph
4b99886433 Help: Support optional image in push_tab_pair 2019-03-20 14:51:47 +00:00
josteph
d9d445c23f Help: Use a typedef instead of hardcoding the concrete type 2019-03-20 14:51:46 +00:00
josteph
9e8db93893 help: Call gettext on ToD topic strings that are already marked translatable
Manually fwdported from 82af89f950

(cherry picked from commit 82af89f950)
2018-11-03 06:52:16 +00:00
josteph
c54f4e6f19 Help: Hide abilities with empty names.
Fixes empty name abilities in help in Liberty S1.

(cherry-picked from commit c88a799b90)
2018-10-07 03:25:22 +00:00
Martin Hrubý
96bbebb514 Fix building with Xcode 10 (#3460)
Resolves #3458.

(cherry-picked from commit 50301f84e3)
2018-10-07 03:24:17 +00:00
Charles Dang
dfce371287 Convert custom unicode type aliases to proper types (available as of C++11)
This changes:
utf8::char_t   ->  char
utf8::string   ->  std::string
utf16::char_t  ->  char16_t
utf16::string  ->  std::u16string
ucs4::char_t   ->  char32_t
ucs4::string   ->  std::u32string

utf16::string and ucs4::string are now proper strings instead of vectors of characters too.

In order to get this change to compile at all, I needed to add a ucs4_convert_impl::convert_impl
specialization for wchar_t alongside the new char16_t specialization; both point to the same
conversion implementation type.

This commit doesn't do any additional cleanup. I'm sure if we looked, we could get rid of a
lot of the custom conversion code and probably a bunch of stuff that might have had to do with
supporting utf16::string and ucs4::string being vectors instead of basic_string specializations.
Either way, I don't know the code (or encoding handling in general) to make a call as to what's
needed or not. I'll let someone else do that.

(cherry-picked from commit 1deacd89f6)
2018-10-07 03:18:49 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f693)
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
Celtic Minstrel
dc0d6474e8 Boost deprecation logdomain severity when debug mode is enabled 2018-03-04 21:21:33 -05:00
Charles Dang
044dedb43a Removed Credits section from help browser (fixes #2555)
I had disabled this when I redid the End Credits screen in GUI2 (476027f) since (IIRC)
I didn't want to figure out about parsing the new config-based credits storage. The topic
remained in Help, empty. We've decided the new End Credits screen is a better method for
viewing the credits anyway, so I'm now removing the topic.
2018-03-03 21:27:19 +11:00
Charles Dang
e270a7c665 Formatting cleanup: > > to '>>`
Allowed since C++11. Might as well use it everywhere.
2018-02-21 12:11:21 +11:00
Charles Dang
dec677f2c5 Refactor unit type ability metadata storage
This fixes #1774. Essentially, I made the help browser use both ability name and ids when
deciding which ones to add topics for. To facilitate that, I've gotten rid of the separate
vectors for ability names and descriptions and consolidated all the data into a single
ability_metadata struct to unit_type. It still needs to be expanded for use in the unit
class (which I intend to do), which is why it has a whole bunch of fields I don't use.

I've also totally refactored the ability topic generation code in the help browser.
2018-02-19 21:47:48 +11:00
Charles Dang
f23305f7e2 Formatting cleanup: T const& -> const T& 2018-01-23 01:26:23 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
eab8380fc4 Avoid copying temp configs when adding config children (where possible)
A few of them are quite small, so this has no performance effect on those, but a few others
are potentially quite large, such as the one in campaign_server.cpp.
2017-12-03 07:37:12 +11:00
josteph
673c1fa4d9 help: Handle traits with empty names or descriptions.
Fixes #2108.
2017-11-03 18:11:08 +11:00
Charles Dang
542f65d2a7 Use std::string::empty() for string-is-empty comparisons 2017-09-05 06:25:26 +11:00
Charles Dang
2eacb4e1c3 Use !std::string::empty() for string-is-not-empty comparisons 2017-09-05 06:25:25 +11:00
gfgtdf
0f44669e59 improve faction help ids
this not only fixes a very theoretical case where an era could have the same id as an era form another faction. It also makes it possible to check whether a topic describes a faction by just checking it's id prefix.
2017-06-21 20:58:48 +02:00
ln-zookeeper
01b4a162f0 Fixed help topics not working right when multiple factions share an id
For example the factions of Default Era and Age of Heroes have the same id's, which caused the faction help topics to have the same id's as well, leading to a faction link on both era pages to lead to the same faction page. Adding an era prefix to the faction topic id's makes them unique and solves the problem.
2017-06-21 21:32:05 +03:00
Charles Dang
e41a415588 Deployed yet even more further additional emplace_back 2017-05-10 14:15:15 +11:00
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00
Charles Dang
2a6ca6cd9e Deployed more emplace_back (how do I keep missing these...)
Covers more cases of:

* push_back(std::pair
* push_back(std::make_pair
* push_back(std::make_tuple
* push_back(T) where T is an empty object of type T

Small thing I noticed: this does mean the numbers in font::subset_descriptor are no longer 'cast' to size_t before being
added to the vector, but that shouldn't matter (hopefully).
2017-04-28 17:15:13 +11:00
Charles Dang
0c3260dc05 Finished deploying std::map::emplace (cont. e1a579da51)
Apparently, the last time I did this I only grepped for `insert(std::pair` not `insert(std::make_pair`. Oversight, much?
2017-04-12 07:51:42 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
12cf0fb45e Replace some uses of string::find with string::compare
These instances were found by cppcheck.
Thanks matthiaskrgr for running it.
2017-03-16 17:10:38 -04:00
Charles Dang
b97a20b059 Split SDL_Surface wrapper class and related helper struts into their own file
This (should) allow sdl/utils.hpp to be modified without a huge rebuild, since a number
of widely used headers included that file simply for the surface class type.
2016-12-10 22:36:31 +11:00
Charles Dang
71bb216352 Use font::unicode_bullet instead of manually writing • 2016-12-10 14:14:51 +11:00
Celtic Minstrel
e7e5ca5fa2 Fix Travis 2016-12-01 15:06:25 +02:00
Charles Dang
4b3862493f Convert all usecases of SDL_Color to color_t 2016-11-30 17:59:30 +11:00