Skip to content

Commit

Permalink
ocgapi change: return LEN_FAIL if not exist (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
salix5 authored Jan 2, 2025
1 parent 1a0b712 commit 85dd198
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ocgapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ extern "C" DECL_DLLEXPORT void new_tag_card(intptr_t pduel, uint32_t code, uint8
}
/**
* @brief Get card information.
* @param buf uint32_t array
* @param buf int32_t array
* @return buffer length in bytes
*/
extern "C" DECL_DLLEXPORT int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, int32_t query_flag, byte* buf, int32_t use_cache) {
Expand All @@ -201,7 +201,7 @@ extern "C" DECL_DLLEXPORT int32_t query_card(intptr_t pduel, uint8_t playerid, u
duel* ptduel = (duel*)pduel;
card* pcard = nullptr;
location &= 0x7f;
if(location & LOCATION_ONFIELD)
if (location == LOCATION_MZONE || location == LOCATION_SZONE)
pcard = ptduel->game_field->get_field_card(playerid, location, sequence);
else {
card_vector* lst = nullptr;
Expand All @@ -217,10 +217,9 @@ extern "C" DECL_DLLEXPORT int32_t query_card(intptr_t pduel, uint8_t playerid, u
lst = &ptduel->game_field->player[playerid].list_main;
else
return LEN_FAIL;
if(sequence >= (int32_t)lst->size())
pcard = nullptr;
else
pcard = (*lst)[sequence];
if (sequence >= (int32_t)lst->size())
return LEN_FAIL;
pcard = (*lst)[sequence];
}
if (pcard) {
return pcard->get_infos(buf, query_flag, use_cache);
Expand Down

0 comments on commit 85dd198

Please sign in to comment.