Skip to content

Commit

Permalink
fix core.duel_rule in start_duel() (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
salix5 authored Feb 10, 2025
1 parent 6812551 commit a9685da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ocgapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ extern "C" DECL_DLLEXPORT intptr_t create_duel(uint_fast32_t seed) {
}
extern "C" DECL_DLLEXPORT void start_duel(intptr_t pduel, uint32_t options) {
duel* pd = (duel*)pduel;
pd->game_field->core.duel_options |= options & 0xffff;
int32_t duel_rule = options >> 16;
uint16_t duel_rule = options >> 16;
uint16_t duel_options = options & 0xffff;
pd->game_field->core.duel_options |= duel_options;
if (duel_rule >= 1 && duel_rule <= CURRENT_RULE)
pd->game_field->core.duel_rule = duel_rule;
else if(options & DUEL_OBSOLETE_RULING) //provide backward compatibility with replay
pd->game_field->core.duel_rule = 1;
else
if (pd->game_field->core.duel_rule < 1 || pd->game_field->core.duel_rule > CURRENT_RULE)
pd->game_field->core.duel_rule = CURRENT_RULE;
if (pd->game_field->core.duel_rule == MASTER_RULE3) {
pd->game_field->player[0].szone_size = 8;
Expand Down

0 comments on commit a9685da

Please sign in to comment.