Beispiel #1
0
static void gm_create(const void *tnext, struct unit *u, struct order *ord)
{
  int i;
  attrib *permissions = a_find(u->faction->attribs, &at_permissions);
  if (permissions)
    permissions = (attrib *) permissions->data.v;
  if (!permissions)
    return;
  i = getint();

  if (i > 0) {
    const char *iname = getstrtoken();
    const item_type *itype = finditemtype(iname, u->faction->locale);
    if (itype == NULL) {
      mistake(u, ord, "unknown item.");
    } else {
      attrib *a = a_find(permissions, &at_gmcreate);

      while (a && a->type == &at_gmcreate && a->data.v != (void *)itype)
        a = a->next;
      if (a)
        i_change(&u->items, itype, i);
      else
        mistake(u, ord, "your faction cannot create this item.");
    }
  }
}
Beispiel #2
0
static int att_modification(const unit * u, skill_t sk)
{
  double result = 0;
  static bool init = false;
  static const curse_type *skillmod_ct, *gbdream_ct, *worse_ct;
  curse *c;

  if (!init) {
    init = true;
    skillmod_ct = ct_find("skillmod");
    gbdream_ct = ct_find("gbdream");
    worse_ct = ct_find("worse");
  }

  c = get_curse(u->attribs, worse_ct);
  if (c != NULL)
    result += curse_geteffect(c);
  if (skillmod_ct) {
    attrib *a = a_find(u->attribs, &at_curse);
    while (a && a->type == &at_curse) {
      curse *c = (curse *) a->data.v;
      if (c->type == skillmod_ct && c->data.i == sk) {
        result += curse_geteffect(c);
        break;
      }
      a = a->next;
    }
  }

  /* TODO hier kann nicht mit get/iscursed gearbeitet werden, da nur der
   * jeweils erste vom Typ C_GBDREAM zurückgegen wird, wir aber alle
   * durchsuchen und aufaddieren müssen */
  if (u->region) {
    double bonus = 0, malus = 0;
    attrib *a = a_find(u->region->attribs, &at_curse);
    while (a && a->type == &at_curse) {
      curse *c = (curse *) a->data.v;
      if (curse_active(c) && c->type == gbdream_ct) {
        double mod = curse_geteffect(c);
        unit *mage = c->magician;
        /* wir suchen jeweils den größten Bonus und den größten Malus */
        if (mod > bonus) {
          if (mage == NULL || mage->number == 0
            || alliedunit(mage, u->faction, HELP_GUARD)) {
            bonus = mod;
          }
        } else if (mod < malus) {
          if (mage == NULL || !alliedunit(mage, u->faction, HELP_GUARD)) {
            malus = mod;
          }
        }
      }
      a = a->next;
    }
    result = result + bonus + malus;
  }

  return (int)result;
}
Beispiel #3
0
static bool chaosgate_valid(const connection * b)
{
    const attrib *a = a_find(b->from->attribs, &at_direction);
    if (!a)
        a = a_find(b->to->attribs, &at_direction);
    if (!a)
        return false;
    return true;
}
Beispiel #4
0
static int
use_museumexitticket(unit * u, const struct item_type *itype, int amount,
order * ord)
{
    attrib *a;
    region *r;
    unit *warden = findunit(atoi36("mwar"));
    int unit_cookie;

    unused_arg(amount);

    /* Prüfen ob in Eingangshalle */
    if (u->region->x != 9525 || u->region->y != 9525) {
        cmistake(u, ord, 266, MSG_MAGIC);
        return 0;
    }

    a = a_find(u->attribs, &at_museumexit);
    assert(a);
    r = findregion(a->data.sa[0], a->data.sa[1]);
    assert(r);
    a_remove(&u->attribs, a);
    /* Übergebene Gegenstände zurückgeben */

    a = a_find(u->attribs, &at_museumgivebackcookie);
    if (a) {
        unit_cookie = a->data.i;
        a_remove(&u->attribs, a);

        for (a = a_find(warden->attribs, &at_museumgiveback);
            a && a->type == &at_museumgiveback; a = a->next) {
            if (((museumgiveback *)(a->data.v))->cookie == unit_cookie)
                break;
        }
        if (a && a->type == &at_museumgiveback) {
            museumgiveback *gb = (museumgiveback *)(a->data.v);
            item *it;

            for (it = gb->items; it; it = it->next) {
                i_change(&u->items, it->type, it->number);
            }
            ADDMSG(&u->faction->msgs, msg_message("museumgiveback",
                "region unit sender items", r, u, warden, gb->items));
            a_remove(&warden->attribs, a);
        }
    }

    /* Benutzer zurück teleportieren */
    move_unit(u, r, NULL);

    /* Exitticket abziehen */
    i_change(&u->items, itype, -1);

    return 0;
}
Beispiel #5
0
static int do_potion(unit * u, region *r, const potion_type * ptype, int amount)
{
  if (ptype == oldpotiontype[P_LIFE]) {
    int holz = 0;
    static int tree_type = -1;
    static int tree_count = -1;
    if (tree_type < 0) {
      tree_type = get_param_int(global.parameters, "rules.magic.wol_type", 1);
      tree_count =
        get_param_int(global.parameters, "rules.magic.wol_effect", 10);
    }
    /* mallorn is required to make mallorn forests, wood for regular ones */
    if (fval(r, RF_MALLORN)) {
      holz = use_pooled(u, rt_find("mallorn"),
        GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, tree_count * amount);
    } else {
      holz = use_pooled(u, rt_find("log"),
        GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, tree_count * amount);
    }
    if (r->land == 0)
      holz = 0;
    if (holz < tree_count * amount) {
      int x = holz / tree_count;
      if (holz % tree_count)
        ++x;
      if (x < amount)
        amount = x;
    }
    rsettrees(r, tree_type, rtrees(r, tree_type) + holz);
    ADDMSG(&u->faction->msgs, msg_message("growtree_effect",
        "mage amount", u, holz));
  } else if (ptype == oldpotiontype[P_HEILWASSER]) {
    u->hp = _min(unit_max_hp(u) * u->number, u->hp + 400 * amount);
  } else if (ptype == oldpotiontype[P_PEOPLE]) {
    attrib *a = (attrib *) a_find(r->attribs, &at_peasantluck);
    if (!a)
      a = a_add(&r->attribs, a_new(&at_peasantluck));
    a->data.i += amount;
  } else if (ptype == oldpotiontype[P_HORSE]) {
    attrib *a = (attrib *) a_find(r->attribs, &at_horseluck);
    if (!a)
      a = a_add(&r->attribs, a_new(&at_horseluck));
    a->data.i += amount;
  } else if (ptype == oldpotiontype[P_WAHRHEIT]) {
    fset(u, UFL_DISBELIEVES);
    amount = 1;
  } else if (ptype == oldpotiontype[P_MACHT]) {
    /* Verfünffacht die HP von max. 10 Personen in der Einheit */
    u->hp += _min(u->number, 10 * amount) * unit_max_hp(u) * 4;
  } else {
    change_effect(u, ptype, 10 * amount);
  }
  return amount;
}
Beispiel #6
0
void warden_add_give(unit * src, unit * u, const item_type * itype, int n)
{
    attrib *aw = a_find(u->attribs, &at_warden);
    museumgiveback *gb = NULL;
    museumgivebackcookie *gbc;
    attrib *a;

    /* has the giver a cookie corresponding to the warden */
    for (a = a_find(src->attribs, &at_museumgivebackcookie);
        a && a->type == &at_museumgivebackcookie; a = a->next) {
        if (((museumgivebackcookie *)(a->data.v))->warden_no == u->no)
            break;
    }

    /* if not give it one */
    if (a == NULL || a->type != &at_museumgivebackcookie) {
        a = a_add(&src->attribs, a_new(&at_museumgivebackcookie));
        gbc = (museumgivebackcookie *)a->data.v;
        gbc->warden_no = u->no;
        gbc->cookie = aw->data.i;
        assert(aw->data.i < INT_MAX);
        aw->data.i++;
    }
    else {
        gbc = (museumgivebackcookie *)(a->data.v);
    }

    /* now we search for the warden's corresponding item list */
    for (a = a_find(u->attribs, &at_museumgiveback);
        a && a->type == &at_museumgiveback; a = a->next) {
        gb = (museumgiveback *)a->data.v;
        if (gb->cookie == gbc->cookie) {
            break;
        }
    }

    /* if there's none, give it one */
    if (!gb) {
        a = a_add(&u->attribs, a_new(&at_museumgiveback));
        gb = (museumgiveback *)a->data.v;
        gb->cookie = gbc->cookie;
    }

    /* now register the items */
    i_change(&gb->items, itype, n);

    /* done */

    /* this has a caveat: If the src-unit is destroyed while inside
     * the museum, the corresponding itemlist of the warden will never
     * be removed. to circumvent that in a generic way will be extremly
     * difficult. */
}
Beispiel #7
0
static attrib *set_new_dragon_target(unit * u, region * r, int range)
{
    int max_affinity = 0;
    region *max_region = NULL;
    quicklist *ql, *rlist = regions_in_range(r, range, allowed_dragon);
    int qi;

    for (qi = 0, ql = rlist; ql; ql_advance(&ql, &qi, 1)) {
        region *r2 = (region *)ql_get(ql, qi);
        int affinity = dragon_affinity_value(r2, u);
        if (affinity > max_affinity) {
            max_affinity = affinity;
            max_region = r2;
        }
    }

    ql_free(rlist);

    if (max_region && max_region != r) {
        attrib *a = a_find(u->attribs, &at_targetregion);
        if (!a) {
            a = a_add(&u->attribs, make_targetregion(max_region));
        }
        else {
            a->data.v = max_region;
        }
        return a;
    }
    return NULL;
}
Beispiel #8
0
/**
 ** GM: TELL PLANE <string>
 ** requires: permission-key "gmmsgr"
 **/
