Add explicit OCG_DuelCreationStatus values for null rng seed and wrong lua lib

This commit is contained in:
Edoardo Lolletti 2025-06-13 19:43:34 +02:00
parent a5e62fb65e
commit 872f7b01a7
2 changed files with 5 additions and 3 deletions

View file

@ -41,14 +41,14 @@ OCGAPI int OCG_CreateDuel(OCG_Duel* out_ocg_duel, const OCG_DuelOptions* options
options.payload4 = nullptr;
}
if(options.seed[0] == 0 && options.seed[1] == 0 && options.seed[2] == 0 && options.seed[3] == 0)
return OCG_DUEL_CREATION_NOT_CREATED;
return OCG_DUEL_CREATION_NULL_RNG_SEED;
bool valid_lua_lib = true;
auto* duelPtr = new (std::nothrow) duel(options, valid_lua_lib);
if(duelPtr == nullptr)
return OCG_DUEL_CREATION_NOT_CREATED;
if(!valid_lua_lib) {
delete duelPtr;
return OCG_DUEL_CREATION_NOT_CREATED;
return OCG_DUEL_CREATION_INCOMPATIBLE_LUA_API;
}
*out_ocg_duel = static_cast<OCG_Duel>(duelPtr);
return OCG_DUEL_CREATION_SUCCESS;

View file

@ -22,7 +22,9 @@ typedef enum OCG_DuelCreationStatus {
OCG_DUEL_CREATION_NO_OUTPUT,
OCG_DUEL_CREATION_NOT_CREATED,
OCG_DUEL_CREATION_NULL_DATA_READER,
OCG_DUEL_CREATION_NULL_SCRIPT_READER
OCG_DUEL_CREATION_NULL_SCRIPT_READER,
OCG_DUEL_CREATION_INCOMPATIBLE_LUA_API,
OCG_DUEL_CREATION_NULL_RNG_SEED
}OCG_DuelCreationStatus;
typedef enum OCG_DuelStatus {