mirror of
https://github.com/edo9300/ygopro-core
synced 2026-08-25 16:23:07 -04:00
Don't leak OCGAPI macros from the header
This commit is contained in:
parent
8c16a51db6
commit
c79c54ede7
2 changed files with 16 additions and 14 deletions
26
ocgapi.cpp
26
ocgapi.cpp
|
|
@ -13,14 +13,14 @@
|
|||
#include "field.h"
|
||||
#include "effect.h"
|
||||
|
||||
OCGAPI void OCG_GetVersion(int* major, int* minor) {
|
||||
void OCG_GetVersion(int* major, int* minor) {
|
||||
if(major)
|
||||
*major = OCG_VERSION_MAJOR;
|
||||
if(minor)
|
||||
*minor = OCG_VERSION_MINOR;
|
||||
}
|
||||
|
||||
OCGAPI int OCG_CreateDuel(OCG_Duel* out_ocg_duel, const OCG_DuelOptions* options_ptr) {
|
||||
int OCG_CreateDuel(OCG_Duel* out_ocg_duel, const OCG_DuelOptions* options_ptr) {
|
||||
if(out_ocg_duel == nullptr)
|
||||
return OCG_DUEL_CREATION_NO_OUTPUT;
|
||||
auto options = *options_ptr;
|
||||
|
|
@ -54,12 +54,12 @@ OCGAPI int OCG_CreateDuel(OCG_Duel* out_ocg_duel, const OCG_DuelOptions* options
|
|||
return OCG_DUEL_CREATION_SUCCESS;
|
||||
}
|
||||
|
||||
OCGAPI void OCG_DestroyDuel(OCG_Duel ocg_duel) {
|
||||
void OCG_DestroyDuel(OCG_Duel ocg_duel) {
|
||||
if(ocg_duel)
|
||||
delete static_cast<duel*>(ocg_duel);
|
||||
}
|
||||
|
||||
OCGAPI void OCG_DuelNewCard(OCG_Duel ocg_duel, const OCG_NewCardInfo* info_ptr) {
|
||||
void OCG_DuelNewCard(OCG_Duel ocg_duel, const OCG_NewCardInfo* info_ptr) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
auto& game_field = *(pduel->game_field);
|
||||
const auto& info = *info_ptr;
|
||||
|
|
@ -103,12 +103,12 @@ OCGAPI void OCG_DuelNewCard(OCG_Duel ocg_duel, const OCG_NewCardInfo* info_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
OCGAPI void OCG_StartDuel(OCG_Duel ocg_duel) {
|
||||
void OCG_StartDuel(OCG_Duel ocg_duel) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
pduel->game_field->emplace_process<Processors::Startup>();
|
||||
}
|
||||
|
||||
OCGAPI int OCG_DuelProcess(OCG_Duel ocg_duel) {
|
||||
int OCG_DuelProcess(OCG_Duel ocg_duel) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
pduel->buff.clear();
|
||||
auto flag = OCG_DUEL_STATUS_END;
|
||||
|
|
@ -119,7 +119,7 @@ OCGAPI int OCG_DuelProcess(OCG_Duel ocg_duel) {
|
|||
return flag;
|
||||
}
|
||||
|
||||
OCGAPI void* OCG_DuelGetMessage(OCG_Duel ocg_duel, uint32_t* length) {
|
||||
void* OCG_DuelGetMessage(OCG_Duel ocg_duel, uint32_t* length) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
pduel->generate_buffer();
|
||||
if(length)
|
||||
|
|
@ -127,17 +127,17 @@ OCGAPI void* OCG_DuelGetMessage(OCG_Duel ocg_duel, uint32_t* length) {
|
|||
return pduel->buff.data();
|
||||
}
|
||||
|
||||
OCGAPI void OCG_DuelSetResponse(OCG_Duel ocg_duel, const void* buffer, uint32_t length) {
|
||||
void OCG_DuelSetResponse(OCG_Duel ocg_duel, const void* buffer, uint32_t length) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
pduel->set_response(buffer, length);
|
||||
}
|
||||
|
||||
OCGAPI int OCG_LoadScript(OCG_Duel ocg_duel, const char* buffer, uint32_t length, const char* name) {
|
||||
int OCG_LoadScript(OCG_Duel ocg_duel, const char* buffer, uint32_t length, const char* name) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
return pduel->lua->load_script(buffer, length, name);
|
||||
}
|
||||
|
||||
OCGAPI uint32_t OCG_DuelQueryCount(OCG_Duel ocg_duel, uint8_t team, uint32_t loc) {
|
||||
uint32_t OCG_DuelQueryCount(OCG_Duel ocg_duel, uint8_t team, uint32_t loc) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
if(team > 1)
|
||||
return 0;
|
||||
|
|
@ -177,7 +177,7 @@ ForceInline void insert_value(std::vector<uint8_t>& vec, T2 val) {
|
|||
insert_value_int<T>(vec, static_cast<T>(val));
|
||||
}
|
||||
|
||||
OCGAPI void* OCG_DuelQuery(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryInfo* info_ptr) {
|
||||
void* OCG_DuelQuery(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryInfo* info_ptr) {
|
||||
const auto& info = *info_ptr;
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
if(bit::popcnt(info.loc & ~LOCATION_OVERLAY) != 1)
|
||||
|
|
@ -204,7 +204,7 @@ OCGAPI void* OCG_DuelQuery(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryI
|
|||
return pduel->query_buffer.data();
|
||||
}
|
||||
|
||||
OCGAPI void* OCG_DuelQueryLocation(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryInfo* info_ptr) {
|
||||
void* OCG_DuelQueryLocation(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryInfo* info_ptr) {
|
||||
const auto& info = *info_ptr;
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
auto& buffer = pduel->query_buffer;
|
||||
|
|
@ -247,7 +247,7 @@ OCGAPI void* OCG_DuelQueryLocation(OCG_Duel ocg_duel, uint32_t* length, const OC
|
|||
return buffer.data();
|
||||
}
|
||||
|
||||
OCGAPI void* OCG_DuelQueryField(OCG_Duel ocg_duel, uint32_t* length) {
|
||||
void* OCG_DuelQueryField(OCG_Duel ocg_duel, uint32_t* length) {
|
||||
auto* pduel = static_cast<duel*>(ocg_duel);
|
||||
auto& query = pduel->query_buffer;
|
||||
query.clear();
|
||||
|
|
|
|||
4
ocgapi.h
4
ocgapi.h
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
/*** CORE INFORMATION ***/
|
||||
OCGAPI void OCG_GetVersion(int* major, int* minor);
|
||||
/* OCGAPI void OCG_GetName(const char** name); Maybe created by git hash? */
|
||||
|
||||
/*** DUEL CREATION AND DESTRUCTION ***/
|
||||
OCGAPI int OCG_CreateDuel(OCG_Duel* out_ocg_duel, const OCG_DuelOptions* options_ptr);
|
||||
|
|
@ -45,4 +44,7 @@ OCGAPI void* OCG_DuelQuery(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryI
|
|||
OCGAPI void* OCG_DuelQueryLocation(OCG_Duel ocg_duel, uint32_t* length, const OCG_QueryInfo* info_ptr);
|
||||
OCGAPI void* OCG_DuelQueryField(OCG_Duel ocg_duel, uint32_t* length);
|
||||
|
||||
#undef OCGAPI
|
||||
#undef EXTERN_C
|
||||
|
||||
#endif /* OCGAPI_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue