Here is what I have in fight.c:
Code:
/* Uh oh.  Victim died. */
  if (GET_POS(victim) == POS_DEAD) {
//    send_to_char(ch, "DEAD\r\n");
    if (ch != victim && (IS_NPC(victim) || victim->desc)) {
      if (AFF_FLAGGED(ch, AFF_GROUP))
	group_gain(ch, victim);
      else
        solo_gain(ch, victim);
    }
    if (!IS_NPC(victim)) {
      mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name);
      if (IS_AGGRESSIVE(ch, AGGR_TYPE_MEMORY))
        forget(ch, victim);
    }
    /* Cant determine GET_GOLD on corpse, so do now and store */
    if (IS_NPC(victim)) {
	  if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD))
      {
        happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100));
        happy_gold = MAX(0, happy_gold);
		increase_gold(victim, happy_gold);
	  }
      local_gold = GET_GOLD(victim);
      sprintf(local_buf,"%ld", (long)local_gold);
    }
 
Code:
/* transfer gold */
  if (GET_GOLD(ch) > 0) {
    /*
     * following 'if' clause added to fix gold duplication loophole
     * The above line apparently refers to the old "partially log in,
     * kill the game character, then finish login sequence" duping
     * bug. The duplication has been fixed (knock on wood) but the
     * test below shall live on, for a while. -gg 3/3/2002
     */
	 if (IS_NPC(ch) && IS_HAPPYGOLD <= 0) {
      money = create_money(GET_GOLD(ch));
      obj_to_obj(money, corpse);
    }
    if (IS_NPC(ch) && IS_HAPPYGOLD > 0) {
      money = create_money(GET_GOLD(ch)+ ((GET_GOLD(ch) * HAPPY_GOLD) / 100));
      obj_to_obj(money, corpse);
	}
    GET_GOLD(ch) = 0;
  }
 
Increase/decrease gold functions in limits.c:
Code:
/* Note: amt may be negative */
int increase_gold(struct char_data *ch, int amt)
{
  int curr_gold;
  curr_gold = GET_GOLD(ch);
  if (amt < 0) {
    GET_GOLD(ch) = MAX(0, curr_gold+amt);
    /* Validate to prevent overflow */
    if (GET_GOLD(ch) > curr_gold) GET_GOLD(ch) = 0;
  } else {
    GET_GOLD(ch) = MIN(MAX_GOLD, curr_gold+amt);
    /* Validate to prevent overflow */
    if (GET_GOLD(ch) < curr_gold) GET_GOLD(ch) = MAX_GOLD;
  }
  return (GET_GOLD(ch));
}
 
utils.h:
Code:
int increase_gold(struct char_data *ch, int amt);
int decrease_gold(struct char_data *ch, int amt);