Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
301 stars 43 forks source link

Crash: cutting web crashes after getting stuck on the web #516

Open AquariusPower opened 5 years ago

AquariusPower commented 5 years ago

EDIT: ugh... it is not that precise on how to simulate it, happened 4 times already w/o a crash...

to simulate, try to cut a web until you get stuck on it (the player fumbles and is moved to the web square, may be this is the source of the bug? more stuff should be coded when the player is moved possibly?), after that try to move and the crash will happen. May be, if you are going to try to actually track the bug and fix it, changing the code temporarily, so that rare event happen always, would be wiser :)

#0  character::TryToUnStickTraps(this = 0x39f84f0, Dir = ) at Main/Source/char.cpp:11630
#1  character::Move(this = 0x39f84f0, MoveTo = , TeleportMove = false, Run = false) at Main/Source/char.cpp:1126
#2  character::TryMove(this = 0x39f84f0, MoveVector = , Important = true, Run = false, pbWaitNeutralMove = 0x7ffffffc2a90) at Main/Source/char.cpp:1467
#3  character::GetPlayerCommand(this = 0x39f84f0) at Main/Source/char.cpp:3491
#4  character::Be(this = 0x39f84f0) at Main/Source/char.cpp:1087
#5  pool::Be() at Main/Source/pool.cpp:31
#6  game::Run() at Main/Source/game.cpp:1112
#7  main(argc = 1, argv = 0x7ffffffc2e58) at Main/Source/main.cpp:164

At character::TryToUnStickTraps() The field character::TrapData is not NULL when it should be after using the craft cut web functionality in case the player is stuck on it, selecting direction as '.' That linked list first entry character::TrapData should be NULL after success on cutting the web but it is not.

This seems a tricky bug that may require some hours of experimentation/debugLogReading to find out, because why character::TrapData is not NULL? is it being set again AFTER web cutting works? or for some reason web cutting is not cleaning it?

ryfactor commented 5 years ago

the player fumbles and is moved to the web square

Which line of code is that? Is it here: https://github.com/Attnam/ivan/blob/d10e677d3fc68475689f4fe8fe3ea6bfd2941592/Main/Source/cmdcraft.cpp#L1279 ?

red-kangaroo commented 5 years ago

What about using FallTo()? That should check walkability for you.

AquariusPower commented 5 years ago

@fejoa yes that's it, as I remember I used the teleport code as reference, but now I think I should have used something more robust like what is probably used on the moveTo code when we use the direction keys

@red-kangaroo may be FallTo() could be the perfect solution, by it's name feels like a forced moveTo?

Also, it would be good if a check for already stuck on a web is performed before getting stuck on a new web, but... it may be too much precision, and the way it is now "navigating thru webs" could be a fun thing actually lol

red-kangaroo commented 5 years ago

@AquariusPower

it's name feels like a forced moveTo?

Yeah, that's exactly what it should do. Also there is a IsStuck() function if you want to check whether the player is trapped in a web/beartrap before trying to move them.