Commit graph

134 commits

Author SHA1 Message Date
Edoardo Lolletti
e4c343cc21 Address various clang-20 warnings
Mostly extra semicolon warnings
2025-06-25 20:55:42 +02:00
Edoardo Lolletti
25e86283f4 Automatically select counters if only 1 card is available 2025-04-13 15:05:43 +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
d58b1a97cc Remove try/catch usage 2025-02-25 22:45:23 +01:00
Edoardo Lolletti
c213bc5bdd Update instances where SortCard was being used
Don't assume 64 max entries sorted by that processor
2024-01-13 16:05:50 +01:00
Edoardo Lolletti
e97a1c2f94
Restructure the processor handling to use a variant object (#149)
Rewrite the whole ``process`` function of the processor to use instead tag dispatching on variant objects.
Each single processor message got rewritten as a struct, inheriting from a base templated Process struct, containing only the required data for that process, rather than using the generic structure that ended up needing to spam bitwise operations to pack as many arguments in a byte as possible. This makes things easier to follow and streamlines the addition of new processes:
 - Define its struct with the parameters it expects by also providing a constructor
   - If the process requires an answer, inherit it from ``Process<true>``, if it requires no answer, inherit it from ``Process<false>``
 - Add such struct to the ``processors`` variant type
 - Declare and implement its corresponding ``bool process(Processors::NewProcess& arg);`` function
2024-01-08 20:46:41 +01:00
Edoardo Lolletti
ff41aec90a Update header inclusion 2024-01-05 13:03:46 +01:00
Edoardo Lolletti
da45f91460 Update copyright for 2024 2024-01-03 01:21:08 +01:00
Edoardo Lolletti
f47060eb43 Make select_chains and ignition_priority_chains lists
This allows to exchange the nodes with the other lists, thus removing unneded object copying
2023-11-26 17:48:20 +01:00
Edoardo Lolletti
d9b48da42b Revert "Add extra check in parse_response_cards"
This reverts commit 9c44670724.
To be readded later, the ai currently is sending invalid data for the selection type that would fail the check
2023-10-17 10:40:46 +02:00
Edoardo Lolletti
9c44670724 Add extra check in parse_response_cards 2023-09-24 20:08:44 +02:00
Edoardo Lolletti
a2c28b50c2 Fix typo in has_invalid_bits
It was being called with the wrong parameter order from libduel, make the parameter names clearer and update its usage accordingly
2023-04-24 14:09:59 +02:00
Edoardo Lolletti
d9474f0551
Update Duel.AnnounceRace and Duel.AnnounceAttribute to handle new race (#136)
Do the required changes to make Duel.AnnounceRace work with the new types and also any possible newly added type removing some hardcodings down the way and adding some extra checks, also apply the same updates to Duel.AnnounceAttribute
2023-04-23 21:34:36 +02:00
Edoardo Lolletti
e73fb449a8 Silence downcast warnings 2023-02-07 16:43:27 +01:00
Edoardo Lolletti
af65cb7d31 Clear player hint if select_option returns early 2022-10-15 16:11:13 +02:00
Edoardo Lolletti
c4785633ba Remove undefined behaviour from ProgressiveBuffer class
Add a separate ``set`` function and use memcpy to store/retrieve the data in the buffer, removes the raw cast to a reference that could have also lead to aligment issues.
2022-09-17 15:19:38 +02:00
Edoardo Lolletti
eb82fa3c57 Minor syntax/readibility updates 2022-09-17 12:46:51 +02:00
Edoardo Lolletti
0de9a3e1e4
Update internal race value to 64 bit (#127)
Bump the race value size from 32 to 64 bit, giving us 32 new race values.
This is needed to futureproof the new upcoming rush card types, that could end up making the card types become more than 32.
This change breaks both the core abi and the messages.
For the abi now the race field in the OCG_CardData struct changed from uint32_t to uint64_t.
For the messages, QUERY_RACE will now be an uint64_t instead of uint32_t, MSG_ANNOUNCE_RACE will send an uint64_t for the races that can be declared, and also will now expect an uint64_t as answer, also, the HINT_RACE property associated with MSG_HINT will be using the full uint64_t data field as well.
2022-09-03 22:45:49 +02:00
Edoardo Lolletti
cfb98af8c7 Fix minor clang static analyzer warnings 2022-05-22 11:54:57 +02:00
Edoardo Lolletti
4da35cb7f1 Use preincrement operator instead of postincrement in the codebase
Semantically the proper operator to use for oneline increments is the preincrement one, the postincrement is the one to be used only in teh cases where the previous value is required.
2022-03-05 13:56:43 +01:00
Edoardo Lolletti
cce981ff4a
Send full location info for cards to be selected from msg_select_sum (#125) 2022-02-13 17:27:07 +01:00
Edoardo Lolletti
3e58a18e0d Update playerop.cpp 2021-12-07 22:16:09 +01:00
Edoardo Lolletti
fd55f5842f Separate the logic of SelectCardsFromCodes
No longer hijack select_card
2021-12-07 22:13:34 +01:00
Edoardo Lolletti
d12aab4fbb Properly parse the sizes of the values in field::parse_response_cards's buffer as unsigned integers 2021-11-06 16:24:47 +01:00
Edoardo Lolletti
4c8c56db75 Make duel::read_card return a const reference rather than a pointer
Also fixed card's setcode related functions that kept copying the set of the card's setcodes
2021-11-06 16:23:19 +01:00
Edoardo Lolletti
28a7989121 Update duel::read_card
Remove the second optional parameter and manually copy assign the struct in the few places where it was being used
2021-11-06 16:04:34 +01:00
Edoardo Lolletti
0de788365e Fix missing overtribute check in select_tribute 2021-09-05 20:29:20 +02:00
Edoardo Lolletti
8fd5b97d04 Completely remove custom integer type typedefs
Directly use the standard's
2021-09-04 22:04:14 +02:00
Edoardo Lolletti
b34f834573 Update check for return value of field::select_place
It wasn't checking if all the returned zones were unique, also added check invalid sequences and made the logic cleaner
2021-06-09 19:16:04 +02:00
Edoardo Lolletti
0fed75ab81 [ci skip]Remove no longer needed bitset header 2021-03-24 19:31:05 +01:00
Edoardo Lolletti
d253ca273a Send new MSG_ROCK_PAPER_SCISSORS when repeating it immediately, without waiting for the next call
When the processor called rock_paper_scissors, it would have returned PROCESSOR_FLAG_WAITING, while it should have been PROCESSOR_FLAG_CONTINUE. Change he way the new message is sent, removing the need for further handling in the processor
2021-03-06 15:11:43 +01:00
edo9300
0228fb4a22 move field::rock_paper_scissors to playerop.cpp, also add check for message answer 2021-01-01 23:31:52 +01:00
edo9300
771cf12b7e Fix some visual studio warnings 2020-11-07 19:47:50 +01:00
edo9300
3b239b11c2 Remove unneded "byte", "ptr", "BOOL" typedefs 2020-11-07 19:47:19 +01:00
edo9300
763733cddc Add extra opcodes for duel_announce_card, allow passing opcodes directly from a table
Add OPCODE_ALLOW_ALIASES and OPCODE_ALLOW_TOKENS to allow aliased cards and token cards to be declared. Allow the function to be called with opcodes in a table.
2020-10-17 23:34:04 +02:00
edo9300
844d969b79 Resolve clang and g++ warnings
Also fix to_check parameter from select_release_group not being passed to the functions
2020-09-16 18:22:55 +02:00
edo9300
27fb772b32 Set playerid when using code ionly card selection 2020-09-02 15:03:43 +02:00
edo9300
f40b5f1a43 Update behaviour of Duel.SelectCardsCodes
Add parameter to make the function return pairs of cardid + index in the passed arguments
2020-09-02 15:03:13 +02:00
edo9300
f841a50605 Minor cleanups
Check for location and team validity in OCG_DuelQueryLocation, remove some minor warnings
2020-08-23 18:06:51 +02:00
edo9300
5d814e52d7 Add Duel.SelectCardsFromCodes
Like Group.Select, but allows card codes to be passed directly, instead of card objects
```
Duel.SelectCardsFromCodes(0,1,3,false,10000000,75582395,48356796,48356796)
```
2020-08-21 22:24:48 +02:00
edo9300
e6ffcf80de Use 64 bit opcodes for announce card
There will be no longer the issue of overlapping card ids
2020-07-21 18:02:27 +02:00
edo9300
77fca20e11 Handle cards selection with minimum at 0 2020-06-18 23:20:29 +02:00
edo9300
d72a889c21 Clear selection hint if there's no card to select 2020-06-10 16:15:10 +02:00
edo9300
8cd82297a8 Catch out of bound access in parse_response_cards, and send msg_retry 2020-06-09 20:02:45 +02:00
Edoardo Lolletti
56cb13e843 fix return of select_unselect with simple ai 2020-02-26 06:22:16 +01:00
kevinlul
8db50d17f4 Fix some signed/unsigned warnings 2020-01-30 23:30:06 -05:00
edo9300
5434d89338 Changed internal handling of cards data, allow unlimited amount of setcodes per card at creation 2020-01-13 20:03:14 +01:00
edo9300
15218244ec Use pointers in initialize list 2020-01-13 14:52:51 +01:00
Dylam De La Torre
59a31497e2 move count to before the loop
like every other message...
2019-11-24 19:22:09 +01:00
Dylam De La Torre
4cef9340fd update MSG_SELECT_BATTLECMD, MSG_SELECT_IDLECMD and MSG_SELECT_CHAIN
now send the mode of the effect on the same layout, and they can all
identify resolve effects now. And just like the others, no longer have
the flag appended to card code.
2019-11-24 16:45:55 +01:00