static void gm_messageplane(const void *tnext, struct unit *gm, struct order *ord)
{
  const struct plane *p = rplane(gm->region);
  const char *zmsg = getstrtoken();
  if (p == NULL) {
    mistake(gm, ord, "In diese Ebene kann keine Nachricht gesandt werden.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(gm->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
      mistake(gm, ord, "permission denied.");
    } else {
      message *msg = msg_message("msg_event", "string", zmsg);
      faction *f;
      region *r;
      for (f = factions; f; f = f->next) {
        freset(f, FFL_SELECT);
      }
      for (r = regions; r; r = r->next) {
        unit *u;
        if (rplane(r) != p)
          continue;
        for (u = r->units; u; u = u->next)
          if (!fval(u->faction, FFL_SELECT)) {
            f = u->faction;
            fset(f, FFL_SELECT);
            add_message(&f->msgs, msg);
          }
      }
      msg_release(msg);
    }
  }
}
Beispiel #9
0
/**
 ** GM: GATE <id> <x> <y>
 ** requires: permission-key "gmgate"
 **/
static void gm_gate(const void *tnext, struct unit * u, struct order *ord)
{
  const struct plane *pl = rplane(u->region);
  int id = getid();
  int x = rel_to_abs(pl, u->faction, getint(), 0);
  int y = rel_to_abs(pl, u->faction, getint(), 1);
  building *b = findbuilding(id);
  region *r;

  pnormalize(&x, &y, pl);
  r = findregion(x, y);
  if (b == NULL || r == NULL || pl != rplane(b->region) || pl != rplane(r)) {
    mistake(u, ord, "the unit cannot transform this building.");
    return;
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (permissions && has_permission(permissions, atoi36("gmgate"))) {
      remove_triggers(&b->attribs, "timer", &tt_gate);
      remove_triggers(&b->attribs, "create", &tt_unguard);
      if (r != b->region) {
        add_trigger(&b->attribs, "timer", trigger_gate(b, r));
        add_trigger(&b->attribs, "create", trigger_unguard(b));
        fset(b, BLD_UNGUARDED);
      }
    }
  }
}
Beispiel #10
0
const potion_type *ugetpotionuse(const unit * u)
{
  attrib *a = a_find(u->attribs, &at_potionuser);
  if (!a)
    return NULL;
  return (const potion_type *)a->data.v;
}
Beispiel #11
0
const char *uprivate(const unit * u)
{
  attrib *a = a_find(u->attribs, &at_private);
  if (!a)
    return NULL;
  return a->data.v;
}
Beispiel #12
0
/**
 ** GM: TERRAFORM <x> <y> <terrain>
 ** requires: permission-key "gmterf"
 **/
