Commit graph

150 commits

Author SHA1 Message Date
Pentarctagon
6b97a76109 Add a prompt to allow entering an add-on's password at upload time.
This is an alternative to needing to store the plaintext password in the _server.pbl.
2021-04-04 01:28:23 -05:00
Iris Morelle
055eb13e67 Move font::is_cjk_char() to help browser implementation 2021-03-13 13:51:47 -03:00
Iris Morelle
2dfdc0061d Remove SDL_ttf wrapper API
This removes the build-time dependencies on SDL_ttf and FriBidi,
alongside the SDL_ttf wrappers, the SDL_ttf text surface class, the
SDL_ttf render cache, and the SDL_ttf (de)initialization code.
2021-03-13 13:51:47 -03:00
Iris Morelle
8cd739cef1 font/sdl_ttf_compat: Initial Pango-based font rendering API for GUI1
This adds a minimal wrapper around pango_text intended for use in GUI1,
in particular for the help browser. Functionality is very incomplete
right now but for the time being we can render text, determine line
dimensions, and ellipsize text, which is almost the bare minimum needed
for porting the Help system (it's still missing a word wrapping
implementation).
2021-03-13 13:51:47 -03:00
Pentarctagon
b974423e2e Add optional fuh to campaignd. 2021-03-12 16:12:09 -06:00
Charles Dang
561cc33dc4
Upgrade to Lua 5.4.2 (#5535)
The change to static_cast for the definition of  LUAL_BUFFERSIZE replaces the fix previously used (d0100758f8) for Lua 5.3. 5.4 removes the static alternative for LUAL_BUFFERSIZE. A better solution would probably be to disable the old-style-cast warning for luaconf.h, but I can't figure out how to do that so using static_cast is the easiest solution. Do note that change will have to be applied each Lua update like the aforementioned commit.
2021-02-14 02:07:12 +11:00
Charles Dang
e3f8b68796 Added basic dialog definitions for the Match History viewer 2021-01-17 11:48:21 +11:00
Pentarctagon
5ee08c80fb Add support for asynchronously querying a player's game history for display on the client. 2021-01-16 12:48:07 -06:00
Steve Cotton
4205de91e5 Remove the editor's unused set_starting_position dialog
6424d79f48 changed to using an editor palette instead.
2020-12-30 15:01:47 +01:00
Charles Dang
ccd006cccd Refactored handling of advanced preferences
Instead of having the preferences dialog make a copy of all advanced preference config objects (and sorting them)
every time you invoke it, this adds a new advanced_manager class instantiated once in game_launcher (not sure if
that's the best place for it, though) that parses and handles the options. Allows me to greatly clean up the
preferences dialog code.
2020-12-14 05:56:52 +11:00
Iris Morelle
8c3918197c gui/addon_manager: Add dedicated license prompt dialog
This allows using full markup for the license text and making it
independently scrollable without messing up the dialog. It also enables
URL parsing in it.
2020-12-10 00:15:17 -03:00
CrawlCycle
a6f36becb9 Test parsing of WML define and undef macros by the preprocessor & parser
This commit adds tools to test parsing of WML macros by the preprocessor
and parser. The commit also adds two tests of the #define and #undef
WML macro as examples.

The tests consist of three steps:

1. Define one WML string containing macros and one WML string
   that lacks macros in each test. The two WML strings should be
   equivalent after preprocessing.

2. Transform each WML string into a syntax tree (represented by config
   objects) with the preprocessor and parser of Wesnoth.

3. Check if the two config objects are equal. Since the two WML strings
   are equivalent, the two configs object should be equivalent if the
   preprocessor and parsers are both correct.

The output of the preprocessor is in an undocumented format. Therefore,
this commit does not test the preprocessor as an isolated unit.
2020-11-28 14:52:48 -05:00
Iris Morelle
227738cb6f campaignd: Command line processing w/ Boost.program_options
This also adds a few utility switches which people are probably already
familiarized with from the game proper. Most notably this means I don't
need to alter and recompile campaignd any time I want different logging
settings.

There's some functionality commented out in this commit while I figure
out how to wire it into the campaignd server class.
2020-11-09 21:22:00 -03:00
Iris Morelle
145c986a5c Move argv repackaging logic out of wesnoth.cpp
This includes all the Win32-specific code dealing with the retrieval of
the UTF-16 version of the command line and subsequent parsing into an
array of UTF-8 strings.

The latter code is unchanged except for the function names and one local
variable originally named `is_excaped` instead of `is_escaped`.

(Note to self: ask gfgtdf if he was aware of the existence of
CommandLineToArgvW() back when he wrote the Win32 command line retrieval
logic.)
2020-11-09 21:22:00 -03:00
Iris Morelle
cfa0342829 campaignd: Move auth functionality out of server.cpp 2020-11-01 16:11:20 -03:00
Steve Cotton
934cae6093 Refactoring the orb-coloring code, adding new units/orb_status.hpp
Instead of creating lots of image::locators and calling a family of
similarly-named preferences functions, this refactor encapsulates that logic
and uses an enum.

The new orb_status files still need adding to the MacOS build.

An assert has been added to `unit_drawer`'s constructor. There are two callers
- the `display` class guards it with an explicit check before constructing
unit_drawer. The `game_display` class doesn't have an explicit check, but it's
clear that other code in that class assumes the teams are already valid (and
would crash if they weren't).
2020-10-17 14:11:10 +02:00
Steve Cotton
a2b98687b7
Update the VC16 project files for Lua Widgets (#5125)
In source_lists/wesnoth, put the new files in alphabetical order.

This (as expected) fails to build on MacOS, just like the previous build.

It also fails to build with Clang on Linux, just like the previous build. That's
caused by src/scripting/push_check.hpp:89's unused parameter 'L', and is
also just like the previous build.
2020-09-04 05:44:15 +02:00
gfgtdf
90a5930f21 new lua gui2 widget userdata
lua now has a widget userdata that can be used
to set/get widgets properties as one would
expect, a lot of the set/get_dialog_xy function
were converted into modifiable properties of
the widget userdata. This in particular allows
us to get rid of the strange 'path to widget'
type of arguments of gui2 functions.

It currently generates lot of compiler wanrings,
I will fix this in a later commit.

One of the main advantage is that it makes it
much easier to add new api, previously a lot
of functions where overused, probably because
that was just easier than creatign a new
function. For example set_dialog_value returned
multiple value of listbox objects. (the
compatibility path doesn't support this
particular feature yet but i don't think it is
important, it probably wasn't even used at all,
since it also wasn't documented).

This also adds some new features, like an 'add_item'
function to add an item to a listbox, a 'type'
property of widgets to query the type of a
widget and a 'item_count' property to count the
number of children in an item.

Im still not 100% sure about the
property /function names, in particular:

1) i might rename 'items' to 'elements' or
   'children' in some functions. Not sure yet
2) I might rename the 'value' property to
   'value_compat' to make clear that its only
   supposed to be used by the
   backwards_compat.lua code.

A next step in improving this api might be
to introduce a (reusable!) 'window' userdata
so that the implementaion of wesnoth.show_dialog
would become:
```
function wesnoth.show_dialog(wml, preshow, postshow)
  local dialog = gui.create_dialog(wml)
  preshow(dialog)
  local res = dialog:show()
  postshow(dialog)
  return res
end
```

However this is currently not really possble
since the pure existance of a gui2::window
object blocks the gui1 code (the main game view)
from receiving events. So we clearly cannot luas
gc take ownership of gui2::window objects.
2020-09-03 22:08:53 +02:00
Pentarctagon
46f74f0ebb Move campaignd and wesnothd files into more descriptive locations.
Also fix a few cases of not specifying the full path to header files.
2020-08-06 12:16:18 -05:00
Pentarctagon
113a4e0913 Use mariadbpp rather than the mysql C connector.
Reasoning being:
* The result_set and other APIs are nicer to use.
* We use mariadb on our server rather than mysql, so this would minimize the chance of any incompatibilities.
* The mysql C++ connector 1.1 isn't compatible with with c++17 (https://stackoverflow.com/q/47284705).
2020-07-30 13:17:22 -05:00
Pentarctagon
f996803cf6 A separate button for info/announcements.
Rather than having everything in the MOTD, this adds a separate button that will popup a window which will have most of this information in two tabs:
* General server information, such as a link to the CoC.
* Announcements, such as tournaments and new versions being released.

The information on this new window will be stored in the new `server_config` database table.
The MOTD will then just be a short greeting instead of the several lines that are shown currently.

Additionally, now the motd will only be displayed in the lobby chat the first time the user logs on.
2020-07-30 13:17:22 -05: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
gfgtdf
f9790bcb5d add wesnoth.colors
see #3706

the main usecase to be able to show messages and
dialog labels in the color of a specific team.
2020-03-16 00:29:57 +01:00
Celtic Minstrel
1323e75ee2 Split out the main core modules of Wesnoth (wml, gui, stringx) into separate C++ source files
And load them with lua_requiref because we can.
2019-12-09 21:54:28 -05:00
Charles Dang
15bf3bb256 Removed scaling algorithm customization
We're going to be using NN scaling for the map, and that's already handled automatically
by SDL (and in the future, OGL). We don't need these settings for surface SCALED_TO_ZOOM
and SCALED_TO_HEX scaling. In any case, if we want to scale a surface to zoom or hex, it
will almost certainly be for map rendering (such scaling methods don't make sense in the
UI, for example), so just defaulting to NN is simplest.

This change drops the option to use Linear or xBRZ scaling for map zooming. This was already
the practical case due to me converting map rendering to use textures. NN was used for all
zoom levels, and it's fast and looks good.
2019-11-05 22:55:05 +11:00
Charles Dang
e643d2dce7 Removed joystick code
This was never fully implemented and has been essentially abandoned. If we want to
add this again, we should look to adding full game controller support (Steam controller,
for example), though I don't know how suited this game is for controller support. As for
as I can tell, the only working part was ever map scrolling.

Includes a sqrt -> std::sqrt conversion I forgot in this file awhile back.
2019-10-19 18:21:14 +11:00
Celtic Minstrel
7c07cc71c0 Remove support for legacy menu markup 2019-09-18 22:48:53 -04:00
Pentarctagon
77fc455b0b Remove sample_user_handler.
While I understand the reason it's here, it's been over a decade, no other user handlers have been added, and there's no indication any others will be added. Therefore, it doesn't seem like there's much of a reason to keep this code around.
2019-08-22 10:41:51 +02:00
Iris Morelle
37cca84684 Add utils::format_timespan() for formatting time lengths for user display 2019-03-01 02:29:20 -03:00
loonycyborg
34e2ef12c7 Add support for ipv6 addresses to addon client and multiplayer client
ipv6 address must be specifid surrounded by [], like [ipv6_address]:port,
since otherwise impossible to disambiguate colons separating ipv6 quads
from the colon delimiting port
2019-01-04 17:45:39 +03:00
Celtic Minstrel
639787e1c9 Merge pull request #2562 from wesnoth/schema 2018-11-11 13:52:19 -05:00
Celtic Minstrel
a32e279b7c Split tag.hpp into three files 2018-11-04 19:05:21 -05:00
Martin Hrubý (hrubymar10)
ca7f7a2e93 Fix C-Make and Scons builds 2018-10-30 07:16:42 +02:00
gfgtdf
3d1e3b36df add lua terrainmap object 2018-10-20 13:29:16 +02: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
c6e9efde9c GUI2: removed 2010 experimental listbox
This was never finished, is not maintained, suffers from a lack of features the "old" listbox
class now has, and seems (according to the logs) to be have been superceded by the pane widget.
At the very least, the pane widget seems to be what mordante was working with in his early
prototype of a new addon manager, and not this 2010 list class.

(cherry-picked from commit 458dd284b8)
2018-10-07 03:23:07 +00:00
Pentarctagon
d6833d76d0 Remove unused test file and images.
(cherry-picked from commit 0a7ed44c08)
2018-10-07 03:22:49 +00:00
Charles Dang
3b89e7f7e9 Rename gettext_boost.cpp to gettext.cpp
Since there isn't another version anymore.

(cherry-picked from commit e0beff6615)
2018-10-07 03:21:16 +00:00
Charles Dang
08e4108aa2 Renamed filesystem_boost.cpp to filesystem.cpp
(cherry-picked from commit e0192b1b1f)
2018-10-07 03:20:54 +00:00
Jyrki Vesterinen
4b84091c8b Implement saving MP chat message history (#1194, #2802)
(cherry-picked from commit a02100a0f1)
2018-10-07 03:19:26 +00:00
Alexander van Gessel
0ed7ff100a
Factor out base64 and crypt {en,de}coding
Base64 according to RFC4648.
Crypt64 is whatever crypt() does.

The two radix-64 encodings share less code than I would like,
because base64 is stream-oriented and therefore big-endian,
while crypt is little-endian.
2018-03-16 07:57:51 +01:00
Gregory A Lundberg
a3c46d3639 Upgrade to PHP 5.6.27 bcrypt
Valid through PHP 7.2.2, at least.

Switch to the PHP-specific version of crypt_blowfish. Eliminate libbcrypt as dead/redundant code.
2018-03-13 19:58:43 -05:00
Charles Dang
078f61c412 Removed unused GUI1 label widget 2018-03-07 06:17:20 +11:00
loonycyborg
1c8f520672 Implemented support for forum auth using bcrypt as per #1761
Newer versions of phpbb use bcrypt for password hashing requiring this
change. This is squash commit of bcrypt_auth branch.
2018-02-21 22:26:05 +03:00
Celtic Minstrel
3440546f2d Some fixes to the Lua deprecation API, and extend it to C++
* Some improvements to the messages
* Don't clobber existing metatables on deprecated subtables
* Fix Lua deprecation messages not even being logged
* Fix deprecation of Lua subtables
* Don't clobber the metatable when deprecating a subtable
2018-02-12 00:09:48 -05:00
kallaballa
024b2e7e9b Implement a surrender dialog
This records a surrender command in replays and quits the game.
2018-02-05 00:35:35 +01:00
Charles Dang
002b1a3c87 MP Staging/Join Game: unified player list handling and added player icons
Previously, MP Staging was using connect_engine::connected_users() to fill in the user list.
However, I noticed that the server was already sending the user list to all clients, including
the host, so I could unify the handling between Staging and Join Game by just using the server
data for both.

I've also added appropriate indicators for host, observer, and self in the list for both dialogs.
Additional host= and observer= status keys are sent by the server for that purpose.

I've also made the server dispatch the player list to the host when a game is created. This is
slightly redundant, since the host is the only player at that point, but it's easier than creating
a user config locally, or using connected_users(), not to mention easier to maintain.

The wesnothd::game::send_user_list function no longer exists early id `description_` is null.
No idea why it did that. It's not even used in the function. Anyway, it needed to be removed in
order for the above change to work.

Speaking of the host's copy of the player list, I haven't touched that. It's still needed for
managing things in the connect_engine. Might simplify things further in the future by delegating
more handling to the server, since it has a lot of the data needed already, but that's a different
project.
2017-12-14 11:12:49 +11:00
Charles Dang
6759f41b1e GUI2: cleaned up and restructured initialization process
This mostly has to do with moving various components into more logical locations instead of
all mushed together in gui/widgets/settings.*pp. To that end, the following changes have been
made:

* The gui2::init function has been moved to its own file in the gui/ toplevel.
* load_settings() has been merged into init().
* All functions and code relating to gui theme definitions have been moved to their own file.
* All code relating to widgets or window static init have been moved to their own file.
* window::update_screen_size has been moved out of the window class and into settings.cpp.
* The unimplemented free-stadnding version of load_widget_definitions has been removed.
* gui_definition::read and gui_defintion::load have been merged into the gui_definition ctor
  and greatly simplified.
* Some functions relating to builder_widgets have been renamed for clarity.
* add/remove_single_widget_defintion now access the current gui theme instead of the default.
  This looks like it was a mistake made in the original code.
* Since the static registry is now externally linked, the unit tests accessor for window types
  has been removed.
* Documentation has been updated. The wikidoc comment for gui_definition has been removed. It
  was rather out-of-date and needed to be reworked anyway.
* widget_builder_func_t's signature is now to take a config reference and not a copy, though
  REGISRER_WIDGET had already passed register_builder_widget a lambda that took a reference.
* Various other misc cleanups and improvements.
2017-12-11 14:49:58 +11:00
Gregory A Lundberg
b7881a0e6e Force linking all widgets
Ensure all GUI2 Widgets are linked into the Wesnoth executable even if there are no specific references to them.
2017-12-08 21:27:40 -06:00
Charles Dang
e08350cd17 Revert "rebase commit: implemented a surrender dialog that records a surrender command in replays and quits the game"
This reverts commit 4dda0ad9b2. This feature needs to be
considered further. Right now the design doesn't make sense.
2017-12-06 13:35:28 +11:00