diff options
| author | Léo Lam <leo@leolam.fr> | 2026-09-14 00:02:22 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2026-09-14 00:02:22 +0200 |
| commit | f4cd38c43b436fe91def1a1b0b3dfe0134369870 (patch) | |
| tree | 1ab07eab2ea43c0719d6b1309743715bd80cd408 /src/Game/Actor/Query/queryCompareGameDataTime.cpp | |
| parent | 5b26254bfe69560b0993a50d8ba8f418ae749380 (diff) | |
Actor: move all AI code under Game/Actor
Link order shows one sorted actor tree, not a separate AI project: the
Action/AI/Query folders and per-feature folders (Camera, Player, Horse,
...) come out of the same archive rounds as the actor classes.
(AI assisted using Claude Fable 5.1 and Claude Opus 5.5)
Diffstat (limited to 'src/Game/Actor/Query/queryCompareGameDataTime.cpp')
| -rw-r--r-- | src/Game/Actor/Query/queryCompareGameDataTime.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/Game/Actor/Query/queryCompareGameDataTime.cpp b/src/Game/Actor/Query/queryCompareGameDataTime.cpp new file mode 100644 index 00000000..3cb57d2b --- /dev/null +++ b/src/Game/Actor/Query/queryCompareGameDataTime.cpp @@ -0,0 +1,66 @@ +#include "Game/Actor/Query/queryCompareGameDataTime.h" +#include <evfl/Query.h> +#include "KingSystem/GameData/gdtManager.h" + +namespace uking::query { + +CompareGameDataTime::CompareGameDataTime(const InitArg& arg) : ksys::act::ai::Query(arg) {} + +CompareGameDataTime::~CompareGameDataTime() = default; + +int CompareGameDataTime::doQuery() { + int min_a{}; + int sec_a{}; + int milli_a{}; + int min_b{}; + int sec_b{}; + int milli_b{}; + + auto* gdt = ksys::gdt::Manager::instance(); + if (!gdt) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&min_a, mGameDataIntMinA)) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&sec_a, mGameDataIntSecA)) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&milli_a, mGameDataIntMilliA)) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&min_b, mGameDataIntMinB)) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&sec_b, mGameDataIntSecB)) + return 0; + if (!gdt->getParamBypassPerm().get().getS32(&milli_b, mGameDataIntMilliB)) + return 0; + + const int time_a = (60 * 1000 * min_a) + (1000 * sec_a) + milli_a; + const int time_b = (60 * 1000 * min_b) + (1000 * sec_b) + milli_b; + + if (time_a < time_b) + return 0; + if (time_a == time_b) + return 1; + if (time_a != time_b) + return 2; + SEAD_ASSERT(false); + return -1; +} + +void CompareGameDataTime::loadParams(const evfl::QueryArg& arg) { + loadString(arg.param_accessor, "GameDataIntMinA"); + loadString(arg.param_accessor, "GameDataIntSecA"); + loadString(arg.param_accessor, "GameDataIntMilliA"); + loadString(arg.param_accessor, "GameDataIntMinB"); + loadString(arg.param_accessor, "GameDataIntSecB"); + loadString(arg.param_accessor, "GameDataIntMilliB"); +} + +void CompareGameDataTime::loadParams() { + getDynamicParam(&mGameDataIntMinA, "GameDataIntMinA"); + getDynamicParam(&mGameDataIntSecA, "GameDataIntSecA"); + getDynamicParam(&mGameDataIntMilliA, "GameDataIntMilliA"); + getDynamicParam(&mGameDataIntMinB, "GameDataIntMinB"); + getDynamicParam(&mGameDataIntSecB, "GameDataIntSecB"); + getDynamicParam(&mGameDataIntMilliB, "GameDataIntMilliB"); +} + +} // namespace uking::query |
