bool b_blockall(const connection * b, const unit * u, const region * r)
{
    unused_arg(u);
    unused_arg(r);
    unused_arg(b);
    return true;
}
bool b_blocknone(const connection * b, const unit * u, const region * r)
{
    unused_arg(u);
    unused_arg(r);
    unused_arg(b);
    return false;
}
Example #3
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;
}
Example #4
0
static const char *b_namequestportal(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    const char *bname;
    int lock = b->data.i;
    unused_arg(b);
    unused_arg(r);

    if (gflags & GF_ARTICLE) {
        if (lock > 0) {
            bname = "a_gate_locked";
        }
        else {
            bname = "a_gate_open";
        }
    }
    else {
        if (lock > 0) {
            bname = "gate_locked";
        }
        else {
            bname = "gate_open";
        }
    }
    if (gflags & GF_PURE)
        return bname;
    return LOC(f->locale, mkname("border", bname));
}
Example #5
0
int cr_ignore(variant var, char *buffer, const void *userdata)
{
    unused_arg(var);
    unused_arg(buffer);
    unused_arg(userdata);
    return -1;
}
bool b_finvisible(const connection * b, const struct faction * f,
    const region * r)
{
    unused_arg(r);
    unused_arg(f);
    unused_arg(b);
    return false;
}
Example #7
0
static bool
b_blockfogwall(const connection * b, const unit * u, const region * r)
{
  unused_arg(b);
  unused_arg(r);
  if (!u)
    return true;
  return (bool) (effskill(u, SK_PERCEPTION) > 4);    /* Das ist die alte Nebelwand */
}
static const char *b_namefogwall(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    unused_arg(f);
    unused_arg(b);
    unused_arg(r);
    if (gflags & GF_PURE)
        return "fogwall";
    if (gflags & GF_ARTICLE)
        return LOC(f->locale, mkname("border", "a_fogwall"));
    return LOC(f->locale, mkname("border", "fogwall"));
}
static const char *b_namewall(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    const char *bname = "wall";

    unused_arg(f);
    unused_arg(r);
    unused_arg(b);
    if (gflags & GF_ARTICLE)
        bname = "a_wall";
    if (gflags & GF_PURE)
        return bname;
    return LOC(f->locale, mkname("border", bname));
}
Example #10
0
/*
 * C_MAGICSTREET
 *  erzeugt Straßennetz
 */
static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse * c,
                                  int self)
{
    unused_arg(typ);
    unused_arg(self);
    unused_arg(obj);
    assert(typ == TYP_REGION);

    /* Warnung vor Auflösung */
    if (c->duration >= 2) {
        return msg_message("curseinfo::magicstreet", "id", c->no);
    }
    return msg_message("curseinfo::magicstreetwarn", "id", c->no);
}
Example #11
0
/*
 * godcursezone
 */
static message *cinfo_cursed_by_the_gods(const void *obj, objtype_t typ,
        const curse * c, int self)
{
    region *r = (region *)obj;

    unused_arg(typ);
    unused_arg(self);
    assert(typ == TYP_REGION);

    if (fval(r->terrain, SEA_REGION)) {
        return msg_message("curseinfo::godcurseocean", "id", c->no);
    }
    return msg_message("curseinfo::godcurse", "id", c->no);
}
Example #12
0
static message *cinfo_antimagiczone(const void *obj, objtype_t typ, const curse * c,
                                    int self)
{
    unused_arg(typ);
    unused_arg(self);
    unused_arg(obj);
    assert(typ == TYP_REGION);

    /* Magier spüren eine Antimagiezone */
    if (self != 0) {
        return msg_message("curseinfo::antimagiczone", "id", c->no);
    }

    return NULL;
}
Example #13
0
/* --------------------------------------------------------------------- */
static message *cinfo_farvision(const void *obj, objtype_t typ, const curse * c,
                                int self)
{
    unused_arg(typ);
    unused_arg(obj);

    assert(typ == TYP_REGION);

    /* Magier spüren eine farvision */
    if (self != 0) {
        return msg_message("curseinfo::farvision", "id", c->no);
    }

    return 0;
}
Example #14
0
/* ------------------------------------------------------------- */
message *cinfo_simple(const void *obj, objtype_t typ, const struct curse * c,
  int self)
{
  struct message *msg;

  unused_arg(typ);
  unused_arg(self);
  unused_arg(obj);

  msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
  if (msg == NULL) {
    log_error("There is no curseinfo for %s.\n", c->type->cname);
  }
  return msg;
}
Example #15
0
static int
summon_igjarjuk(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", ""));
    return EUNUSABLE;
  } else {
    assert(!"not implemented");
    return EUNUSABLE;
  }
}
Example #16
0
/*
 * C_GBDREAM
 */
