Commit graph

70547 commits

Author SHA1 Message Date
loonycyborg
621b474367 Simplify custom asio socket option definition 2017-12-02 03:19:27 +03:00
loonycyborg
55c70a1b0d Made addon client and server exchange OOB messages on user cancel
this is needed to fix issue #2203
2017-12-01 19:56:12 +03:00
pentarctagon
044d715b78 Updates to licensing info and makes a link https. 2017-12-01 19:59:40 +11:00
Charles Dang
35e5cdf291 Game Events: include cleanup
* Removed a ton of unnecessary includes
* Moved handler type aliases to fwd.hpp
* Added copyright notice to fwd.hpp
2017-12-01 14:52:39 +11:00
Charles Dang
daec3eb945 Removed unnecessary friend declaration
Not needed as of 056d7ac8f8.
2017-12-01 12:42:42 +11:00
Charles Dang
911fd9fa99 Removed orphaned function declaration
This function appears to now be part of game_board.
2017-12-01 12:35:00 +11:00
Charles Dang
238a994429 Fixup 2c12d1328b (don't try to dereference a nullptr) 2017-12-01 10:57:57 +11:00
Charles Dang
f17dcd4195 Game Events: removed assertion if weak event handler ptr fails to lock (fixup 056d7ac8f8)
I kinda assumed this should never happen due to the cleanup stage, but it seems there are
still cases where it does. Since the code already checks that the lock is valid before
returning, this isn't apparently needed and just breaks things.
2017-12-01 09:52:40 +11:00
Jyrki Vesterinen
6cd2a9b7cd Fix #2253: crash when accessing out-of-range attack from Lua 2017-11-30 19:44:38 +02:00
Charles Dang
dcd93bbd13 Save Index: fixed leader TC coloring always being default (fixup ff5d68f9f5)
I was using the unit config instead of the side config :( Closes #2255. This is the
proper fix.
2017-12-01 04:13:28 +11:00
Wedge009
f61138498c Remove header from VC project (deleted in 056d7ac8).
[ci skip]
2017-11-30 11:59:01 +11:00
Charles Dang
e5cea35169 Game Events: ensure event names are properly standardized in the config
This ensures all names are always valid to use in by-name lookup and are stored consistently.

Also fixes a potential issue in 2c12d1328b. I should have called standardize_name on each
name entry in the cleanup phase like when done in the registration phase, but this commit
ensures that's not needed anymore.
2017-11-30 11:44:06 +11:00
Charles Dang
fb5fd3f3c4 Game Events: made use of some emplace_back when constructing handlers
And added a clarifying comment about types.
2017-11-30 10:06:46 +11:00
Charles Dang
2c12d1328b Game Events: fixed a few oversights in 056d7ac8f8
* Fixed assertion failure when removing single-use custom events. Not actually something
  broken, I just forgot to add a "not already disabled" check when doing so since I added
  that assertion in event_handler::disable.
* Added a message to the aforementioned assertion.
* Ensure handler cleanup actually happens when removing custom events.
* Account for events with multiple names in cleanup.
2017-11-30 09:56:02 +11:00
Gregory A Lundberg
3f646cc965 DiD S04 Todo: Add snow
Lifted code from HttT to add snow coverage.
2017-11-29 16:32:44 -06:00
Gregory A Lundberg
128413da5a DiD S02 Fix bug: Swamp only
Use a terrain filter to avoid triggering the Ghouls when ending in forest instead of swamp.
2017-11-29 16:32:44 -06:00
Gregory A Lundberg
a599436ec3 DiD Remove variable artifacts 2017-11-29 16:32:44 -06:00
Gregory A Lundberg
a6fce92585 DiD S02 Cannot undo
The first moveto to 15,11 also causes a capture, which sets some variables and creates some units. So allow_undo has no effect.
2017-11-29 16:32:44 -06:00
Gregory A Lundberg
bdcfe84d6f DiD S01 Fix bug: Allow undo
Be consistent and allow undo on both sign posts.
2017-11-29 16:32:44 -06:00
Jeffrey 'Sigurd' Westcoat
822f98b754 HttT S17: Fix lava issues (#2249)
1. Undo now works again in the scenario.
2. Lava now works again.
3. Triggering on a moveto event was not good, as several shorter moves
   would make rate of lava grow much faster than fewer longer moves.
2017-11-30 00:25:22 +02:00
Jyrki Vesterinen
72739c56a5 Revert ignoring MP test failures due to video init failure (2e5c5da003)
This code ended up ignoring *all* MP test failures, in particular the one
fixed in commit 11d7b9f0cf.

I'd test the code and fix it if I could, but unfortunately I can no longer
develop on GNU/Linux because of PC issues (which I mentioned in Discord).
Therefore I'm just reverting the entire change.
2017-11-29 21:34:03 +02:00
Gregory A Lundberg
11d7b9f0cf Fix mp_tests
Don't know why it's not working but I can get it working by not performing the chat message.
2017-11-28 21:15:34 -06:00
Gregory A Lundberg
4dbe4fbbb2 Eliminate use of string_view::at
We only use it in once place. At that point we can guarantee we stay in-bounds. So there is no need to use at() to check we remain in-bounds.

This eliminates a warning when building Debug for Windows (quieting Appveyor).

AI0886 had a similar issue building using GCC 6.3 on Boost 1.62

Reverting ca03818fa8 and 0cbab6eeed since this changeset should correct both issues.
2017-11-29 11:01:25 +11:00
Charles Dang
230dce9fec Minor cleanup to 2045b6739e
[ci skip]
2017-11-29 08:04:08 +11:00
Charles Dang
056d7ac8f8 Game Events: refactored event handler storage
This throws out the custom smart_list class in favor of a plain std::list. It also greatly simplifies
a few things. First, event handlers no longer remove themselves from the main list in event_handlers.
Now they just flag themselves as disabled (which means they will never execute once marked) and cleaned
up later in a newly added cleanup stage. This means a handler no longer needs to keep its index in the
active handler vector.

This removal of reliance on indices also means I could add the aforementioned cleanup stage. With the
smart_list code, event handlers were never actually removed from the active vector, nor any weak_ptrs
pointing to them removed either. This wasn't exactly a problem, since the handlers were stored via
shared_ptrs which would then simply be null after one deleted itself. Still, it's cleaner to drop any
invalid ones (and unlockable weak_ptrs) from any relevant containers. I've opted to do this in
manager::execute_on_events. Seems a good enough place as any.

The net result of this is the code is much cleaner. We're able to get rid of a bunch of unnecessary
feelers into various classes. This also makes the manager::iteration dereference code a lot easier
to understand. There certainly could be further refactoring, but I think this is a good start.
2017-11-29 08:04:08 +11:00
Jyrki Vesterinen
f62b62b700 Fix #2251: possible crash when AI invokes attack prediction 2017-11-28 21:38:56 +02:00
sigurdfdragon
a593e9753f Update changelogs 2017-11-27 20:28:36 -05:00
sigurdfdragon
3213e63efe DM S19: Fix carryover report 2017-11-27 20:15:54 -05:00
sigurdfdragon
4bafb736f0 DM S19: Rebalance scenario for a more exciting battle
1. Increases difficulty
2. Allows player and enemy to field more units
2017-11-27 20:15:54 -05:00
Charles Dang
b73e8dd73f GUI2/Window: don't constantly send useless DRAW events to the queue
This is a small subset of a change made on accelerated_rendering. Essentially, since drawing
doesn't happen until events::pump is called, and that function also drops all but one DRAW
event from the queue, sending a DRAW event every 20 ms is just useless noise and excessive
CPU use.

There should be no change in the actual rate GUI2 dialogs are redrawn with this change.
2017-11-28 10:38:08 +11:00
lundberg
a05d48e80d Fix copyright defect and add missing icon 2017-11-27 15:15:40 -06:00
Charles Dang
eba94b3e22 Cleaned up unnecessary drawing calls
After testing, it seems these calls to raise_draw_event and display/game_display::draw()
were unnecessary - or at least, became unnecessary at some point. One or two are definitely
still needed, but removing these doesn't seem to cause anything to to glitch out. Likely
explanation is anything that needs updating just gets updated either immediately or on the
next play_slice loop.
2017-11-28 06:38:19 +11:00
mattsc
b7efaadec4 Protect Unit Micro AI: fix typo/bug in AI aspect change 2017-11-27 06:54:14 -08:00
Jeffrey 'Sigurd' Westcoat
aceabbe018 Macros: Tweak sceptre damage for story reasons (#2220)
Sceptre (15x4) is now stronger than the uncut ruby of fire (14x4) for
regular mainline users Thursagan and Konard II. Level 3 Konrad & Li'sar
in HttT are still exceptional users of the sceptre (18x4 & 16x4).

From discussions with zookeeper in irc.
2017-11-27 13:46:57 +02:00
Charles Dang
e8655af1b4 Display: one (hopefully) significant optimization and one minor one
Copying the blit_helper objects when adding them to the drawing buffer was expensive since
blit_helper contains a vector of surfaces. We definitely want to copy that as little as
possible.

Also used std::move when fetching fog/shroud images. This function apparently has little
overhead, but still nice to not make copies here.

Also made get_terrain_images return void (this is just minor cleanup, not an optimization).
No need for it to return a reference to a class member.
2017-11-27 16:41:05 +11:00
Charles Dang
9b988f27f7 Hotkey/Command Executor: removed get_video() member in favor of singleton
Also removed CVideo reference passed to make_screenshot() and its argument function, since the
reference is only used in the one specific screenshot() function anyway.
2017-11-27 15:59:38 +11:00
Severin Glöckner
e0cebdd402 desktop_entry: include high resolution icons
wesnoth-optipng has been applied to the new images
2017-11-27 01:52:36 +01: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
lundberg
ba6b6a1f53 Update VC12 project for wesnothd
Drop the additional requirements for SDL2 libraries. Wesnothd no longer requires SDL2.
2017-11-26 15:26:17 -06:00
Jyrki Vesterinen
13f216cd17 Fix a copy-paste mistake 2017-11-26 21:00:09 +02:00
Jyrki Vesterinen
8a74ee4d72 An year has less than 27 months 2017-11-26 20:58:45 +02:00
Charles Dang
a21697fef3 Cleaned up various areas of code related to setting window resolution
* Added a point ctor that takes an SDL_Point.
* Added a toggle_fullscreen function to CVideo.
* Change all management of resolution data to use point instead of std::pair<int, int>. This
  shortens the code considerably.
* Cleaned up preferences_dialog::set_resolution_list
* Made CVideo::set_resolution return a bool indicating whether resolution was changed.
* Swapped which of the two set_resolution overloads contains the main implementation.
* Moved the events::raise_resize_event() call when setting resolution to the CVideo function
  where it should have always been (instead of the prefs dialog callback). This is a pretty
  essential component and having it localized in one place meant any other area of the code
  that might have called set_resolution wouldn't have it.
2017-11-27 05:53:23 +11:00
Charles Dang
4ff249da7d Fixed regression in 8bf95ce69a (fixes #2245)
I thought changing what the return value of sdl_event_handler::hotkey_pressed meant wouldn't
cause any regressions, but apparently I was wrong. This made it so certain key-down events
were never fired at all, meaning the associated keys could never be entered in a textbox.
Pretty serious!

I've restored the bool retval to dispatcher::execute_hotkey. It will return false if there's
no associated hotkey function (like before), and true otherwise. sdl_event_handler::hotkey_pressed
has also been reverted to return the value of that function.
2017-11-27 05:45:46 +11:00
Jyrki Vesterinen
4d0c46164e Miscellaneous optimizations in display::get_terrain_images()
* The vector of surfaces is now a class member variable instead of a local
variable. This saves a memory allocation every time the function is called
- which is worth it in this case, as the function is a major performance
bottleneck.

* The surfaces are now being moved instead of copied where possible. Turns
out that freeing a SDL surface is fairly expensive in performance-critical
code.

* Pointers to ToDs are now cached, reducing the number of calls to
get_time_of_day() from 37 to 7.

In a stress-test in Aetheryn's Mod at 50 % zoom, the FPS I was getting on
my PC (Intel Core i5-4430) increased from 16 to 23.
2017-11-26 20:07:34 +02:00
Jyrki Vesterinen
ca4cef633a Stop explicitly redrawing in playmp_controller::play_human_turn()
Play_controller::play_slice() that the aforementioned function calls
redraws the game anyway. Calling redraw code from two places makes
profiling data harder to investigate.
2017-11-26 15:22:22 +02:00
doofus-01
090810a778
updating Ixthala Demon unit (#2240) 2017-11-25 11:43:49 -08:00
pentarctagon
42a44ff668 Remove ENABLE_TOOLS and ENABLE_SDL2_TOOLS from cmake. 2017-11-25 12:01:49 -06:00
pentarctagon
75b73043e3 Remove MSVC support from cmake. 2017-11-25 12:01:49 -06:00
Gregory A Lundberg
537f530c2b Fix compile errors
Not sure where these came from. I'm assuming the changes to have CMake and SCons be equally strict.

If so, I'm amazed this was all which popped up!
2017-11-24 18:48:28 -06:00