I've been putting in a lot of debug-mode checking on type conversion into my code and it's finally paid off.
It caught that the ego_item data I'm using allows negative to hit / to dam bonuses but the ego_item_type struct in Vanilla Angband stores them in byte (unsigned char) variables.
Code:
#ifndef NDEBUG # define INT2BYTE(P) int2byte(P) #else # define INT2BYTE(P) (byte) (P) #endif #ifndef NDEBUG byte int2byte(const int P) { assert(P >= 0); assert(P <= 255); return((byte) P); } #endif
Comment