Skip to content

Commit

Permalink
允许低版本编译器;修改错别字;全局饱腹度修复
Browse files Browse the repository at this point in the history
  • Loading branch information
hjenryin committed Feb 8, 2025
1 parent 9cd4103 commit bba6e0c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [Unreleased]
### 修复
- 全局饱腹度变化匹配游戏内加成

## [2.0.0] - 2025-02-03
### 新增
- 支持游戏内校验码直接导出
Expand Down
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_COMPILER "/usr/bin/g++-10")
# set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(PJNAME bcjh)
project(${PJNAME})
include_directories(src/include)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 7.1
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
message(FATAL_ERROR "GCC version must be at least 10 to compile c++20!" ${CMAKE_CXX_COMPILER_VERSION})
endif()
endif()

# Add debug definitions
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -44,8 +39,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
execute_process(COMMAND bash assets/removeSpaces.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "Spaces and newlines in data.min.json have been removed.")
else()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -pthread -Wall -Wextra -Wno-reorder -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wextra -Wno-reorder -Wno-unused-parameter")
# add_definitions(-DNOJIT) # EMS doesn't really work with SSE2?

endif()
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

### 配置厨具

`厨具样例.csv`已在2.0.0弃用。直接使用白采菊花代码,保留高级厨具,新手池厨具可变。
`厨具样例.csv`已在2.0.0弃用。直接使用白菜菊花代码,保留高级厨具,新手池厨具可变。

### 更改迭代次数

Expand Down
7 changes: 6 additions & 1 deletion src/Calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ BanquetInfo getPrice(const Skill &skill, Recipe *recipe, BanquetRuleTogether &r,
const BanquetRule &BanquetRuleTogether::merge() {
this->lenientRule.execOneMore();
this->lenientRule.addRule.add(this->strictRule.addRule);
this->lenientRule.baseRule.add(this->strictRule.baseRule);
this->lenientRule.baseRule.add(this->strictRule.baseRule);
{
// Delayed full add
auto& addr= lenientRule.addRule;
addr.full += this->strictRule.delayedFullAdd;
}
return this->lenientRule;
}
1 change: 1 addition & 0 deletions src/Calculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class BanquetRule {
*
*/
struct BanquetStrictRule : public BanquetRule {
int delayedFullAdd;
void oneMore() {
std::cout << "BanquetStrictRule has no oneMore()";
exit(1);
Expand Down
7 changes: 7 additions & 0 deletions src/banquetRuleGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ loadBanquetRuleFromJson(const Json::Value &rulesTarget, const GDMap &allBuffs,

auto singleRule = getRuleFromJson(buffContent, d,
allIntents, allBuffs, 1);
{
auto *fae = dynamic_cast<FullAddEffect *>(
singleRule->effect.get());
if (fae) {
fae->delayedAdd = true;
}
}
auto e = std::make_shared<CreatePhaseRulesEffect>(
singleRule, DISH_PER_CHEF, true, false);
auto rule = std::make_shared<SingleConditionRule>(
Expand Down
13 changes: 9 additions & 4 deletions src/banquetRuleGen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,17 @@ class CreatePhaseRulesEffect : public Effect {
class FullAddEffect : public Effect {
public:
int full;
FullAddEffect(int full) : full(full) {}
bool delayedAdd;
FullAddEffect(int full) : full(full), delayedAdd(false) {}
void operator()(BanquetRuleTogether *brt, int i, States &s) const override {
if (strict) {
brt[i].strictRule.addRule.full += full;
if (delayedAdd) {
brt[i].strictRule.delayedFullAdd += full;
} else {
brt[i].lenientRule.addRule.full += full;
if (strict) {
brt[i].strictRule.addRule.full += full;
} else {
brt[i].lenientRule.addRule.full += full;
}
}
}
};
Expand Down

0 comments on commit bba6e0c

Please sign in to comment.