Пример #1
0
int countheroes(const struct faction *f)
{
  const unit *u = f->units;
  int n = 0;

  while (u) {
    if (fval(u, UFL_HERO))
      n += u->number;
    u = u->nextF;
  }
#ifdef DEBUG_MAXHEROES
  int m = maxheroes(f);
  if (n > m) {
    log_warning("%s has %d of %d heroes\n", factionname(f), n, m);
  }
#endif
  return n;
}
Пример #2
0
static int tolua_faction_get_maxheroes(lua_State * L)
{
    faction *self = (faction *)tolua_tousertype(L, 1, 0);
    tolua_pushnumber(L, (lua_Number)maxheroes(self));
    return 1;
}