573 Commits

Author SHA1 Message Date
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
newfrenchy83
a6883aabe0
Update list of boost modules 2023-08-21 15:03:38 +02:00
Steve Cotton
cc8dddea6e Support negative numbers in ranges
Adds support for using these in the weapons and ability filters:
* "-1", which was previously treated as an parse error (no number before the separator).
* "-3--1"
* "-infinity" as the lower number in the range, provided a different upper number is given.

This treats "-infinity" (with no other number), "-infinity--infinity",
"infinity" (with no other number) and "infinity-infinity" as errors. It seems
unlikely that someone would intend to use a filter that can't match any
reasonable number.

The range "-infinity-infinity" will be parsed successfully. I don't see a use
case for that, but nor do I see a reason to add extra C++ to reject it.
However, it's not added to the schema, as I think it's good for the schema to
give a warning when someone creates a filter which will accept every value
(including accepting the default, so "-infinity-infinity" accepts the unset
value too).

Includes new unit tests for the C++ and the Lua stringx.parse_range functions.
The next commit adds more WML tests, but is kept separate to credit the author.

This started as a change to move common filter functions from unit.cpp to
somewhere that they could be reused for other config-based filters. In the
process a missing feature was found and added, the move is still included in a
single Git commit because the move was required in order to make these
functions accessible to the Boost unit tests.

Two CodeBlocks project files additionally get src/utils/any.hpp added,
which was in one of them but missing from the other two. I noticed because
these are alphabetically at the start of the src/utils file list.

