It is currently 16 Apr 2024, 21:44
   
Text Size

[fixed] Bad Parameter Alert - Hurricane

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

[fixed] Bad Parameter Alert - Hurricane

Postby etphonehome » 26 Jul 2021, 22:48

Another Bad Parameter Alert

Savegame and Dump included

THX
Attachments
dump.rar
(249 Bytes) Downloaded 55 times
Bad Parameters.rar
(2.34 KiB) Downloaded 55 times
Captura de ecrã 2021-07-26 234411.jpg
Last edited by drool66 on 29 Jul 2021, 18:05, edited 3 times in total.
Reason: fixed
etphonehome
 
Posts: 300
Joined: 21 May 2020, 12:50
Has thanked: 270 times
Been thanked: 39 times

Re: Another Bad Parameter Alert

Postby drool66 » 29 Jul 2021, 00:57

It's Hurricane - it triggers because of the instance->info_slot in new_damage_all(); I can't figure out how to code around this without throttling the AI somewhat
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [confirmed] Another Bad Parameter Alert

Postby Korath » 29 Jul 2021, 03:52

Why would that matter? By the time it gets to new_damage_all(), the argument's just a number like any other.

What's really happening here is the assumption in new_damage_all() that damage_creature(target_player, target_card, amount_of_damage, player, card) always returns a valid card index controlled by player. It just returns -1 when it fails early, whether because target_player or player is unset, or if it can't create a damage card, or - as here - damage is 0 or less. The easy repro is to put a creature with flying on the bf and cast Hurricane with X = 0.

(damage_creature() - which really should have been named deal_damage() or similar instead, since it's also the function implementing damage to players - also doesn't return a card index controlled by player when {target_player,target_card} is player's opponent. Damage cards attached to players are always controlled by the player they're attached to, due to a display bug dating back to the original MicroProse release; anything attached to a player is displayed attached to its controller's player, rather than the player it's actually attached to. So, since only damage cards attached to players back then, they worked around it by giving them to the wrong player so they looked right. If you really do need to get a damage card for damage to a player, you have to do get_card_instance(target_player, whatever_damage_creature_returned) instead of get_card_instance(player, ...). But new_damage_all() only does stuff with the created damage card when it's damaging a permanent, so that doesn't matter here.)

The solution is to A) return at the start of new_damage_all() if dmg is <= 0, since comp rule 120.8 makes dealing 0 or less damage equivalent to no damage event at all anyway; and B) check that dmg_card >= 0 before getting an instance in the inner loop of new_damage_all().

Also, why does card_hurricane() tell generic_spell() that it has a target?
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed] Bad Parameter Alert - Hurricane

Postby drool66 » 29 Jul 2021, 18:05

That makes sense, thanks. I figured because I could change instance->info_slot to a constant it had something to do with that instance, but I hadn't gotten to the bottom of it.

The target in Hurricane has to be an error.

Implemented and fixed in 3bd4eea
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times


Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 66 guests


Who is online

In total there are 66 users online :: 0 registered, 0 hidden and 66 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 66 guests

Login Form