mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
Merge branch 'develop' of https://github.com/vcmi/vcmi into windows_mingw_cmake_presets
This commit is contained in:
commit
30b851da7c
2
.github/workflows/github.yml
vendored
2
.github/workflows/github.yml
vendored
@ -244,7 +244,7 @@ jobs:
|
||||
|
||||
- name: CMake Preset with ccache
|
||||
run: |
|
||||
cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache --preset ${{ matrix.preset }}
|
||||
cmake -DENABLE_CCACHE:BOOL=ON --preset ${{ matrix.preset }}
|
||||
|
||||
- name: Build Preset
|
||||
run: |
|
||||
|
@ -265,8 +265,9 @@ uint64_t DangerHitMapAnalyzer::enemyCanKillOurHeroesAlongThePath(const AIPath &
|
||||
{
|
||||
int3 tile = path.targetTile();
|
||||
int turn = path.turn();
|
||||
const HitMapNode & info = hitMap[tile.x][tile.y][tile.z];
|
||||
|
||||
const auto& info = getTileThreat(tile);
|
||||
|
||||
return (info.fastestDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, info.fastestDanger.danger))
|
||||
|| (info.maximumDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, info.maximumDanger.danger));
|
||||
}
|
||||
@ -280,9 +281,7 @@ const HitMapNode & DangerHitMapAnalyzer::getObjectThreat(const CGObjectInstance
|
||||
|
||||
const HitMapNode & DangerHitMapAnalyzer::getTileThreat(const int3 & tile) const
|
||||
{
|
||||
const HitMapNode & info = hitMap[tile.x][tile.y][tile.z];
|
||||
|
||||
return info;
|
||||
return hitMap[tile.x][tile.y][tile.z];
|
||||
}
|
||||
|
||||
const std::set<const CGObjectInstance *> empty = {};
|
||||
|
@ -321,9 +321,7 @@ bool AINodeStorage::hasBetterChain(const PathNodeInfo & source, CDestinationNode
|
||||
|
||||
bool AINodeStorage::isTileAccessible(const int3 & pos, const EPathfindingLayer layer) const
|
||||
{
|
||||
const AIPathNode & node = nodes[layer][pos.z][pos.x][pos.y][0];
|
||||
|
||||
return node.action != EPathNodeAction::UNKNOWN;
|
||||
return nodes[layer][pos.z][pos.x][pos.y][0].action != EPathNodeAction::UNKNOWN;
|
||||
}
|
||||
|
||||
std::vector<AIPath> AINodeStorage::getChainInfo(const int3 & pos, bool isOnLand) const
|
||||
|
@ -79,28 +79,31 @@ if(NOT APPLE_IOS AND NOT ANDROID)
|
||||
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
|
||||
endif()
|
||||
|
||||
# On Linux, use -DCMAKE_CXX_COMPILER_LAUNCHER=ccache instead.
|
||||
# The XCode and MSVC builds each require some more configuration, which is enabled by the following option:
|
||||
if(MSVC OR (CMAKE_GENERATOR STREQUAL "Xcode"))
|
||||
option(ENABLE_CCACHE "Speed up recompilation by caching previous compilations" OFF)
|
||||
option(ENABLE_CCACHE "Speed up recompilation by caching previous compilations" OFF)
|
||||
if(ENABLE_CCACHE)
|
||||
find_program(CCACHE ccache REQUIRED)
|
||||
endif()
|
||||
|
||||
# On Linux, use ccache via CMAKE_CXX_COMPILER_LAUNCHER.
|
||||
# The XCode and MSVC builds each require some more configuration further down.
|
||||
if(ENABLE_CCACHE AND LINUX)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "ccache")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "ccache")
|
||||
endif()
|
||||
|
||||
if(ENABLE_CCACHE AND (CMAKE_GENERATOR STREQUAL "Xcode"))
|
||||
find_program(CCACHE ccache REQUIRED)
|
||||
if(CCACHE)
|
||||
# https://stackoverflow.com/a/36515503/2278742
|
||||
# Set up wrapper scripts
|
||||
configure_file(xcode/launch-c.in xcode/launch-c)
|
||||
configure_file(xcode/launch-cxx.in xcode/launch-cxx)
|
||||
execute_process(COMMAND chmod a+rx
|
||||
"${CMAKE_BINARY_DIR}/xcode/launch-c"
|
||||
"${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
# Set Xcode project attributes to route compilation through our scripts
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
endif()
|
||||
# https://stackoverflow.com/a/36515503/2278742
|
||||
# Set up wrapper scripts
|
||||
configure_file(xcode/launch-c.in xcode/launch-c)
|
||||
configure_file(xcode/launch-cxx.in xcode/launch-cxx)
|
||||
execute_process(COMMAND chmod a+rx
|
||||
"${CMAKE_BINARY_DIR}/xcode/launch-c"
|
||||
"${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
# Set Xcode project attributes to route compilation through our scripts
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
||||
endif()
|
||||
|
||||
# Allow to pass package name from Travis CI
|
||||
@ -266,19 +269,16 @@ if(MINGW OR MSVC)
|
||||
if(MSVC)
|
||||
if(ENABLE_CCACHE)
|
||||
# https://github.com/ccache/ccache/discussions/1154#discussioncomment-3611387
|
||||
find_program(CCACHE ccache REQUIRED)
|
||||
if (CCACHE)
|
||||
file(COPY_FILE
|
||||
${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
|
||||
ONLY_IF_DIFFERENT)
|
||||
file(COPY_FILE
|
||||
${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
|
||||
ONLY_IF_DIFFERENT)
|
||||
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"CLToolExe=cl.exe"
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"TrackFileAccess=false"
|
||||
"UseMultiToolTask=true"
|
||||
)
|
||||
endif()
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"CLToolExe=cl.exe"
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"TrackFileAccess=false"
|
||||
"UseMultiToolTask=true"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
|
@ -65,6 +65,15 @@
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/clang++"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-release-ccache",
|
||||
"displayName": "Clang x86_64-pc-linux-gnu with ccache",
|
||||
"description": "VCMI Linux Clang with ccache",
|
||||
"inherits": "linux-release",
|
||||
"cacheVariables": {
|
||||
"ENABLE_CCACHE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-release",
|
||||
"displayName": "GCC x86_64-pc-linux-gnu",
|
||||
@ -76,6 +85,15 @@
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/g++"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-release-ccache",
|
||||
"displayName": "GCC x86_64-pc-linux-gnu with ccache",
|
||||
"description": "VCMI Linux GCC with ccache",
|
||||
"inherits": "linux-release",
|
||||
"cacheVariables": {
|
||||
"ENABLE_CCACHE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-debug",
|
||||
"displayName": "GCC x86_64-pc-linux-gnu (debug)",
|
||||
@ -293,6 +311,11 @@
|
||||
"configurePreset": "linux-clang-release",
|
||||
"inherits": "default-release"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-release-ccache",
|
||||
"configurePreset": "linux-clang-release-ccache",
|
||||
"inherits": "linux-clang-release"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-test",
|
||||
"configurePreset": "linux-clang-test",
|
||||
@ -308,6 +331,11 @@
|
||||
"configurePreset": "linux-gcc-release",
|
||||
"inherits": "default-release"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-release-ccache",
|
||||
"configurePreset": "linux-gcc-release-ccache",
|
||||
"inherits": "linux-gcc-release"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-debug",
|
||||
"configurePreset": "linux-gcc-debug",
|
||||
|
@ -54,6 +54,8 @@
|
||||
"vcmi.radialWheel.moveDown" : "下移",
|
||||
"vcmi.radialWheel.moveBottom" : "移到底端",
|
||||
|
||||
"vcmi.spellBook.search" : "搜索中...",
|
||||
|
||||
"vcmi.mainMenu.serverConnecting" : "连接中...",
|
||||
"vcmi.mainMenu.serverAddressEnter" : "使用地址:",
|
||||
"vcmi.mainMenu.serverConnectionFailed" : "连接失败",
|
||||
@ -69,6 +71,7 @@
|
||||
"vcmi.lobby.noPreview" : "无地上部分",
|
||||
"vcmi.lobby.noUnderground" : "无地下部分",
|
||||
|
||||
"vcmi.client.errors.missingCampaigns" : "{找不到数据文件}\n\n没有找到战役数据文件!你可能使用了不完整或损坏的英雄无敌3数据文件,请重新安装数据文件。",
|
||||
"vcmi.server.errors.existingProcess" : "一个VCMI进程已经在运行,启动新进程前请结束它。",
|
||||
"vcmi.server.errors.modsToEnable" : "{需要启用的mod列表}",
|
||||
"vcmi.server.errors.modsToDisable" : "{需要禁用的mod列表}",
|
||||
@ -302,7 +305,6 @@
|
||||
"vcmi.optionsTab.simturns.months.1" : " %d 月",
|
||||
"vcmi.optionsTab.simturns.months.2" : " %d 月",
|
||||
|
||||
|
||||
// Custom victory conditions for H3 campaigns and HotA maps
|
||||
"vcmi.map.victoryCondition.daysPassed.toOthers" : "敌人依然存活至今,你失败了!",
|
||||
"vcmi.map.victoryCondition.daysPassed.toSelf" : "祝贺你,你依然存活,取得了胜利!",
|
||||
|
@ -62,7 +62,7 @@ Building for Android is a 2-step process. First, native C++ code is compiled to
|
||||
This is a traditional CMake project, you can build it from command line or some IDE. You're not required to pass any custom options (except Conan toolchain file), defaults are already good. If you wish to use your own CMake presets, inherit them from our `build-with-conan` preset. Example:
|
||||
|
||||
```
|
||||
cmake -S . -B ../build -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_C_COMPILER_LAUNCHER=ccache --toolchain ...
|
||||
cmake -S . -B ../build -G Ninja -D CMAKE_BUILD_TYPE=Debug -D ENABLE_CCACHE:BOOL=ON --toolchain ...
|
||||
cmake --build ../build
|
||||
```
|
||||
|
||||
|
@ -76,7 +76,7 @@ cmake ../vcmi
|
||||
**Notice**: The ../vcmi/ is not a typo, it will place makefile scripts into the build dir as the build dir is your working dir when calling CMake.
|
||||
|
||||
## To use ccache:
|
||||
`cmake ../vcmi -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_C_COMPILER_LAUNCHER=ccache`
|
||||
`cmake ../vcmi -D ENABLE_CCACHE:BOOL=ON`
|
||||
|
||||
## Trigger build
|
||||
|
||||
|
@ -226,7 +226,7 @@ void CGPandoraBox::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
handler.serializeInt("experience", vinfo.reward.heroExperience, 0);
|
||||
handler.serializeInt("mana", vinfo.reward.manaDiff, 0);
|
||||
|
||||
int val;
|
||||
int val = 0;
|
||||
handler.serializeInt("morale", val, 0);
|
||||
if(val)
|
||||
vinfo.reward.bonuses.emplace_back(BonusDuration::ONE_BATTLE, BonusType::MORALE, BonusSource::OBJECT_INSTANCE, val, BonusSourceID(id));
|
||||
|
Loading…
Reference in New Issue
Block a user