static void gm_terraform(const void *tnext, struct unit *u, struct order *ord)
{
  const struct plane *p = rplane(u->region);
  int x = rel_to_abs(p, u->faction, getint(), 0);
  int y = rel_to_abs(p, u->faction, getint(), 1);
  const char *c = getstrtoken();
  variant token;
  void **tokens = get_translations(u->faction->locale, UT_TERRAINS);
  region *r;
  pnormalize(&x, &y, p);
  r = findregion(x, y);

  if (r == NULL || p != rplane(r)) {
    mistake(u, ord, "region is in another plane.");
    return;
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmterf")))
      return;
  }

  if (findtoken(*tokens, c, &token) != E_TOK_NOMATCH) {
    const terrain_type *terrain = (const terrain_type *)token.v;
    terraform_region(r, terrain);
  }
}
Beispiel #13
0
void set_movement(attrib ** alist, int type)
{
    attrib *a = a_find(*alist, &at_movement);
    if (a == NULL)
        a = a_add(alist, a_new(&at_movement));
    a->data.i |= type;
}
Beispiel #14
0
static void set_factionstealth(unit *u, faction *f) {
    attrib *a = a_find(u->attribs, &at_otherfaction);
    if (!a)
        a = a_add(&u->attribs, make_otherfaction(f));
    else
        a->data.v = f;
}
Beispiel #15
0
/**
 ** GM: SKILL <unit> <skill> <tage>
 ** requires: permission-key "gmskil"
 **/
