182 Commits

Author SHA1 Message Date
shijie.chen
d88ddec6f1
Remove unnecessary header files (#8531)
Co-authored-by: shijie.chen <shijie.chen@goland.cn>
2024-03-12 00:07:48 -04:00
pentarctagon
970163813d 2024 copyright update 2024-01-20 22:22:23 -06:00
Subhraman Sarkar
f1f67ae5df
Add functionality to Time Schedule Editor (#8066)
selected schedule will write to utils/schedule.cfg on scenario save

HOTKEY_EDITOR_CUSTOM_TODS is disabled unless user loads scenario

custom_tod:Preview button and associated callback added.

editor:translatable attributes now written with leading underscore

editor:support for multiple custom time schedules
2023-12-14 17:12:07 -06:00
Pentarctagon
c44cc2742e Copyright update.. 2023-04-29 10:48:11 -05:00
newfrenchy83
18e77e45ef
Remove deprecated backstab code and using wml filters instead (#7031)
This replaces the code for handling backstab with code that converts it to something new that still works.
Thus, the deprecation message is now INDEFINITE instead of PREEMPTIVE.
2022-10-06 08:52:20 -04:00
Tommy
1fe87c4e24 Remove "<< '\n';" from log lines 2022-07-20 15:20:57 +12:00
newfrenchy83
9f4829fc88
Fix liminal not being affected by overillumination/darkening (#6749) 2022-06-05 17:23:42 -04:00
Pentarctagon
340023921d
2022 copyright update. 2022-03-06 19:07:13 -06:00
Pentarctagon
c4c292fa3b Replace all remaining usages if MAKE_ENUM. 2022-03-03 21:23:02 -06:00
Amir Hassan
6b41eae4e5
reintroduced usage of time_cfg[current_time] in replace_schedule functions #5757 (#6495) 2022-02-13 13:51:41 -05:00
Pentarctagon
57ce449af8
Re-add attribution to copyright notices.
These are mostly useless and outdated/wrong, but apparently it's probably illegal to remove them.
2021-07-27 20:21:38 -05:00
Pentarctagon
ba75e1af50
Copyright update.
This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
2021-07-26 11:38:03 -05:00
Celtic Minstrel
a03d59d7eb Lua: Add a new schedule module
The primary components of this are:
- wesnoth.current.schedule
- wesnoth.map.get_time_area()
- wesnoth.schedule module
2021-06-19 11:07:53 -04:00
Charles Dang
ca90cbe620 ToD Manager: minor code cleanup 2021-01-14 07:36:05 +11:00
Charles Dang
17b37737d8 ToD Manager: code formatting 2021-01-14 07:34:19 +11:00
Charles Dang
6e2f3e099e Removed utils/functional.hpp 2020-12-04 15:30:46 +11:00
Charles Dang
6b89bf86a7 Removed trailing tabs and whitespaces from C++ source
[ci skip]

I ran the same command from 9b7b1751fdda.

Excludes:
* lua/
* spirit_po/
2020-10-09 14:14:38 +11:00
gfgtdf
6157603ed9 don't write unset attributes in the scenario editor 2020-09-26 12:08:22 +02:00
gfgtdf
194b903918 fewer units/types.hpp includes 2020-06-20 02:21:14 +02:00
gfgtdf
cacd68342f small illuminates optimisation
removes a call to get_ability_bool, in case that get_ability_bool
would return false, it would ot be faster than get_abilities, in
case that it returns true it is useless.
2020-04-18 01:56:43 +02:00
gfgtdf
d50e37c2e3 make tod_manager more robust & code cleanups
the setters in tod_manager now ake sure that their parameter
is valid
2020-02-21 22:27:31 +01:00
gfgtdf
ebbecb3b04 support [time_area] with no specific time schedule
now the c++ code does no longer add a dummy time when
there are no times defines for an [time_area]. this is
in particular useful when one wants to define areas in
the map editor that is then used ingame for example in
filters.
We should consider renamaing [time_area] to just [area]
[time_area]s that don't define their own times schedule
are now ignored during tod calculation.
2020-02-21 22:27:31 +01:00
Celtic Minstrel
7b358440f6 Merge pull request #2664 from holius-fr/liminal_bonus 2018-11-17 13:04:49 -05:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0678f40a209797d72dfaba3e5e88545
(cherry-picked from commit bc4d22dc72e79c3d6a3364ac896e473afd298246)
2018-10-07 03:23:36 +00:00
Charles Dang
d9fb6c0bf5 Catch all exceptions (where possible) as const references
A few catch blocks modify something in their exceptions, so those are kept non-const.

(cherry-picked from commit 2bf4d68c87b69256266b7745a9e3453693794e35)
2018-10-07 03:20:58 +00:00
gfgtdf
cf63206d3c fix segfault on area= filter.
areas_ might be empty, so areas_[0] might crash, also returning areas_[0].hexes didn't really make sense in the first place

(cherry-picked from commit 41d7df970c43cd74413a93b635058e494dd67d78)
2018-10-07 03:19:57 +00:00
Charles Dang
2b65a8c5c8 Units: refactor display_context parameter out of ability functions
This was essentially only needed for the affects_side() helper. THAT'S IT. All this code just for
one single line... Anyway...

Utilized the display singleton's display_context getter instead. This also means fewer explicit
uses of resources::gameboard as the display_context object, meaning more compatibility with the
editor (not that that's relevant for most of the changed usecases, such as the AI, but it does
affect unit::get_abilities, which might be useful there in the future).

This also removes the display_context parameter from unit::invisible() since it was only passed to
unit::get_ability_bool().

unit::is_visible_to_team() also had its display_context parameter removed. It was used once as an
argument for invisible() and the other case was replaced with display::get_map().

(cherry-picked from commit 7e442cbb541b0bfbc5f3511fd1510fea80a4d34e)
2018-10-07 03:19:34 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f6935176b70a035d3e1c03080f79687f94)
2018-10-07 03:17:59 +00:00
fsd
ec1c7cb2d8 use has_attribute(liminal_bonus) as suggested 2018-03-16 15:59:07 +01:00
fsd
40483874ea change liminal implementation, from a night and day malus to a twilight bonus 2018-03-16 09:44:49 +01:00
Charles Dang
a7f6862210 More include cleanups
Cleaned up unnecessary inclusions of:
* event.hpp
* exceptions.hpp
* formatter.hpp
* hash.hpp
* image.hpp
* sound.hpp
* team.hpp
* tstring.hpp
* wml_exception.hpp
2018-03-11 23:22:02 +11:00
Charles Dang
a3a9697d14 Cleaned up unnecessary inclusion of formula/string_utils.hpp
These were either not needed, or serialization/string_utils.hpp was desired instead.
2018-03-03 20:22:17 +11:00
Charles Dang
ae53a38835 Use std::array for adjacent map_location arrays
I left the implementation of get_adjacent_tiles using messy C ptr arithmetic
since it most simply accounts for a few cases using arrays that are larger than
6 (such as in tod_manager) or underlying vector storage.

Also made use of std::array::size where applicable, and one case of std::array
iterators.

aspect_attacks_base::analyze_targets was changed to take a adjacent_loc_array_t
reference.
2018-02-20 11:33:51 +11:00
Charles Dang
8903ea9446 ToD Manager: don't write stub ToD to scenario file (fixes #2302) 2018-01-24 16:24:50 +11:00
Charles Dang
f23305f7e2 Formatting cleanup: T const& -> const T& 2018-01-23 01:26:23 +11:00
Jyrki Vesterinen
0db553ef36 Restore bounded_add()
Partial revert of commit ecbb15e1c6d1106ff2f8e540c584523481426c04.

Replacing bounded_add() with std::clamp() in these contexts disables
time-of-day bonuses, since ToD bonuses (the base value in these functions)
are almost always outside the range set in terrain properties.
2018-01-21 17:27:51 +02:00
Charles Dang
ecbb15e1c6 Minor cleanups to math utils
* Dropped bounded_add for clamp. There's a slight behavior change with this, namely that
  base is no longer returned if it falls outside the bounds. However, for both usecases of
  bounded_add, that behavior doesn't make sense. The wiki clearly states min/max_light=
  define the bounds for light=.

* Replaced gcd with Boost's gcd function. We already use the latter in the Preferences
  dialog, so this is more consistent.

* Simplified the implementation of in_ranges.
2018-01-21 18:12:06 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Jyrki Vesterinen
a4018faad1 ToD manager: ensure that there is at least one ToD
Complete lack of ToDs is an unsupported use case,
causing crashes and undefined behavior. See time_of_day::parse_times().

Fixes #2301.
2018-01-01 12:36:12 +02:00
Jyrki Vesterinen
b710af1716 Fix #2285: GCC-dev compiler warnings 2017-12-09 18:30:49 +02:00
Celtic Minstrel
96ca0b026e Replace config_of with new variadic config constructor 2017-05-21 16:27:46 -04:00
Charles Dang
e41a415588 Deployed yet even more further additional emplace_back 2017-05-10 14:15:15 +11:00
Charles Dang
e90d11d02a Renamed namespace 'random' to 'randomness'
This is because GCC 4.x has a problem with symbol name collisions with 'random'
2017-04-21 03:05:52 +11:00
Charles Dang
d8ed11c2b1 Drop the _new suffix from random_new
The 'old' random code has long been removed.
2017-04-20 08:48:47 +11:00
Rikard Falkeborn
94e73a7ccc Add const to some more functions 2017-04-17 16:51:30 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
9754d3e08b Fixed a few of the simpler warnings reported by cppcheck 2017-03-16 22:12:15 +11:00
Wedge009
5d14459594 Initialise member has_tod_bonus_changed_ in constructor (bug #25218) 2016-10-23 21:49:31 +11:00
Jyrki Vesterinen
7573678201 Fix crash on placing a unit with the scenario editor
The unit::get_ability_bool() function accessed resources::gameboard that
is not set in the editor. Now the function receives the display context
as a parameter instead.

I also fixed two crashes on editor startup in MSVC debug builds (both
caused by indexing the teams vector when there aren't any teams), and the
GUI2 unit list dialog showing wrong status icons.
2016-09-06 23:03:09 +03:00
Jyrki Vesterinen
531e05af9e Implement tod_manager::resolve_random() without Boost.Range (#711)
In order to do this, it was necessary to switch from boost::copy to
standard library algorithms, which is less space-efficient.
2016-07-25 01:31:20 -04:00