Thanks to @CelticMinstrel for the review comments and Xcode project updates.
2023-08-11 21:59:06 +02:00
Pentarctagon
10997c39a3
Start giving the editor add-on level functionality. (#7719)
The key word of course being "start". This PR changes the editor by default to work at the add-on level instead of in its own separate scenarios and maps directories. The goal is to make the editor more useful generally, but also specifically to make it much easier for players to distribute content they create using the editor:
* When they click the Editor button on the main menu, they will first be prompted to choose an add-on (or mainline), or to create a new add-on.
* When saved, if the scenario cfg is in the format previously generated by the editor, it will be converted to the new format and to use the [multiplayer] tag, the map_file attribute, and have the map data saved to a separate .map file.
* Relatedly, the editor now knows how to handle scenarios with the map_file attribute at all (which yes, does mean that currently wesnoth's editor doesn't know how to load its own mainline scenarios from their cfg).
* When opening the file chooser dialog, it now defaults to their selected add-on's directory.

If they choose to create a new add-on, then the editor creates for them:
* a basic but functional _main.cfg.
* an empty achievements.cfg (at this point mostly just so they might see it at some point and realize achievements exist, but ideally an achievements editor dialog could be created eventually).
* an empty _server.pbl file.
* a proper add-on directory structure containing the standard set of folders (maps/, scenarios/, units/, utils/, images/, etc).

Additionally, as an initial proof of concept for actually using this new add-on level functionality, a new Add-ons dropdown has been added to the editor's top bar, with a pbl editor option. This allows populating the blank _server.pbl file as well as editing an existing _server.pbl. There is also an option to change the add-on's ID, which will update the add-on's folder name and _main.cfg.

Misc other changes:
* The ability to add a recruit list to a side has been added back as a text box on the edit side dialog. While admittedly this doesn't allow players to select units from within the editor itself, it does set the actual side's recruit list (rather than a specific unit's extra_recruits), will show the user what the current recruit list for the side is (which the previously removed implementation didn't show anywhere), and correctly sets the faction as Custom so that the recruit list is used.
* When saving an old-style editor scenario, everything that can be triggered via [event] is either moved to a start event with a specific id attribute. Exceptions to this are [time], [side], and [side][village]. This is done so that the editor can know (for the most part) what things are actually its own to safely replace. As such, aside from the three previously mentioned tags plus the start event, any other WML added to a scenario by a UMC author is preserved rather than being overwritten - the editor no longer replaces the entire contents of the scenario file.
* The editor no longer writes out cfg files missing the top level scenario tag. If it doesn't find one or this is the first save of a new scenario it defaults to [multiplayer], but otherwise it will properly handle finding [test] or [scenario] as well.
* Requires that map files have the .map extension and scenario files have the .cfg extension. Also it assumes that .map files do actually only have map data in them and the .cfg files do actually have valid WML in them. I understand that this is not a limitation it had previously, but I don't think this is an unreasonable thing to require.
* Addresses part of #7667 by just not using regex for figuring out the map_data attribute value.

Additionally, it is not possible to change the currently selected add-on without going back to the main menu, clicking the editor button, and choosing a different add-on. This is intentional - I don't want to deal with having multiple add-ons open at the same time. If someone feels really strongly otherwise, then they can implement that themselves later.
2023-07-19 15:00:14 -05:00
newfrenchy83
4494689d68 update codeblock projectfiles 2023-05-05 13:50:43 -05:00
gfgtdf
01f28b12ae Refactor statistics
Previously statistics were stored in global variables, now
it is a part of saved_game. With this saved_game now finally
represent the contents of a safefile as it was intended to,
without needing to fill the statistics part in some global
variable. (See also #4672 )

In particular now no longer have to manually reset the
statistics as random parts of the code, it gets reset
along with the saved_game object. Also it is now in theroy
possible for multiple saved_game objects to exist.

Statistics was split in two objects, the statistics_record
which only contains the data, and statistics_t, which
provides methods to modify statistics during a game (to get
cleaner dependencies)

This fixes multiple related bugs with statistics in replays:
- #4133 (stats not bring reset when loading a replay)
- #4133 (duplicate entry for current scenario in replay)
- #4441 (wrong stats at the beginning of a replay)

And issues with statistics being lost for non-host players when
reloading a game in (online) mp (no ticket for that one found).
2023-05-04 21:25:55 +02:00
newfrenchy83
81f72539d9 update codeblock projectfiles 2023-03-21 14:15:38 -05:00
gfgtdf
d954d307bc move carryover message to new file
This will in particular make future refactors of that code easier.
2023-03-18 19:04:39 +01:00
Pentarctagon
3f63908296 Further consolidate logging functionality between Windows and non-Windows platforms.
For non-Windows platforms this adds:
* a new check for whether the logs directory exists and is writable by attempting to write a single whitespace to a dummy.log file.
* a popup shown immediately after the GUI system is initialized letting the player know if there was an issue creating the log file.

For Windows, this changes:
* instead of writing to the OS temp directory and then attempting to move that file to the logs directory, this uses the same check that was described above for non-Windows platforms.
* the alert shown when writing the dummy log file fails is now a Wesnoth alert message rather than the Windows-specific MessageBox.
* a failure to create a log file does not immediately exit wesnoth anymore.

Additionally, this makes it so that for the default state (logging to file), all platforms follow the same code path by calling `lg::set_log_to_file()`. `log_windows` now contains only the Windows-specific logic needed for handling the creation/redirection of output to a console.
2023-02-17 10:03:05 -06:00
Pentarctagon
d1465a9eb9
Add basic achievements functionality. (#7237)
* Add basic achievements functionality.

This reads the mainline achievements.cfg and then all the achievements of each installed add-on.

This is intentionally handled separately from other WML loading so that:
a) All achievements and their status are able to be displayed on the main menu right after Wesnoth starts and regardless of which add-ons are active.
b) Add-ons can add additional achievements to other content, whether UMC or mainline. For example, a modification that adds more achievements for mainline campaigns.

Marking something as achieved is handled by the new [set_achieved] tag and whether an achievement has been completed can be checked via [has_achievement].

There is no attempt to prevent people from manually editing which achievements they've accomplished.

NOTE: These are *not* in any way related to Steam achievements!
2023-01-21 10:32:45 -06:00
Pentarctagon
0e85fac29c
Have /report show a dialog for entering information. (#6969)
Resolves #5056
2022-09-02 21:18:03 -05:00
Pentarctagon
72a1c801c0 Log exception type when doing catch(...). 2022-08-25 22:22:22 -05:00
newfrenchy83
2d89af63b4 update codeblock projectfiles 2022-08-07 16:08:40 -05:00
newfrenchy83
ad8f6a6f4c update codeblock 2022-08-06 10:37:38 -05:00
newfrenchy83
465e5c1a4d revert removefiles of list
all files necessary for compilation of tests in codeblock projectfiles/CodeBlocks/tests
2022-08-05 00:08:03 -05:00
newfrenchy83
b16a196dbc
update codeblock test project (#6929) 2022-08-03 08:40:25 -04:00
newfrenchy83
7c4e0e51d9 update codeblock projectfile 2022-07-31 01:34:54 +12:00
newfrenchy83
0bfb384887
Update codeblocks project files for gcc11 2022-07-20 11:39:50 +02:00
newfrenchy83
8cb73a4231 update codeblocks projectfiles 2022-07-13 14:15:05 +02:00
newfrenchy83
6024df5794 update codeblock projectfiles
remove unused tracer.cpp source file
2022-07-07 21:05:53 +10:00
newfrenchy83
d8b8c5ea80 add GLIBCXX_USE_DEPRECATED=0 in codeblock projectfiles 2022-07-05 08:57:12 -05:00
newfrenchy83
55fedbb27c Revert "update codeblock projectfiles"
This reverts commit df05b5061a8236e1e7be1adc192af975d661e11b.
2022-07-04 21:21:16 -04:00
newfrenchy83
df05b5061a update codeblock projectfiles 2022-07-04 13:13:43 -05:00
newfrenchy83
a077235e8d update codeblock projectfiles 2022-06-29 13:35:49 +02:00
newfrenchy83
16cbca3027 update codeblock projectfiles 2022-06-12 09:29:37 -05:00
newfrenchy83
49682d29ad update codeblock projectfiles 2022-06-02 08:52:30 -05:00
newfrenchy83
de5409b5d2 add sdl/ texture and input to codeblock projectfiles 2022-04-30 16:40:42 -05:00
Charles Dang
f1a9420042
Merge pull request #6558 from stevecotton/cleanup_pane_includes
Remove gui/auxiliary/filter.hpp and unused includes of pane.hpp
2022-03-14 16:36:03 -04:00
newfrenchy83
04181d7de8 update codeblock projetfiles 2022-03-13 12:07:00 -05:00
newfrenchy83
429094b577 update codeblock projectfiles 2022-03-13 11:27:42 +01:00
Steve Cotton
3279973960 Remove gui/auxiliary/filter.hpp and unused includes of pane.hpp
Remove filter.hpp, which wasn't included by any file, and relied on
pane.hpp indirectly via one of the lines removed in this commit. The sorting
functionality seems to have moved into pane.cpp when matrix.hpp was added.
Note: there are two other unrelated `filter.hpp` files.

Header pane.hpp is only used by matrix.hpp, pane.cpp, and window_builder.cpp;
the class is also used via a forward-declaration in window.hpp, which friends
it, allowing a call to window::layout_linked_widgets. The class is also made
accessible via REGISTER_WIDGET.

Part of #6540.
2022-03-09 13:54:05 +01:00
newfrenchy83
691c157124 update codeblock projectfiles 2022-03-04 10:41:12 -06:00
Pentarctagon
c4c292fa3b Replace all remaining usages if MAKE_ENUM. 2022-03-03 21:23:02 -06:00
newfrenchy83
252f227234 update instruction for compilate boost libraries 2022-02-16 10:53:52 -06:00
newfrenchy83
6ba2ae1076 update codeblock projectfiles 2022-01-27 11:41:29 -06:00
newfrenchy83
4664946dc5 update codeblock projectfiles 2021-08-01 15:34:16 +02:00
newfrenchy83
88873e3fae update codeblock projectfiles 2021-07-18 11:48:58 -05:00
newfrenchy83
3e05480b5b fix codeblock projectfiles 2021-06-03 18:53:16 -05:00
newfrenchy83
b9cbc084c3 update codeblock projectfiles 2021-06-02 13:18:21 -05:00
newfrenchy83
8c1142be4b update codeblock projectfiles 2021-05-22 12:26:00 -05:00
newfrenchy83
7e839a924c
update codeblock projectfiles
Add libssl and some includes for lua_mathx.
2021-05-19 16:39:06 -05:00
newfrenchy83
612e6c5f84 update codeblock projectfiles 2021-05-12 13:23:35 -05:00
newfrenchy83
03e87ffb2c remove SDL2_ttf.a to codeblock projectfiles 2021-04-27 17:53:49 -05:00
newfrenchy83
f70039fe26 update codeblock projectfiles 2021-04-07 11:47:00 -05:00
newfrenchy83
1df8572726 Update Codeblock projectfiles 2021-03-17 14:42:18 -05:00
newfrenchy83
f671d2a678 Update wesnothd.cbp 2021-02-18 14:14:34 -06:00
newfrenchy83
144dd2310e Update wesnoth.cbp 2021-02-18 14:14:34 -06:00
newfrenchy83
6e43b2bd48 Update liblua.cbp 2021-02-18 14:14:34 -06:00
newfrenchy83
f0dae02029 Update tests.cbp 2021-02-18 14:14:34 -06:00
newfrenchy83
0bcd1853e7 revert to c++20 dev to c++17 2021-02-18 14:14:34 -06:00