static void gm_skill(const void *tnext, struct unit *u, struct order *ord)
{
  unit *to = findunit(getid());
  skill_t skill = findskill(getstrtoken(), u->faction->locale);
  int num = getint();

  if (to == NULL || rplane(to->region) != rplane(u->region)) {
    /* unknown or in another plane */
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (skill == NOSKILL || skill == SK_MAGIC || skill == SK_ALCHEMY) {
    /* unknown or not enough */
    mistake(u, ord, "unknown skill, or skill cannot be raised.");
  } else if (num < 0 || num > 30) {
    /* sanity check failed */
    mistake(u, ord, "invalid value.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmskil"))) {
      mistake(u, ord, "permission denied.");
    } else {
      set_level(to, skill, num);
    }
  }
}
Beispiel #16
0
/**
 ** GM: TAKE <unit> <int> <itemtype>
 ** requires: permission-key "gmtake"
 **/
static void gm_take(const void *tnext, struct unit *u, struct order *ord)
{
  unit *to = findunit(getid());
  int num = getint();
  const item_type *itype = finditemtype(getstrtoken(), u->faction->locale);

  if (to == NULL || rplane(to->region) != rplane(u->region)) {
    /* unknown or in another plane */
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (itype == NULL || i_get(to->items, itype) == 0) {
    /* unknown or not enough */
    mistake(u, ord, "invalid item or item not found.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmtake"))) {
      mistake(u, ord, "permission denied.");
    } else {
      int i = i_get(to->items, itype);
      if (i < num)
        num = i;
      if (num) {
        i_change(&to->items, itype, -num);
        i_change(&u->items, itype, num);
      }
    }
  }
}
Beispiel #17
0
/**
 ** GM: TELL <unit> <string>
 ** requires: permission-key "gmmsgr"
 **/
