fix: 临期理智药天数缺省值

This commit is contained in:
status102
2026-05-14 19:41:24 +08:00
parent ae11a7ca6d
commit fc81cc3bbd

View File

@@ -66,12 +66,12 @@ bool asst::FightTask::set_params(const json::value& params)
const std::string stage = params.get("stage", "");
const int medicine = params.get("medicine", 0);
int medicine_expire_days = 2;
int medicine_expire_days = 0;
if (auto expiring_day_opt = params.find<int>("medicine_expire_days"); !expiring_day_opt) {
if (auto opt = params.find<int>("expiring_medicine"); opt) {
medicine_expire_days = opt.value() == 0 ? 0 : 2;
LogWarn << "================ DEPRECATED ================";
LogWarn << __FUNCTION__ << " 'expiring_medicine' is deprecated, please use 'medicine_expire_days' instead.";
LogWarn << __FUNCTION__ << " 'expiring_medicine' is deprecated since v6.8.0, please use 'medicine_expire_days' instead.";
LogWarn << "================ DEPRECATED ================";
}
}
@@ -79,7 +79,7 @@ bool asst::FightTask::set_params(const json::value& params)
medicine_expire_days = expiring_day_opt.value();
}
if (medicine_expire_days < 0) {
LogError << __FUNCTION__ << "Invalid medicine_expire_days";
LogError << __FUNCTION__ << "Invalid medicine_expire_days," << medicine_expire_days;
return false;
}