Skip to content

Commit

Permalink
Merge branch 'enum_iterator' into fix-bug-968-wrong-roads
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jul 7, 2024
2 parents cec118f + 0ec13f6 commit c2016f3
Show file tree
Hide file tree
Showing 91 changed files with 2,368 additions and 502 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ jobs:
# Use C++ 17 standard (default for gcc-11)
# Use system cmake
# Use system boost
- { compiler: gcc-11, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0 }
- { compiler: clang-14, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0, cxx: 17 }
# Also include a (semi-)optimized build to a) shake out issues there an b) run the replay tests
- { compiler: clang-14, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0, cxx: 17 }
- { compiler: gcc-11, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0 }
- { compiler: gcc-11, os: ubuntu-22.04, type: RelWithDebInfo, cmake: 3.22.1, boost: 1.74.0 }
#
# Latest Compilers
# GCC 12 needs boost 1.82 to compile correctly
Expand Down Expand Up @@ -191,7 +193,7 @@ jobs:
run: echo "TRAVIS_BUILD_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV

- name: Build
run: tools/ci/travisBuild.sh
run: tools/ci/build.sh

- run: tools/ci/collectCoverageData.sh && external/libutil/tools/ci/uploadCoverageData.sh
if: matrix.coverage && success()
Expand Down
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

cmake_minimum_required(VERSION 3.9)
if(POLICY CMP0093)
cmake_policy(SET CMP0093 NEW) # Use Boost_VERSION x.y.z in CMake >= 3.15 or BoostConfig
cmake_policy(SET CMP0093 NEW) # Use Boost_VERSION x.y.z in CMake >= 3.15 or BoostConfig
endif()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # find_package uses <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW) # find_package uses <PackageName>_ROOT variables
endif()

if(NOT RTTR_VERSION)
Expand Down Expand Up @@ -325,18 +325,18 @@ endif()
option(RTTR_USE_SYSTEM_BOOST_NOWIDE "Use system installed Boost.Nowide. Fails if not found!" "${RTTR_USE_SYSTEM_LIBS}")

if(Boost_VERSION_MINOR GREATER_EQUAL "74" OR RTTR_USE_SYSTEM_BOOST_NOWIDE)
# Boost 1.73 contains Boost.Nowide, 1.74 a required fix
find_package(Boost COMPONENTS nowide)
# Boost 1.73 contains Boost.Nowide, 1.74 a required fix
find_package(Boost COMPONENTS nowide)
endif()
# Prefer system version, either as part of Boost or preinstalled
if(NOT Boost_NOWIDE_FOUND)
if(RTTR_USE_SYSTEM_BOOST_NOWIDE)
set(bnw_required REQUIRED)
else()
set(bnw_required QUIET)
endif()
find_package(boost_nowide 11.0.0 ${bnw_required})
# Fallback in libutil, but find_package must be done here so all subprojects can use it
if(RTTR_USE_SYSTEM_BOOST_NOWIDE)
set(bnw_required REQUIRED)
else()
set(bnw_required QUIET)
endif()
find_package(boost_nowide 11.0.0 ${bnw_required})
# Fallback in libutil, but find_package must be done here so all subprojects can use it
endif()

add_subdirectory(external)
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ platform:
- x64

environment:
BOOST_ROOT: C:\Libraries\boost_1_77_0
BOOST_ROOT: C:\Libraries\boost_1_83_0
GENERATOR: Visual Studio 16 2019
RTTR_DISABLE_ASSERT_BREAKPOINT: 1

Expand Down
2 changes: 1 addition & 1 deletion data/RTTR/MAPS
26 changes: 23 additions & 3 deletions data/RTTR/campaigns/world/campaign.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---- Campaign lua version ------
function getRequiredLuaVersion()
return 1
return 2
end