static void gm_messageunit(const void *tnext, struct unit *u, struct order *ord)
{
  const struct plane *p = rplane(u->region);
  unit *target = findunit(getid());
  const char *msg = getstrtoken();
  region *r;

  if (target == NULL) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
    return;
  }

  r = target->region;

  if (r == NULL || p != rplane(r)) {
    mistake(u, ord, "region is in another plane.");
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmmsgu"))) {
      mistake(u, ord, "permission denied.");
    } else {
      add_message(&target->faction->msgs,
        msg_message("regionmessage", "region sender string", r, u, msg));
    }
  }
}
Beispiel #18
0
/**
 ** GM: KILL FACTION <id> <string>
 ** requires: permission-key "gmmsgr"
 **/
static void gm_killfaction(const void *tnext, struct unit *u, struct order *ord)
{
  int n = getid();
  faction *f = findfaction(n);
  const char *msg = getstrtoken();
  plane *p = rplane(u->region);
  attrib *permissions = a_find(u->faction->attribs, &at_permissions);
  if (!permissions || !has_permission(permissions, atoi36("gmkill"))) {
    mistake(u, ord, "permission denied.");
    return;
  }
  if (f != NULL) {
    region *r;
    for (r = regions; r; r = r->next)
      if (rplane(r) == p) {
        unit *target;
        for (target = r->units; target; target = target->next) {
          if (target->faction == f) {
            scale_number(target, 0);
            ADDMSG(&target->faction->msgs, msg_message("killedbygm",
                "region unit string", r, target, msg));
            return;
          }
        }
      }
  }
  mistake(u, ord, "cannot remove a unit from this faction.");
}
Beispiel #19
0
static void
gm_messagefaction(const void *tnext, struct unit *gm, struct order *ord)
{
  int n = getid();
  faction *f = findfaction(n);
  const char *msg = getstrtoken();
  plane *p = rplane(gm->region);
  attrib *permissions = a_find(gm->faction->attribs, &at_permissions);
  if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
    mistake(gm, ord, "permission denied.");
    return;
  }
  if (f != NULL) {
    region *r;
    for (r = regions; r; r = r->next)
      if (rplane(r) == p) {
        unit *u;
        for (u = r->units; u; u = u->next)
          if (u->faction == f) {
            add_message(&f->msgs, msg_message("msg_event", "string", msg));
            return;
          }
      }
  }
  mistake(gm, ord, "cannot send messages to this faction.");
}
Beispiel #20
0
int deathcount(const region * r)
{
    attrib *a = a_find(r->attribs, &at_deathcount);
    if (!a)
        return 0;
    return a->data.i;
}
Beispiel #21
0
void set_group(struct unit *u, struct group *g)
{
    attrib *a = NULL;

    if (fval(u, UFL_GROUP)) {
        a = a_find(u->attribs, &at_group);
    }

    if (a) {
        group *og = (group *)a->data.v;
        if (og == g)
            return;
        --og->members;
    }

    if (g) {
        if (!a) {
            a = a_add(&u->attribs, a_new(&at_group));
            fset(u, UFL_GROUP);
        }
        a->data.v = g;
        g->members++;
    }
    else if (a) {
        a_remove(&u->attribs, a);
        freset(u, UFL_GROUP);
    }
}
Beispiel #22
0
int ualias(const unit * u)
{
  attrib *a = a_find(u->attribs, &at_alias);
  if (!a)
    return 0;
  return a->data.i;
}
Beispiel #23
0
static int
use_speedsail(struct unit *u, const struct item_type *itype, int amount,
struct order *ord)
{
    struct plane *p = rplane(u->region);
    unused_arg(amount);
    unused_arg(itype);
    if (p != NULL) {
        ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
    }
    else {
        if (u->ship) {
            attrib *a = a_find(u->ship->attribs, &at_speedup);
            if (a == NULL) {
                a = a_add(&u->ship->attribs, a_new(&at_speedup));
                a->data.sa[0] = 50;     /* speed */
                a->data.sa[1] = 50;     /* decay */
                ADDMSG(&u->faction->msgs, msg_message("use_speedsail", "unit", u));
                /* Ticket abziehen */
                i_change(&u->items, itype, -1);
                return 0;
            }
            else {
                cmistake(u, ord, 211, MSG_EVENT);
            }
        }
        else {
            cmistake(u, ord, 144, MSG_EVENT);
        }
    }
    return EUNUSABLE;
}
Beispiel #24
0
void usetpotionuse(unit * u, const potion_type * ptype)
{
  attrib *a = a_find(u->attribs, &at_potionuser);
  if (!a)
    a = a_add(&u->attribs, a_new(&at_potionuser));
  a->data.v = (void *)ptype;
}
Beispiel #25
0
int get_chaoscount(const region * r)
{
    attrib *a = a_find(r->attribs, &at_chaoscount);
    if (!a)
        return 0;
    return a->data.i;
}
Beispiel #26
0
int change_effect(unit * u, const potion_type * effect, int delta)
{
  if (delta != 0) {
    attrib *a = a_find(u->attribs, &at_effect);
    effect_data *data = NULL;

    while (a && a->type == &at_effect) {
      data = (effect_data *) a->data.v;
      if (data->type == effect) {
        if (data->value + delta == 0) {
          a_remove(&u->attribs, a);
          return 0;
        } else {
          data->value += delta;
          return data->value;
        }
      }
      a = a->next;
    }

    a = a_add(&u->attribs, a_new(&at_effect));
    data = (effect_data *) a->data.v;
    data->type = effect;
    data->value = delta;
    return data->value;
  }
  log_error("change effect with delta==0 for unit %s\n", itoa36(u->no));
  return 0;
}
Beispiel #27
0
/**
 ** GM: TELEPORT <unit> <x> <y>
 ** requires: permission-key "gmtele"
 **/
