Skip to content

Commit

Permalink
fix(nodejs): more init (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO authored Jan 15, 2025
1 parent 1959a79 commit 83aa31a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions source/binding/NodeJS/release/maa-node/src/tasker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ export class TaskerBase {
}
}

latest_node(task: string) {
return maa.tasker_get_latest_node(this.handle, task)
latest_node(node: string) {
return maa.tasker_get_latest_node(this.handle, node)
}
}

Expand Down
10 changes: 5 additions & 5 deletions source/binding/NodeJS/src/instance/tasker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ std::optional<std::tuple<std::string, std::string, bool, MaaRect, std::string, N
{
StringBuffer name;
StringBuffer algorithm;
MaaBool hit {};
MaaBool hit = false;
MaaRect box {};
StringBuffer detail;
ImageBuffer raw;
Expand All @@ -162,8 +162,8 @@ std::optional<std::tuple<std::string, std::string, bool, MaaRect, std::string, N
std::optional<std::tuple<std::string, MaaRecoId, bool>> tasker_get_node_detail(Napi::External<TaskerInfo> info, MaaNodeId id)
{
StringBuffer name;
MaaRecoId reco_id;
MaaBool completed;
MaaRecoId reco_id = MaaInvalidId;
MaaBool completed = false;
if (MaaTaskerGetNodeDetail(info.Data()->handle, id, name, &reco_id, &completed)) {
return std::make_tuple(name.str(), reco_id, completed);
}
Expand All @@ -181,7 +181,7 @@ std::optional<std::tuple<std::string, std::vector<MaaNodeId>, MaaStatus>>
}
StringBuffer entry;
std::vector<MaaNodeId> nodes(node_size);
MaaStatus status;
MaaStatus status = MaaStatus_Invalid;
if (MaaTaskerGetTaskDetail(info.Data()->handle, id, entry, nodes.data(), &node_size, &status)) {
return std::make_tuple(entry.str(), nodes, status);
}
Expand All @@ -192,7 +192,7 @@ std::optional<std::tuple<std::string, std::vector<MaaNodeId>, MaaStatus>>

std::optional<MaaNodeId> tasker_get_latest_node(Napi::External<TaskerInfo> info, std::string name)
{
MaaNodeId latest_id;
MaaNodeId latest_id = MaaInvalidId;
if (MaaTaskerGetLatestNode(info.Data()->handle, name.c_str(), &latest_id)) {
return latest_id;
}
Expand Down

0 comments on commit 83aa31a

Please sign in to comment.