Fixing bugs with pathfinding, bump version

This commit is contained in:
Vladislav Khorev committed 2026-11-15 21:46:30 +06:00
1 parent 8e2b019c92
commit f1cc28ab31
22 files changed
+1119 -759

No files matched your search

+19
View File
@@ -2,6 +2,7 @@
#include "LocationState.h"
#include <algorithm>
#include <cmath>
#include <stdexcept>
namespace FRG {
@@ -499,6 +500,8 @@ void CharacterState::save(nlohmann::json& out) const
out["hp"] = hp;
out["enabled"] = enabled;
out["battle_state"] = battle_state;
out["attack"] = attack;
out["resetAnim"] = resetAnim;
out["currentState"] = static_cast<int>(currentState);
out["attack_cooldown"] = attack_cooldown;
out["showWeapon"] = showWeapon;
@@ -517,6 +520,10 @@ void CharacterState::save(nlohmann::json& out) const
out["movementBlockedTicks"] = movementBlockedTicks;
out["navigationRetryTicks"] = navigationRetryTicks;
out["movedLastTick"] = movedLastTick;
out["velocity"] = {
velocity.x.raw_value(),
velocity.y.raw_value()
};
out["navigationRetryCooldownTicks"] = navigationRetryCooldownTicks;
out["navigationRetryCooldownIndex"] = navigationRetryCooldownIndex;
@@ -549,6 +556,8 @@ void CharacterState::load(const nlohmann::json& in)
visibleRange = static_cast<fp>(in.value("visibleRange", static_cast<double>(visibleRange)));
enabled = in.value("enabled", enabled);
battle_state = in.value("battle_state", battle_state);
attack = in.at("attack").get<int>();
resetAnim = in.at("resetAnim").get<bool>();
currentState = static_cast<AnimationState>(in.value("currentState", static_cast<int>(currentState)));
attack_cooldown = in.value("attack_cooldown", attack_cooldown);
showWeapon = in.value("showWeapon", showWeapon);
@@ -568,6 +577,16 @@ void CharacterState::load(const nlohmann::json& in)
movementBlockedTicks = in.value("movementBlockedTicks", movementBlockedTicks);
navigationRetryTicks = in.value("navigationRetryTicks", navigationRetryTicks);
movedLastTick = in.value("movedLastTick", movedLastTick);
const auto& velocityValue = in.at("velocity");
if (!velocityValue.is_array() || velocityValue.size() != 2 ||
!velocityValue[0].is_number_integer() ||
!velocityValue[1].is_number_integer()) {
throw std::runtime_error(
"Character velocity must contain two fixed-point raw integers");
}
velocity = Vec2fp(
fp::from_raw_value(velocityValue[0].get<std::int32_t>()),
fp::from_raw_value(velocityValue[1].get<std::int32_t>()));
navigationRetryCooldownTicks = in.value(
"navigationRetryCooldownTicks", navigationRetryCooldownTicks);
navigationRetryCooldownIndex = in.value(