Commit graph

2570 commits

Author SHA1 Message Date
Edoardo Lolletti
8d3a553b12 Check for 2048 groups
Doesn't really change much, but looks nicer(?)
2025-05-30 23:09:30 +02:00
Edoardo Lolletti
4a8aeeccef Apply suggestions 2025-05-30 23:09:29 +02:00
Edoardo Lolletti
436cc5aa99 Cleanup calling of lua_gc
The function like luaL_unref should never raise any error, so it's safe to be called outside a protected lua context
2025-05-30 23:09:29 +02:00
Edoardo Lolletti
6ba666b5ee Don't use pushcfunction/pcall to call luaL_unref
Lua guarantees that luaL_unref will never raise any error, and in case the only in this block of code could come from lua_checkstack, but we already weren't checking for its return value before
2025-05-30 23:09:29 +02:00
Edoardo Lolletti
c20d9a4b38 Update copyright years in changed files 2025-05-30 23:09:29 +02:00
Edoardo Lolletti
2b17d51587 Cleanup operators in owned_lua 2025-05-30 23:09:28 +02:00
Edoardo Lolletti
c990686e2e Remove duel::release_script_group
It was now an empty function
2025-05-30 23:09:28 +02:00
Edoardo Lolletti
0e6d4ed79a Rename delete_group_no_unref to delete_group 2025-05-30 23:09:28 +02:00
Edoardo Lolletti
b71b5f2ebe Run a single gc step when collection on group creation and full gc step when resetting the field 2025-05-30 23:09:27 +02:00
Edoardo Lolletti
4ab7ffbb02 Update comments 2025-05-30 23:09:27 +02:00
Edoardo Lolletti
c4fb83b3d9 Use std tie for tevent operator 2025-05-30 23:09:27 +02:00
Edoardo Lolletti
20d2e5a5ab Properly implement tevent::operator< instead of using memcmp
Properly handle the fact that event_cards  is now no longer a pointer
2025-05-30 23:09:26 +02:00
Edoardo Lolletti
7833345fc8 Add equality operator to owned_lua
Fixed comparision of tevent structs
2025-05-30 23:09:26 +02:00
Edoardo Lolletti
6e5398f563 Remove remnants of explicit group lifetime management
Rely entirely on lua, don't use `deleted` lua object to mark groups as deleted, fixes crashes under linux
2025-05-30 23:09:25 +02:00
Edoardo Lolletti
02a0d1ff19 Make release_script_group a noop
Running the gc every time this was called was too costly and ovvered not much gains
2025-05-30 23:09:24 +02:00
Edoardo Lolletti
34df889e69 Address gcc warnings 2025-05-30 23:09:24 +02:00
Edoardo Lolletti
b01f23bfa6 Make group::is_readonly a bool
It is no longer used as multiple values "boolean" to indicate a group not to be collected
2025-05-30 23:09:23 +02:00
Edoardo Lolletti
98afb41d0c Deal with groups cleanup at duel destruction and on field reload 2025-05-30 23:09:23 +02:00
Edoardo Lolletti
5f94023431 Call garbage collector on release_script_group 2025-05-30 23:09:23 +02:00
Edoardo Lolletti
fb7088e6a6 Add more stack checking and call gc functions in a safe lua environment 2025-05-30 23:09:22 +02:00
Edoardo Lolletti
50a2b9ba22 Add initial draft of lua managed group lifetime 2025-05-30 23:09:22 +02:00
Edoardo Lolletti
5628753a4f Default initialize tevent members 2025-05-30 21:42:20 +02:00
Edoardo Lolletti
0b31b9b56d Add Duel.GetReasonPlayer and GetReasonEffect 2025-05-29 22:27:08 +02:00
Edoardo Lolletti
2d72976984 Import https://github.com/Fluorohydride/ygopro-core/pull/752 2025-05-17 11:48:30 +02:00
Edoardo Lolletti
8104f31d69 Check at runtime for the lua library to be doing proper stack unwinding 2025-05-16 11:37:35 +02:00
Edoardo Lolletti
b468df11a7 Use initializer list to pass parameters to random's constructor 2025-05-16 10:41:17 +02:00
Edoardo Lolletti
b3abeec212 Add mingw32crtdll build target 2025-05-10 20:15:25 +02:00
Edoardo Lolletti
b3c846db2d Fix wrong filename in readme 2025-04-27 22:28:13 +02:00
Edoardo Lolletti
9cd09364ca Fix EFFECT_TOSS_COIN_REPLACE and EFFECT_TOSS_DICE_REPLACE not letting results be set
The results array wasn't being resized to allow for it to be then populated by SetCoinResult/SetDiceResult
2025-04-27 22:27:38 +02:00
Edoardo Lolletti
41f6e8901d Remove no longer present group.cpp from android makefile 2025-04-25 12:32:09 +02:00
Edoardo Lolletti
0a690c0467 Minor cleanups in group constructor
Remove redoundant rvalue constructor and remove separate group.cpp file by inlining the lua_obj constructor
2025-04-25 12:30:44 +02:00
Edoardo Lolletti
4e278a05ef Explicitly use lua_newuserdatauv with lua 5.4+ with 0 userdata value slots
In lua 5.4 and later, it's now possible to specify the number of userdata value slots, including 0, unlike in earlier versions where the slots were always fixed at 1.
Since they're unused in our case, use the full function to have 0 slots available and save some space for each userdata object
2025-04-25 12:05:00 +02:00
Edoardo Lolletti
640de69d6d Ensure that the Check/SelectWithSum functions don't receive groups with cards for which the operation value function returns 0
Prevents errors down the line due to overpaying since a card with sum_param of 0 will never contribute to the total and error out when the client sends a response
2025-04-25 11:57:30 +02:00
Edoardo Lolletti
f747c21c3a Explicitly allow fusion spell cards to start in the extra deck 2025-04-24 22:24:50 +02:00
Edoardo Lolletti
f77ff14eca Allow adding cards to the duel with locaton 0
Used for duel rule cards
2025-04-24 22:24:35 +02:00
Edoardo Lolletti
158aebe758 Add duel flag DUEL_NORMAL_SUMMON_FACEUP_DEF 2025-04-17 21:57:02 +02:00
Edoardo Lolletti
9ba58cb794 Fix typo in trap monster adjust
If the first player had no free zones, the cards in the `returns` vector from any previous selection were added to the cards to be sent to the grave
2025-04-13 16:02:00 +02:00
Edoardo Lolletti
c57be7a4d4 Add string for cards added to the hand by a currently resolving effect 2025-04-13 15:38:52 +02:00
Edoardo Lolletti
a3ee9a10ab Reset the various "turn" actions statuses when a card banished temporairly returns to field regardless of the turn number 2025-04-13 15:23:34 +02:00
Edoardo Lolletti
0d1e79a232 Make Duel.HintSelection default to true for the selection parameter 2025-04-13 15:07:49 +02:00
Edoardo Lolletti
25e86283f4 Automatically select counters if only 1 card is available 2025-04-13 15:05:43 +02:00
Edoardo Lolletti
94f9110339 Update core to use lua 5.4.7 2025-04-10 21:16:31 +02:00
Edoardo Lolletti
fe15c04ac0 Bump core version to 11.0 2025-04-06 21:32:06 +02:00
Edoardo Lolletti
6ba4390319
Revert "Revert "Add extra check in parse_response_cards"" (#154)
This reverts commit d9b48da42b.
2025-04-06 21:30:06 +02:00
Edoardo Lolletti
892202db5d
Addressed implementation defined behaviour in rng function (#156)
Properly handle the results of the rng output as unsigned ints, rather than relying on implementation defined conversion from unsigned to signed integers
2025-04-06 20:32:09 +02:00
Edoardo Lolletti
f0aecd3e8d Fix wrong merge 2025-04-06 20:28:55 +02:00
Edoardo Lolletti
13e06bbf4b
Pass structs by pointers to the ocgapi (#148)
Passing structs by value doesn't guarantee a stable abi
2025-04-06 20:26:12 +02:00
Edoardo Lolletti
4505fa604a
Add DUEL_EXTRA_DECK_RITUAL flag (#164)
Allows ritual monsters to be treated as extra deck monsters, to account for the change in RUSH duels. For this implementation, if the flag is used with the extra monster zones enabled, the monster will be summonable to both EMZone and MMZone like other non link cards
2025-03-29 13:02:46 +01:00
Edoardo Lolletti
dcd5023c70
Add DUEL_FAST_EFFECT_IGNITION and restore old behaviour of DUEL_OBSOLETE_IGNITION (#155)
DUEL_FAST_EFFECT_IGNITION will treat any ignition effect as fast effect if they're the first in a chain, to match GOAT rulings, DUEL_OBSOLETE_IGNITION instead, now renamed to DUEL_OCG_OBSOLETE_IGNITION will behave as before, with ignition effects being only activateable in response to a summon, as it worked in ocg's master rule 1
2025-03-29 13:00:50 +01:00
Edoardo Lolletti
73560d0f72 Ensure that exactly 1 location is passed to the ocgapi functions
The only exception is for functions accounting for LOCATION_OVERLAY, in which case the 1 location is enforced but ignoring that flag
2025-03-22 20:18:30 +01:00