Commit graph

77 commits

Author SHA1 Message Date
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
kallaballa
4dda0ad9b2
rebase commit: implemented a surrender dialog that records a surrender command in replays and quits the game 2017-12-05 17:01:06 -06:00
Charles Dang
34e065e011 Tests: removed another empty file I missed in c93aebb1de
Its contents were also removed when SDL 1.2 was dropped.
2017-11-27 09:47:45 +11:00
Charles Dang
c93aebb1de Tests: removed empty files
These were emptied out when SDL 1.2 was removed (358bd1235f). I seem to recall
someone saying it might be worth keeping them around in case something needed to be put
back, but it's been a year and a half. Not much worth in keeping empty files.
2017-11-27 09:42:14 +11:00
Alexander van Gessel
669ba885ce Add make_unit_ptr functions in separate header, to avoid inclusion of unit.hpp 2017-11-19 17:50:47 +01:00
Charles Dang
378b9199ae Moved point wrapper out of GUI2 namespace
I'm not sure if it should become part of the sdl namespace, but for now I'm leaving it out.
2017-11-11 21:49:05 +11:00
Gregory A Lundberg
d091391899 Renamed the target and binary for the Boost unit tests from test to boost_unit_tests
This quells warnings from CMake about reserved target names, and reduces confusion about which `test` is intended: the wesnoth executable or the standard shell command.
2017-11-06 20:32:27 +02:00
Charles Dang
b1ad293ccd GUI2: removed unused MP Command Wrapper dialog
This was the equivalent of the Player Info dialog for the old GUI1 MP Lobby, and is now unused.
The new GUI2 lobby uses the aforementioned Player Info dialog. The functionality is basically
the same, though, except the send-private-message interface is more streamlined in the new lobby.
2017-10-29 16:56:16 +11:00
gfgtdf
e9c6dff56a Slider refactor
1) We now use a single function to set slider min/max value, this fixes #1641
   (sliders having a temporary invalid (min > max) state between set_min() and
   set_max() calls)
2) I split the sliders_base class from the scrollbar_base class to not
   accidently break the rather complicated scrollbar_base class while
   refactoring sliders.
3) We don't use floats in the slider code to make sure no rounding errors happen.
4) This fixes #1539 by removing slider::in_orthoginal (which made it impossible
   to pull a slider to its maximum/minimum) and intead clamping the mouse
   position in range.
5) This fixes #1656 and #1767 by refactoriung code (that bug happend mainly
   because the old code used variables that contained the position in 'steps'
   as pixel position and vice versa)
6) Sliders now 'snap' to the correct values just like the gui1 sliders did.
7) Slider positions are now poperly rounded to its neariest values
   instead of just beeing 'floored'
2017-10-29 01:13:48 +02:00
Gregory A Lundberg
f7bea59fe9 Finish switch to MT19937 for randomness
Coverity has been complaining about using rand() as an insecure function. As we're using it, this function is not insecure; but is also not a very good RNG. We're using MT19937 in a system-independant manner. But some uses of rand() were never converted. This converts them.

This closes the following Coverity issues:

CID 1356297
CID 1356299
CID 1356303
CID 1356304
CID 1356306
CID 1356312
CID 1356314
CID 1380163
CID 1380173
CID 1380179
CID 1380191
CID 1380198
CID 1380201
CID 1380210
CID 1380214
CID 1380215
CID 1380219
CID 1380230
CID 1380241
2017-10-26 09:28:24 +11:00
Charles Dang
f2593034a8 GUI2: moved MP Lobby and Player Info files into the multiplayer dialog subdir 2017-10-20 16:36:18 +11:00
Ignacio R. Morelle
28c5179636 campaignd: Add wrapper for atomic commits of crucial files
As the 2016-10-07~09 downtime incident shows, it is paramount to take
further steps in guaranteeing that the server can't corrupt its own data
files (especially the add-ons database) when receiving
inappropriately-timed signals.

This commit adds and deploys an ostream wrapper that requires callers to
explicitly commit the results to disk when finished writing to the
stream, so that only then the real destination file is overwritten with
the working copy (a temporary in the same dir). This way, there should
never be a situation in which the destination is left in an inconsistent
state due to a signal or exception.

The temporary receives a predictable name right now in the interest of
simplicity, since we are more or less in control of the target directory
anyway. We definitely don't want it to be an unlinked file since that
would make it impossible for admins to inspect and compare the temporary
against the original afterwards.

The code makes some assumptions about the nature of the return value of
filesystem::ostream_file() which will never be broken in this stable
branch, which is why one helper function is in campaignd land rather
than in the global filesystem API for now. This should probably be
rectified when forward-porting to master. Maybe.

Nothing of this will work reliably on Windows but we don't care. There's
only one machine in the world where we support running campaignd at this
time and it runs Linux.
2017-09-14 20:14:08 -03:00
Celtic Minstrel
658bbbf1da fixup Travis compile 2017-08-14 22:05:29 -04:00
Celtic Minstrel
25a0d099a9 Enable sorting campaign list in chronological or lexicographical order 2017-08-14 12:36:07 -04:00
Celtic Minstrel
4bd1fa7157 Allow filter formulas to use a number of previously FormulaAI-exclusive functions 2017-06-24 19:07:53 -04:00
Jyrki Vesterinen
56433d12a3 Merge branch 'login_save_crypt' 2017-05-22 20:10:09 +03:00
Charles Dang
246ea98dd9 GUI2: moved common swap_grid util function into new widget_helpers file 2017-05-22 14:50:16 +11:00
Charles Dang
1ea8e0f05c Renamed wmi_container to wmi_manager
Since it's not a container anymore, it shouldn't be called such.
2017-05-19 06:50:57 +11:00
gfgtdf
13b00f73ff move config::attribte_value out of config.?pp
this has 2 advantages:
1) we can now forwaed declare the class config_attribute_value without
including config.hpp
2) the config.?pp files are a little easier to read.
2017-05-15 02:27:18 +02:00
Celtic Minstrel
c9191c9812 Add OpenSSL's libcrypto as a dependency
This also removes the included SHA1 and MD5 implementations
in favour of those from OpenSSL.

Thanks to @jyrkive for helping to get the CMake build working and
ensuring the game still compiles with OpenSSL 1.1.0.
(The SHA_xxx() aliases were removed in OpenSSL 1.1.0.)
2017-05-12 15:57:13 -04:00
Celtic Minstrel
9365538b3b Don't store the user's password in plaintext in the prefs file
The game now supports @ or = in usernames for the purpose of saving them to a file.

Though I don't think these are allowed currently, it's probably better to
support it from the start rather than having things break if they later
become allowed.
2017-05-12 15:56:41 -04:00
Charles Dang
ad4f6b122d Rename animated_game.cpp -> animated.cpp
Makes it clearer which header it's a companion to.
2017-05-11 21:17:54 +11:00
Charles Dang
194b5ef17d Removed unused help_button class and its associated GUI1 components
Looking at this more I realized the help_button was a GUI1 dialog component meant to open the Help
dialog. Since all dialogs invoking Help now use GUI2, there's no need for this class anymore. It
also allows a bunch of remaining GUI1 stuff to be cleaned up.
2017-05-10 10:50:46 +11:00
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00