Skip to content

Commit e01acf4

Browse files
authored
Merge branch 'master' into sidequest/single-soldier-coin-training
2 parents a7d6d60 + be68dc6 commit e01acf4

95 files changed

Lines changed: 1701 additions & 438 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2005 - 2021 Settlers Freaks <sf-team at siedler25.org>
1+
# Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
22
#
33
# SPDX-License-Identifier: CC0-1.0
44

@@ -11,9 +11,12 @@
1111
*.user
1212
*~
1313
.DS_Store
14+
.opencode
1415
.vscode
1516
.vs
1617
.cache
18+
.opencode
19+
opencode.json
1720
/S2
1821
/build
1922
/external/boost*

‎CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Copyright (C) 2005 - 2025 Settlers Freaks <sf-team at siedler25.org>
1+
# Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
22
#
33
# SPDX-License-Identifier: GPL-2.0-or-later
44

5-
cmake_minimum_required(VERSION 3.16..3.31)
5+
cmake_minimum_required(VERSION 3.16...3.31)
66

77
if(NOT RTTR_VERSION)
88
string(TIMESTAMP RTTR_VERSION "%Y%m%d")

‎cpp.hint‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2005 - 2021 Settlers Freaks <sf-team at siedler25.org>
1+
// Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
22
//
33
// SPDX-License-Identifier: BSL-1.0
44

@@ -15,5 +15,4 @@
1515
#define BOOST_REQUIRE_GT(x,y) BOOST_REQUIRE((x) > (y))
1616

1717
#define RTTR_FOREACH_PT(PtType, size) for(PtType pt;;)
18-
#define SUPPRESS_UNUSED
1918
#define RTTR_Assert(cond) assert(cond)

‎doc/AddingCustomCampaign.md‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
66

77
# Add a custom campaign
88

9-
You can have a look into the already existing original Settlers 2 campaigns in the subfolders `RTTR/campaigns/roman` and `RTTR/campaigns/continent` for an example.
9+
You can take a look into the already existing original Settlers 2 campaigns in the subfolders `RTTR/campaigns/roman` and `RTTR/campaigns/continent` for an example.
1010
We will now create an example campaign `garden`.
1111

