draconisPW / PWMAngband

A free, multi-player roguelike dungeon exploration game based on Angband
35 stars 11 forks source link

crush on breath #602

Closed igroglaz closed 6 months ago

igroglaz commented 6 months ago

https://www.youtube.com/watch?v=0AggKOZ7VDI

I suppose it may be connected with recent 'second chance' code: https://github.com/igroglaz/Tangaria/commit/ccd237a7417e8dc87e5c9db8e4a363068892e067#diff-c1ede660ea6b21ba87cf1610eb5c1b2a77b339c6e799b668d425a485444365ae as last message in game's log is:

            msg(p, "Death nearly grasped you, but in the last moment....");
            msg(p, "........something pulled you into the aether........");
igroglaz commented 6 months ago

p is ok there: image

we compare it with origin (which contain memory garbage): image ... which is as it should be as it's monster attack.. p got his blow there: image

but when we process side effects there is no player in context: image

so we send empty p image

igroglaz commented 6 months ago

so monster tried to learn with update_smart_learn() from empty player

draconisPW commented 6 months ago

equip_learn_flag() requires a valid player pointer p, at 0:12 we can see on the left that p is NULL, that's why the game crashes.

From what I understand from the log, the player met a baby law drake that breathed shards, then player phased away out of sight of the drake which breathed sound. What I don't understand is why the player is "starving" and then "rises up through the ceiling"... that's clearly not what sound does.

igroglaz commented 6 months ago

"second life" thingy teleports player away ( https://github.com/igroglaz/Tangaria/commit/ccd237a7417e8dc87e5c9db8e4a363068892e067#diff-c1ede660ea6b21ba87cf1610eb5c1b2a77b339c6e799b668d425a485444365ae ).... I suppose it bad idea.. should be post-pone teleport somehow? source_player(who, get_player_index(get_connection(p->conn)), p); effect_simple(EF_TELEPORT_LEVEL, who, "0", 0, 0, 0, 0, 0, NULL);

draconisPW commented 6 months ago

The problem is that "sound breath" must have been modified somewhere to include "hunger" and then "teleport level" which should never happen, effects should not be modified without adapting the code. The sound routine expects the player to be on the same spot which is not the case if the effect also teleports the player out of the level.

draconisPW commented 6 months ago

Fix: adapt your "second chance code" to be coded into the "death" routine. There is already code there (blackguard + necromancer can already avoid death) you can take example.