Page 1 of 1

[fixed]Bad parameters - validate counterslell crashes game

PostPosted: 29 May 2024, 18:47
by Althuna
Error message said to include dump.txt so I did. I also have the savegame just as the AI uses whatever card causes it.

Re: [confirmed]Bad parameters crashes game

PostPosted: 30 May 2024, 13:17
by Aswan jaguar
I can't find out what is happening maybe drool66 can find out from the dump.text.

Re: [confirmed]Bad parameters crashes game

PostPosted: 30 May 2024, 16:16
by Althuna
I think the card is Expansion/Explosion. Or at least I had the same error with that card in another game although the game continued. I attached a save for that too.

Re: [confirmed]Bad parameters crashes game

PostPosted: 31 May 2024, 19:27
by drool66
The issue is in counterspell_validate(), which is indeed called from Expansion/Explosion. It doesn't check parameters before calling get_card_instance() to check STATE_INVISIBLE

Aswan jaguar, I'm still a little in the weeds with my trigger card changes; would you be able to fix and apply this? I think the change would probably be to change the following line in counterspell_validate():
Code: Select all
   if (!valid || !(get_card_instance(instance->targets[target_num].player, instance->targets[target_num].card)->state & STATE_INVISIBLE)){
to:
Code: Select all
   if (!valid || (instance->targets[target_num].card > -1 && !(get_card_instance(instance->targets[target_num].player, instance->targets[target_num].card)->state & STATE_INVISIBLE))){
edit: fix syntax

Re: [confirmed]Bad parameters crashes game

PostPosted: 02 Jun 2024, 08:10
by Aswan jaguar
I can commit the change of course but I can't make any tests as counterspells are broken in dev and will crash. If that's not an issue I can proceed.

Re: [confirmed]Bad parameters crashes game

PostPosted: 28 Jun 2024, 12:50
by Aswan jaguar
Fixed by drool66 in commit 08b94da ("Param check in counterspell_validate()", 2024-06-10).