1212
## Location for adding a new campaign
@@ -41,18 +41,20 @@ campaign = {
4141
name = _"name",
4242
shortDescription = _"shortDescription",
4343
longDescription = _"longDescription",
44-
image = "<RTTR_RTTR>/campaigns/garden/garden.bmp",
44+
image = "<RTTR_RTTR>/campaigns/garden/garden.bmp", -- Same as: image = "garden.bmp",
4545
maxHumanPlayers= 1,
4646
difficulty = "easy",
47-
mapFolder = "<RTTR_RTTR>/campaigns/garden",
48-
luaFolder = "<RTTR_RTTR>/campaigns/garden",
47+
mapFolder = "<RTTR_RTTR>/campaigns/garden", -- optional
48+
luaFolder = "<RTTR_RTTR>/campaigns/garden", -- optional
4949
maps = { "MISS01.WLD","MISS02.WLD"},
5050
selectionMap = {
51-
background = {"<RTTR_GAME>/campaigns/garden/mapscreen/background.bmp", 0},
52-
map = {"<RTTR_GAME>/campaigns/garden/mapscreen/map.bmp", 0},
53-
missionMapMask = {"<RTTR_GAME>/campaigns/garden/mapscreen/map_mask.bmp", 0},
54-
marker = {"<RTTR_GAME>/campaigns/garden/mapscreen/marker.bmp", 0},
55-
conquered = {"<RTTR_GAME>/campaigns/garden/mapscreen/conquered.bmp", 0},
51+
background = {"<RTTR_RTTR>/campaigns/garden/mapscreen/background.bmp", 0},
52+
map = {"<RTTR_RTTR>/campaigns/garden/mapscreen/map.bmp", 0},
53+
missionMapMask = {"<RTTR_RTTR>/campaigns/garden/mapscreen/map_mask.bmp", 0},
54+
marker = {"<RTTR_RTTR>/campaigns/garden/mapscreen/marker.bmp", 0},
55+
conquered = {"<RTTR_RTTR>/campaigns/garden/mapscreen/conquered.bmp", 0},
56+
-- Each '<RTTR_RTTR>/campaigns/garden/' is optional: Paths are treated as relative to campaign file.
57+
-- E.g.: conquered = {"mapscreen/conquered.bmp", 0},
5658
backgroundOffset = {0, 0},
5759
disabledColor = 0x70000000,
5860
missionSelectionInfos = {
@@ -75,7 +77,7 @@ The Lua campaign interface is versioned using a major version. Every time a feat
7577

7678
Every map script must have 1 function:
7779
`getRequiredLuaVersion()`
78-
You need to implement this and return the version your script works with. If it does not match the current version an error will be shown and the script will not be used.
80+
You need to implement this and return the version your script works with. If it is higher than the current version an error will be shown and the script will not be used.
7981

8082
### Explanation of the campaign table fields
8183

@@ -86,7 +88,7 @@ If you want a field to be translated you have to add the translation as describe
8688
3. `name`: The name of the campaign
8789
4. `shortDescription`: Short description of the campaign (like a headline to get a rough imagination of the campaign)
8890
5. `longDescription`: Extended description describing the campaign in detail. Will be shown in the campaign selection screen, when the campaign is selected.
89-
6. `image`: Path to an image displayed in the campaign selection screen. You can omit this if you do no want to provide an image.
91+
6. `image`: Path to an image displayed in the campaign selection screen. Can be any "archive" with an image, e.g. `.bmp`, `.lbm`. You can omit this if you do no want to provide an image.
9092
7. `maxHumanPlayers`: For now this is always 1 until we support multiplayer campaigns
9193
8. `difficulty`: Difficulty of the campaign. Should be one of the values easy, medium or hard.
9294
9. `mapFolder` and `luaFolder`: Path to the folder containing the campaign maps and associated Lua files. Usually your campaign folder or a subfolder of it.
@@ -95,7 +97,7 @@ If you want a field to be translated you have to add the translation as describe
9597

9698
Hints:
9799

98-
- To work on case-sensitive OS (like Linux) the file name of the Lua file must have the same case as the map file name. This applies to the map names in the campaign.lua file too.
100+
- To work on case-sensitive OS (like Linux) the file name of the Lua file must have the same case as the map file name. This applies to the map names in the `campaign.lua` file too.
99101
For example: `MISS01.WLD, MISS01.lua` is correct and `MISS01.WLD, miss01.lua` will not work on Linux
100102
- The Lua file of a map must have the same name as the map itself but with the extension `.lua` to be found.
101103
- The Lua and the map file don't need to be in the same folder because the path can be specified separately.
@@ -107,7 +109,7 @@ For example: `MISS01.WLD, MISS01.lua` is correct and `MISS01.WLD, miss01.lua` wi
107109

108110
### Optional map selection screen {#selection-map}
109111

110-
This parameter is optional and can be omitted in the Lua campaign file. If this parameter is specified the selection screen for the missions of a campaign is replaced by a selection map. Like the one used in the original settlers 2 world campaign.
112+
This parameter is optional and can be omitted in the Lua campaign file. If this parameter is specified the selection screen for the missions of a campaign is replaced by a selection map. Like the one used in the original Settlers 2 world campaign.
111113

112114
We have the following parameters:
113115

@@ -124,6 +126,11 @@ Hint:
124126
All the images are described by the path to the image file and an index parameter. Usually the index parameter is zero.
125127
For special image formats containing multiple images in an archive this is the index of the image to use.
126128

129+
### Image paths
130+
131+
The paths to the campaign image and selection map images can be relative to the campaign folder and at most inside a single subfolder.
132+
E.g. `images/garden.bmp` and `mapscreen/conquered.bmp` work, but `images/mapscreen/conquered.bmp` does not.
133+
127134
## Final view of the example garden campaign folder
128135

129136
```sh
@@ -140,3 +147,6 @@ RTTR/campaigns/garden/mapscreen/map_mask.bmp
140147
RTTR/campaigns/garden/mapscreen/marker.bmp
141148
RTTR/campaigns/garden/mapscreen/conquered.bmp
142149
```
150+
151+
Note that for custom campaigns, placed in `<RTTR_USERDATA>/campaigns/` the top-level `RTTR` folder won't exist.
152+
Hence, `<RTTR_RTTR>/campaigns/` should not be used in the campaign description file to refer to campaign files.

‎doc/lua/functions.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (C) 2005 - 2021 Settlers Freaks <sf-team at siedler25.org>
2+
Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
33
44
SPDX-License-Identifier: GPL-2.0-or-later
55
-->
@@ -24,7 +24,8 @@ Reference: [libs/libGamedata/lua/LuaInterfaceBase.cpp](../../libs/libGamedata/lu
2424
**rttr:GetFeatureLevel()**
2525
Get the current feature level of the LUA interface.
2626
Increases here indicate new features.
27-
The current version is **6**.
27+
The current version is **7**.
28+
See [list of changes](main.md#versioning).
2829

2930
**rttr:Log(message)**
3031
Log the message to console.

‎doc/lua/main.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (C) 2005 - 2021 Settlers Freaks <sf-team at siedler25.org>
2+
Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
33
44
SPDX-License-Identifier: GPL-2.0-or-later
55
-->
@@ -47,6 +47,10 @@ You need to implement this and return the major/main version your script works w
4747
If it does not match the current version an error will be shown and the script will not be used.
4848
See also `rttr:GetFeatureLevel()`.
4949

50+
### Feature level 7
51+
52+
- Allow relative paths for images referenced by campaign files.
53+
5054
## Example
5155

5256
```lua

‎external/CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/dev-tools/CMakeLists.txt AND NOT DEFINED RTT
1717
if(APPLE) # Lua 5.2 required which is not easily available on OSX
1818
set(includeDevToolsDefault ON)
1919
else()
20-
message(STATUS "Precompiled binaries are available to use for development."
21-
"They are not compatible with all platforms though."
20+
message(STATUS "Precompiled binaries are available to use for development. "
21+
"They are not compatible with all platforms though.\n"
2222
"Configure with -DRTTR_INCLUDE_DEVTOOLS=ON to make them available to CMake."
2323
)
2424
endif()

‎external/kaguya‎

‎external/libendian‎

0 commit comments

Comments
 (0)