I am noticing a wonky issue with do_split
if a member of the group splits the gold from a kill and there is 1 coin left, it is giving 2 coins to the looter
see attached screenshot
fight.c
Code:
if (GROUP(ch) && (local_gold > 0) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOSPLIT)) {
struct obj_data *coin_obj, *next_obj;
struct obj_data *corpse_obj = get_obj_contents_room_vis(ch, "corpse");
if (corpse_obj) {
do_get(ch, "all.currencie corpse", 0, 0);
do_split(ch,local_buf,0,0);
}
/* need to remove the gold from the corpse */
}
else if (!IS_NPC(ch) && (ch != victim) && PRF_FLAGGED(ch, PRF_AUTOGOLD)) {
do_get(ch, "all.currencie corpse", 0, 0);
}
if (!IS_NPC(ch) && (ch != victim) && PRF_FLAGGED(ch, PRF_AUTOLOOT)) {
do_get(ch, "all corpse", 0, 0);
}
if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOSAC)) {
do_sac(ch,"corpse",0,0);
}
return (-1);
}
return (dam);
}
act.other.c
Code:
decrease_gold(ch, share * (num - 1));
/* Abusing signed/unsigned to make sizeof work. */
len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n",
GET_NAME(ch), amount, share);
if (rest && len < sizeof(buf)) {
snprintf(buf + len, sizeof(buf) - len,
"%d coin%s %s not splitable, so %s keeps the money.\r\n", rest,
(rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch));
}
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL)
if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) {
increase_gold(k, share);
send_to_char(k, "%s", buf);
}
send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n",
amount, num, share);
if (rest) {
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
increase_gold(ch, rest);
}
} else {
send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
return;
}
}