rttr:RegisterTranslations(
Expand Down Expand Up @@ -29,6 +29,26 @@ campaign = {
maxHumanPlayers= 1,
difficulty = "easy",
mapFolder = "<RTTR_GAME>/DATA/MAPS2",
luaFolder = "<RTTR_RTTR>/campaigns/world",
maps = { "AFRICA.WLD","AUSTRA.WLD","EUROPE.WLD","GREEN.WLD","JAPAN.WLD","NAMERICA.WLD","NASIA.WLD","SAMERICA.WLD","SASIA.WLD"}
luaFolder = "<RTTR_RTTR>/CAMPAIGNS/WORLD",
maps = { "EUROPE.WLD","NAMERICA.WLD","SAMERICA.WLD","GREEN.WLD","AFRICA.WLD","NASIA.WLD","SASIA.WLD","JAPAN.WLD","AUSTRA.WLD"},
selectionMap = {
background = {"<RTTR_GAME>/GFX/PICS/SETUP990.LBM", 0},
map = {"<RTTR_GAME>/GFX/PICS/WORLD.LBM", 0},
missionMapMask = {"<RTTR_GAME>/GFX/PICS/WORLDMSK.LBM", 0},
marker = {"<RTTR_GAME>/DATA/IO/IO.DAT", 231},
conquered = {"<RTTR_GAME>/DATA/IO/IO.DAT", 232},
backgroundOffset = {64, 70},
disabledColor = 0x70000000,
missionSelectionInfos = {
{0xffffff00, 243, 97},
{0xffaf73cb, 55,78},
{0xff008fc3, 122, 193},
{0xff43c373, 166, 36},
{0xff27871b, 241,176},
{0xffc32323, 366,87},
{0xff573327, 375,145},
{0xffcfaf4b, 486, 136},
{0xffbb6313, 441, 264}
}
}
}
38 changes: 37 additions & 1 deletion doc/AddingCustomCampaign.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ campaign = {
difficulty = "easy",
mapFolder = "<RTTR_RTTR>/campaigns/garden",
luaFolder = "<RTTR_RTTR>/campaigns/garden",
maps = { "MISS01.WLD","MISS02.WLD"}
maps = { "MISS01.WLD","MISS02.WLD"},
selectionMap = {
background = {"<RTTR_GAME>/campaigns/garden/mapscreen/background.bmp", 0},
map = {"<RTTR_GAME>/campaigns/garden/mapscreen/map.bmp", 0},
missionMapMask = {"<RTTR_GAME>/campaigns/garden/mapscreen/map_mask.bmp", 0},
marker = {"<RTTR_GAME>/campaigns/garden/mapscreen/marker.bmp", 0},
conquered = {"<RTTR_GAME>/campaigns/garden/mapscreen/conquered.bmp", 0},
backgroundOffset = {0, 0},
disabledColor = 0x70000000,
missionSelectionInfos = {
{0xffffff00, 100, 50},
{0xffaf73cb, 200, 100}
}
}
}
```

Expand Down Expand Up @@ -78,13 +91,31 @@ If you want a field to be translated you have to add the translation as describe
8. `difficulty` difficulty of the campaign. Should be one of the valus easy, medium or hard.
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
10. `maps` List of the names of the files of the campaigns mission maps
11. `selectionMap` Optional parameter. See [map selection screen](#selection-map) for detailed explanations.

Hints:
- The lua file of a map must have the same name as the map it self but with the extension `.lua` to be found correctly. The lua and the map file must not be in the same folder because the path can be specified differently.
- 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.
For example: `MISS01.WLD, MISS01.lua` is correct and `MISS01.WLD, miss01.lua` will not work on linux
- All paths can contain placeholders like `<RTTR_RTTR>, ...`

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

This parameter is optional and can be obmitted 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 settler 2 world campaign.

We have the following parameters:
1. `background` background image for the selection map
2. `map` the map image itself
3. `missionMapMask` this image is a mask that describes the mission areas of the `map` image. It must be the same size as the `map` image where the color of each pixel determines the mission it belongs to. Each mission must have a unique color (specified in the `missionSelectionInfos`). Any other color is treated as neutral area and ignored.
4. `marker` the marker image shown when a mission is selected
5. `conquered` the image shown when a mission is already finished
6. `backgroundOffset` offset of the `map` image and `missionMapMask` image relative to the `background` image. Can be (0,0) if no offset exists.
7. `disabledColor` color for drawing missions not playable yet. Usually this should be a partly transparent color
8. `missionSelectionInfos` contains an entry for each mission and must be the same order as specified in `maps` lua parameter. Each entry consists of three elements. The first is the `maskAreaColor` and the two following are the `ankerPos` x and y position. The `ankerPos` is the position the `conquered` image and the `cursor` image, if mission is selected, are displayed for this mission. The offset is always counted from the origin of the `map` image. The `maskAreaColor` is the color for the mission used in the `missionMapMask`.

Hints:
- All the images are described by the path to the image file and an index parameter. Usually the index parameter is zero. For special image formats containing multiple images in an archive this is the index of the image to use.

## Final view of the example garden campaign folder
```
RTTR/campaigns/garden
Expand All @@ -94,5 +125,10 @@ RTTR/campaigns/garden/MISS01.lua
RTTR/campaigns/garden/MISS01.WLD
RTTR/campaigns/garden/MISS02.lua
RTTR/campaigns/garden/MISS02.WLD
RTTR/campaigns/garden/mapscreen/background.bmp
RTTR/campaigns/garden/mapscreen/map.bmp
RTTR/campaigns/garden/mapscreen/map_mask.bmp
RTTR/campaigns/garden/mapscreen/marker.bmp
RTTR/campaigns/garden/mapscreen/conquered.bmp
```
17 changes: 10 additions & 7 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ else()
endif()
option(RTTR_INCLUDE_DEVTOOLS "Include folder with precompiled binaries for development" ${devToolsExist})
if(RTTR_INCLUDE_DEVTOOLS)
add_subdirectory(dev-tools)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} PARENT_SCOPE)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} PARENT_SCOPE)
add_subdirectory(dev-tools)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} PARENT_SCOPE)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} PARENT_SCOPE)
endif()

# Building the updater when using non-default paths (especially absolute paths)
Expand Down Expand Up @@ -54,12 +54,15 @@ else()
include(FetchContent)
FetchContent_Declare(
LibSamplerate
GIT_REPOSITORY https://github.com/Flamefire/libsamplerate
GIT_TAG b5d39fbfc86b656fed68c935ac7b0a06349e4aa1
GIT_REPOSITORY https://github.com/libsndfile/libsamplerate
GIT_TAG 0.2.2
)
set(LIBSAMPLERATE_TESTS OFF CACHE INTERNAL "")
set(LIBSAMPLERATE_EXAMPLES OFF CACHE INTERNAL "")
set(LIBSAMPLERATE_INSTALL OFF CACHE INTERNAL "")
set(old_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF)
FetchContent_MakeAvailable(LibSamplerate)
set(BUILD_TESTING ${old_BUILD_TESTING})
endif()

# No tests for turtle
Expand Down
2 changes: 1 addition & 1 deletion external/dev-tools
2 changes: 1 addition & 1 deletion external/libsiedler2
2 changes: 1 addition & 1 deletion external/mygettext
Submodule mygettext updated 1 files
+6 −6 CMakeLists.txt
2 changes: 1 addition & 1 deletion external/s25edit
Submodule s25edit updated 4 files
+56 −4 CGame.cpp
+1 −1 CGame.h
+5 −5 CMakeLists.txt
+1 −2 callbacks.cpp
2 changes: 1 addition & 1 deletion external/s25update
Submodule s25update updated 1 files
+35 −16 src/CMakeLists.txt
17 changes: 9 additions & 8 deletions extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

add_subdirectory(audioDrivers)
add_subdirectory(videoDrivers)
add_subdirectory(ai-battle)
if(RTTR_BUNDLE AND APPLE)
add_subdirectory(macosLauncher)
endif()

if(MSVC)
option(RTTR_ENABLE_VLD "Enable use of Visual Leak Detector" OFF)
option(RTTR_ENABLE_VLD_FORCED "Force using of Visual Leak Detector (in non-Debug builds)" OFF)
option(RTTR_ENABLE_VLD "Enable use of Visual Leak Detector" OFF)
option(RTTR_ENABLE_VLD_FORCED "Force using of Visual Leak Detector (in non-Debug builds)" OFF)
else()
set(RTTR_ENABLE_VLD OFF)
set(RTTR_ENABLE_VLD OFF)
endif()
add_library(rttr_vld INTERFACE)
add_library(rttr::vld ALIAS rttr_vld)
target_compile_definitions(rttr_vld INTERFACE RTTR_HAS_VLD=$<BOOL:${RTTR_ENABLE_VLD}>)
if(RTTR_ENABLE_VLD)
find_package(VLD 2.5.1 REQUIRED)
target_link_libraries(rttr_vld INTERFACE vld::vld)
if(RTTR_ENABLE_VLD_FORCED)
target_compile_definitions(rttr_vld INTERFACE VLD_FORCE_ENABLE)
endif()
find_package(VLD 2.5.1 REQUIRED)
target_link_libraries(rttr_vld INTERFACE vld::vld)
if(RTTR_ENABLE_VLD_FORCED)
target_compile_definitions(rttr_vld INTERFACE VLD_FORCE_ENABLE)
endif()
endif()
11 changes: 11 additions & 0 deletions extras/ai-battle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (C) 2005 - 2024 Settlers Freaks <sf-team at siedler25.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later

add_executable(ai-battle main.cpp HeadlessGame.cpp)
target_link_libraries(ai-battle PRIVATE s25Main Boost::program_options Boost::nowide)

if(WIN32)
include(GatherDll)
gather_dll_copy(ai-battle)
endif()
Loading

0 comments on commit c2016f3

Please sign in to comment.