static message *cinfo_dreamcurse(const void *obj, objtype_t typ, const curse * c,
                                 int self)
{
    unused_arg(self);
    unused_arg(typ);
    unused_arg(obj);
    assert(typ == TYP_REGION);

    if (c->effect > 0) {
        return msg_message("curseinfo::gooddream", "id", c->no);
    }
    else {
        return msg_message("curseinfo::baddream", "id", c->no);
    }
}
static const char *b_nameillusionwall(const connection * b, const region * r,
    const struct faction *f, int gflags)
{
    int fno = b->data.i;
    unused_arg(b);
    unused_arg(r);
    if (gflags & GF_PURE)
        return (f && fno == f->no) ? "illusionwall" : "wall";
    if (gflags & GF_ARTICLE) {
        return LOC(f->locale, mkname("border", (f
            && fno == f->subscription) ? "an_illusionwall" : "a_wall"));
    }
    return LOC(f->locale, mkname("border", (f
        && fno == f->no) ? "illusionwall" : "wall"));
}
Example #18
0
static const char *b_nameroad(const connection * b, const region * r,
  const struct faction *f, int gflags)
{
  region *r2 = (r == b->to) ? b->from : b->to;
  int local = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
  static char buffer[64];

  unused_arg(f);
  if (gflags & GF_PURE)
    return "road";
  if (gflags & GF_ARTICLE) {
    if (!(gflags & GF_DETAILED))
      return LOC(f->locale, mkname("border", "a_road"));
    else if (r->terrain->max_road <= local) {
      int remote = (r2 == b->from) ? b->data.sa[0] : b->data.sa[1];
      if (r2->terrain->max_road <= remote) {
        return LOC(f->locale, mkname("border", "a_road"));
      } else {
        return LOC(f->locale, mkname("border", "an_incomplete_road"));
      }
    } else {
      int percent = _max(1, 100 * local / r->terrain->max_road);
      if (local) {
        slprintf(buffer, sizeof(buffer), LOC(f->locale, mkname("border",
              "a_road_percent")), percent);
      } else {
        return LOC(f->locale, mkname("border", "a_road_connection"));
      }
    }
  } else if (gflags & GF_PLURAL)
    return LOC(f->locale, mkname("border", "roads"));
  else
    return LOC(f->locale, mkname("border", "road"));
  return buffer;
}
Example #19
0
static int gate_handle(trigger * t, void *data)
{
  /* call an event handler on gate.
   * data.v -> ( variant event, int timer )
   */
  gate_data *gd = (gate_data *) t->data.v;
  struct building *b = gd->gate;
  struct region *r = gd->target;

  if (b && b->region && r) {
    unit **up = &b->region->units;
    while (*up) {
      unit *u = *up;
      if (u->building == b)
        move_unit(u, r, NULL);
      if (*up == u)
        up = &u->next;
    }
  } else {
    log_error("could not perform gate::handle()\n");
    return -1;
  }
  unused_arg(data);
  return 0;
}
Example #20
0
static int
leave_arena(struct unit *u, const struct item_type *itype, int amount,
order * ord)
{
    if (!u->building && leave_fail(u)) {
        return -1;
    }
    if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) {
        return -1;
    }
    unused_arg(amount);
    unused_arg(ord);
    unused_arg(itype);
    assert(!"not implemented");
    return 0;
}
Example #21
0
static int a_agedirection(attrib * a, void *owner)
{
    spec_direction *d = (spec_direction *)(a->data.v);
    unused_arg(owner);
    --d->duration;
    return (d->duration > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
}
Example #22
0
/* alle Magier können eine Antimagiezone wahrnehmen */
static int
cansee_antimagiczone(const struct faction *viewer, const void *obj, objtype_t typ,
                     const curse * c, int self)
{
    region *r;
    unit *u = NULL;
    unit *mage = c->magician;

    unused_arg(typ);

    assert(typ == TYP_REGION);
    r = (region *)obj;
    for (u = r->units; u; u = u->next) {
        if (u->faction == viewer) {
            if (u == mage) {
                self = 2;
                break;
            }
            if (is_mage(u)) {
                self = 1;
            }
        }
    }
    return self;
}
static void eval_add(opstack ** stack, const void *userdata)
{                               /* (int, int) -> int */
    int a = opop_i(stack);
    int b = opop_i(stack);
    opush_i(stack, a + b);
    unused_arg(userdata);
}
static void eval_if(opstack ** stack, const void *userdata)
{                               /* (int, int) -> int */
    void *a = opop_v(stack);
    void *b = opop_v(stack);
    int cond = opop_i(stack);
    opush_v(stack, cond ? b : a);
    unused_arg(userdata);
}
static void eval_eq(opstack ** stack, const void *userdata)
{                               /* (int, int) -> int */
    int a = opop_i(stack);
    int b = opop_i(stack);
    int rval = (a == b) ? 1 : 0;
    opush_i(stack, rval);
    unused_arg(userdata);
}
Example #26
0
/*
 * C_SPARKLE
 */
static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c,
    int self)
{
    const char *effects[] = {
        NULL,                       /* end grau */
        "sparkle_1",
        "sparkle_2",
        NULL,                       /* end traum */
        "sparkle_3",
        "sparkle_4",
        NULL,                       /* end tybied */
        "sparkle_5",
        "sparkle_6",
        "sparkle_7",
        "sparkle_8",
        NULL,                       /* end cerrdor */
        "sparkle_9",
        "sparkle_10",
        "sparkle_11",
        "sparkle_12",
        NULL,                       /* end gwyrrd */
        "sparkle_13",
        "sparkle_14",
        "sparkle_15",
        "sparkle_16",
        "sparkle_17",
        "sparkle_18",
        NULL,                       /* end draig */
    };
    int m, begin = 0, end = 0;
    unit *u;
    unused_arg(typ);

    assert(typ == TYP_UNIT);
    u = (unit *)obj;

    if (!c->magician || !c->magician->faction)
        return NULL;

    for (m = 0; m != c->magician->faction->magiegebiet; ++m) {
        while (effects[end] != NULL)
            ++end;
        begin = end + 1;
        end = begin;
    }

    while (effects[end] != NULL)
        ++end;
    if (end == begin)
        return NULL;
    else {
        int index = begin + curse_geteffect_int(c) % (end - begin);
        return msg_message(mkname("curseinfo", effects[index]), "unit id", u,
            c->no);
    }
}
Example #27
0
message *cinfo_ship(const void *obj, objtype_t typ, const curse * c, int self)
{
    message *msg;

    unused_arg(typ);
    unused_arg(obj);
    assert(typ == TYP_SHIP);

    if (self != 0) {              /* owner or inside */
        msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
    }
    else {
        msg = msg_message("curseinfo::ship_unknown", "id", c->no);
    }
    if (msg == NULL) {
        log_error("There is no curseinfo for %s.\n", c->type->cname);
    }
    return msg;
}
Example #28
0
File: shock.c Project: mideg/server
static int shock_handle(trigger * t, void *data)
{
  /* destroy the unit */
  unit *u = (unit *) t->data.v;
  if (u && u->number) {
    do_shock(u, "trigger");
  }
  unused_arg(data);
  return 0;
}
Example #29
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;
}
Example #30
0
static void
lc_write(const struct attrib *a, const void *owner, struct storage *store)
{
    building_action *data = (building_action *)a->data.v;
    const char *fname = data->fname;
    const char *fparam = data->param;

    unused_arg(owner);
    WRITE_TOK(store, fname);
    WRITE_TOK(store, fparam ? fparam : NULLSTRING);
}