Skip to content

Commit

Permalink
M302de: Original-Bugfix: some item counter fixes
Browse files Browse the repository at this point in the history
The item counter in the character sheet gets broken when items
get moved in the inventory. This is bad, since that item counter
is referenced in SCHWEIF when importing from SCHICK, and crahes
when the value is too high (or too low).

This bug is known for some time and Bright-Eyes controlles the
item counter with a timer and corrects it.

Now two places have been fixed, when two stackable items of the same
type are merged.
  • Loading branch information
Henrik Kretzschmar committed Mar 21, 2014
1 parent a5e7e9b commit 4992cc0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/custom/schick/rewrite_m302de/seg106.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ void move_item(signed short pos1, signed short pos2, Bit8u *hero)
/* delete item at pos2 */
memset(hero + 0x196 + pos2 * SIZEOF_KS_ITEM,
0, SIZEOF_KS_ITEM);
#ifdef M302de_ORIGINAL_BUGFIX
/* Decrement the item counter */
dec_ptr_bs(hero + 0x20);
#endif
} else {
if (!can_hero_use_item(hero, item2)) {
sprintf((char*)Real2Host(ds_readd(DTP2)),
Expand Down Expand Up @@ -185,6 +189,10 @@ void move_item(signed short pos1, signed short pos2, Bit8u *hero)
/* delete item at pos2 */
memset(hero + 0x196 + pos2 * SIZEOF_KS_ITEM,
0, SIZEOF_KS_ITEM);
#ifdef M302de_ORIGINAL_BUGFIX
/* Decrement the item counter */
dec_ptr_bs(hero + 0x20);
#endif
} else {

#if !defined(__BORLANDC__)
Expand Down

0 comments on commit 4992cc0

Please sign in to comment.