diff options
| author | Léo Lam <leo@leolam.fr> | 2021-03-26 01:54:16 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-03-26 02:04:50 +0100 |
| commit | bc8b8d5829182beb053a83dbe3530133afb64d76 (patch) | |
| tree | 37979f07ca9983e951cac6503bdd1e79573b0212 /src/Game/AI/Query | |
| parent | ce3d29d2ec3173c63425d8df5f319faaeac41c39 (diff) | |
query: Implement CompareGameDataTime
Diffstat (limited to 'src/Game/AI/Query')
| -rw-r--r-- | src/Game/AI/Query/queryCompareGameDataTime.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/Game/AI/Query/queryCompareGameDataTime.cpp b/src/Game/AI/Query/queryCompareGameDataTime.cpp index 257ab9d4..b65d01bb 100644 --- a/src/Game/AI/Query/queryCompareGameDataTime.cpp +++ b/src/Game/AI/Query/queryCompareGameDataTime.cpp @@ -1,5 +1,6 @@ #include "Game/AI/Query/queryCompareGameDataTime.h" #include <evfl/query.h> +#include "KingSystem/GameData/gdtManager.h" namespace uking::query { @@ -7,8 +8,40 @@ CompareGameDataTime::CompareGameDataTime(const InitArg& arg) : ksys::act::ai::Qu CompareGameDataTime::~CompareGameDataTime() = default; -// FIXME: implement 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; } |
