Commit graph

33042 commits

Author SHA1 Message Date
Charles Dang
db5abb7e63 GUI2/Text Box: refactored hint text interface
Previously, I had implemented the hint text ("Search)" and image (the magnifying glass)
as a custom text box definition. This caused some problems, though. Since the string was
hard-coded as part of a WFL formula, it couldn't be translated (see #2709 and #2732). It
also wasn't expandable to any other usecase.

Instead, I've added two new hint_text= and hint_image= keys to [text_box], wrapped the
"Search" text and magnifying image path in a helper macro, and refactored the default
definition to display the hint text and image when appropriate.

This also fixes a minor issue where selected text wouldn't remain highlighted when the
box wasn't focused when using the filter definition (it did with the default one).

This should fix the untranslatable "Search" text issue mentioned in both issues above.
The new string is in the wesnoth-lib textdomain.
2018-03-26 12:11:34 +11:00
Charles Dang
2b9c7b1abd GUI2/Canvas: allow formula values for [text] font_size= 2018-03-26 12:03:46 +11:00
Charles Dang
46598681b6 Fixup 76c2cbac46
Using assignment is for 1.14. We can use `boost::optional::emplace` here on master.
2018-03-26 10:46:42 +11:00
newfrenchy83
76c2cbac46 Implement [filter_weapon] in leadership and resistance abilities
Closes #2718
2018-03-25 17:16:16 -04:00
Charles Dang
e52682e07b wesnothd: removed password reminder backend (closes #2753) 2018-03-26 07:50:27 +11:00
Charles Dang
ebec4d6ce8 MP Login: removed Password Reminder functionality
Resolves #2748.

Essentially, all this did was tell users to go use the forum, so it wasn't worth
it to keep it and solve the infinite loading screen issues it was causing.

The server backend still needs to be cleaned up.

Also removed a dead reference to some "Change Username" button in the Login dialog's
code.
2018-03-26 02:15:53 +11:00
gfgtdf
f219b527e4 fix playmp_controller reading later network packages
in linger mode.

playmp_controller::play_linger_turn calls play_slice after processing
end_linger/[notify_next_scenario] which would (after 'fix chat in
[delay]' commit) then read more data from the network in particular data
for the next scenario which will then be lost.
2018-03-26 01:55:06 +11:00
gfgtdf
94aa24c5a8 fix moves sometimes not undone when control is changed.
with the 'fix chat not working during delay/animation' it could happen
that play_slice_catch would process a incoming controller change in
which case that while loop would end without the code inside that 'if
(player_type_changed_)' being executed, which woudl lead to oos errors
since that client woudl have made moves that other players don't have.
2018-03-26 01:55:05 +11:00
gfgtdf
274da80788 fix chat during [delay] and animations
fixes #1856
2018-03-26 01:55:04 +11:00
Hironori Fujimoto
6b98bbdca1 Rename variable so that it's role becomes clearly 2018-03-25 16:49:13 +03:00
Hironori Fujimoto
6212a62a98 Use is_composing() instead of raw ime_in_progress_ 2018-03-25 16:48:50 +03:00
Hironori Fujimoto
5e22b2b714 Remove private member 'ime_length_'
In order to get length of composition text, just compare text_ and
text_cached
2018-03-25 16:46:02 +03:00
Hironori Fujimoto
16a8ac7e49 Turn ime_in_progress_ off when composition text is nothing 2018-03-25 16:43:02 +03:00
Martin Hrubý
39d1476ade Drop OS X 10.7 and Growl support (#2749) 2018-03-25 15:48:23 +03:00
Iris Morelle
84ce75af19 gui2/unit_attack: Fix damage types and ranges being displayed in English
Part of issue #2732.
2018-03-25 04:41:22 -03:00
Iris Morelle
7056ae014c gui2/unit_attack: Fix alignments being displayed in English
Part of issue #2732.
2018-03-25 04:19:42 -03:00
Charles Dang
0e9eac9ad8 Mouse Events: removed an override that only called the base method 2018-03-25 16:48:37 +11:00
Charles Dang
915dfaa399 Quick fix for "Mandatory WML child missing" error when starting MP
This isn't a proper fix since then the minimap doesn't show, but it at least allows
you to start an MP game.

Fixes #2724.
2018-03-25 06:28:02 +11:00
Charles Dang
8d3dcb109b GUI2/Window: reverted some unintentional semantic changes from 88e5c49f5d
These were never intended to go in that commit at all. I accidentally included them.
This reverts the semantic changes. The rest was just formatting so I'm leaving it.
2018-03-25 05:10:26 +11:00
Charles Dang
e4b7820ab0 Fixed infinite loading screen when logging in with an invalid nickname
Fixes #2728.
2018-03-25 04:46:02 +11:00
gfgtdf
7621af926b show the oos savegame dialog when receiving a debug command in mp
with a different text of course.

fixes #2683
2018-03-25 04:16:44 +11:00
gfgtdf
da2081de77 fix initial selection of mods in sp 2018-03-25 04:15:07 +11:00
Charles Dang
afaa75842c Add ability to bypass strict no-disabled-events assertion when writing events
This is since the Gamestate Inspector can be invoked mid-event (using [inspect])
and it makes use of write_events().
2018-03-25 04:06:13 +11:00
Charles Dang
ef172d47fa Exclude command console and game ui dialogs from tests
They need to be more stable and complete before we test them.
2018-03-25 04:00:15 +11:00
Celtic Minstrel
cf385537c2 Fixup last commit 2018-03-24 12:42:13 -04:00
Celtic Minstrel
f7cc1842bb Don't bother trying to standardize event name if there isn't one 2018-03-24 12:40:58 -04:00
Charles Dang
89e0d7e2ae Events: ensure the global event context is always available
The Boost unit tests have been failing since I removed the GUI2 event context since the
code expects both that A: the topmost context is the global one and B: that you can't
use join() to join the global context. Removing the UI event context meant the test's
fake_display event_context became the only (and global) context, causing an assert.
2018-03-25 03:35:47 +11:00
Celtic Minstrel
e317f346e8 Don't show a message for missing name in [event] if it has an id 2018-03-24 12:32:04 -04:00
Jyrki Vesterinen
fbfa82c6b1 Remove error message if creating texture for floating label fails
Textures can't be created with faked video. That's pretty much the only
reason why creating that texture can ever fail (other cases, such as
credits, stress the text rendering system much more than floating labels).
2018-03-24 11:38:19 +02:00
Jyrki Vesterinen
2257c03771 Fix build with GCC and Clang 2018-03-24 11:11:25 +02:00
Jyrki Vesterinen
d4c9db9e35 Visual Studio: increased warning level to /W4 even for release builds
In particular, this enables C4100, the warning for unreferenced function
parameters.

I also fixed some /W4 warnings.
2018-03-24 09:41:28 +02:00
Iris Morelle
5c59fade0f Use the correct textdomain for the random faction mirror options
Fixes up commit 2e502334f2.

See issue #2709.
2018-03-24 00:37:29 -03:00
Iris Morelle
9852064ba9 Fix warning about an unused method parameter 2018-03-24 00:37:29 -03:00
Charles Dang
49d36e6eb4 Display: always draw the map in the full window
This is a temporary measure that removes reliance on the theme map rect.
I need to ponder the best design to handle displaying the full map.
2018-03-24 14:36:40 +11:00
Charles Dang
5ece7ac5b7 Split the rect_of_hexes struct into its own file
And cleaned up it a bit. Made use of std::array and gave it a default ctor using
the values from display::hexes_under_rect.
2018-03-24 13:22:54 +11:00
Charles Dang
85dcef7fa0 Removed remaining references to window framebuffer surface 2018-03-24 10:31:04 +11:00
Charles Dang
c7367344b1 Removed surface_restorer class
This was only used in the GUI1 widget base class and isn't something we'll need
with accelerated rendering.
2018-03-24 10:28:51 +11:00
Charles Dang
3be39a98fe 0 -> nullptr in 2 places 2018-03-24 10:22:25 +11:00
Charles Dang
c2fd4f48f9 Cleaned up unnecessary instances of emplace_back(config {})
No need to invoke the copy ctor.
2018-03-24 00:55:28 +11:00
Charles Dang
2e502334f2 MP Create Game: attempt to fix RFM type labels being untranslated (#2709)
Since these are defined in their MAKE_ENUM enum with N_, we need to manually un-not-translate
them here.
2018-03-24 00:55:27 +11:00
Charles Dang
57700090d8 GUI2: reimplemented [dis]connect_signal SFINAE using constexpr functions
This replaces the use of the boost::mpl::set lists. It replaces those damn things with simple
constexpr functions that check the template parameter against an accepted list for each event
type. This is a *lot* simpler.

These helpers are also used in the runtime checks in dispatcher::fire.

I've had to leave the mpl sets in, though, since I can't figure out how to convert the last
place where they're used. The presence of a type is required for SFINAE in
dispatcher_implementation::event_signal, and I can't figure out a new design that avoids the
need for the template parameters.
2018-03-23 18:46:20 +11:00
Iris Morelle
94c5f64cc6 i18n: Remove no-op translation::init() function
This function only ever had an implementation when building the i18n API
to use libintl instead of Boost.Locale was possible, in which case its
implementation would be a std::setlocale() call specific to POSIX
systems.

I'm not backporting this to 1.14 since it's an inconsequential cosmetic
thing, or so I'd like to think. Last time someone tried to remove a
similarly empty "init" function elsewhere, things went south pretty
quickly.
2018-03-23 04:20:22 -03:00
Iris Morelle
a602391168 i18n: Make VGETTEXT()/VNGETTEXT() always require a GETTEXT_DOMAIN to be defined
This drops a preprocessor conditional branch that is dead code now that
the file pulls gettext.hpp and the GETTEXT_DOMAIN defaults with it.

See also PR #2711.
2018-03-23 04:18:46 -03:00
Iris Morelle
5c28dcaab6 i18n: Forcefully pull gettext.hpp into formula/string_utils.hpp
There are cases (deprecation.cpp for one) where string_utils.hpp is
included first, which causes the VGETTEXT/VNGETTEXT definition to use
the textdomain-less (a.k.a. forced wesnoth-lib textdomain) overloads of
vgettext() and vngettext(), because GETTEXT_DOMAIN has not yet been
defined by anything. This again results in strings being looked up in
catalogues where xgettext is not adding them.

This is a companion for PR #2711 I should've noticed sooner. Without it,
there were still cases where interpolated strings would not be
translated due to vgettext() using the wrong textdomain for them.

I ran a quick scan on the codebase to make sure there aren't any files
including formula/string_utils.hpp before defining their own
GETTEXT_DOMAIN instead of the gettext.hpp default.
2018-03-23 04:18:36 -03:00
Iris Morelle
c5b3947e4a Replace all instances of naked vgettext() calls with VGETTEXT()
The vgettext() function, while declared in src/formula/string_utils.hpp,
actually has its implementation out-of-line in
src/formula/string_utils.cpp where GETTEXT_TEXTDOMAIN is defined to
"wesnoth-lib". Because vgettext() is implemented in terms of the _()
function (an inline wrapper around translation::dsgettext()), it passes
the textdomain defined in the file where it was implemented as a
parameter.

This means that every case of vgettext() being used in other code units
where GETTEXT_TEXTDOMAIN is not defined to "wesnoth-lib", is broken if
the string being looked upon doesn't coincidentally exist in the
wesnoth-lib textdomain.

Ages ago, to work around this limitation, an overload of vgettext() that
takes the textdomain name as a parameter was introduced (see commit
0ba3d05204). Since this form of vgettext()
is rather unwieldy to use (and in particular, the xgettext message
extraction tool mistakes the first argument for the msgid, see below), a
VGETTEXT() macro was also added that uses the GETTEXT_TEXTDOMAIN symbol
defined in the file where the call is made, and thus we get the correct
string from the correct textdomain.

Switching all cases of naked vgettext() in mainline to VGETTEXT() fixes
a myriad of situations where an interpolated string that has an extant
translation does not actually get translated in practice because of the
mismatched textdomain reference (see issue #2709 for an example with MP
game titles). I couldn't find any cases of the companion vngettext()
function (which handles plurals) being used in the wild naked, but for
future reference it also has a companion VNGETTEXT() macro to pass the
correct textdomain to its textdomain-parameter overload.

One caveat is that this commit DOES break the string freeze in one
particular case -- src/units/unit.cpp has a case where the
textdomain-parameter version of naked vgettext() was in use with
"wesnoth" as the first parameter, and xgettext misidentified this as a
translation entry for a "wesnoth" string in the file's assigned
textdomain (which is the default textdomain, wesnoth). So this will
result in the next pot-update both removing the spurious "wesnoth"
string AND adding the correct string to the relevant catalogue template
("<span color=\"$color\">$number_or_percent</span> HP").
to that textdomain.

Other than that, I believe this does not break the string freeze in any
other fashion and it shouldn't result in any regressions for i18n.

It might be worth considering in the future renaming vgettext() and
vngettext() to names that make people less likely to misidentify them as
functions they can freely call directly without regard to the textdomain
assignment issue.
2018-03-23 04:18:01 -03:00
Charles Dang
7a9ed8d363 Used UNUSED macro instead of (void) where applicable 2018-03-23 12:29:56 +11:00
Charles Dang
b6c4f0f6ae Display: removed redraw observer interface
This won't be needed once we get everything sorted out and refactored.
2018-03-23 12:23:58 +11:00
Alexander van Gessel
8179c7226b Invert a conditional
Found by coverity.
2018-03-22 16:52:45 +01:00
Gregory A Lundberg
812de972ac
Fix unused parameter
If you're going to stub a function, please remember to clean up its parameters as well.
2018-03-22 10:12:52 -05:00
Charles Dang
410398a70b Used stdlib math functions instead of global C versions 2018-03-22 23:25:23 +11:00