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
..

Compiling Wesnoth on Windows using CodeBlocks

(Last tested using Wesnoth 1.15.9+ on Code::Blocks 17.12)

  1. Get a Wesnoth source tarball or Git repository clone. The folder which contains the data/, projectfiles/, and src/ subfolders is referred to as wesnoth_root in this file.

  2. Install CodeBlocks from http://www.codeblocks.org/. MinGW is not needed.

  3. Download and unpack MinGW-w64 from https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z. Note that the project files in wesnoth_root/projectfiles/CodeBlocks/ may contain a setting to compile with OpenMP support, so you should make sure that this option is enabled while installing the compiler (mark the checkbox for this when choosing components to install).

    NOTE: You must make sure to download the 64-bit version.

    If you download the 32 bit version and you have out of memory errors when creating debug builds, you can follow these steps:

    1. If you use 32-bit Windows, run in admin command prompt
    bcdedit/set IncreaseUserVa 3072
    
    1. Install MASM32;

    2. Open cmd (also as admin);

    3. Run these commands in an admin command prompt

    cd C:\..\mingw32\libexec\gcc\i686-w64-mingw32\7.2.0
    
    C:\masm32\bineditbin.exe /LARGEADDRESSAWARE cc1plus.exe
    

    If you use the 64-bit version then you cannot use MASM32 since it doesn't have a 64 bit version, which means you cannot make a debug build.

  4. Download the latest CodeBlocksWinSDK*.zip package from http://sourceforge.net/projects/wesnoth/files/SDK/. The package contains the right version/build combination of source headers, build-time libraries (*.a) and run-time libraries (*.dll) needed to build and run Wesnoth. Older versions of the package may no longer be useful after new dependencies are added to Wesnoth or its version requirements change.

    for versions > 1.12, follow the steps in libraries.md to update libraries yourself.

    Unpack the file to any path of your choice, which will be referred to as sdk_root for the remainder of this file.

    The exact names of the folders containing the required files may vary; take note of them for the next steps.

  5. In CodeBlocks, open wesnoth_root/projectfiles/CodeBlocks/wesnoth.workspace.

    NOTE: The first time CodeBlocks is opened you will be asked to select a compiler. If installation from step 3 is complete it may detect it for you, in which case you can select the GNU GCC compiler which will produce some default selections for step 6 - be sure to change any that don't match as directed below.

  6. Go to the Settings -> Compiler option in the menu, and choose the Global compiler settings -> Toolchain executables tab in the settings dialog. Enter the following settings into the text boxes:

    • Compiler's installation directory: the path to which you installed mingw-w64 (click on ... to browse for it).
    • C compiler, C++ compiler, Linker for dynamic libs: g++.exe
    • Linker for static libs: ar.exe
  7. Change to the Search directories -> Compiler tab and choose Add; enter the path to sdk_root/include_w64-mingw32/.

  8. Change to the Search directories -> Linker tab and choose Add; enter the path to sdk_root/lib_w64-mingw32/.

  9. OPTIONAL: By default, CodeBlocks will only run one compiler instance at a time, making the overall build process very slow even with fast hardware. If you have a multi-core processor, you may make better use of its power by increasing the value of the option "Number of processes for parallel builds" in the Build options tab. It is recommended to set this to the number of CPU cores your system has.

  10. Close the settings dialog.

  11. Choose the Build -> Build workspace option in the CodeBlocks menu. Once finished, wesnoth.exe and wesnothd.exe should appear in wesnoth_root.

  12. To be able to run your build, copy all *.dll files from the sdk_root/dll/ folder to wesnoth_root where the *.exe files are.