void
remove_from_here_list(int loc, int who)
{

  assert(in_here_list(loc, who));
  ilist_rem_value(&(rp_loc_info(loc)->here_list), who);
  /*
   *  Mon Apr 20 18:08:44 1998 -- Scott Turner
   *
   *  Thanks to Rich's nice encapsulation, this is the only
   *  place we have to worry about someone being the last person
   *  out of a subloc...so here's where we reset the fees.
   *
   *  Anyway, that's plan :-).
   *
   */
  if (!ilist_len(rp_loc_info(loc)->here_list) &&
      rp_subloc(loc)) {
    rp_subloc(loc)->control.weight = 0;
    rp_subloc(loc)->control.nobles = 0;
    rp_subloc(loc)->control.men = 0;

    rp_subloc(loc)->control2.weight = 0;
    rp_subloc(loc)->control2.nobles = 0;
    rp_subloc(loc)->control2.men = 0;
  };
      
  assert(!in_here_list(loc, who));
}
Beispiel #2
0
char *
display_with(int who)
{

  if (rp_loc_info(who) && ilist_len(rp_loc_info(who)->here_list) > 0)
    return ", accompanied~by:";

  return "";
}
int
in_here_list(int loc, int who)
{
	struct loc_info *p;

	p = rp_loc_info(loc);

	if (p == NULL)
		return FALSE;

	return (ilist_lookup(p->here_list, who) != -1);
}
static void
add_here(int who, ilist *l)
{
	int i;
	struct loc_info *p;

	assert(valid_box(who));

	ilist_append(l, who);

	p = rp_loc_info(who);
	assert(p != NULL);

	for (i = 0; i < ilist_len(p->here_list); i++)
		add_here(p->here_list[i], l);
}
void
all_here(int who, ilist *l)
{
	int i;
	struct loc_info *p;

	assert(valid_box(who));

	ilist_clear(l);

	p = rp_loc_info(who);

	if (p == NULL)
		return;

	for (i = 0; i < ilist_len(p->here_list); i++)
		add_here(p->here_list[i], l);
}
void
all_stack(int who, ilist *l)
{
	int i;
	struct loc_info *p;

	assert(valid_box(who));

	ilist_clear(l);
	ilist_append(l, who);

	p = rp_loc_info(who);

	if (p == NULL)
		return;

	for (i = 0; i < ilist_len(p->here_list); i++)
		if (kind(p->here_list[i]) == T_char)
			add_char_here(p->here_list[i], l);
}