static void gm_teleport(const void *tnext, struct unit *u, struct order *ord)
{
  const struct plane *p = rplane(u->region);
  unit *to = findunit(getid());
  int x = rel_to_abs(p, u->faction, getint(), 0);
  int y = rel_to_abs(p, u->faction, getint(), 1);
  region *r = findregion(x, y);

  if (r == NULL || p != rplane(r)) {
    mistake(u, ord, "region is in another plane.");
  } else if (to == NULL) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
        ""));
  } else if (rplane(to->region) != rplane(r) && !ucontact(to, u)) {
    ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_no_contact",
        "target", to));
  } else {
    /* checking permissions */
    attrib *permissions = a_find(u->faction->attribs, &at_permissions);
    if (!permissions || !has_permission(permissions, atoi36("gmtele"))) {
      mistake(u, ord, "permission denied.");
    } else
      move_unit(to, r, NULL);
  }
}
Beispiel #28
0
static void melt_iceberg(region * r)
{
  attrib *a;
  unit *u;

  for (u = r->units; u; u = u->next)
    freset(u->faction, FFL_SELECT);
  for (u = r->units; u; u = u->next)
    if (!fval(u->faction, FFL_SELECT)) {
      fset(u->faction, FFL_SELECT);
      ADDMSG(&u->faction->msgs, msg_message("iceberg_melt", "region", r));
    }

  /* driftrichtung löschen */
  a = a_find(r->attribs, &at_iceberg);
  if (a)
    a_remove(&r->attribs, a);

  /* Gebäude löschen */
  while (r->buildings) {
    remove_building(&r->buildings, r->buildings);
  }

  /* in Ozean wandeln */
  terraform_region(r, newterrain(T_OCEAN));

  /* Einheiten, die nicht schwimmen können oder in Schiffen sind,
   * ertrinken */
  drown(r);
}
Beispiel #29
0
void usetcontact(unit * u, const unit * u2)
{
  attrib *a = a_find(u->attribs, &at_contact);
  while (a && a->type == &at_contact && a->data.v != u2)
    a = a->next;
  if (a && a->type == &at_contact)
    return;
  a_add(&u->attribs, a_new(&at_contact))->data.v = (void *)u2;
}
Beispiel #30
0
struct building *usiege(const unit * u)
{
  attrib *a;
  if (!fval(u, UFL_SIEGE))
    return NULL;
  a = a_find(u->attribs, &at_siege);
  assert(a || !"flag set, but no siege found");
  return (struct building *)a->data.v;
}