Code:
if (check_for_inscrip(gear_obj, "!L")) {
const char *s = quark_str(gear_obj->note); // gear_obj->note is not 0
while (s) {
s = strstr(s, "!L");
/* The stacking limit tag is !L<digit><digit> */
if (s && '0'<=s[2] && s[2]<='9' && '0'<=s[3] && s[3]<='9') {
stack_limit = (int)10*(s[2]-'0') + s[3] - '0';
/* TODO ignore staking limits > 40? */
break;
}
if (s) s++;
}
if (stack_limit>=0)
num_to_pickup = MIN(num_to_pickup, stack_limit - gear_obj->number);
}
Code:
const char *inscription = quark_str(gear_obj->note);
const char *s = strstr(inscription, "!L");
if (s && sscanf(s, "!L%d", &stack_limit) > 0) {
num_to_pickup = MIN(num_to_pickup, stack_limit - gear_obj->number);
}
But that might be because I'm already used to it.)

(I also don't like lots of things about C but it still beats assembly code
Comment