Attnam / ivan

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

Interrupted crafting crash #610

Open red-kangaroo opened 4 years ago

red-kangaroo commented 4 years ago

Reported here.

Trying to make ingots out of iron. The first attempt was interrupted (because I was starving and passed out) but I decided to continue processing my lumps for a bones file. I didn't "continue previous job" (if such an option exists) but went straight back to "melt ingot" (which, side note, is poorly phrased - makes it sound like we are taking ingots and melting them down, rather than melting lumps into ingots).

CTD with the following message:

this crafting was already suspended
'rc.IscanBeSuspended()=1; itToolID=0; itTool2ID=0, itSpawnCfg=2, itSpawnMatMainCfg=28674; itSpawnMatMainVol=250; itSpawnMatSecCfg=0; itSpawnMatSecVol=0; otSpawnCfg=0; otSpawnMatMainCfg=0; otSpawnMatMainVol=0; otSpawnMatSecCfg=0; otSpawnMatSecVol=0; fsItemSpawnSearchPrototype=; fsCraftInfo=melt an ingot (), started at Underwater Tunnel II; v2AnvilLocation=0,0; v2ForgeLocation=129,12; v2WorkbenchLocation=0,0; v2PlaceAt=0,0; v2PlayerCraftingAt=128,12;

Any ideas, @AquariusPower ?

AquariusPower commented 4 years ago

could be "melt (something) into an ingot"? hehe yep that needs fixing :> on the code we would change the var value from "melt" to "melt into" I think?

I didn't "continue previous job" (if such an option exists)

I think it will be there, so you can continue it,

this crafting was already suspended

and would be a way to avoid the "crash" (it was actually an intentional ABORT() based on the message above).

but went straight back to "melt ingot"

Based on what you did, it should not crash in that way... It should just create a new melt action, and later if you try to use the suspended one it would complain about missing ingredients and would fail but not ABORT().

Btw, what branch you used for this test? Despite I didn't change anything about it so I guess this test will ABORT() in all branches.

red-kangaroo commented 4 years ago

Not me, that was Ischaldirh on the forums. :) I'd think they were playing the latest release, so it might have already been fixed in your feature branch.

AquariusPower commented 4 years ago

the bug still happens on latest branch somefixes1234 follow exactly what he said I used a lump of 1000cm3 and ingots of minimum volume (so we have time to suspend it by pressing any key) if I try to start a new melt action with the same lump and ingot volum it will ABORT() with that message!

the problem is the craft action ID, it is not as unique as I thought... this is the code

void craftcore::AddSuspended(const recipedata& rpd){
...
  for(int i=0;i<vSuspended.size();i++)
    if(vSuspended[i].id()==rpd.id()) //!!! BUG HERE IS THE NOT SO UNIQUE ID PROBLEM !!!
      ABORT("this crafting was already suspended '%s'",vSuspended[i].id().CStr());

this is the stacktrace:

#0  dbgmsg::breakPointSimulator() at FeLib/Source/dbgmsg.cpp:594
#1  globalerrorhandler::Abort(Format = 0x555555fddf40 "this crafting was already suspended %s") at FeLib/Source/error.cpp:144
#2  craftcore::AddSuspended(rpd = ) at Main/Source/cmdcraft.cpp:36
#3  craft::Terminate(this = 0x55555b87a7f0, Finished = false) at Main/Source/actions.cpp:400
#4  character::Be(this = 0x55555b0202d0) at Main/Source/char.cpp:1128
#5  pool::Be() at Main/Source/pool.cpp:31
#6  game::Run() at Main/Source/game.cpp:1139
#7  main(argc = 1, argv = 0x7ffffffc31f8) at Main/Source/main.cpp:235

so, to fix this bug that ID rpd.id() must be more unique.

I think to make it 100% unique, we just need to add the initial starting gameplay turn to the ID (actually the ID could be just that turn I guess...), it will have to be a recipedata field and will also have to be saved.

PS.: I added as many details as possible as I dont know when I will be able to implement it

AquariusPower commented 4 years ago

implemented and tested: at https://github.com/Attnam/ivan/pull/587 :>

red-kangaroo commented 2 years ago

Maybe related: Linux crafting crash