[comp.sources.games.bugs] omega inventory hash

Fiacha of Glencar@hjuxa.UUCP (Fiacha of Glencar) (09/23/88)

I finally got disgusted with the hash being made of objects names and
tracked down the bug.

split_item in oinv.c is the culprit. It does a malloc to create newitem
and then copies item into newitem. It also needs to make a separate
allocation for objstr. This is because dispose_lost_object will free the
original objstr and item, leaving newitem->objstr pointing at something
random on the heap. This sequence of events will occur every time you
switch something to the 'up in the air' slot of the inventory.

To fix, insert the following line in split_item in oinv.c immediately after
the assignment *newitem = *item;

	newitem->objstr = salloc ( item->objstr );

Have fun,
		Nigel